]> git.mdlowis.com Git - proto/labwc.git/commitdiff
Decorations: respect earlier decoration negotiation results
authorConsolatis <35009135+Consolatis@users.noreply.github.com>
Mon, 20 Mar 2023 21:36:35 +0000 (22:36 +0100)
committerJohan Malm <johanmalm@users.noreply.github.com>
Sat, 25 Mar 2023 07:24:40 +0000 (07:24 +0000)
Before this patch, setting `<decoration>` to `client` would cause applications
which prefer server side decorations to not have any decorations at all. This
patch fixes it by respecting the result of earlier negotiations via the
xdg-decoration-unstable-v1 protocol.

Fixes #297
Fixes #831

src/xdg.c

index d4077d22763d32a7b6ace1486bfecf69604d7023..a01962e6617776de35397a8201dde430510f923d 100644 (file)
--- a/src/xdg.c
+++ b/src/xdg.c
@@ -48,7 +48,16 @@ handle_new_xdg_popup(struct wl_listener *listener, void *data)
 static bool
 has_ssd(struct view *view)
 {
+       if (view->ssd_enabled) {
+               /* View prefers server side decorations */
+               return true;
+       }
+
        if (!rc.xdg_shell_server_side_deco) {
+               /*
+                * User prefers client side decorations and
+                * the view didn't negotiate server side ones.
+                */
                return false;
        }
 
@@ -56,6 +65,10 @@ has_ssd(struct view *view)
         * Some XDG shells refuse to disable CSD in which case their
         * geometry.{x,y} seems to be greater than zero. We filter on that
         * on the assumption that this will remain true.
+        *
+        * TODO: Replace this with a proper implementation of
+        *       the KDE decoration variant as can be seen at
+        *       https://github.com/swaywm/sway/blob/master/sway/decoration.c
         */
        struct wlr_xdg_surface_state *current =
                &xdg_surface_from_view(view)->current;