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>
This commit is contained in:
Jonas Ådahl 2021-02-24 11:24:42 +01:00 committed by Marge Bot
parent 25e2839339
commit 62ef293cdb
2 changed files with 11 additions and 16 deletions

View File

@ -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.
*/

View File

@ -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)");