summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCarlos Garnacho <carlosg@gnome.org>2023-03-09 17:34:22 +0100
committerMarge Bot <marge-bot@gnome.org>2023-03-18 15:40:17 +0000
commit5daddf0bc733c4d935767d1598610837347606e1 (patch)
tree99fa82542dcdd78f20a177eda5c39bd489332711
parentd31b781efb25365d6373d6c98c10815b7feca8be (diff)
downloadmutter-5daddf0bc733c4d935767d1598610837347606e1.tar.gz
core: Retrieve DESKTOP_AUTOSTART_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. Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2906>
-rw-r--r--src/core/meta-context-main.c11
-rw-r--r--src/x11/session.c10
2 files changed, 11 insertions, 10 deletions
diff --git a/src/core/meta-context-main.c b/src/core/meta-context-main.c
index 8fee10cd5..cc930116e 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 37dd633cb..83ec3a94e 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)");