sites

public wiki contents of suckless.org
git clone git://git.suckless.org/sites
Log | Files | Refs

commit ffa65b2c310cfbed24788d593dd915c931e3bb48
parent 3b39a9b574bb804396b4e975ebcac529bcbe454d
Author: Quentin Rameau <quinq@quinq.eu.org>
Date:   Sun, 26 Jan 2014 22:24:04 +0100

dwm patches: added "keycode" patch

Diffstat:
Adwm.suckless.org/patches/dwm-6.0-keycode.diff | 54++++++++++++++++++++++++++++++++++++++++++++++++++++++
Adwm.suckless.org/patches/keycode.md | 12++++++++++++
2 files changed, 66 insertions(+), 0 deletions(-)

diff --git a/dwm.suckless.org/patches/dwm-6.0-keycode.diff b/dwm.suckless.org/patches/dwm-6.0-keycode.diff @@ -0,0 +1,54 @@ +diff --git a/dwm.c b/dwm.c +index 1bbb4b3..54ddf00 100644 +--- a/dwm.c ++++ b/dwm.c +@@ -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> +@@ -100,7 +99,7 @@ struct Client { + + typedef struct { + unsigned int mod; +- KeySym keysym; ++ KeyCode keycode; + void (*func)(const Arg *); + const Arg arg; + } Key; +@@ -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); + } + } + +@@ -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 @@ -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@quinq.eu.org>