summaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorLibravatar Drew DeVault <sir@cmpwn.com>2017-11-11 18:06:50 -0500
committerLibravatar Drew DeVault <sir@cmpwn.com>2017-11-11 18:06:50 -0500
commit0c8491f7d0c735299a25f0ab929f5d1e0866b929 (patch)
tree69fc808ce6b8ceda33e8fadcf7cbbc10b892ca00 /include
parentWire up output frame loop (diff)
downloadsway-0c8491f7d0c735299a25f0ab929f5d1e0866b929.tar.gz
sway-0c8491f7d0c735299a25f0ab929f5d1e0866b929.tar.zst
sway-0c8491f7d0c735299a25f0ab929f5d1e0866b929.zip
Initial (awful) pass on xdg shell support
Diffstat (limited to 'include')
-rw-r--r--include/sway/container.h13
-rw-r--r--include/sway/server.h6
-rw-r--r--include/sway/view.h56
3 files changed, 66 insertions, 9 deletions
diff --git a/include/sway/container.h b/include/sway/container.h
index 09e29291..d46ffa63 100644
--- a/include/sway/container.h
+++ b/include/sway/container.h
@@ -11,6 +11,8 @@ typedef struct sway_container swayc_t;
11extern swayc_t root_container; 11extern swayc_t root_container;
12extern swayc_t *current_focus; 12extern swayc_t *current_focus;
13 13
14struct sway_view;
15
14/** 16/**
15 * Different kinds of containers. 17 * Different kinds of containers.
16 * 18 *
@@ -27,14 +29,6 @@ enum swayc_types {
27 C_TYPES, 29 C_TYPES,
28}; 30};
29 31
30enum swayc_view_types {
31 V_WL_SHELL,
32 V_XDG_SHELL_V6,
33 V_XWAYLAND,
34 // Keep last
35 V_TYPES,
36};
37
38/** 32/**
39 * Different ways to arrange a container. 33 * Different ways to arrange a container.
40 */ 34 */
@@ -76,6 +70,7 @@ struct sway_container {
76 70
77 union { 71 union {
78 struct sway_output *output; 72 struct sway_output *output;
73 struct sway_view *view;
79 } _handle; 74 } _handle;
80 75
81 /** 76 /**
@@ -207,7 +202,7 @@ swayc_t *new_container(swayc_t *child, enum swayc_layouts layout);
207 * 202 *
208 * Pass in a sibling view, or a workspace to become this container's parent. 203 * Pass in a sibling view, or a workspace to become this container's parent.
209 */ 204 */
210swayc_t *new_view(swayc_t *sibling, wlc_handle handle); 205swayc_t *new_view(swayc_t *sibling, struct sway_view *view);
211/** 206/**
212 * Allocates a new floating view in the active workspace. 207 * Allocates a new floating view in the active workspace.
213 */ 208 */
diff --git a/include/sway/server.h b/include/sway/server.h
index 043c1a33..5a8a8d31 100644
--- a/include/sway/server.h
+++ b/include/sway/server.h
@@ -5,6 +5,7 @@
5#include <wlr/backend.h> 5#include <wlr/backend.h>
6#include <wlr/backend/session.h> 6#include <wlr/backend/session.h>
7#include <wlr/types/wlr_data_device_manager.h> 7#include <wlr/types/wlr_data_device_manager.h>
8#include <wlr/types/wlr_xdg_shell_v6.h>
8#include <wlr/render.h> 9#include <wlr/render.h>
9// TODO WLR: make Xwayland optional 10// TODO WLR: make Xwayland optional
10#include <wlr/xwayland.h> 11#include <wlr/xwayland.h>
@@ -24,6 +25,9 @@ struct sway_server {
24 struct wl_listener output_add; 25 struct wl_listener output_add;
25 struct wl_listener output_remove; 26 struct wl_listener output_remove;
26 struct wl_listener output_frame; 27 struct wl_listener output_frame;
28
29 struct wlr_xdg_shell_v6 *xdg_shell_v6;
30 struct wl_listener xdg_shell_v6_surface;
27}; 31};
28 32
29struct sway_server server; 33struct sway_server server;
@@ -35,4 +39,6 @@ void server_run(struct sway_server *server);
35void output_add_notify(struct wl_listener *listener, void *data); 39void output_add_notify(struct wl_listener *listener, void *data);
36void output_remove_notify(struct wl_listener *listener, void *data); 40void output_remove_notify(struct wl_listener *listener, void *data);
37 41
42void handle_xdg_shell_v6_surface(struct wl_listener *listener, void *data);
43
38#endif 44#endif
diff --git a/include/sway/view.h b/include/sway/view.h
new file mode 100644
index 00000000..979b20a8
--- /dev/null
+++ b/include/sway/view.h
@@ -0,0 +1,56 @@
1#ifndef _SWAY_VIEW_H
2#define _SWAY_VIEW_H
3#include <wayland-server.h>
4#include <wlr/types/wlr_xdg_shell_v6.h>
5
6struct sway_container;
7struct sway_view;
8
9struct sway_xdg_surface_v6 {
10 struct sway_view *view;
11
12 struct wl_listener commit;
13 struct wl_listener request_move;
14 struct wl_listener request_resize;
15 struct wl_listener request_maximize;
16};
17
18enum sway_view_type {
19 SWAY_WL_SHELL_VIEW,
20 SWAY_XDG_SHELL_V6_VIEW,
21 SWAY_XWAYLAND_VIEW,
22 // Keep last
23 SWAY_VIEW_TYPES,
24};
25
26enum sway_view_prop {
27 VIEW_PROP_TITLE,
28 VIEW_PROP_CLASS,
29 VIEW_PROP_INSTANCE,
30 VIEW_PROP_APP_ID,
31};
32
33/**
34 * sway_view is a state container for surfaces that are arranged in the sway
35 * tree (shell surfaces).
36 */
37struct sway_view {
38 struct wl_listener destroy;
39 enum sway_view_type type;
40 struct sway_container *swayc;
41
42 union {
43 struct wlr_xdg_surface_v6 *wlr_xdg_surface_v6;
44 };
45
46 union {
47 struct sway_xdg_surface_v6 *sway_xdg_surface_v6;
48 };
49
50 struct {
51 const char *(*get_prop)(struct sway_view *view,
52 enum sway_view_prop prop);
53 } iface;
54};
55
56#endif