aboutsummaryrefslogtreecommitdiffstats
path: root/sway/tree/view.c
diff options
context:
space:
mode:
authorLibravatar Ryan Dwyer <ryandwyer1@gmail.com>2018-09-27 22:44:57 +1000
committerLibravatar Ryan Dwyer <ryandwyer1@gmail.com>2018-09-27 22:51:37 +1000
commit21ff87d72b44604d348cf71da3175b85ac5b2f75 (patch)
treede0ecfd66fd3a6957e0f8a2eb5038c785b3965c2 /sway/tree/view.c
parentRename view_set_csd_from_client to view_update_csd_from_client (diff)
downloadsway-21ff87d72b44604d348cf71da3175b85ac5b2f75.tar.gz
sway-21ff87d72b44604d348cf71da3175b85ac5b2f75.tar.zst
sway-21ff87d72b44604d348cf71da3175b85ac5b2f75.zip
Improve CSD logic
This does the following: * Removes the xdg-decoration surface_commit listener. I was under the impression the client could ignore the server's preference and set whatever decoration they like using this protocol, but I don't think that's right. * Adds a listener for the xdg-decoration request_mode signal. The protocol states that the server should respond to this with its preference. We'll always respond with SSD here. * Makes it so tiled views which use CSD will still have sway decorations rendered. To do this, using_csd had to be added back to the view struct, and the border is changed when floating or unfloating a view.
Diffstat (limited to 'sway/tree/view.c')
-rw-r--r--sway/tree/view.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/sway/tree/view.c b/sway/tree/view.c
index 1c94de4c..9ffcf206 100644
--- a/sway/tree/view.c
+++ b/sway/tree/view.c
@@ -309,6 +309,7 @@ void view_request_activate(struct sway_view *view) {
309} 309}
310 310
311void view_set_csd_from_server(struct sway_view *view, bool enabled) { 311void view_set_csd_from_server(struct sway_view *view, bool enabled) {
312 wlr_log(WLR_DEBUG, "Telling view %p to set CSD to %i", view, enabled);
312 if (view->xdg_decoration) { 313 if (view->xdg_decoration) {
313 uint32_t mode = enabled ? 314 uint32_t mode = enabled ?
314 WLR_XDG_TOPLEVEL_DECORATION_V1_MODE_CLIENT_SIDE : 315 WLR_XDG_TOPLEVEL_DECORATION_V1_MODE_CLIENT_SIDE :
@@ -316,15 +317,20 @@ void view_set_csd_from_server(struct sway_view *view, bool enabled) {
316 wlr_xdg_toplevel_decoration_v1_set_mode( 317 wlr_xdg_toplevel_decoration_v1_set_mode(
317 view->xdg_decoration->wlr_xdg_decoration, mode); 318 view->xdg_decoration->wlr_xdg_decoration, mode);
318 } 319 }
320 view->using_csd = enabled;
319} 321}
320 322
321void view_update_csd_from_client(struct sway_view *view, bool enabled) { 323void view_update_csd_from_client(struct sway_view *view, bool enabled) {
324 wlr_log(WLR_DEBUG, "View %p updated CSD to %i", view, enabled);
322 if (enabled && view->border != B_CSD) { 325 if (enabled && view->border != B_CSD) {
323 view->saved_border = view->border; 326 view->saved_border = view->border;
324 view->border = B_CSD; 327 if (container_is_floating(view->container)) {
328 view->border = B_CSD;
329 }
325 } else if (!enabled && view->border == B_CSD) { 330 } else if (!enabled && view->border == B_CSD) {
326 view->border = view->saved_border; 331 view->border = view->saved_border;
327 } 332 }
333 view->using_csd = enabled;
328} 334}
329 335
330void view_set_tiled(struct sway_view *view, bool tiled) { 336void view_set_tiled(struct sway_view *view, bool tiled) {