From d55f4b41c6ebf00e36a5e91ddc962a753f6c9ef8 Mon Sep 17 00:00:00 2001 From: Dana Jansens Date: Mon, 14 Dec 2009 15:40:09 -0500 Subject: 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. --- openbox/modkeys.c | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) (limited to 'openbox/modkeys.c') 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; } -- cgit v1.2.3