summaryrefslogtreecommitdiff
path: root/src/actions.c
diff options
context:
space:
mode:
authorrcyeske <rcyeske>2001-03-08 02:32:39 +0000
committerrcyeske <rcyeske>2001-03-08 02:32:39 +0000
commitec98560f785194f3055e4ea4e6ea0743f0cafdc2 (patch)
treefffc77a55e0b3db8032530eaf77178ed54662d9f /src/actions.c
parentff25f8d4eb5a4e623576d031d3a74d495079245d (diff)
downloadratpoison-ec98560f785194f3055e4ea4e6ea0743f0cafdc2.zip
(string_to_keysym): New function.
(parse_keydesc): Call string_to_keysym.
Diffstat (limited to 'src/actions.c')
-rw-r--r--src/actions.c21
1 files changed, 18 insertions, 3 deletions
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)