]> git.mdlowis.com Git - proto/labwc.git/commitdiff
xdg: Use wlr_xdg_surface_get_geometry() to get size
authorJohn Lindgren <john@jlindgren.net>
Mon, 20 Feb 2023 22:30:17 +0000 (17:30 -0500)
committerConsolatis <35009135+Consolatis@users.noreply.github.com>
Tue, 21 Feb 2023 07:30:10 +0000 (08:30 +0100)
This fixes an issue with havoc not having a valid size on map().

Investigation showed that xdg_surface->current.geometry is set only by
the xdg_surface::set_geometry protocol message, which is optional. If
set_geometry is not called, then we are supposed to compute the size
from the surface buffer(s). wlr_xdg_surface_get_geometry() already
accounts for this, so we just need to use wlr_xdg_surface_get_geometry()
instead of reading xdg_surface->current.geometry directly.

src/xdg.c

index 0315b92920b3a6124928ae7e9eab3335b5a72632..dca9f44c68b1fcca1203049bc5e2667d5305f723 100644 (file)
--- a/src/xdg.c
+++ b/src/xdg.c
@@ -325,10 +325,10 @@ xdg_toplevel_view_map(struct view *view)
                 * dimensions remain zero until handle_commit().
                 */
                if (wlr_box_empty(&view->pending)) {
-                       view->pending.width =
-                               xdg_surface->current.geometry.width;
-                       view->pending.height =
-                               xdg_surface->current.geometry.height;
+                       struct wlr_box size;
+                       wlr_xdg_surface_get_geometry(xdg_surface, &size);
+                       view->pending.width = size.width;
+                       view->pending.height = size.height;
                }
 
                /*