]> git.mdlowis.com Git - proto/labwc.git/commitdiff
xdg: try to handle missing set_window_geometry with Qt apps
authorJohn Lindgren <john@jlindgren.net>
Sat, 21 Oct 2023 23:49:38 +0000 (19:49 -0400)
committerConsolatis <35009135+Consolatis@users.noreply.github.com>
Mon, 6 Nov 2023 19:43:22 +0000 (20:43 +0100)
Qt applications occasionally fail to call set_window_geometry after a
configure request, but do correctly update the actual surface extent.
This results in a mismatch between the window decorations (which follow
the logical geometry) and the visual size of the client area. As a
workaround, try to detect this case and ignore the out-of-date window
geometry.

Fixes: #1194
src/xdg.c

index dc9be3347ad170863ccecb7b5a27803af52cc669..f55649761a7c00a2124ef1b97d6a369702ce3bd8 100644 (file)
--- a/src/xdg.c
+++ b/src/xdg.c
@@ -90,6 +90,27 @@ handle_commit(struct wl_listener *listener, void *data)
        struct wlr_box size;
        wlr_xdg_surface_get_geometry(xdg_surface, &size);
 
+       /*
+        * Qt applications occasionally fail to call set_window_geometry
+        * after a configure request, but do correctly update the actual
+        * surface extent. This results in a mismatch between the window
+        * decorations (which follow the logical geometry) and the visual
+        * size of the client area. As a workaround, we try to detect
+        * this case and ignore the out-of-date window geometry.
+        */
+       if (size.width != view->pending.width
+                       || size.height != view->pending.height) {
+               struct wlr_box extent;
+               wlr_surface_get_extends(xdg_surface->surface, &extent);
+               if (extent.width == view->pending.width
+                               && extent.height == view->pending.height) {
+                       wlr_log(WLR_DEBUG, "window geometry for client (%s) "
+                               "appears to be incorrect - ignoring",
+                               view_get_string_prop(view, "app_id"));
+                       size = extent; /* Use surface extent instead */
+               }
+       }
+
        struct wlr_box *current = &view->current;
        bool update_required = current->width != size.width
                || current->height != size.height;