mirror of
https://github.com/brl/mutter.git
synced 2024-11-29 11:30:45 -05:00
plugins: Add early_initialize vfunc
For GNOME Shell, we need to grab our DBus names *before* we talk XSMP. gnome-session takes our XSMP connection as "I'm ready", and starts running all the other random crud that people dropped in as autostart files. But for example, we need to have claimed org.freedesktop.Notifications before a lot of said crud starts. This requires a plugin API version bump. Misc: Move handling of --version way earlier in main() where it should be; no point having it wedged after plugin handling.
This commit is contained in:
parent
183190d089
commit
f2158218be
@ -7,7 +7,7 @@ m4_define([mutter_micro_version], [90])
|
|||||||
m4_define([mutter_version],
|
m4_define([mutter_version],
|
||||||
[mutter_major_version.mutter_minor_version.mutter_micro_version])
|
[mutter_major_version.mutter_minor_version.mutter_micro_version])
|
||||||
|
|
||||||
m4_define([mutter_plugin_api_version], [3])
|
m4_define([mutter_plugin_api_version], [4])
|
||||||
|
|
||||||
AC_INIT([mutter], [mutter_version],
|
AC_INIT([mutter], [mutter_version],
|
||||||
[http://bugzilla.gnome.org/enter_bug.cgi?product=mutter])
|
[http://bugzilla.gnome.org/enter_bug.cgi?product=mutter])
|
||||||
|
@ -55,6 +55,8 @@ struct MetaPluginManager
|
|||||||
{
|
{
|
||||||
MetaScreen *screen;
|
MetaScreen *screen;
|
||||||
|
|
||||||
|
gboolean plugin_load_attempted;
|
||||||
|
|
||||||
GList /* MetaPlugin */ *plugins; /* TODO -- maybe use hash table */
|
GList /* MetaPlugin */ *plugins; /* TODO -- maybe use hash table */
|
||||||
GList *unload; /* Plugins that are disabled and pending unload */
|
GList *unload; /* Plugins that are disabled and pending unload */
|
||||||
|
|
||||||
@ -181,6 +183,8 @@ meta_plugin_manager_unload (MetaPluginManager *plugin_mgr)
|
|||||||
|
|
||||||
g_list_free (plugin_mgr->plugins);
|
g_list_free (plugin_mgr->plugins);
|
||||||
plugin_mgr->plugins = NULL;
|
plugin_mgr->plugins = NULL;
|
||||||
|
|
||||||
|
plugin_mgr->plugin_load_attempted = FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@ -218,6 +222,10 @@ meta_plugin_manager_load (MetaPluginManager *plugin_mgr)
|
|||||||
const gchar *dpath = MUTTER_PLUGIN_DIR "/";
|
const gchar *dpath = MUTTER_PLUGIN_DIR "/";
|
||||||
GSList *plugins, *fallback = NULL;
|
GSList *plugins, *fallback = NULL;
|
||||||
|
|
||||||
|
if (plugin_mgr->plugin_load_attempted)
|
||||||
|
return TRUE;
|
||||||
|
plugin_mgr->plugin_load_attempted = TRUE;
|
||||||
|
|
||||||
plugins = meta_prefs_get_clutter_plugins ();
|
plugins = meta_prefs_get_clutter_plugins ();
|
||||||
|
|
||||||
if (!plugins)
|
if (!plugins)
|
||||||
@ -312,6 +320,34 @@ meta_plugin_manager_load (MetaPluginManager *plugin_mgr)
|
|||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* meta_plugin_manager_initialize_early:
|
||||||
|
* @plugin_mgr: a #MetaPluginManager
|
||||||
|
*
|
||||||
|
* This function invokes any plugin handling code that needs to be run
|
||||||
|
* effectively immediately after we know which plugins are going to be
|
||||||
|
* used. This means before the process has an X connection, or
|
||||||
|
* talks to the session manager, for example.
|
||||||
|
*
|
||||||
|
* An example intended use is claiming DBus names.
|
||||||
|
*/
|
||||||
|
gboolean
|
||||||
|
meta_plugin_manager_initialize_early (MetaPluginManager *plugin_mgr)
|
||||||
|
{
|
||||||
|
GList *iter;
|
||||||
|
|
||||||
|
for (iter = plugin_mgr->plugins; iter; iter = iter->next)
|
||||||
|
{
|
||||||
|
MetaPlugin *plugin = (MetaPlugin*) iter->data;
|
||||||
|
MetaPluginClass *klass = META_PLUGIN_GET_CLASS (plugin);
|
||||||
|
|
||||||
|
if (klass->early_initialize)
|
||||||
|
klass->early_initialize (plugin);
|
||||||
|
}
|
||||||
|
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
gboolean
|
gboolean
|
||||||
meta_plugin_manager_initialize (MetaPluginManager *plugin_mgr)
|
meta_plugin_manager_initialize (MetaPluginManager *plugin_mgr)
|
||||||
{
|
{
|
||||||
|
@ -50,6 +50,7 @@ MetaPluginManager * meta_plugin_manager_get (MetaScreen *screen);
|
|||||||
MetaPluginManager * meta_plugin_manager_get_default (void);
|
MetaPluginManager * meta_plugin_manager_get_default (void);
|
||||||
|
|
||||||
gboolean meta_plugin_manager_load (MetaPluginManager *mgr);
|
gboolean meta_plugin_manager_load (MetaPluginManager *mgr);
|
||||||
|
gboolean meta_plugin_manager_initialize_early (MetaPluginManager *plugin_mgr);
|
||||||
gboolean meta_plugin_manager_initialize (MetaPluginManager *plugin_mgr);
|
gboolean meta_plugin_manager_initialize (MetaPluginManager *plugin_mgr);
|
||||||
gboolean meta_plugin_manager_event_simple (MetaPluginManager *mgr,
|
gboolean meta_plugin_manager_event_simple (MetaPluginManager *mgr,
|
||||||
MetaWindowActor *actor,
|
MetaWindowActor *actor,
|
||||||
|
@ -539,6 +539,9 @@ main (int argc, char **argv)
|
|||||||
/* Parse command line arguments.*/
|
/* Parse command line arguments.*/
|
||||||
ctx = meta_parse_options (&argc, &argv, &meta_args);
|
ctx = meta_parse_options (&argc, &argv, &meta_args);
|
||||||
|
|
||||||
|
if (meta_args.print_version)
|
||||||
|
version ();
|
||||||
|
|
||||||
/* This must come before the introspect below, so we load all the plugins
|
/* This must come before the introspect below, so we load all the plugins
|
||||||
* in order to get their get_type functions.
|
* in order to get their get_type functions.
|
||||||
*/
|
*/
|
||||||
@ -587,10 +590,18 @@ main (int argc, char **argv)
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
meta_set_syncing (meta_args.sync || (g_getenv ("MUTTER_SYNC") != NULL));
|
/* Early initialization for plugins comes before almost anything
|
||||||
|
else here */
|
||||||
|
{
|
||||||
|
MetaPluginManager *mgr = meta_plugin_manager_get_default ();
|
||||||
|
|
||||||
if (meta_args.print_version)
|
if (!meta_plugin_manager_load (mgr))
|
||||||
version ();
|
g_error ("failed to load plugins");
|
||||||
|
|
||||||
|
meta_plugin_manager_initialize_early (mgr);
|
||||||
|
}
|
||||||
|
|
||||||
|
meta_set_syncing (meta_args.sync || (g_getenv ("MUTTER_SYNC") != NULL));
|
||||||
|
|
||||||
meta_select_display (meta_args.display_name);
|
meta_select_display (meta_args.display_name);
|
||||||
|
|
||||||
|
@ -64,6 +64,8 @@ struct _MetaPluginClass
|
|||||||
{
|
{
|
||||||
GObjectClass parent_class;
|
GObjectClass parent_class;
|
||||||
|
|
||||||
|
void (*early_initialize) (MetaPlugin *plugin);
|
||||||
|
|
||||||
void (*start) (MetaPlugin *plugin);
|
void (*start) (MetaPlugin *plugin);
|
||||||
|
|
||||||
void (*minimize) (MetaPlugin *plugin,
|
void (*minimize) (MetaPlugin *plugin,
|
||||||
|
Loading…
Reference in New Issue
Block a user