From 21ff87d72b44604d348cf71da3175b85ac5b2f75 Mon Sep 17 00:00:00 2001 From: Ryan Dwyer Date: Thu, 27 Sep 2018 22:44:57 +1000 Subject: 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. --- sway/tree/view.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'sway/tree/view.c') 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) { } void view_set_csd_from_server(struct sway_view *view, bool enabled) { + wlr_log(WLR_DEBUG, "Telling view %p to set CSD to %i", view, enabled); if (view->xdg_decoration) { uint32_t mode = enabled ? WLR_XDG_TOPLEVEL_DECORATION_V1_MODE_CLIENT_SIDE : @@ -316,15 +317,20 @@ void view_set_csd_from_server(struct sway_view *view, bool enabled) { wlr_xdg_toplevel_decoration_v1_set_mode( view->xdg_decoration->wlr_xdg_decoration, mode); } + view->using_csd = enabled; } void view_update_csd_from_client(struct sway_view *view, bool enabled) { + wlr_log(WLR_DEBUG, "View %p updated CSD to %i", view, enabled); if (enabled && view->border != B_CSD) { view->saved_border = view->border; - view->border = B_CSD; + if (container_is_floating(view->container)) { + view->border = B_CSD; + } } else if (!enabled && view->border == B_CSD) { view->border = view->saved_border; } + view->using_csd = enabled; } void view_set_tiled(struct sway_view *view, bool tiled) { -- cgit v1.2.3-54-g00ecf