summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorrcyeske <rcyeske>2001-02-24 21:46:48 +0000
committerrcyeske <rcyeske>2001-02-24 21:46:48 +0000
commitd0da7f4c96c1bda168b176257b6e06800e943f7d (patch)
treee78542d4b72aedcf6d601bed6f553bd7d23236b5 /src
parentee0dedbfbf28b084c507891e37c28fede2b61644 (diff)
downloadratpoison-d0da7f4c96c1bda168b176257b6e06800e943f7d.zip
fix key rebinding
Diffstat (limited to 'src')
-rw-r--r--src/ChangeLog9
-rw-r--r--src/actions.c27
2 files changed, 29 insertions, 7 deletions
diff --git a/src/ChangeLog b/src/ChangeLog
index 42bdb3a..d3a5e5a 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,3 +1,12 @@
+2001-02-24 Ryan Yeske <rcyeske@cut.hotdog.tmp>
+
+ * conf.h: remove themes support
+
+ * themes.h: remove file
+
+ * actions.c (replace_keybinding): add function
+ (cmd_bind): handle binding of previously bound key
+
2001-02-23 shawn <sabetts@diggin.lamenet.tmp>
* main.c (main): passes return value of find_window_other() to
diff --git a/src/actions.c b/src/actions.c
index a132abc..0d8f2b7 100644
--- a/src/actions.c
+++ b/src/actions.c
@@ -70,6 +70,15 @@ add_keybinding (int keysym, int state, char *cmd)
++key_actions_last;
}
+static void
+replace_keybinding (rp_action *key_action, char *newcmd)
+{
+ if (strlen (key_action->data) < strlen (newcmd))
+ key_action->data = (char*) realloc (key_action->data, strlen (newcmd) + 1);
+
+ strcpy (key_action->data, newcmd);
+}
+
void
initialize_default_keybindings (void)
{
@@ -221,19 +230,23 @@ cmd_bind (void *data)
message (" FIXME: cmd_bind: need a command to bind to key ");
else
{
- char foo[1000];
-
struct key *key = parse_keydesc (keydesc);
-
+
if (key)
{
+ rp_action *key_action;
+ char foo[1000];
+
sprintf (foo, " %ld %ld : '%s' ", key->state, key->sym, cmd);
- add_keybinding (key->sym, key->state, cmd);
+ message (foo);
+
+ if ((key_action = find_keybinding (key->sym, key->state)))
+ replace_keybinding (key_action, cmd);
+ else
+ add_keybinding (key->sym, key->state, cmd);
}
else
- sprintf (foo, " FIXME: cmd_bind: couldnt parse key ");
-
- message (foo);
+ message (" FIXME: cmd_bind: couldnt parse key ");
}
}