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
This commit is contained in:
Rui Matos 2013-04-01 20:22:16 +02:00
parent 1f03f33230
commit 5b98213b04

View file

@ -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;
}