JasonWoof Got questions, comments, patches, etc.? Contact Jason Woofenden
applied sumik's multihead patch
[dwm.git] / event.c
diff --git a/event.c b/event.c
index 0f984f2..25ed6fa 100644 (file)
--- a/event.c
+++ b/event.c
@@ -114,33 +114,30 @@ buttonpress(XEvent *e)
                        }
                        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) {
-                               if(arrange == dofloat || c->isfloat) {
-                                       higher(c);
-                                       movemouse(c);
-                               }
-                               else
-                                       zoom(NULL);
-                       }
+                       if(!c->ismax && (arrange == dofloat || c->isfloat))
+                               movemouse(c);
+                       break;
+               case Button2:
+                       if(!c->ismax && arrange != dofloat && !c->isfloat)
+                               zoom(NULL);
                        break;
                case Button3:
-                       if(!c->ismax && (arrange == dofloat || c->isfloat)) {
-                               higher(c);
+                       if(!c->ismax && (arrange == dofloat || c->isfloat))
                                resizemouse(c);
-                       }
                        break;
                }
        }
@@ -229,8 +226,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
@@ -270,8 +270,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