[wiki] [sites] dwm patches: added "keycode" patch || Quentin Rameau
commit ffa65b2c310cfbed24788d593dd915c931e3bb48
Author: Quentin Rameau <quinq_AT_quinq.eu.org>
Date: Sun Jan 26 22:24:04 2014 +0100
dwm patches: added "keycode" patch
diff --git a/dwm.suckless.org/patches/dwm-6.0-keycode.diff b/dwm.suckless.org/patches/dwm-6.0-keycode.diff
new file mode 100644
index 0000000..0a72214
--- /dev/null
+++ b/dwm.suckless.org/patches/dwm-6.0-keycode.diff
_AT_@ -0,0 +1,54 @@
+diff --git a/dwm.c b/dwm.c
+index 1bbb4b3..54ddf00 100644
+--- a/dwm.c
++++ b/dwm.c
+_AT_@ -31,7 +31,6 @@
+ #include <sys/types.h>
+ #include <sys/wait.h>
+ #include <X11/cursorfont.h>
+-#include <X11/keysym.h>
+ #include <X11/Xatom.h>
+ #include <X11/Xlib.h>
+ #include <X11/Xproto.h>
+_AT_@ -100,7 +99,7 @@ struct Client {
+
+ typedef struct {
+ unsigned int mod;
+- KeySym keysym;
++ KeyCode keycode;
+ void (*func)(const Arg *);
+ const Arg arg;
+ } Key;
+_AT_@ -945,14 +944,12 @@ grabkeys(void) {
+ {
+ unsigned int i, j;
+ unsigned int modifiers[] = { 0, LockMask, numlockmask, numlockmask|LockMask };
+- KeyCode code;
+
+ XUngrabKey(dpy, AnyKey, AnyModifier, root);
+ for(i = 0; i < LENGTH(keys); i++)
+- if((code = XKeysymToKeycode(dpy, keys[i].keysym)))
+- for(j = 0; j < LENGTH(modifiers); j++)
+- XGrabKey(dpy, code, keys[i].mod | modifiers[j], root,
+- True, GrabModeAsync, GrabModeAsync);
++ for(j = 0; j < LENGTH(modifiers); j++)
++ XGrabKey(dpy, keys[i].keycode, keys[i].mod | modifiers[j], root,
++ True, GrabModeAsync, GrabModeAsync);
+ }
+ }
+
+_AT_@ -976,13 +973,11 @@ isuniquegeom(XineramaScreenInfo *unique, size_t n, XineramaScreenInfo *info) {
+ void
+ keypress(XEvent *e) {
+ unsigned int i;
+- KeySym keysym;
+ XKeyEvent *ev;
+
+ ev = &e->xkey;
+- keysym = XKeycodeToKeysym(dpy, (KeyCode)ev->keycode, 0);
+ for(i = 0; i < LENGTH(keys); i++)
+- if(keysym == keys[i].keysym
++ if(ev->keycode == keys[i].keycode
+ && CLEANMASK(keys[i].mod) == CLEANMASK(ev->state)
+ && keys[i].func)
+ keys[i].func(&(keys[i].arg));
diff --git a/dwm.suckless.org/patches/keycode.md b/dwm.suckless.org/patches/keycode.md
new file mode 100644
index 0000000..41bcdbe
--- /dev/null
+++ b/dwm.suckless.org/patches/keycode.md
_AT_@ -0,0 +1,12 @@
+Keycode
+========
+With this patch, handling key input is done with keycodes instead of keysyms.
+This way, input is keyboard layout independant (adapt config.h to your keyboard using for exemple xev).
+
+Download
+--------
+* [dwm-6.0-keycode.diff](dwm-6.0-keycode.diff)
+
+Author
+------
+* Quentin Rameau <quinq_AT_quinq.eu.org>
Received on Sun Jan 26 2014 - 22:24:50 CET
This archive was generated by hypermail 2.3.0
: Thu Jun 18 2015 - 17:38:12 CEST