[gnome-control-center] keyboard: Add the XKB option for the input source switch shortcut



commit 5b98213b04627f57c55d54b10f03351c9381ccc9
Author: Rui Matos <tiagomatos gmail com>
Date:   Mon Apr 1 20:22:16 2013 +0200

    keyboard: Add the XKB option for the input source switch shortcut
    
    Mutter now uses the "grp" XKB option to implement a special
    modifiers-only shortcut use by gnome-shell to switch input sources.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=700346

 panels/keyboard/cc-keyboard-option.c |   34 ++++++++++++++++++++++++++++++++++
 1 files changed, 34 insertions(+), 0 deletions(-)
---
diff --git a/panels/keyboard/cc-keyboard-option.c b/panels/keyboard/cc-keyboard-option.c
index 33cb415..7a94f66 100644
--- a/panels/keyboard/cc-keyboard-option.c
+++ b/panels/keyboard/cc-keyboard-option.c
@@ -39,6 +39,7 @@
 
 #define XKB_OPTION_GROUP_LVL3 "lv3"
 #define XKB_OPTION_GROUP_COMP "Compose key"
+#define XKB_OPTION_GROUP_GRP  "grp"
 
 enum
 {
@@ -97,6 +98,32 @@ static const gchar *xkb_option_comp_whitelist[] = {
   NULL
 };
 
+/* This list must be kept in sync with what mutter is able to
+ * handle. */
+static const gchar *xkb_option_grp_whitelist[] = {
+  "grp:toggle",
+  "grp:lalt_toggle",
+  "grp:lwin_toggle",
+  "grp:rwin_toggle",
+  "grp:lshift_toggle",
+  "grp:rshift_toggle",
+  "grp:lctrl_toggle",
+  "grp:rctrl_toggle",
+  "grp:sclk_toggle",
+  "grp:menu_toggle",
+  "grp:caps_toggle",
+  "grp:shift_caps_toggle",
+  "grp:alt_caps_toggle",
+  "grp:alt_space_toggle",
+  "grp:ctrl_shift_toggle",
+  "grp:lctrl_lshift_toggle",
+  "grp:rctrl_rshift_toggle",
+  "grp:ctrl_alt_toggle",
+  "grp:alt_shift_toggle",
+  "grp:lalt_lshift_toggle",
+  NULL
+};
+
 static GList *objects_list = NULL;
 
 GType cc_keyboard_option_get_type (void);
@@ -233,6 +260,8 @@ cc_keyboard_option_constructed (GObject *object)
     self->whitelist = xkb_option_lvl3_whitelist;
   else if (g_str_equal (self->group, XKB_OPTION_GROUP_COMP))
     self->whitelist = xkb_option_comp_whitelist;
+  else if (g_str_equal (self->group, XKB_OPTION_GROUP_GRP))
+    self->whitelist = xkb_option_grp_whitelist;
   else
     g_assert_not_reached ();
 
@@ -328,6 +357,11 @@ cc_keyboard_option_get_all (void)
                                                */
                                                "description", _("Compose Key"),
                                                NULL));
+  objects_list = g_list_prepend (objects_list,
+                                 g_object_new (CC_TYPE_KEYBOARD_OPTION,
+                                               "group", XKB_OPTION_GROUP_GRP,
+                                               "description", _("Modifiers-only switch to next source"),
+                                               NULL));
   return objects_list;
 }
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]