X-Git-Url: https://jasonwoof.com/gitweb/?a=blobdiff_plain;f=event.c;h=187c65e63492d66a83f9a130325666ef9e205a4b;hb=442334641e4124d8c32387287d431a83761ff916;hp=1e077fab769cf673ee51250579f3ead520e01d88;hpb=9eef9f7b0277a893fb5e22ac109f785faf573580;p=dwm.git diff --git a/event.c b/event.c index 1e077fa..187c65e 100644 --- a/event.c +++ b/event.c @@ -109,10 +109,10 @@ buttonpress(XEvent *e) for(a.i = 0; a.i < ntags; a.i++) { x += textw(tags[a.i]); if(ev->x < x) { - if(ev->button == Button3) - toggleview(&a); - else + if(ev->button == Button1) view(&a); + else if(ev->button == Button3) + toggleview(&a); return; } } @@ -144,11 +144,11 @@ buttonpress(XEvent *e) static void configurerequest(XEvent *e) { + unsigned long newmask; Client *c; XConfigureRequestEvent *ev = &e->xconfigurerequest; XEvent synev; XWindowChanges wc; - unsigned long newmask; if((c = getclient(ev->window))) { gravitate(c, True); @@ -277,6 +277,16 @@ leavenotify(XEvent *e) } static void +mappingnotify(XEvent *e) +{ + XMappingEvent *ev = &e->xmapping; + + XRefreshKeyboardMapping(ev); + if(ev->request == MappingKeyboard) + grabkeys(); +} + +static void maprequest(XEvent *e) { static XWindowAttributes wa; @@ -348,6 +358,7 @@ void (*handler[LASTEvent]) (XEvent *) = { [LeaveNotify] = leavenotify, [Expose] = expose, [KeyPress] = keypress, + [MappingNotify] = mappingnotify, [MapRequest] = maprequest, [PropertyNotify] = propertynotify, [UnmapNotify] = unmapnotify @@ -360,6 +371,7 @@ grabkeys() unsigned int i; KeyCode code; + XUngrabKey(dpy, AnyKey, AnyModifier, root); for(i = 0; i < len; i++) { code = XKeysymToKeycode(dpy, key[i].keysym); XGrabKey(dpy, code, key[i].mod, root, True, @@ -370,6 +382,5 @@ grabkeys() GrabModeAsync, GrabModeAsync); XGrabKey(dpy, code, key[i].mod | NUMLOCKMASK | LockMask, root, True, GrabModeAsync, GrabModeAsync); - XSync(dpy, False); } }