summaryrefslogtreecommitdiff
path: root/src/events.c
diff options
context:
space:
mode:
authorrcyeske <rcyeske>2001-02-20 03:30:28 +0000
committerrcyeske <rcyeske>2001-02-20 03:30:28 +0000
commitb04b541a3aaab9e5f0d36b88f97720f9c78a538f (patch)
tree57f7de7a40cf5504c0ed4b2396eff04689e52733 /src/events.c
parentd1676f8fd215f735623cea1c1d707a346e9b6390 (diff)
downloadratpoison-b04b541a3aaab9e5f0d36b88f97720f9c78a538f.zip
removed key_actions table, replaced with set of functions
Diffstat (limited to 'src/events.c')
-rw-r--r--src/events.c47
1 files changed, 20 insertions, 27 deletions
diff --git a/src/events.c b/src/events.c
index 6300086..5cbc08a 100644
--- a/src/events.c
+++ b/src/events.c
@@ -287,7 +287,7 @@ handle_key (screen_info *s)
{
char *keysym_name;
char *msg;
- const rp_action *i;
+ char *cmd;
int revert;
Window fwin; /* Window currently in focus */
KeySym keysym; /* Key pressed */
@@ -304,38 +304,31 @@ handle_key (screen_info *s)
read_key (&keysym, &mod);
- for (i = key_actions; i->key != 0; i++)
+ if ((cmd = find_keybinding (keysym, mod)))
{
- if (keysym == i->key)
- {
- if (mod == i->state)
- {
- /* Revert focus back to the current window before
- executing the command. */
- XSetInputFocus (dpy, fwin, revert, CurrentTime);
- (*i->func)(i->data);
- return;
- }
- }
+ XSetInputFocus (dpy, fwin, revert, CurrentTime);
+ command (cmd);
}
-
- keysym_name = keysym_to_string (keysym, mod);
- msg = (char *) malloc ( strlen ( keysym_name ) + 20 );
- if ( msg == NULL )
+ else
{
- PRINT_ERROR ("Out of memory\n");
- exit (EXIT_FAILURE);
- }
- snprintf (msg, strlen (keysym_name) + 13, "%s unbound key!", keysym_name);
- free (keysym_name);
+ keysym_name = keysym_to_string (keysym, mod);
+ msg = (char *) malloc ( strlen ( keysym_name ) + 20 );
+ if ( msg == NULL )
+ {
+ PRINT_ERROR ("Out of memory\n");
+ exit (EXIT_FAILURE);
+ }
+ snprintf (msg, strlen (keysym_name) + 13, "%s unbound key!", keysym_name);
+ free (keysym_name);
- PRINT_DEBUG ("%s\n", msg);
+ PRINT_DEBUG ("%s\n", msg);
- /* No key match, notify user. */
- XSetInputFocus (dpy, fwin, revert, CurrentTime);
- message (msg);
+ /* No key match, notify user. */
+ XSetInputFocus (dpy, fwin, revert, CurrentTime);
+ message (msg);
- free (msg);
+ free (msg);
+ }
}
void