From 3bea86298d6bc1b0e856b091cb06d69b5f3ab140 Mon Sep 17 00:00:00 2001 From: Carlos Garnacho Date: Thu, 11 May 2023 20:15:37 +0200 Subject: [PATCH] core: Avoid placing hidden windows too early on Wayland This check only waited for windows without a buffer for wayland clients. This should happen for all windows on a Wayland backend here, unlike the other places calling client_window_should_be_mapped() that expect to get ahead of the window state. Closes: https://gitlab.gnome.org/GNOME/mutter/-/issues/2786 Part-of: --- src/core/window.c | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/src/core/window.c b/src/core/window.c index ff552b509..1d2fc9b27 100644 --- a/src/core/window.c +++ b/src/core/window.c @@ -1727,9 +1727,8 @@ meta_window_showing_on_its_workspace (MetaWindow *window) return showing; } -gboolean -meta_window_should_be_showing_on_workspace (MetaWindow *window, - MetaWorkspace *workspace) +static gboolean +window_has_buffer (MetaWindow *window) { #ifdef HAVE_WAYLAND if (meta_is_wayland_compositor ()) @@ -1740,6 +1739,16 @@ meta_window_should_be_showing_on_workspace (MetaWindow *window, } #endif + return TRUE; +} + +gboolean +meta_window_should_be_showing_on_workspace (MetaWindow *window, + MetaWorkspace *workspace) +{ + if (!window_has_buffer (window)) + return FALSE; + if (window->client_type == META_WINDOW_CLIENT_TYPE_X11 && window->decorated && !window->frame) return FALSE; @@ -1781,7 +1790,7 @@ implement_showing (MetaWindow *window, * Force placing windows only when they should be already mapped, * see #751887 */ - if (!window->placed && client_window_should_be_mapped (window)) + if (!window->placed && window_has_buffer (window)) meta_window_force_placement (window, FALSE); meta_window_hide (window);