summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDana Jansens <danakj@orodu.net>2003-09-17 02:37:52 +0000
committerDana Jansens <danakj@orodu.net>2003-09-17 02:37:52 +0000
commitdbd3e9b6b2b452e853a17352560b5a4b4c568e84 (patch)
tree78121646550e35a3b72fe21ddce0f05b8d613db7
parentb288fdee411495fba48465c1af3eea4002e93241 (diff)
allow the use of keycodes directly in key bindings
-rw-r--r--openbox/translate.c23
1 files changed, 17 insertions, 6 deletions
diff --git a/openbox/translate.c b/openbox/translate.c
index 2903bf3c..b9b2f2af 100644
--- a/openbox/translate.c
+++ b/openbox/translate.c
@@ -89,13 +89,24 @@ gboolean translate_key(char *str, guint *state, guint *keycode)
*state |= m;
}
- /* figure out the keycode */
- sym = XStringToKeysym(l);
- if (sym == NoSymbol) {
- g_warning("Invalid key name '%s' in key binding.", l);
- goto translation_fail;
+ if (!g_ascii_strncasecmp("0x", l, 2)) {
+ gchar *end;
+
+ /* take it directly */
+ *keycode = strtol(l, &end, 16);
+ if (*l == '\0' || *end != '\0') {
+ g_warning("Invalid key code '%s' in key binding.", l);
+ goto translation_fail;
+ }
+ } else {
+ /* figure out the keycode */
+ sym = XStringToKeysym(l);
+ if (sym == NoSymbol) {
+ g_warning("Invalid key name '%s' in key binding.", l);
+ goto translation_fail;
+ }
+ *keycode = XKeysymToKeycode(ob_display, sym);
}
- *keycode = XKeysymToKeycode(ob_display, sym);
if (!*keycode) {
g_warning("Key '%s' does not exist on the display.", l);
goto translation_fail;