X-Git-Url: https://git.xinqibao.xyz/dwm.git/blobdiff_plain/4bd0d33f57c6fb764ef546a9b0ebfcd20ff1df70..8278f0a6befccfb4eb156cb312c69e032158734a:/event.c diff --git a/event.c b/event.c index 36d873f..53a110a 100644 --- a/event.c +++ b/event.c @@ -103,21 +103,25 @@ buttonpress(XEvent *e) if(barwin == ev->window) { switch(ev->button) { - default: + case Button1: x = 0; for(a.i = 0; a.i < ntags; a.i++) { x += textw(tags[a.i]); if(ev->x < x) { view(&a); - break; + return; } } + focusprev(NULL); + break; + case Button3: + focusnext(NULL); break; case Button4: - viewnext(&a); + viewprev(&a); break; case Button5: - viewprev(&a); + viewnext(&a); break; } } @@ -132,8 +136,7 @@ buttonpress(XEvent *e) movemouse(c); break; case Button2: - if(!c->ismax && arrange != dofloat && !c->isfloat) - zoom(NULL); + zoom(NULL); break; case Button3: if(!c->ismax && (arrange == dofloat || c->isfloat)) @@ -226,8 +229,11 @@ enternotify(XEvent *e) if((c = getclient(ev->window)) || (c = getctitle(ev->window))) focus(c); - else if(ev->window == root) + else if(ev->window == root) { issel = True; + XSetInputFocus(dpy, root, RevertToPointerRoot, CurrentTime); + drawall(); + } } static void @@ -267,8 +273,10 @@ leavenotify(XEvent *e) { XCrossingEvent *ev = &e->xcrossing; - if((ev->window == root) && !ev->same_screen) - issel = True; + if((ev->window == root) && !ev->same_screen) { + issel = False; + drawall(); + } } static void