summaryrefslogtreecommitdiff
path: root/src/ui
diff options
context:
space:
mode:
authorSam Spilsbury <smspillaz@gmail.com>2011-01-13 11:10:05 +0800
committerSam Spilsbury <smspillaz@gmail.com>2011-01-13 11:10:05 +0800
commita8fd894b132f6e7a6dffa1fc3d3839ddf4a8d73b (patch)
tree2afcfe5a800fc6c70849367f8492fe1ae085d0e2 /src/ui
parent5b8a93dcfd719eb1d084a6bb629cb41c7f65e5b2 (diff)
parente6964750909bbe8a5c5ca217f1acee2405a566b5 (diff)
downloadmetacity-a8fd894b132f6e7a6dffa1fc3d3839ddf4a8d73b.tar.gz
metacity-a8fd894b132f6e7a6dffa1fc3d3839ddf4a8d73b.tar.bz2
Merge branch 'master' of git://git.gnome.org/metacity
Diffstat (limited to 'src/ui')
-rwxr-xr-xsrc/ui/ui.c40
1 files changed, 38 insertions, 2 deletions
diff --git a/src/ui/ui.c b/src/ui/ui.c
index 960e702..5ef4f52 100755
--- a/src/ui/ui.c
+++ b/src/ui/ui.c
@@ -896,14 +896,50 @@ meta_ui_accelerator_parse (const char *accel,
guint *keycode,
GdkModifierType *keymask)
{
+ const char *above_tab;
+
if (accel[0] == '0' && accel[1] == 'x')
{
*keysym = 0;
*keycode = (guint) strtoul (accel, NULL, 16);
*keymask = 0;
+
+ return;
}
- else
- gtk_accelerator_parse (accel, keysym, keymask);
+
+ /* The key name 'Above_Tab' is special - it's not an actual keysym name,
+ * but rather refers to the key above the tab key. In order to use
+ * the GDK parsing for modifiers in combination with it, we substitute
+ * it with 'Tab' temporarily before calling gtk_accelerator_parse().
+ */
+#define is_word_character(c) (g_ascii_isalnum(c) || ((c) == '_'))
+#define ABOVE_TAB "Above_Tab"
+#define ABOVE_TAB_LEN 9
+
+ above_tab = strstr (accel, ABOVE_TAB);
+ if (above_tab &&
+ (above_tab == accel || !is_word_character (above_tab[-1])) &&
+ !is_word_character (above_tab[ABOVE_TAB_LEN]))
+ {
+ char *before = g_strndup (accel, above_tab - accel);
+ char *after = g_strdup (above_tab + ABOVE_TAB_LEN);
+ char *replaced = g_strconcat (before, "Tab", after, NULL);
+
+ gtk_accelerator_parse (replaced, NULL, keymask);
+
+ g_free (before);
+ g_free (after);
+ g_free (replaced);
+
+ *keysym = META_KEY_ABOVE_TAB;
+ return;
+ }
+
+#undef is_word_character
+#undef ABOVE_TAB
+#undef ABOVE_TAB_LEN
+
+ gtk_accelerator_parse (accel, keysym, keymask);
}
gboolean