From 7b138e5ef0f679c9bb0078019d7c9c63fef36273 Mon Sep 17 00:00:00 2001 From: Ryan Dwyer Date: Mon, 24 Sep 2018 20:54:57 +1000 Subject: 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. --- sway/decoration.c | 22 ++++++++-------------- 1 file changed, 8 insertions(+), 14 deletions(-) (limited to 'sway/decoration.c') 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 @@ #include #include "sway/decoration.h" +#include "sway/desktop/transaction.h" #include "sway/server.h" +#include "sway/tree/arrange.h" #include "sway/tree/view.h" #include "log.h" @@ -24,20 +26,12 @@ static void server_decoration_handle_mode(struct wl_listener *listener, return; } - switch (view->type) { - case SWAY_VIEW_XDG_SHELL_V6:; - struct sway_xdg_shell_v6_view *xdg_shell_v6_view = - (struct sway_xdg_shell_v6_view *)view; - xdg_shell_v6_view->deco_mode = deco->wlr_server_decoration->mode; - break; - case SWAY_VIEW_XDG_SHELL:; - struct sway_xdg_shell_view *xdg_shell_view = - (struct sway_xdg_shell_view *)view; - xdg_shell_view->deco_mode = deco->wlr_server_decoration->mode; - break; - default: - break; - } + bool csd = deco->wlr_server_decoration->mode == + WLR_SERVER_DECORATION_MANAGER_MODE_CLIENT; + view_set_csd_from_client(view, csd); + + arrange_container(view->container); + transaction_commit_dirty(); } void handle_server_decoration(struct wl_listener *listener, void *data) { -- cgit v1.2.3