mutter/0001-modified-3329.patch

146 lines
4.7 KiB
Diff
Raw Normal View History

From e20ebeefa42997fe65008b11ef771c71b697273c Mon Sep 17 00:00:00 2001
From: Adam Williamson <awilliam@redhat.com>
Date: Fri, 20 Oct 2023 22:12:23 -0700
Subject: [PATCH] modified 3329
Signed-off-by: Adam Williamson <awilliam@redhat.com>
---
src/compositor/meta-compositor-x11.c | 2 ++
src/core/display.c | 34 ----------------------------
src/tests/x11-test.sh | 3 +++
src/x11/meta-x11-display.c | 30 +++++++++++++++++++++++-
4 files changed, 34 insertions(+), 35 deletions(-)
diff --git a/src/compositor/meta-compositor-x11.c b/src/compositor/meta-compositor-x11.c
index 1ad3327dd..ce7bc1945 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/core/display.c b/src/core/display.c
index 0a191c0fb..b16e50e21 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/tests/x11-test.sh b/src/tests/x11-test.sh
index 59e460fc3..d95b2460f 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
diff --git a/src/x11/meta-x11-display.c b/src/x11/meta-x11-display.c
index 4e98203dd..4ca620410 100644
--- a/src/x11/meta-x11-display.c
+++ b/src/x11/meta-x11-display.c
@@ -300,8 +300,36 @@ 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);
+ }
+
+ if (meta_is_wayland_compositor ())
+ meta_x11_display_redirect_windows (x11_display, display);
+
+
meta_display_manage_all_xwindows (display);
- meta_x11_display_redirect_windows (x11_display, 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
--
2.41.0