core: make session registration an explicit step

gnome-shell shouldn't announce to the session manager it's
"ready" until it's fully initialized.  It currently tells
the session manager it's ready as soon as it hits the main
loop. This causes nautilus in classic mode to start before
we have workspaces initialized.

https://bugzilla.gnome.org/show_bug.cgi?id=694876
This commit is contained in:
Ray Strode 2013-02-28 10:37:03 -05:00
parent 7f14298126
commit 773ae8dc65
3 changed files with 45 additions and 33 deletions

View File

@ -446,10 +446,49 @@ meta_init (void)
meta_clutter_init ();
}
/**
* meta_register_with_session:
*
* Registers mutter with the session manager. Call this after completing your own
* initialization.
*
* This should be called when the session manager can safely continue to the
* next phase of startup and potentially display windows.
*/
void
meta_register_with_session (void)
{
if (!opt_disable_sm)
{
if (opt_client_id == NULL)
{
const gchar *desktop_autostart_id;
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.
*/
g_free (opt_save_file);
g_free (opt_display_name);
g_free (opt_client_id);
}
/**
* meta_run: (skip)
*
* Runs mutter. Call this after completing your own initialization.
* Runs mutter. Call this after completing initialization that doesn't require
* an event loop.
*
* Return value: mutter's exit status
*/
@ -509,35 +548,6 @@ meta_run (void)
if (!meta_ui_have_a_theme ())
meta_fatal (_("Could not find a theme! Be sure %s exists and contains the usual themes.\n"),
MUTTER_DATADIR"/themes");
/* Connect to SM as late as possible - but before managing display,
* or we might try to manage a window before we have the session
* info
*/
if (!opt_disable_sm)
{
if (opt_client_id == NULL)
{
const gchar *desktop_autostart_id;
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.
*/
g_free (opt_save_file);
g_free (opt_display_name);
g_free (opt_client_id);
if (!meta_display_open ())
meta_exit (META_EXIT_ERROR);

View File

@ -81,5 +81,6 @@ main (int argc, char **argv)
meta_plugin_manager_load (plugin);
meta_init ();
meta_register_with_session ();
return meta_run ();
}

View File

@ -26,9 +26,10 @@
#include <glib.h>
GOptionContext *meta_get_option_context (void);
void meta_init (void);
int meta_run (void);
GOptionContext *meta_get_option_context (void);
void meta_init (void);
int meta_run (void);
void meta_register_with_session (void);
gboolean meta_get_replace_current_wm (void); /* Actually defined in util.c */
void meta_set_wm_name (const char *wm_name);