Skip to content

Instantly share code, notes, and snippets.

@mrvdb
Created May 16, 2012 06:58
Show Gist options
  • Save mrvdb/2708186 to your computer and use it in GitHub Desktop.
Save mrvdb/2708186 to your computer and use it in GitHub Desktop.
Index: evrouter.c
===================================================================
--- evrouter.c (revision 15)
+++ evrouter.c (working copy)
@@ -78,6 +78,7 @@
#include <X11/Xutil.h>
#include <X11/keysym.h>
#include <X11/extensions/XTest.h>
+#include <X11/XKBlib.h>
#include "evdev.h"
#include "x11.h"
@@ -143,7 +144,7 @@
j,i,
xmk->modifiermap[(j*xmk->max_keypermod)+i],
xmk->modifiermap[(j*xmk->max_keypermod)+i],
- XKeysymToString(XKeycodeToKeysym(d,xmk->modifiermap[(j*xmk->max_keypermod)+i],0)));
+ XKeysymToString(XkbKeycodeToKeysym(d,xmk->modifiermap[(j*xmk->max_keypermod)+i],0,0)));
}
#define getbit(buf,n) (buf [(n) >> 3] & (1 << ((n) & 7)))
@@ -326,6 +327,11 @@
(r->anymods == 0) &&
(r->mods != (mods = get_modifier_state (d)))) continue;
+ /* Match modifiers on a rel event, thus supporting another degree of freedom */
+ if ((ev->type == EV_REL) && (r->type == evt_rel) &&
+ (r->arg1 == ev->code) && (r->arg2 == ev->value) &&
+ (r->mods != (mods = get_modifier_state (d)))) continue;
+
/* Perform the action */
perform_action (ev, r, mods);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment