From 4f68713020cbb4eefbcd4e134480255ba4a43643 Mon Sep 17 00:00:00 2001 From: Carlos Garnacho Date: Tue, 2 Jan 2024 13:42:57 +0100 Subject: [PATCH] frames: Notify borders on first content resize This addresses the following race condition: 1. Window+MetaFrame are created non-fullscreen, _MUTTER_FRAME_EXTENTS is initialized through widget measuring, accounting for frame. 2. Window and MetaFrame become fullscreen. 3. MetaFrameContent gets first size allocation, already fullscreen. 4. Borders were initialized to 0,0,0,0, become set to 0,0,0,0 correctly reflecting fullscreen, however notify::borders is not emitted. 5. _MUTTER_FRAME_EXTENTS stays accounting for the frame extents. It sounds sensible to have the borders initialized to a meaningful value, so account for the first time the border would be set due to the content being (re)sized, and let this first value trigger notify::borders resulting in _MUTTER_FRAME_EXTENTS updates. Since all later _MUTTER_FRAME_EXTENTS changes happen through content resizes, we only have to cater for this initial handover between the frame/content initialization paths done through widget measuring and the later paths done through MetaFrameContent resizes. Closes: https://gitlab.gnome.org/GNOME/mutter/-/issues/2937 Part-of: --- src/frames/meta-frame-content.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/frames/meta-frame-content.c b/src/frames/meta-frame-content.c index 139662506..12113c996 100644 --- a/src/frames/meta-frame-content.c +++ b/src/frames/meta-frame-content.c @@ -26,6 +26,7 @@ struct _MetaFrameContent GtkWidget parent_instance; Window window; GtkBorder border; + gboolean border_initialized; }; enum { @@ -100,13 +101,15 @@ static void meta_frame_content_update_border (MetaFrameContent *content, GtkBorder border) { - if (content->border.left == border.left && + if (content->border_initialized && + content->border.left == border.left && content->border.right == border.right && content->border.top == border.top && content->border.bottom == border.bottom) return; content->border = border; + content->border_initialized = TRUE; g_object_notify (G_OBJECT (content), "border"); }