[mutter] display: Add API to set wm_name / wm_keybindings
- From: Florian MÃllner <fmuellner src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [mutter] display: Add API to set wm_name / wm_keybindings
- Date: Tue, 18 Sep 2012 10:54:01 +0000 (UTC)
commit 0593df8fe04e96cb619f271c95ba2b8d22df0e09
Author: Florian MÃllner <fmuellner gnome org>
Date: Thu Oct 20 16:22:35 2011 +0200
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
src/core/display.c | 42 ++++++++++++++++++++++++++++++++++++++----
src/meta/main.h | 3 +++
2 files changed, 41 insertions(+), 4 deletions(-)
---
diff --git a/src/core/display.c b/src/core/display.c
index 661480e..f62fad1 100644
--- a/src/core/display.c
+++ b/src/core/display.c
@@ -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);
@@ -410,6 +416,36 @@ meta_display_init (MetaDisplay *disp)
}
/**
+ * 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:
*
* Opens a new display, sets it up, initialises all the X extensions
@@ -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,
diff --git a/src/meta/main.h b/src/meta/main.h
index f1aab67..1382678 100644
--- a/src/meta/main.h
+++ b/src/meta/main.h
@@ -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,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]