X-Git-Url: https://jasonwoof.com/gitweb/?a=blobdiff_plain;f=event.c;h=e452167460a59d7c1034bac80a705725e784b1d1;hb=292ccc4c43d9529cb6db0973fcab6e24c73607a5;hp=c3169aa7001c3434f214028d6371c38985f048c4;hpb=92e55c7c53cb808b584982ac8f6d69112d713fab;p=dwm.git diff --git a/event.c b/event.c index c3169aa..e452167 100644 --- a/event.c +++ b/event.c @@ -108,56 +108,48 @@ buttonpress(XEvent *e) for(a.i = 0; a.i < ntags; a.i++) { x += textw(tags[a.i]); if(ev->x < x) { - view(&a); - break; + if(ev->button == Button3) + viewextend(&a); + else + view(&a); + return; } } + if(ev->button == Button1) + viewprev(&a); + else if(ev->button == Button3) + viewnext(&a); break; case Button4: - viewnext(&a); + viewprev(&a); break; case Button5: - viewprev(&a); + viewnext(&a); break; } } else if((c = getclient(ev->window))) { + higher(c); focus(c); switch(ev->button) { default: break; case Button1: - if(!c->ismax && (arrange == dofloat || c->isfloat)) { - higher(c); + if(!c->ismax && (arrange == dofloat || c->isfloat)) movemouse(c); - } break; case Button2: - lower(c); + zoom(NULL); break; case Button3: - if(!c->ismax && (arrange == dofloat || c->isfloat)) { - higher(c); + if(!c->ismax && (arrange == dofloat || c->isfloat)) resizemouse(c); - } break; } } } static void -clientmessage(XEvent *e) -{ - Client *c; - XClientMessageEvent *ev = &e->xclient; - - if(ev->message_type == netatom[NetActiveWindow]) { - if((c = getclient(ev->window)) && c->tags[tsel]) - focus(c); - } -} - -static void configurerequest(XEvent *e) { Client *c; @@ -235,13 +227,16 @@ enternotify(XEvent *e) Client *c; XCrossingEvent *ev = &e->xcrossing; - if(ev->detail == NotifyInferior) + if(ev->mode != NotifyNormal || ev->detail == NotifyInferior) return; 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 @@ -281,8 +276,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 @@ -351,7 +348,6 @@ unmapnotify(XEvent *e) void (*handler[LASTEvent]) (XEvent *) = { [ButtonPress] = buttonpress, - [ClientMessage] = clientmessage, [ConfigureRequest] = configurerequest, [DestroyNotify] = destroynotify, [EnterNotify] = enternotify,