[mutter] main: Let session management code deal with DESKTOP_AUTOSTART_ID



commit 62ef293cdbec60072c7a0377b4729fe2ead5c8a0
Author: Jonas Ã…dahl <jadahl gmail com>
Date:   Wed Feb 24 11:24:42 2021 +0100

    main: Let session management code deal with DESKTOP_AUTOSTART_ID
    
    No need to have that outside of meta_session_init().
    
    Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1833>

 src/core/main.c   | 17 +----------------
 src/x11/session.c | 10 ++++++++++
 2 files changed, 11 insertions(+), 16 deletions(-)
---
diff --git a/src/core/main.c b/src/core/main.c
index 6dabcfe73e..8f6133e130 100644
--- a/src/core/main.c
+++ b/src/core/main.c
@@ -887,23 +887,8 @@ void
 meta_register_with_session (void)
 {
   if (!opt_disable_sm)
-    {
-      if (opt_client_id == NULL)
-        {
-          const gchar *desktop_autostart_id;
+    meta_session_init (opt_client_id, opt_save_file);
 
-          desktop_autostart_id = g_getenv ("DESKTOP_AUTOSTART_ID");
-
-          if (desktop_autostart_id != NULL)
-            opt_client_id = g_strdup (desktop_autostart_id);
-        }
-
-      /* Unset DESKTOP_AUTOSTART_ID in order to avoid child processes to
-       * use the same client id. */
-      g_unsetenv ("DESKTOP_AUTOSTART_ID");
-
-      meta_session_init (opt_client_id, opt_save_file);
-    }
   /* Free memory possibly allocated by the argument parsing which are
    * no longer needed.
    */
diff --git a/src/x11/session.c b/src/x11/session.c
index 8072db727f..9d11b6d8ae 100644
--- a/src/x11/session.c
+++ b/src/x11/session.c
@@ -233,6 +233,16 @@ meta_session_init (const char *previous_client_id,
   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)");
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]