diff options
Diffstat (limited to 'include')
-rw-r--r-- | include/sway/server.h | 5 | ||||
-rw-r--r-- | include/sway/tree/container.h | 2 | ||||
-rw-r--r-- | include/sway/tree/view.h | 21 | ||||
-rw-r--r-- | include/sway/xdg_decoration.h | 19 |
4 files changed, 40 insertions, 7 deletions
diff --git a/include/sway/server.h b/include/sway/server.h index 5dabb61f..3e1cbb33 100644 --- a/include/sway/server.h +++ b/include/sway/server.h | |||
@@ -54,6 +54,10 @@ struct sway_server { | |||
54 | struct wl_listener server_decoration; | 54 | struct wl_listener server_decoration; |
55 | struct wl_list decorations; // sway_server_decoration::link | 55 | struct wl_list decorations; // sway_server_decoration::link |
56 | 56 | ||
57 | struct wlr_xdg_decoration_manager_v1 *xdg_decoration_manager; | ||
58 | struct wl_listener xdg_decoration; | ||
59 | struct wl_list xdg_decorations; // sway_xdg_decoration::link | ||
60 | |||
57 | size_t txn_timeout_ms; | 61 | size_t txn_timeout_ms; |
58 | list_t *transactions; | 62 | list_t *transactions; |
59 | list_t *dirty_nodes; | 63 | list_t *dirty_nodes; |
@@ -78,5 +82,6 @@ void handle_xdg_shell_surface(struct wl_listener *listener, void *data); | |||
78 | void handle_xwayland_surface(struct wl_listener *listener, void *data); | 82 | void handle_xwayland_surface(struct wl_listener *listener, void *data); |
79 | #endif | 83 | #endif |
80 | void handle_server_decoration(struct wl_listener *listener, void *data); | 84 | void handle_server_decoration(struct wl_listener *listener, void *data); |
85 | void handle_xdg_decoration(struct wl_listener *listener, void *data); | ||
81 | 86 | ||
82 | #endif | 87 | #endif |
diff --git a/include/sway/tree/container.h b/include/sway/tree/container.h index 5e281a2f..6019602c 100644 --- a/include/sway/tree/container.h +++ b/include/sway/tree/container.h | |||
@@ -28,6 +28,7 @@ enum sway_container_border { | |||
28 | B_NONE, | 28 | B_NONE, |
29 | B_PIXEL, | 29 | B_PIXEL, |
30 | B_NORMAL, | 30 | B_NORMAL, |
31 | B_CSD, | ||
31 | }; | 32 | }; |
32 | 33 | ||
33 | struct sway_root; | 34 | struct sway_root; |
@@ -63,7 +64,6 @@ struct sway_container_state { | |||
63 | bool border_bottom; | 64 | bool border_bottom; |
64 | bool border_left; | 65 | bool border_left; |
65 | bool border_right; | 66 | bool border_right; |
66 | bool using_csd; | ||
67 | }; | 67 | }; |
68 | 68 | ||
69 | struct sway_container { | 69 | struct sway_container { |
diff --git a/include/sway/tree/view.h b/include/sway/tree/view.h index d10251dd..49df7c88 100644 --- a/include/sway/tree/view.h +++ b/include/sway/tree/view.h | |||
@@ -11,6 +11,7 @@ | |||
11 | #include "sway/input/seat.h" | 11 | #include "sway/input/seat.h" |
12 | 12 | ||
13 | struct sway_container; | 13 | struct sway_container; |
14 | struct sway_xdg_decoration; | ||
14 | 15 | ||
15 | enum sway_view_type { | 16 | enum sway_view_type { |
16 | SWAY_VIEW_XDG_SHELL_V6, | 17 | SWAY_VIEW_XDG_SHELL_V6, |
@@ -44,7 +45,6 @@ struct sway_view_impl { | |||
44 | void (*set_tiled)(struct sway_view *view, bool tiled); | 45 | void (*set_tiled)(struct sway_view *view, bool tiled); |
45 | void (*set_fullscreen)(struct sway_view *view, bool fullscreen); | 46 | void (*set_fullscreen)(struct sway_view *view, bool fullscreen); |
46 | bool (*wants_floating)(struct sway_view *view); | 47 | bool (*wants_floating)(struct sway_view *view); |
47 | bool (*has_client_side_decorations)(struct sway_view *view); | ||
48 | void (*for_each_surface)(struct sway_view *view, | 48 | void (*for_each_surface)(struct sway_view *view, |
49 | wlr_surface_iterator_func_t iterator, void *user_data); | 49 | wlr_surface_iterator_func_t iterator, void *user_data); |
50 | void (*for_each_popup)(struct sway_view *view, | 50 | void (*for_each_popup)(struct sway_view *view, |
@@ -60,6 +60,7 @@ struct sway_view { | |||
60 | 60 | ||
61 | struct sway_container *container; // NULL if unmapped and transactions finished | 61 | struct sway_container *container; // NULL if unmapped and transactions finished |
62 | struct wlr_surface *surface; // NULL for unmapped views | 62 | struct wlr_surface *surface; // NULL for unmapped views |
63 | struct sway_xdg_decoration *xdg_decoration; | ||
63 | 64 | ||
64 | pid_t pid; | 65 | pid_t pid; |
65 | 66 | ||
@@ -76,12 +77,12 @@ struct sway_view { | |||
76 | 77 | ||
77 | char *title_format; | 78 | char *title_format; |
78 | enum sway_container_border border; | 79 | enum sway_container_border border; |
80 | enum sway_container_border saved_border; | ||
79 | int border_thickness; | 81 | int border_thickness; |
80 | bool border_top; | 82 | bool border_top; |
81 | bool border_bottom; | 83 | bool border_bottom; |
82 | bool border_left; | 84 | bool border_left; |
83 | bool border_right; | 85 | bool border_right; |
84 | bool using_csd; | ||
85 | 86 | ||
86 | struct timespec urgent; | 87 | struct timespec urgent; |
87 | bool allow_request_urgent; | 88 | bool allow_request_urgent; |
@@ -127,8 +128,6 @@ struct sway_view { | |||
127 | struct sway_xdg_shell_v6_view { | 128 | struct sway_xdg_shell_v6_view { |
128 | struct sway_view view; | 129 | struct sway_view view; |
129 | 130 | ||
130 | enum wlr_server_decoration_manager_mode deco_mode; | ||
131 | |||
132 | struct wl_listener commit; | 131 | struct wl_listener commit; |
133 | struct wl_listener request_move; | 132 | struct wl_listener request_move; |
134 | struct wl_listener request_resize; | 133 | struct wl_listener request_resize; |
@@ -145,8 +144,6 @@ struct sway_xdg_shell_v6_view { | |||
145 | struct sway_xdg_shell_view { | 144 | struct sway_xdg_shell_view { |
146 | struct sway_view view; | 145 | struct sway_view view; |
147 | 146 | ||
148 | enum wlr_server_decoration_manager_mode deco_mode; | ||
149 | |||
150 | struct wl_listener commit; | 147 | struct wl_listener commit; |
151 | struct wl_listener request_move; | 148 | struct wl_listener request_move; |
152 | struct wl_listener request_resize; | 149 | struct wl_listener request_resize; |
@@ -175,6 +172,7 @@ struct sway_xwayland_view { | |||
175 | struct wl_listener set_role; | 172 | struct wl_listener set_role; |
176 | struct wl_listener set_window_type; | 173 | struct wl_listener set_window_type; |
177 | struct wl_listener set_hints; | 174 | struct wl_listener set_hints; |
175 | struct wl_listener set_decorations; | ||
178 | struct wl_listener map; | 176 | struct wl_listener map; |
179 | struct wl_listener unmap; | 177 | struct wl_listener unmap; |
180 | struct wl_listener destroy; | 178 | struct wl_listener destroy; |
@@ -268,6 +266,17 @@ void view_set_activated(struct sway_view *view, bool activated); | |||
268 | */ | 266 | */ |
269 | void view_request_activate(struct sway_view *view); | 267 | void view_request_activate(struct sway_view *view); |
270 | 268 | ||
269 | /** | ||
270 | * If possible, instructs the client to change their decoration mode. | ||
271 | */ | ||
272 | void view_set_csd_from_server(struct sway_view *view, bool enabled); | ||
273 | |||
274 | /** | ||
275 | * Updates the view's border setting when the client unexpectedly changes their | ||
276 | * decoration mode. | ||
277 | */ | ||
278 | void view_set_csd_from_client(struct sway_view *view, bool enabled); | ||
279 | |||
271 | void view_set_tiled(struct sway_view *view, bool tiled); | 280 | void view_set_tiled(struct sway_view *view, bool tiled); |
272 | 281 | ||
273 | void view_close(struct sway_view *view); | 282 | void view_close(struct sway_view *view); |
diff --git a/include/sway/xdg_decoration.h b/include/sway/xdg_decoration.h new file mode 100644 index 00000000..46fb8d34 --- /dev/null +++ b/include/sway/xdg_decoration.h | |||
@@ -0,0 +1,19 @@ | |||
1 | #ifndef _SWAY_XDG_DECORATION_H | ||
2 | #define _SWAY_XDG_DECORATION_H | ||
3 | |||
4 | #include <wlr/types/wlr_xdg_decoration_v1.h> | ||
5 | |||
6 | struct sway_xdg_decoration { | ||
7 | struct wlr_xdg_toplevel_decoration_v1 *wlr_xdg_decoration; | ||
8 | struct wl_list link; | ||
9 | |||
10 | struct sway_view *view; | ||
11 | |||
12 | struct wl_listener destroy; | ||
13 | struct wl_listener surface_commit; | ||
14 | }; | ||
15 | |||
16 | struct sway_xdg_decoration *xdg_decoration_from_surface( | ||
17 | struct wlr_surface *surface); | ||
18 | |||
19 | #endif | ||