X-Git-Url: https://git.dogcows.com/gitweb?a=blobdiff_plain;f=openbox%2Ftranslate.c;h=b9b2f2af5fc703b16ce4a21b5c3e14963ea7eb96;hb=f85a85541790a6095eb583ddb8684eece8dcc0c6;hp=9b4c1406e9af9ebb966e4ee798ce25153fb1faf9;hpb=c90da6da781932c2d178bfb7e39ec1d5003543b7;p=chaz%2Fopenbox diff --git a/openbox/translate.c b/openbox/translate.c index 9b4c1406..b9b2f2af 100644 --- a/openbox/translate.c +++ b/openbox/translate.c @@ -1,4 +1,4 @@ -#include "kernel/openbox.h" +#include "openbox.h" #include "mouse.h" #include #include @@ -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;