Load one copy of plugins early

Although multi-screen support has not been tested and probably
doesn't fully work, the basic setup for multi-screen is that
we have the same list of plugins for all screens, but a different
instance of the plugins for each screen.

To allow plugins to do setup that is screen independent and needs
to occur early in the setup process, we identify a "default plugin
manager" and load (but not start) that plugin manager's plugins
immediately after we know our list of plugins.

That plugin manager is then reused for the first screen we open
and the plugins are started at that time. Separate plugin managers
are loaded and started for any other screens we open.

(A plugin could keep track of whether the screen-independent
setup has been done in a static variable, or it could do everything
in a way that is safe to do repeatedly.)

https://bugzilla.gnome.org/show_bug.cgi?id=615586
This commit is contained in:
Owen W. Taylor
2010-04-12 17:42:46 -04:00
parent 95b260f3a9
commit b77b0a3d81
5 changed files with 80 additions and 12 deletions

View File

@ -586,7 +586,7 @@ main (int argc, char **argv)
* is initialized at this point, and we don't plan to run any real
* plugin code.
*/
MutterPluginManager *mgr = mutter_plugin_manager_new (NULL);
MutterPluginManager *mgr = mutter_plugin_manager_get_default ();
if (!mutter_plugin_manager_load (mgr))
g_critical ("failed to load plugins");
}

View File

@ -27,6 +27,7 @@
#include "prefs.h"
#include "ui.h"
#include "util.h"
#include "compositor/mutter-plugin-manager.h"
#ifdef HAVE_GCONF
#include <gconf/gconf-client.h>
#endif
@ -1043,6 +1044,7 @@ meta_prefs_init (void)
#ifdef HAVE_GCONF
GError *err = NULL;
gchar **gconf_dir_cursor;
MutterPluginManager *plugin_manager;
if (default_client != NULL)
return;
@ -1061,12 +1063,7 @@ meta_prefs_init (void)
cleanup_error (&err);
}
/* Pick up initial values. */
handle_preference_init_enum ();
handle_preference_init_bool ();
handle_preference_init_string ();
handle_preference_init_int ();
/* The plugin list is special and needs to be handled first */
if (!clutter_plugins_overridden)
clutter_plugins = gconf_client_get_list (default_client, KEY_CLUTTER_PLUGINS,
@ -1074,6 +1071,18 @@ meta_prefs_init (void)
cleanup_error (&err);
/* We now initialize plugins so that they can override any preference locations */
plugin_manager = mutter_plugin_manager_get_default ();
mutter_plugin_manager_load (plugin_manager);
/* Pick up initial values. */
handle_preference_init_enum ();
handle_preference_init_bool ();
handle_preference_init_string ();
handle_preference_init_int ();
/* @@@ Is there any reason we don't do the add_dir here? */
for (gconf_dir_cursor=gconf_dirs_we_are_interested_in;
*gconf_dir_cursor!=NULL;