aboutsummaryrefslogtreecommitdiffstats
path: root/sway/tree/container.c
diff options
context:
space:
mode:
authorLibravatar Dudemanguy <random342@airmail.cc>2021-08-10 12:01:37 -0500
committerLibravatar Simon Ser <contact@emersion.fr>2021-08-12 10:02:17 +0200
commitacf946fe4c495b47c5a76230ba98f9b973bec96d (patch)
treeb73daeffd06e391527170d5117e1dc509c8e82b5 /sway/tree/container.c
parentDocument view_map (diff)
downloadsway-acf946fe4c495b47c5a76230ba98f9b973bec96d.tar.gz
sway-acf946fe4c495b47c5a76230ba98f9b973bec96d.tar.zst
sway-acf946fe4c495b47c5a76230ba98f9b973bec96d.zip
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/container.c')
-rw-r--r--sway/tree/container.c12
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 @@
20#include "sway/tree/arrange.h" 20#include "sway/tree/arrange.h"
21#include "sway/tree/view.h" 21#include "sway/tree/view.h"
22#include "sway/tree/workspace.h" 22#include "sway/tree/workspace.h"
23#include "sway/xdg_decoration.h"
23#include "list.h" 24#include "list.h"
24#include "log.h" 25#include "log.h"
25#include "stringop.h" 26#include "stringop.h"
@@ -835,7 +836,13 @@ void container_set_floating(struct sway_container *container, bool enable) {
835 if (container->view) { 836 if (container->view) {
836 view_set_tiled(container->view, false); 837 view_set_tiled(container->view, false);
837 if (container->view->using_csd) { 838 if (container->view->using_csd) {
839 container->saved_border = container->pending.border;
838 container->pending.border = B_CSD; 840 container->pending.border = B_CSD;
841 if (container->view->xdg_decoration) {
842 struct sway_xdg_decoration *deco = container->view->xdg_decoration;
843 wlr_xdg_toplevel_decoration_v1_set_mode(deco->wlr_xdg_decoration,
844 WLR_XDG_TOPLEVEL_DECORATION_V1_MODE_CLIENT_SIDE);
845 }
839 } 846 }
840 } 847 }
841 container_floating_set_default_size(container); 848 container_floating_set_default_size(container);
@@ -873,6 +880,11 @@ void container_set_floating(struct sway_container *container, bool enable) {
873 view_set_tiled(container->view, true); 880 view_set_tiled(container->view, true);
874 if (container->view->using_csd) { 881 if (container->view->using_csd) {
875 container->pending.border = container->saved_border; 882 container->pending.border = container->saved_border;
883 if (container->view->xdg_decoration) {
884 struct sway_xdg_decoration *deco = container->view->xdg_decoration;
885 wlr_xdg_toplevel_decoration_v1_set_mode(deco->wlr_xdg_decoration,
886 WLR_XDG_TOPLEVEL_DECORATION_V1_MODE_SERVER_SIDE);
887 }
876 } 888 }
877 } 889 }
878 container->width_fraction = 0; 890 container->width_fraction = 0;