JasonWoof Got questions, comments, patches, etc.? Contact Jason Woofenden
implemented viewextend and added M-S-C-n shortcuts for extending the current view...
[dwm.git] / event.c
diff --git a/event.c b/event.c
index c3169aa..e452167 100644 (file)
--- 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,