Allow the user to bind more than one keycode to a keysym for Ob Menus/Move/Resize
[mikachu/openbox.git] / openbox / modkeys.c
index c52cbef..e897ccb 100644 (file)
@@ -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;
 }