]> Dogcows Code - chaz/openbox/blobdiff - openbox/openbox.c
make Home and End keys navigate to top/bottom of the active menu
[chaz/openbox] / openbox / openbox.c
index 60e147c357eeee55a304a0db3f81905e45049184..415c16040028eb2f0476b2b0063080725d81bc13 100644 (file)
@@ -104,7 +104,7 @@ static gboolean  reconfigure = FALSE;
 static gboolean  restart = FALSE;
 static gchar    *restart_path = NULL;
 static Cursor    cursors[OB_NUM_CURSORS];
-static KeyCode   keys[OB_NUM_KEYS];
+static KeyCode  *keys[OB_NUM_KEYS];
 static gint      exitcode = 0;
 static guint     remote_control = 0;
 static gboolean  being_replaced = FALSE;
@@ -239,6 +239,8 @@ gint main(gint argc, gchar **argv)
             keys[OB_KEY_DOWN] = modkeys_sym_to_code(XK_Down);
             keys[OB_KEY_TAB] = modkeys_sym_to_code(XK_Tab);
             keys[OB_KEY_SPACE] = modkeys_sym_to_code(XK_space);
+            keys[OB_KEY_HOME] = modkeys_sym_to_code(XK_Home);
+            keys[OB_KEY_END] = modkeys_sym_to_code(XK_End);
 
             {
                 ObParseInst *i;
@@ -417,6 +419,19 @@ gint main(gint argc, gchar **argv)
             event_shutdown(reconfigure);
             config_shutdown();
             actions_shutdown(reconfigure);
+
+            /* Free the key codes for built in keys */
+            g_free(keys[OB_KEY_RETURN]);
+            g_free(keys[OB_KEY_ESCAPE]);
+            g_free(keys[OB_KEY_LEFT]);
+            g_free(keys[OB_KEY_RIGHT]);
+            g_free(keys[OB_KEY_UP]);
+            g_free(keys[OB_KEY_DOWN]);
+            g_free(keys[OB_KEY_TAB]);
+            g_free(keys[OB_KEY_SPACE]);
+            g_free(keys[OB_KEY_HOME]);
+            g_free(keys[OB_KEY_END]);
+
             modkeys_shutdown(reconfigure);
         } while (reconfigure);
     }
@@ -732,10 +747,14 @@ Cursor ob_cursor(ObCursor cursor)
     return cursors[cursor];
 }
 
-KeyCode ob_keycode(ObKey key)
+gboolean ob_keycode_match(KeyCode code, ObKey key)
 {
+    KeyCode *k;
+    
     g_assert(key < OB_NUM_KEYS);
-    return keys[key];
+    for (k = keys[key]; *k; ++k)
+        if (*k == code) return TRUE;
+    return FALSE;
 }
 
 ObState ob_state()
This page took 0.024939 seconds and 4 git commands to generate.