diff --git a/src/core/main.c b/src/core/main.c index 96c8580cc..b0ec284f7 100644 --- a/src/core/main.c +++ b/src/core/main.c @@ -220,6 +220,7 @@ typedef struct gchar *save_file; gchar *display_name; gchar *client_id; + gchar *mutter_plugins; gboolean replace_wm; gboolean disable_sm; gboolean print_version; @@ -251,7 +252,7 @@ static GOptionContext * meta_parse_options (int *argc, char ***argv, MetaArguments *meta_args) { - MetaArguments my_args = {NULL, NULL, NULL, + MetaArguments my_args = {NULL, NULL, NULL, NULL, FALSE, FALSE, FALSE, FALSE, FALSE}; GOptionEntry options[] = { { @@ -307,6 +308,14 @@ meta_parse_options (int *argc, char ***argv, N_("Turn compositing off"), NULL }, +#ifdef WITH_CLUTTER + { + "mutter-plugins", 0, 0, G_OPTION_ARG_STRING, + &my_args.mutter_plugins, + N_("Comma-separated list of compositor plugins"), + "PLUGINS" + }, +#endif {NULL} }; GOptionContext *ctx; @@ -547,6 +556,25 @@ main (int argc, char **argv) if (meta_args.composite || meta_args.no_composite) meta_prefs_set_compositing_manager (meta_args.composite); + if (meta_args.mutter_plugins) + { + char **plugins = g_strsplit (meta_args.mutter_plugins, ",", -1); + char **plugin; + GSList *plugins_list = NULL; + + for (plugin = plugins; *plugin; plugin++) + { + g_strstrip (*plugin); + plugins_list = g_slist_prepend (plugins_list, *plugin); + } + + plugins_list = g_slist_reverse (plugins_list); + meta_prefs_override_clutter_plugins (plugins_list); + + g_slist_free(plugins_list); + g_strfreev (plugins); + } + if (!meta_display_open ()) meta_exit (META_EXIT_ERROR); diff --git a/src/core/prefs.c b/src/core/prefs.c index 2fdc17292..6d8f24977 100644 --- a/src/core/prefs.c +++ b/src/core/prefs.c @@ -113,6 +113,7 @@ static char *workspace_names[MAX_REASONABLE_WORKSPACES] = { NULL, }; #ifdef WITH_CLUTTER static gboolean clutter_disabled = FALSE; +static gboolean clutter_plugins_overridden = FALSE; static GSList *clutter_plugins = NULL; #endif @@ -1044,8 +1045,9 @@ meta_prefs_init (void) handle_preference_init_int (); #ifdef WITH_CLUTTER - clutter_plugins = gconf_client_get_list (default_client, KEY_CLUTTER_PLUGINS, - GCONF_VALUE_STRING, &err); + if (!clutter_plugins_overridden) + clutter_plugins = gconf_client_get_list (default_client, KEY_CLUTTER_PLUGINS, + GCONF_VALUE_STRING, &err); cleanup_error (&err); #endif @@ -1233,7 +1235,7 @@ change_notify (GConfClient *client, queue_changed (META_PREF_WORKSPACE_NAMES); } #ifdef WITH_CLUTTER - else if (g_str_equal (key, KEY_CLUTTER_PLUGINS)) + else if (g_str_equal (key, KEY_CLUTTER_PLUGINS) && !clutter_plugins_overridden) { GError *err = NULL; GSList *l; @@ -2971,6 +2973,21 @@ meta_prefs_set_clutter_plugins (GSList *list) g_error_free (err); } } + +void +meta_prefs_override_clutter_plugins (GSList *list) +{ + GError *err = NULL; + GSList *l; + + clutter_plugins_overridden = TRUE; + clutter_plugins = NULL; + + for (l = list; l; l = l->next) + clutter_plugins = g_slist_prepend (clutter_plugins, g_strdup(l->data)); + + clutter_plugins = g_slist_reverse (clutter_plugins); +} #endif gboolean diff --git a/src/include/prefs.h b/src/include/prefs.h index 152477e3e..0a40469a6 100644 --- a/src/include/prefs.h +++ b/src/include/prefs.h @@ -133,11 +133,20 @@ void meta_prefs_set_clutter_disabled (gboolean whether); GSList * meta_prefs_get_clutter_plugins (void); /** - * Sets whether the compositor is turned on. + * Sets the list of plugins persistently in GConf * - * \param whether TRUE to turn on, FALSE to turn off + * \param list list of plugin:option pairs */ void meta_prefs_set_clutter_plugins (GSList *list); + +/** + * Sets the list of plugins temporarily for this process. The value + * from GConf will be ignored. + * + * \param list list of plugin:option pairs + */ +void meta_prefs_override_clutter_plugins (GSList *list); + #endif gboolean meta_prefs_get_live_hidden_windows (void);