diff options
author | Ryan Dwyer <ryandwyer1@gmail.com> | 2018-09-24 20:54:57 +1000 |
---|---|---|
committer | Ryan Dwyer <ryandwyer1@gmail.com> | 2018-09-27 22:51:37 +1000 |
commit | 7b138e5ef0f679c9bb0078019d7c9c63fef36273 (patch) | |
tree | 2cdbeb394889065e0606a1fcbe38c1e99e25d260 /include/sway/tree/view.h | |
parent | Merge pull request #2717 from ianyfan/tablet-config (diff) | |
download | sway-7b138e5ef0f679c9bb0078019d7c9c63fef36273.tar.gz sway-7b138e5ef0f679c9bb0078019d7c9c63fef36273.tar.zst sway-7b138e5ef0f679c9bb0078019d7c9c63fef36273.zip |
Add CSD to border modes
This replaces view.using_csd with a new border mode: B_CSD. This also
removes sway_xdg_shell{_v6}_view.deco_mode and
view->has_client_side_decorations as we can now get these from the
border.
You can use `border toggle` to cycle through the modes including CSD, or
use `border csd` to set it directly. The client must support the
xdg-decoration protocol, and the only client I know of that does is the
example in wlroots.
If the client switches from SSD to CSD without us expecting it (via the
server-decoration protocol), we stash the previous border type into
view.saved_border so we can restore it if the client returns to SSD. I
haven't found a way to test this though.
Diffstat (limited to 'include/sway/tree/view.h')
-rw-r--r-- | include/sway/tree/view.h | 21 |
1 files changed, 15 insertions, 6 deletions
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); |