summaryrefslogtreecommitdiff
path: root/openbox/modkeys.c
diff options
context:
space:
mode:
authorDana Jansens <danakj@orodu.net>2009-12-14 15:40:09 -0500
committerDana Jansens <danakj@orodu.net>2009-12-14 15:40:33 -0500
commitd55f4b41c6ebf00e36a5e91ddc962a753f6c9ef8 (patch)
tree3197682bebb144eb27c1f45c110cfec0e4005903 /openbox/modkeys.c
parentf3e553446fdcfc04f26ea25396a138965c4a999d (diff)
Allow the user to bind more than one keycode to a keysym for Ob Menus/Move/Resize
If the user has escape bound to more than one keycode then they can use any of them to close a menu. This change applies to the hardcoded keys in openbox, which are used for the menus and for move/resize, and maybe other places.
Diffstat (limited to 'openbox/modkeys.c')
-rw-r--r--openbox/modkeys.c18
1 files changed, 13 insertions, 5 deletions
diff --git a/openbox/modkeys.c b/openbox/modkeys.c
index c52cbef1..e897ccb3 100644
--- a/openbox/modkeys.c
+++ b/openbox/modkeys.c
@@ -176,14 +176,22 @@ static void set_modkey_mask(guchar mask, KeySym sym)
/* CapsLock, Shift, and Control are special and hard-coded */
}
-KeyCode modkeys_sym_to_code(KeySym sym)
+KeyCode* modkeys_sym_to_code(KeySym sym)
{
- gint i, j;
+ KeyCode *ret;
+ gint i, j, n;
+
+ ret = g_new(KeyCode, 1);
+ n = 0;
+ ret[n] = 0;
/* go through each keycode and look for the keysym */
for (i = min_keycode; i <= max_keycode; ++i)
for (j = 0; j < keysyms_per_keycode; ++j)
- if (sym == keymap[(i-min_keycode) * keysyms_per_keycode + j])
- return i;
- return 0;
+ if (sym == keymap[(i-min_keycode) * keysyms_per_keycode + j]) {
+ ret = g_renew(KeyCode, ret, ++n);
+ ret[n-1] = i;
+ ret[n] = 0;
+ }
+ return ret;
}