display: Add API to set wm_name / wm_keybindings

As plugins can now define their own keyboard shortcuts via
meta_display_add_keybinding(), it makes sense for them to
expose those shortcuts to System Settings, so add some API
to set the properties gnome-control-center uses to pick up
wm keybinding settings.

https://bugzilla.gnome.org/show_bug.cgi?id=671010
This commit is contained in:
Florian Müllner 2011-10-20 16:22:35 +02:00
parent 29b3e69dfa
commit 0593df8fe0
2 changed files with 41 additions and 4 deletions

View File

@ -153,6 +153,12 @@ static guint display_signals [LAST_SIGNAL] = { 0 };
*/
static MetaDisplay *the_display = NULL;
/* By default, the GNOME keybindings capplet should include both the Mutter
* and Metacity keybindings */
static const char *gnome_wm_keybindings = "Mutter,Metacity";
static const char *net_wm_name = "Mutter";
#ifdef WITH_VERBOSE_MODE
static void meta_spew_event (MetaDisplay *display,
XEvent *event);
@ -409,6 +415,36 @@ meta_display_init (MetaDisplay *disp)
* but it doesn't really matter. */
}
/**
* meta_set_wm_name: (skip)
* @wm_name: value for _NET_WM_NAME
*
* Set the value to use for the _NET_WM_NAME property. To take effect,
* it is necessary to call this function before meta_init().
*/
void
meta_set_wm_name (const char *wm_name)
{
g_return_if_fail (the_display == NULL);
net_wm_name = wm_name;
}
/**
* meta_set_gnome_wm_keybindings: (skip)
* @wm_keybindings: value for _GNOME_WM_KEYBINDINGS
*
* Set the value to use for the _GNOME_WM_KEYBINDINGS property. To take
* effect, it is necessary to call this function before meta_init().
*/
void
meta_set_gnome_wm_keybindings (const char *wm_keybindings)
{
g_return_if_fail (the_display == NULL);
gnome_wm_keybindings = wm_keybindings;
}
/**
* meta_display_open:
*
@ -762,14 +798,12 @@ meta_display_open (void)
meta_prop_set_utf8_string_hint (the_display,
the_display->leader_window,
the_display->atom__NET_WM_NAME,
"Mutter");
net_wm_name);
/* The GNOME keybindings capplet should include both the Mutter and Metacity
* keybindings */
meta_prop_set_utf8_string_hint (the_display,
the_display->leader_window,
the_display->atom__GNOME_WM_KEYBINDINGS,
"Mutter,Metacity");
gnome_wm_keybindings);
meta_prop_set_utf8_string_hint (the_display,
the_display->leader_window,

View File

@ -31,6 +31,9 @@ void meta_init (void);
int meta_run (void);
gboolean meta_get_replace_current_wm (void); /* Actually defined in util.c */
void meta_set_wm_name (const char *wm_name);
void meta_set_gnome_wm_keybindings (const char *wm_keybindings);
typedef enum
{
META_EXIT_SUCCESS,