diff options
author | Dudemanguy <random342@airmail.cc> | 2021-08-10 12:01:37 -0500 |
---|---|---|
committer | Simon Ser <contact@emersion.fr> | 2021-08-12 10:02:17 +0200 |
commit | acf946fe4c495b47c5a76230ba98f9b973bec96d (patch) | |
tree | b73daeffd06e391527170d5117e1dc509c8e82b5 /sway/tree | |
parent | 7a15e715b7c5c91b12f82b3e94230b6644d3893d (diff) | |
download | sway-acf946fe4c495b47c5a76230ba98f9b973bec96d.tar.xz |
xdg-decoration: let floating clients set borders
The xdg-decoration protocol allows clients to request whether they want
to use server side decorations or client side decorations. Currently,
sway ignores this and always enforces whatever the server is currently
set to. Although tiled clients cannot be allowed to set borders, there
is no harm in listening requests from floating clients. Sidenote: also
fix an unrelated style error.
Diffstat (limited to 'sway/tree')
-rw-r--r-- | sway/tree/container.c | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/sway/tree/container.c b/sway/tree/container.c index 1e84e603..3b661046 100644 --- a/sway/tree/container.c +++ b/sway/tree/container.c @@ -20,6 +20,7 @@ #include "sway/tree/arrange.h" #include "sway/tree/view.h" #include "sway/tree/workspace.h" +#include "sway/xdg_decoration.h" #include "list.h" #include "log.h" #include "stringop.h" @@ -835,7 +836,13 @@ void container_set_floating(struct sway_container *container, bool enable) { if (container->view) { view_set_tiled(container->view, false); if (container->view->using_csd) { + container->saved_border = container->pending.border; container->pending.border = B_CSD; + if (container->view->xdg_decoration) { + struct sway_xdg_decoration *deco = container->view->xdg_decoration; + wlr_xdg_toplevel_decoration_v1_set_mode(deco->wlr_xdg_decoration, + WLR_XDG_TOPLEVEL_DECORATION_V1_MODE_CLIENT_SIDE); + } } } container_floating_set_default_size(container); @@ -873,6 +880,11 @@ void container_set_floating(struct sway_container *container, bool enable) { view_set_tiled(container->view, true); if (container->view->using_csd) { container->pending.border = container->saved_border; + if (container->view->xdg_decoration) { + struct sway_xdg_decoration *deco = container->view->xdg_decoration; + wlr_xdg_toplevel_decoration_v1_set_mode(deco->wlr_xdg_decoration, + WLR_XDG_TOPLEVEL_DECORATION_V1_MODE_SERVER_SIDE); + } } } container->width_fraction = 0; |