summaryrefslogtreecommitdiff
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
parentff25f8d4eb5a4e623576d031d3a74d495079245d (diff)
downloadratpoison-ec98560f785194f3055e4ea4e6ea0743f0cafdc2.zip
(string_to_keysym): New function.
(parse_keydesc): Call string_to_keysym.
-rw-r--r--src/ChangeLog3
-rw-r--r--src/actions.c21
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)