diff options
author | Drew DeVault <sir@cmpwn.com> | 2018-10-03 13:03:06 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-10-03 13:03:06 +0200 |
commit | 06c214a800cab9119ae4b04371e3f6bbca8a0550 (patch) | |
tree | eed325e37d02fa71858a33e71ef33961395dd16f /include/sway/tree | |
parent | Merge pull request #2755 from RyanDwyer/fix-tiling-criteria (diff) | |
parent | Remove server-decoration assumption if view supports xdg-decoration (diff) | |
download | sway-06c214a800cab9119ae4b04371e3f6bbca8a0550.tar.gz sway-06c214a800cab9119ae4b04371e3f6bbca8a0550.tar.zst sway-06c214a800cab9119ae4b04371e3f6bbca8a0550.zip |
Merge pull request #2703 from RyanDwyer/csd-border
Add CSD to border modes
Diffstat (limited to 'include/sway/tree')
-rw-r--r-- | include/sway/tree/container.h | 2 | ||||
-rw-r--r-- | include/sway/tree/view.h | 32 |
2 files changed, 27 insertions, 7 deletions
diff --git a/include/sway/tree/container.h b/include/sway/tree/container.h index b865a0f2..da6592b4 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 56ccbc6c..028be536 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 | ||
@@ -75,13 +76,24 @@ struct sway_view { | |||
75 | int natural_width, natural_height; | 76 | int natural_width, natural_height; |
76 | 77 | ||
77 | char *title_format; | 78 | char *title_format; |
79 | |||
80 | // Our border types are B_NONE, B_PIXEL, B_NORMAL and B_CSD. We normally | ||
81 | // just assign this to the border property and ignore the other two. | ||
82 | // However, when a view using CSD is tiled, we want to render our own | ||
83 | // borders as well. So in this case the border property becomes one of the | ||
84 | // first three, and using_csd is true. | ||
85 | // Lastly, views can change their decoration mode at any time. When an SSD | ||
86 | // view becomes CSD without our approval, we save the SSD border type so it | ||
87 | // can be restored if/when the view returns from CSD to SSD. | ||
78 | enum sway_container_border border; | 88 | enum sway_container_border border; |
89 | enum sway_container_border saved_border; | ||
90 | bool using_csd; | ||
91 | |||
79 | int border_thickness; | 92 | int border_thickness; |
80 | bool border_top; | 93 | bool border_top; |
81 | bool border_bottom; | 94 | bool border_bottom; |
82 | bool border_left; | 95 | bool border_left; |
83 | bool border_right; | 96 | bool border_right; |
84 | bool using_csd; | ||
85 | 97 | ||
86 | struct timespec urgent; | 98 | struct timespec urgent; |
87 | bool allow_request_urgent; | 99 | bool allow_request_urgent; |
@@ -127,8 +139,6 @@ struct sway_view { | |||
127 | struct sway_xdg_shell_v6_view { | 139 | struct sway_xdg_shell_v6_view { |
128 | struct sway_view view; | 140 | struct sway_view view; |
129 | 141 | ||
130 | enum wlr_server_decoration_manager_mode deco_mode; | ||
131 | |||
132 | struct wl_listener commit; | 142 | struct wl_listener commit; |
133 | struct wl_listener request_move; | 143 | struct wl_listener request_move; |
134 | struct wl_listener request_resize; | 144 | struct wl_listener request_resize; |
@@ -145,8 +155,6 @@ struct sway_xdg_shell_v6_view { | |||
145 | struct sway_xdg_shell_view { | 155 | struct sway_xdg_shell_view { |
146 | struct sway_view view; | 156 | struct sway_view view; |
147 | 157 | ||
148 | enum wlr_server_decoration_manager_mode deco_mode; | ||
149 | |||
150 | struct wl_listener commit; | 158 | struct wl_listener commit; |
151 | struct wl_listener request_move; | 159 | struct wl_listener request_move; |
152 | struct wl_listener request_resize; | 160 | struct wl_listener request_resize; |
@@ -175,6 +183,7 @@ struct sway_xwayland_view { | |||
175 | struct wl_listener set_role; | 183 | struct wl_listener set_role; |
176 | struct wl_listener set_window_type; | 184 | struct wl_listener set_window_type; |
177 | struct wl_listener set_hints; | 185 | struct wl_listener set_hints; |
186 | struct wl_listener set_decorations; | ||
178 | struct wl_listener map; | 187 | struct wl_listener map; |
179 | struct wl_listener unmap; | 188 | struct wl_listener unmap; |
180 | struct wl_listener destroy; | 189 | struct wl_listener destroy; |
@@ -275,6 +284,17 @@ void view_set_activated(struct sway_view *view, bool activated); | |||
275 | */ | 284 | */ |
276 | void view_request_activate(struct sway_view *view); | 285 | void view_request_activate(struct sway_view *view); |
277 | 286 | ||
287 | /** | ||
288 | * If possible, instructs the client to change their decoration mode. | ||
289 | */ | ||
290 | void view_set_csd_from_server(struct sway_view *view, bool enabled); | ||
291 | |||
292 | /** | ||
293 | * Updates the view's border setting when the client unexpectedly changes their | ||
294 | * decoration mode. | ||
295 | */ | ||
296 | void view_update_csd_from_client(struct sway_view *view, bool enabled); | ||
297 | |||
278 | void view_set_tiled(struct sway_view *view, bool tiled); | 298 | void view_set_tiled(struct sway_view *view, bool tiled); |
279 | 299 | ||
280 | void view_close(struct sway_view *view); | 300 | void view_close(struct sway_view *view); |