diff options
-rw-r--r-- | src/ChangeLog | 3 | ||||
-rw-r--r-- | src/actions.c | 21 |
2 files changed, 21 insertions, 3 deletions
diff --git a/src/ChangeLog b/src/ChangeLog index 2d2f7f4..9657610 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,5 +1,8 @@ 2001-03-07 Ryan Yeske <rcyeske@cut.hotdog.tmp> + * actions.c (string_to_keysym): New function. + (parse_keydesc): Call string_to_keysym. + * main.c (read_startup_files): Use PRINT_DEBUG to report failure to load rc files. diff --git a/src/actions.c b/src/actions.c index a78f894..e4480da 100644 --- a/src/actions.c +++ b/src/actions.c @@ -177,6 +177,21 @@ user_command user_commands[] = {"startup_message", cmd_unimplemented, arg_VOID}, {0, 0, 0} }; +/* return a KeySym from a string that contains either a hex value or + an X keysym description */ +static int string_to_keysym (char *str) +{ + int retval; + int keysym; + + retval = sscanf (str, "0x%x", &keysym); + + if (!retval || retval == EOF) + keysym = XStringToKeysym (str); + + return keysym; +} + struct rp_key* parse_keydesc (char *keydesc) { @@ -189,12 +204,12 @@ parse_keydesc (char *keydesc) if (keydesc[0] == '^') { p->state = ControlMask; - p->sym = XStringToKeysym (keydesc + 1); + p->sym = string_to_keysym (keydesc + 1); } - else + else { p->state = 0; - p->sym = XStringToKeysym (keydesc); + p->sym = string_to_keysym (keydesc); } if (!p->sym) |