applied Neil Klopfstein's patch, slightly modified

This commit is contained in:
anselm@garbe.us 2012-11-17 19:10:39 +01:00
parent 87adcd263b
commit 344f35f9f5

10
dwm.c
View File

@ -282,7 +282,7 @@ static void (*handler[LASTEvent]) (XEvent *) = {
[UnmapNotify] = unmapnotify [UnmapNotify] = unmapnotify
}; };
static Atom wmatom[WMLast], netatom[NetLast]; static Atom wmatom[WMLast], netatom[NetLast];
static Bool running = True; static Bool running = True, usexkb;
static Cursor cursor[CurLast]; static Cursor cursor[CurLast];
static Display *dpy; static Display *dpy;
static DC dc; static DC dc;
@ -1069,7 +1069,10 @@ keypress(XEvent *e) {
XKeyEvent *ev; XKeyEvent *ev;
ev = &e->xkey; ev = &e->xkey;
keysym = XkbKeycodeToKeysym(dpy, (KeyCode)ev->keycode, 0, 0); if(usexkb) {
keysym = XkbKeycodeToKeysym(dpy, (KeyCode)ev->keycode, 0, 0);
else
keysym = XKeycodeToKeysym(dpy, (KeyCode)ev->keycode, 0);
for(i = 0; i < LENGTH(keys); i++) for(i = 0; i < LENGTH(keys); i++)
if(keysym == keys[i].keysym if(keysym == keys[i].keysym
&& CLEANMASK(keys[i].mod) == CLEANMASK(ev->state) && CLEANMASK(keys[i].mod) == CLEANMASK(ev->state)
@ -1579,6 +1582,7 @@ setmfact(const Arg *arg) {
void void
setup(void) { setup(void) {
XSetWindowAttributes wa; XSetWindowAttributes wa;
int dummy = 0, xkbmajor = XkbMajorVersion, xkbminor = XkbMinorVersion;
/* clean up any zombies immediately */ /* clean up any zombies immediately */
sigchld(0); sigchld(0);
@ -1631,6 +1635,8 @@ setup(void) {
|EnterWindowMask|LeaveWindowMask|StructureNotifyMask|PropertyChangeMask; |EnterWindowMask|LeaveWindowMask|StructureNotifyMask|PropertyChangeMask;
XChangeWindowAttributes(dpy, root, CWEventMask|CWCursor, &wa); XChangeWindowAttributes(dpy, root, CWEventMask|CWCursor, &wa);
XSelectInput(dpy, root, wa.event_mask); XSelectInput(dpy, root, wa.event_mask);
/* init xkb */
usexkb = XkbQueryExtension(dpy, &dummy, &dummy, &dummy, &xkb_major, &xkb_minor);
grabkeys(); grabkeys();
} }