From 84294c9cfb12a85fb5bc08fb0312ef1feb7eee4c Mon Sep 17 00:00:00 2001 From: John Lindgren Date: Mon, 20 Feb 2023 17:30:17 -0500 Subject: [PATCH] xdg: Use wlr_xdg_surface_get_geometry() to get size 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 | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/xdg.c b/src/xdg.c index 0315b929..dca9f44c 100644 --- 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; } /*