From 6c0254bf0211e0a0cdc2cd8f0f4c304ebfc8111d Mon Sep 17 00:00:00 2001 From: Carlos Garnacho Date: Fri, 2 Dec 2022 19:59:21 +0100 Subject: [PATCH] frames: Double check _MUTTER_NEEDS_FRAME property changes Recalculating window features is a busy thing on the Mutter side, the different properties being (re)set will overwrite the current state and cause some side work. Between that is the rewriting of the _MUTTER_NEEDS_FRAME property on the window being recalculated, which throws the frames client off, by thinking the window does actually require a new frame. It is not sufficient to trust that PropertyNewValue means the property or the value are new, also double check that the window did not have in fact a frame, and avoid the busy work if it did. Besides the busywork that can be easily avoided, this also fixes the window close button state being stuck if the window changed its deletable state, since the frame being respawn managed to miss the property change. Part-of: --- src/frames/meta-window-tracker.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/frames/meta-window-tracker.c b/src/frames/meta-window-tracker.c index 7487904c4..f849c547d 100644 --- a/src/frames/meta-window-tracker.c +++ b/src/frames/meta-window-tracker.c @@ -214,9 +214,13 @@ on_xevent (GdkDisplay *display, xevent->xproperty.atom == gdk_x11_get_xatom_by_name_for_display (display, "_MUTTER_NEEDS_FRAME")) { - if (xevent->xproperty.state == PropertyNewValue) + if (xevent->xproperty.state == PropertyNewValue && + !g_hash_table_contains (window_tracker->client_windows, + GUINT_TO_POINTER (xwindow))) set_up_frame (window_tracker, xwindow); - else if (xevent->xproperty.state == PropertyDelete) + else if (xevent->xproperty.state == PropertyDelete && + g_hash_table_contains (window_tracker->client_windows, + GUINT_TO_POINTER (xwindow))) remove_frame (window_tracker, xwindow); } else if (xevent->type == PropertyNotify)