mutter/2906.patch

72 lines
2.5 KiB
Diff

From ca082856adbb425be1c5ae97b6dea225f225bb60 Mon Sep 17 00:00:00 2001
From: Carlos Garnacho <carlosg@gnome.org>
Date: Thu, 9 Mar 2023 17:34:22 +0100
Subject: [PATCH] core: Retrieve DESKTOP_STARTUP_ID early on startup
With the move away from GTK3, and the indirect dependency on GTK4
grown in the GNOME Shell side, we've indirectly gotten a small sneaky
behavioral change: The GTK4 library will, right on dlopen, get
DESKTOP_AUTOSTART_ID for itself and delete it from the environment.
This happens before our own X11 session management code is
initialized, which confuses the hell out of it, into thinking
initialization is actually shutdown, gnome-session does not follow
along with this request, which leaves GNOME Shell into a confused
startup state where it never calls SmcSaveYourselfDone() and grinds
startup to a halt until gnome-session decides to move things forward.
In order to fix this, get the DESKTOP_AUTOSTART_ID before we lend
control to GNOME Shell bits and GTK4 is possibly initialized, and
feed it directly to our X11 session manager bits.
---
src/core/meta-context-main.c | 11 +++++++++++
src/x11/session.c | 10 ----------
2 files changed, 11 insertions(+), 10 deletions(-)
diff --git a/src/core/meta-context-main.c b/src/core/meta-context-main.c
index 8fee10cd57..cc930116e4 100644
--- a/src/core/meta-context-main.c
+++ b/src/core/meta-context-main.c
@@ -289,6 +289,17 @@ meta_context_main_configure (MetaContext *context,
meta_wayland_override_display_name (context_main->options.wayland_display);
#endif
+ if (!context_main->options.sm.client_id)
+ {
+ const char *desktop_autostart_id;
+
+ desktop_autostart_id = g_getenv ("DESKTOP_AUTOSTART_ID");
+ if (desktop_autostart_id)
+ context_main->options.sm.client_id = g_strdup (desktop_autostart_id);
+ }
+
+ g_unsetenv ("DESKTOP_AUTOSTART_ID");
+
return TRUE;
}
diff --git a/src/x11/session.c b/src/x11/session.c
index 37dd633cb4..83ec3a94e5 100644
--- a/src/x11/session.c
+++ b/src/x11/session.c
@@ -280,16 +280,6 @@ meta_session_init (MetaContext *context,
SmcCallbacks callbacks;
char *saved_client_id;
- if (!previous_client_id)
- {
- const char *desktop_autostart_id;
-
- desktop_autostart_id = g_getenv ("DESKTOP_AUTOSTART_ID");
- if (desktop_autostart_id)
- previous_client_id = desktop_autostart_id;
- }
- g_unsetenv ("DESKTOP_AUTOSTART_ID");
-
meta_topic (META_DEBUG_SM, "Initializing session with save file '%s'",
previous_save_file ? previous_save_file : "(none)");
--
GitLab