new function. turn the compositing manager on or off as necessary.

2008-08-31  Thomas Thurman  <tthurman@gnome.org>

        * src/core/prefs.[ch] (meta_prefs_set_compositing_manager): new
          function.
        * src/core/main.c (meta_parse_options): turn the compositing
          manager on or off as necessary.


svn path=/trunk/; revision=3838
This commit is contained in:
Thomas Thurman 2008-08-31 22:55:18 +00:00 committed by Thomas James Alexander Thurman
parent 9c82331009
commit 5128bd4f28
4 changed files with 61 additions and 3 deletions

View File

@ -1,3 +1,10 @@
2008-08-31 Thomas Thurman <tthurman@gnome.org>
* src/core/prefs.[ch] (meta_prefs_set_compositing_manager): new
function.
* src/core/main.c (meta_parse_options): turn the compositing
manager on or off as necessary.
2008-08-30 Thomas Thurman <tthurman@gnome.org>
* src/core/window.c (process_property_notify): moving all

View File

@ -217,8 +217,17 @@ typedef struct
gboolean disable_sm;
gboolean print_version;
gboolean sync;
gboolean composite;
gboolean no_composite;
} MetaArguments;
#ifdef HAVE_COMPOSITE_EXTENSIONS
#define COMPOSITE_OPTS_FLAGS 0
#else /* HAVE_COMPOSITE_EXTENSIONS */
/* No compositor, so don't show the arguments in --help */
#define COMPOSITE_OPTS_FLAGS G_OPTION_FLAG_HIDDEN
#endif /* HAVE_COMPOSITE_EXTENSIONS */
/**
* Parses argc and argv and returns the
* arguments that Metacity understands in meta_args.
@ -235,7 +244,8 @@ static void
meta_parse_options (int *argc, char ***argv,
MetaArguments *meta_args)
{
MetaArguments my_args = {NULL, NULL, NULL, FALSE, FALSE, FALSE};
MetaArguments my_args = {NULL, NULL, NULL,
FALSE, FALSE, FALSE, FALSE, FALSE};
GOptionEntry options[] = {
{
"sm-disable", 0, 0, G_OPTION_ARG_NONE,
@ -256,7 +266,7 @@ meta_parse_options (int *argc, char ***argv,
"ID"
},
{
"display", 0, 0, G_OPTION_ARG_STRING,
"display", 'd', 0, G_OPTION_ARG_STRING,
&my_args.display_name, N_("X Display to use"),
"DISPLAY"
},
@ -278,6 +288,18 @@ meta_parse_options (int *argc, char ***argv,
N_("Make X calls synchronous"),
NULL
},
{
"composite", 'c', COMPOSITE_OPTS_FLAGS, G_OPTION_ARG_NONE,
&my_args.composite,
N_("Turn compositing on"),
NULL
},
{
"no-composite", 0, COMPOSITE_OPTS_FLAGS, G_OPTION_ARG_NONE,
&my_args.no_composite,
N_("Turn compositing off"),
NULL
},
{NULL}
};
GOptionContext *ctx;
@ -474,6 +496,9 @@ main (int argc, char **argv)
g_free (meta_args.display_name);
g_free (meta_args.client_id);
if (meta_args.composite || meta_args.no_composite)
meta_prefs_set_compositing_manager (meta_args.composite);
if (!meta_display_open ())
meta_exit (META_EXIT_ERROR);

View File

@ -49,6 +49,7 @@
*/
#define KEY_TITLEBAR_FONT "/apps/metacity/general/titlebar_font"
#define KEY_NUM_WORKSPACES "/apps/metacity/general/num_workspaces"
#define KEY_COMPOSITOR "/apps/metacity/general/compositing_manager"
#define KEY_GNOME_ACCESSIBILITY "/desktop/gnome/interface/accessibility"
#define KEY_COMMAND_PREFIX "/apps/metacity/keybinding_commands/command_"
@ -2944,6 +2945,24 @@ meta_prefs_get_compositing_manager (void)
return compositing_manager;
}
void
meta_prefs_set_compositing_manager (gboolean whether)
{
GError *err = NULL;
gconf_client_set_bool (default_client,
KEY_COMPOSITOR,
whether,
&err);
if (err)
{
meta_warning (_("Error setting compositor status: %s\n"),
err->message);
g_error_free (err);
}
}
#ifndef HAVE_GCONF
static void
init_button_layout(void)

View File

@ -113,6 +113,13 @@ const char* meta_prefs_get_cursor_theme (void);
int meta_prefs_get_cursor_size (void);
gboolean meta_prefs_get_compositing_manager (void);
/**
* Sets whether the compositor is turned on.
*
* \param whether TRUE to turn on, FALSE to turn off
*/
void meta_prefs_set_compositing_manager (gboolean whether);
/* Screen bindings */
#define META_KEYBINDING_WORKSPACE_1 "switch_to_workspace_1"
#define META_KEYBINDING_WORKSPACE_2 "switch_to_workspace_2"