X-Git-Url: https://jasonwoof.com/gitweb/?a=blobdiff_plain;ds=sidebyside;f=event.c;h=bc7d42c2a452097cf6e741c9e376374766af23d7;hb=4cb78a170c6daa488a90dffb60224fcf2b76fbf0;hp=36d873f983907a3d7b28590ca889d09acd5bbea3;hpb=4bd0d33f57c6fb764ef546a9b0ebfcd20ff1df70;p=dwm.git diff --git a/event.c b/event.c index 36d873f..bc7d42c 100644 --- a/event.c +++ b/event.c @@ -102,23 +102,16 @@ buttonpress(XEvent *e) XButtonPressedEvent *ev = &e->xbutton; if(barwin == ev->window) { - switch(ev->button) { - default: - x = 0; - for(a.i = 0; a.i < ntags; a.i++) { - x += textw(tags[a.i]); - if(ev->x < x) { + x = 0; + 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 view(&a); - break; - } + return; } - break; - case Button4: - viewnext(&a); - break; - case Button5: - viewprev(&a); - break; } } else if((c = getclient(ev->window))) { @@ -132,8 +125,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 +218,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 +262,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