diff options
| author | Dana Jansens <danakj@orodu.net> | 2009-12-14 15:40:09 -0500 |
|---|---|---|
| committer | Dana Jansens <danakj@orodu.net> | 2009-12-14 15:40:33 -0500 |
| commit | d55f4b41c6ebf00e36a5e91ddc962a753f6c9ef8 (patch) | |
| tree | 3197682bebb144eb27c1f45c110cfec0e4005903 /openbox/openbox.c | |
| parent | f3e553446fdcfc04f26ea25396a138965c4a999d (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/openbox.c')
| -rw-r--r-- | openbox/openbox.c | 21 |
1 files changed, 18 insertions, 3 deletions
diff --git a/openbox/openbox.c b/openbox/openbox.c index 60e147c3..0e339782 100644 --- a/openbox/openbox.c +++ b/openbox/openbox.c @@ -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; @@ -417,6 +417,17 @@ 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]); + modkeys_shutdown(reconfigure); } while (reconfigure); } @@ -732,10 +743,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() |
