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 /sway/decoration.c | |
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 'sway/decoration.c')
-rw-r--r-- | sway/decoration.c | 22 |
1 files changed, 8 insertions, 14 deletions
diff --git a/sway/decoration.c b/sway/decoration.c index 0e3e67ac..fea6ed4c 100644 --- a/sway/decoration.c +++ b/sway/decoration.c | |||
@@ -1,6 +1,8 @@ | |||
1 | #include <stdlib.h> | 1 | #include <stdlib.h> |
2 | #include "sway/decoration.h" | 2 | #include "sway/decoration.h" |
3 | #include "sway/desktop/transaction.h" | ||
3 | #include "sway/server.h" | 4 | #include "sway/server.h" |
5 | #include "sway/tree/arrange.h" | ||
4 | #include "sway/tree/view.h" | 6 | #include "sway/tree/view.h" |
5 | #include "log.h" | 7 | #include "log.h" |
6 | 8 | ||
@@ -24,20 +26,12 @@ static void server_decoration_handle_mode(struct wl_listener *listener, | |||
24 | return; | 26 | return; |
25 | } | 27 | } |
26 | 28 | ||
27 | switch (view->type) { | 29 | bool csd = deco->wlr_server_decoration->mode == |
28 | case SWAY_VIEW_XDG_SHELL_V6:; | 30 | WLR_SERVER_DECORATION_MANAGER_MODE_CLIENT; |
29 | struct sway_xdg_shell_v6_view *xdg_shell_v6_view = | 31 | view_set_csd_from_client(view, csd); |
30 | (struct sway_xdg_shell_v6_view *)view; | 32 | |
31 | xdg_shell_v6_view->deco_mode = deco->wlr_server_decoration->mode; | 33 | arrange_container(view->container); |
32 | break; | 34 | transaction_commit_dirty(); |
33 | case SWAY_VIEW_XDG_SHELL:; | ||
34 | struct sway_xdg_shell_view *xdg_shell_view = | ||
35 | (struct sway_xdg_shell_view *)view; | ||
36 | xdg_shell_view->deco_mode = deco->wlr_server_decoration->mode; | ||
37 | break; | ||
38 | default: | ||
39 | break; | ||
40 | } | ||
41 | } | 35 | } |
42 | 36 | ||
43 | void handle_server_decoration(struct wl_listener *listener, void *data) { | 37 | void handle_server_decoration(struct wl_listener *listener, void *data) { |