From 34559e0067d2c4b62d376b90d5e693507e19c180 Mon Sep 17 00:00:00 2001 From: Kalev Lember Date: Fri, 20 Oct 2023 18:19:53 +0200 Subject: [PATCH] Backport upstream MR3329 to fix black screen in the installer (#2241632) https://bugzilla.redhat.com/show_bug.cgi?id=2241632 https://gitlab.gnome.org/GNOME/mutter/-/issues/3089 --- 3329.patch | 191 ++++++++++++++++++++++++++++++++++++++++++++++++++++ mutter.spec | 2 + 2 files changed, 193 insertions(+) create mode 100644 3329.patch diff --git a/3329.patch b/3329.patch new file mode 100644 index 0000000..cc5d94c --- /dev/null +++ b/3329.patch @@ -0,0 +1,191 @@ +From 156f988d3196bbab824236332c6e194323949141 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Jonas=20=C3=85dahl?= +Date: Fri, 20 Oct 2023 15:44:29 +0800 +Subject: [PATCH 1/3] compositor/x11: Redirect subwindows after mapping COW + +This means we'll do it before any windows are mapped, and before any +plugin implementation is started. Doing it before a plugin is started is +important, because things that the plugin does during startup can have +consequences on how compositing on Xorg works. + +Closes: https://gitlab.gnome.org/GNOME/mutter/-/issues/3089 +--- + src/compositor/meta-compositor-x11.c | 2 ++ + src/x11/meta-x11-display.c | 1 - + 2 files changed, 2 insertions(+), 1 deletion(-) + +diff --git a/src/compositor/meta-compositor-x11.c b/src/compositor/meta-compositor-x11.c +index 1ad3327ddf6..ce7bc1945ce 100644 +--- a/src/compositor/meta-compositor-x11.c ++++ b/src/compositor/meta-compositor-x11.c +@@ -188,6 +188,8 @@ meta_compositor_x11_manage (MetaCompositor *compositor, + + compositor_x11->have_x11_sync_object = meta_sync_ring_init (xdisplay); + ++ meta_x11_display_redirect_windows (x11_display, display); ++ + return TRUE; + } + +diff --git a/src/x11/meta-x11-display.c b/src/x11/meta-x11-display.c +index 4e98203dd25..c634a71fb2a 100644 +--- a/src/x11/meta-x11-display.c ++++ b/src/x11/meta-x11-display.c +@@ -301,7 +301,6 @@ on_x11_display_opened (MetaX11Display *x11_display, + MetaDisplay *display) + { + meta_display_manage_all_xwindows (display); +- meta_x11_display_redirect_windows (x11_display, display); + } + + static void +-- +GitLab + + +From a8484ffac70d8f1ee4af4ba7ab0ca8b197a0b918 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Jonas=20=C3=85dahl?= +Date: Fri, 20 Oct 2023 17:03:31 +0800 +Subject: [PATCH 2/3] display: Move X11 initial focus handling to + MetaX11Display + +It's X11 specific, so put it in the X11 display manager object. +--- + src/core/display.c | 34 ---------------------------------- + src/x11/meta-x11-display.c | 25 +++++++++++++++++++++++++ + 2 files changed, 25 insertions(+), 34 deletions(-) + +diff --git a/src/core/display.c b/src/core/display.c +index 0a191c0fbca..b16e50e21de 100644 +--- a/src/core/display.c ++++ b/src/core/display.c +@@ -930,9 +930,6 @@ meta_display_new (MetaContext *context, + MetaDisplay *display; + MetaDisplayPrivate *priv; + guint32 timestamp; +-#ifdef HAVE_X11_CLIENT +- Window old_active_xwindow = None; +-#endif + MetaMonitorManager *monitor_manager; + MetaSettings *settings; + MetaInputCapture *input_capture; +@@ -1048,14 +1045,6 @@ meta_display_new (MetaContext *context, + display->last_focus_time = timestamp; + display->last_user_time = timestamp; + +-#ifdef HAVE_X11 +- if (!meta_is_wayland_compositor ()) +- meta_prop_get_window (display->x11_display, +- display->x11_display->xroot, +- display->x11_display->atom__NET_ACTIVE_WINDOW, +- &old_active_xwindow); +-#endif +- + if (!meta_compositor_manage (display->compositor, error)) + { + g_object_unref (display); +@@ -1076,30 +1065,7 @@ meta_display_new (MetaContext *context, + g_signal_connect (display->gesture_tracker, "state-changed", + G_CALLBACK (gesture_tracker_state_changed), display); + +- /* We know that if mutter is running as a Wayland compositor, +- * we start out with no windows. +- */ +-#ifdef HAVE_X11_CLIENT +- if (!meta_is_wayland_compositor ()) +- meta_display_manage_all_xwindows (display); +- +- if (old_active_xwindow != None) +- { +- MetaWindow *old_active_window; +- old_active_window = meta_x11_display_lookup_x_window (display->x11_display, +- old_active_xwindow); +- if (old_active_window) +- meta_window_focus (old_active_window, timestamp); +- else +- meta_display_unset_input_focus (display, timestamp); +- } +- else +- { +- meta_display_unset_input_focus (display, timestamp); +- } +-#else + meta_display_unset_input_focus (display, timestamp); +-#endif + + g_signal_connect (stage, "notify::is-grabbed", + G_CALLBACK (on_is_grabbed_changed), display); +diff --git a/src/x11/meta-x11-display.c b/src/x11/meta-x11-display.c +index c634a71fb2a..599968a363b 100644 +--- a/src/x11/meta-x11-display.c ++++ b/src/x11/meta-x11-display.c +@@ -300,7 +300,32 @@ static void + on_x11_display_opened (MetaX11Display *x11_display, + MetaDisplay *display) + { ++ Window old_active_xwindow = None; ++ ++ if (!meta_is_wayland_compositor ()) ++ { ++ meta_prop_get_window (display->x11_display, ++ display->x11_display->xroot, ++ display->x11_display->atom__NET_ACTIVE_WINDOW, ++ &old_active_xwindow); ++ } ++ + meta_display_manage_all_xwindows (display); ++ ++ if (old_active_xwindow != None) ++ { ++ MetaWindow *old_active_window; ++ ++ old_active_window = meta_x11_display_lookup_x_window (x11_display, ++ old_active_xwindow); ++ if (old_active_window) ++ { ++ uint32_t timestamp; ++ ++ timestamp = display->x11_display->timestamp; ++ meta_window_focus (old_active_window, timestamp); ++ } ++ } + } + + static void +-- +GitLab + + +From 0fb2b0745bff693f024e9db15a26e86a548c1738 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Jonas=20=C3=85dahl?= +Date: Tue, 17 Oct 2023 15:46:00 +0800 +Subject: [PATCH 3/3] tests/x11: Fix replace test to catch the second instance + failing + +The test never noticed that the second instance never actually managed +to load; it was looping a multi second retry session trying to redirect +windows, meaning it failed to catch https://gitlab.gnome.org/GNOME/mutter/-/issues/3089. + +Fix the test so that it always waits for mutter to finish loading +successfully, just like it waits fro the first. +--- + src/tests/x11-test.sh | 3 +++ + 1 file changed, 3 insertions(+) + +diff --git a/src/tests/x11-test.sh b/src/tests/x11-test.sh +index 59e460fc336..d95b2460f6e 100755 +--- a/src/tests/x11-test.sh ++++ b/src/tests/x11-test.sh +@@ -34,6 +34,9 @@ echo \# Launched with pid $MUTTER2_PID + MUTTER2_PID=$! + wait $MUTTER1_PID + ++echo \# Waiting for the second mutter to finish loading ++gdbus wait --session org.gnome.Mutter.IdleMonitor ++ + sleep 2 + + echo \# Terminating clients > /dev/stderr +-- +GitLab + diff --git a/mutter.spec b/mutter.spec index df2d9c9..4099657 100644 --- a/mutter.spec +++ b/mutter.spec @@ -50,6 +50,8 @@ Patch: 0002-tests-dbusmock-templates-rtkit-Add-MakeThreadHighPri.patch Patch: 0003-thread-Allow-turning-off-rt-scheduling-for-running-t.patch Patch: 0004-kms-impl-device-Inhibit-real-time-scheduling-when-mo.patch +# https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3329 +Patch: 3329.patch BuildRequires: pkgconfig(gobject-introspection-1.0) >= 1.41.0 BuildRequires: pkgconfig(sm)