diff options
Diffstat (limited to 'sway/tree')
-rw-r--r-- | sway/tree/container.c | 8 | ||||
-rw-r--r-- | sway/tree/view.c | 41 |
2 files changed, 35 insertions, 14 deletions
diff --git a/sway/tree/container.c b/sway/tree/container.c index e1e616f9..a069b177 100644 --- a/sway/tree/container.c +++ b/sway/tree/container.c | |||
@@ -669,6 +669,9 @@ void container_set_floating(struct sway_container *container, bool enable) { | |||
669 | container_init_floating(container); | 669 | container_init_floating(container); |
670 | if (container->view) { | 670 | if (container->view) { |
671 | view_set_tiled(container->view, false); | 671 | view_set_tiled(container->view, false); |
672 | if (container->view->using_csd) { | ||
673 | container->view->border = B_CSD; | ||
674 | } | ||
672 | } | 675 | } |
673 | if (old_parent) { | 676 | if (old_parent) { |
674 | container_reap_empty(old_parent); | 677 | container_reap_empty(old_parent); |
@@ -695,6 +698,9 @@ void container_set_floating(struct sway_container *container, bool enable) { | |||
695 | } | 698 | } |
696 | if (container->view) { | 699 | if (container->view) { |
697 | view_set_tiled(container->view, true); | 700 | view_set_tiled(container->view, true); |
701 | if (container->view->using_csd) { | ||
702 | container->view->border = container->view->saved_border; | ||
703 | } | ||
698 | } | 704 | } |
699 | container->is_sticky = false; | 705 | container->is_sticky = false; |
700 | } | 706 | } |
@@ -715,7 +721,7 @@ void container_set_geometry_from_floating_view(struct sway_container *con) { | |||
715 | size_t border_width = 0; | 721 | size_t border_width = 0; |
716 | size_t top = 0; | 722 | size_t top = 0; |
717 | 723 | ||
718 | if (!view->using_csd) { | 724 | if (view->border != B_CSD) { |
719 | border_width = view->border_thickness * (view->border != B_NONE); | 725 | border_width = view->border_thickness * (view->border != B_NONE); |
720 | top = view->border == B_NORMAL ? | 726 | top = view->border == B_NORMAL ? |
721 | container_titlebar_height() : border_width; | 727 | container_titlebar_height() : border_width; |
diff --git a/sway/tree/view.c b/sway/tree/view.c index ca5e6ab0..9c7c44e9 100644 --- a/sway/tree/view.c +++ b/sway/tree/view.c | |||
@@ -5,6 +5,8 @@ | |||
5 | #include <wlr/render/wlr_renderer.h> | 5 | #include <wlr/render/wlr_renderer.h> |
6 | #include <wlr/types/wlr_buffer.h> | 6 | #include <wlr/types/wlr_buffer.h> |
7 | #include <wlr/types/wlr_output_layout.h> | 7 | #include <wlr/types/wlr_output_layout.h> |
8 | #include <wlr/types/wlr_server_decoration.h> | ||
9 | #include <wlr/types/wlr_xdg_decoration_v1.h> | ||
8 | #include "config.h" | 10 | #include "config.h" |
9 | #ifdef HAVE_XWAYLAND | 11 | #ifdef HAVE_XWAYLAND |
10 | #include <wlr/xwayland.h> | 12 | #include <wlr/xwayland.h> |
@@ -23,6 +25,7 @@ | |||
23 | #include "sway/tree/view.h" | 25 | #include "sway/tree/view.h" |
24 | #include "sway/tree/workspace.h" | 26 | #include "sway/tree/workspace.h" |
25 | #include "sway/config.h" | 27 | #include "sway/config.h" |
28 | #include "sway/xdg_decoration.h" | ||
26 | #include "pango.h" | 29 | #include "pango.h" |
27 | #include "stringop.h" | 30 | #include "stringop.h" |
28 | 31 | ||
@@ -248,12 +251,8 @@ void view_autoconfigure(struct sway_view *view) { | |||
248 | view->border_top = false; | 251 | view->border_top = false; |
249 | } | 252 | } |
250 | 253 | ||
251 | enum sway_container_border border = view->border; | 254 | switch (view->border) { |
252 | if (view->using_csd) { | 255 | case B_CSD: |
253 | border = B_NONE; | ||
254 | } | ||
255 | |||
256 | switch (border) { | ||
257 | case B_NONE: | 256 | case B_NONE: |
258 | x = con->x; | 257 | x = con->x; |
259 | y = con->y + y_offset; | 258 | y = con->y + y_offset; |
@@ -326,16 +325,32 @@ void view_request_activate(struct sway_view *view) { | |||
326 | } | 325 | } |
327 | } | 326 | } |
328 | 327 | ||
329 | void view_set_tiled(struct sway_view *view, bool tiled) { | 328 | void view_set_csd_from_server(struct sway_view *view, bool enabled) { |
330 | if (!tiled) { | 329 | wlr_log(WLR_DEBUG, "Telling view %p to set CSD to %i", view, enabled); |
331 | view->using_csd = true; | 330 | if (view->xdg_decoration) { |
332 | if (view->impl->has_client_side_decorations) { | 331 | uint32_t mode = enabled ? |
333 | view->using_csd = view->impl->has_client_side_decorations(view); | 332 | WLR_XDG_TOPLEVEL_DECORATION_V1_MODE_CLIENT_SIDE : |
333 | WLR_XDG_TOPLEVEL_DECORATION_V1_MODE_SERVER_SIDE; | ||
334 | wlr_xdg_toplevel_decoration_v1_set_mode( | ||
335 | view->xdg_decoration->wlr_xdg_decoration, mode); | ||
336 | } | ||
337 | view->using_csd = enabled; | ||
338 | } | ||
339 | |||
340 | void view_update_csd_from_client(struct sway_view *view, bool enabled) { | ||
341 | wlr_log(WLR_DEBUG, "View %p updated CSD to %i", view, enabled); | ||
342 | if (enabled && view->border != B_CSD) { | ||
343 | view->saved_border = view->border; | ||
344 | if (container_is_floating(view->container)) { | ||
345 | view->border = B_CSD; | ||
334 | } | 346 | } |
335 | } else { | 347 | } else if (!enabled && view->border == B_CSD) { |
336 | view->using_csd = false; | 348 | view->border = view->saved_border; |
337 | } | 349 | } |
350 | view->using_csd = enabled; | ||
351 | } | ||
338 | 352 | ||
353 | void view_set_tiled(struct sway_view *view, bool tiled) { | ||
339 | if (view->impl->set_tiled) { | 354 | if (view->impl->set_tiled) { |
340 | view->impl->set_tiled(view, tiled); | 355 | view->impl->set_tiled(view, tiled); |
341 | } | 356 | } |