JasonWoof Got questions, comments, patches, etc.? Contact Jason Woofenden
applied Sanders max_and_focus.patch
[dwm.git] / event.c
diff --git a/event.c b/event.c
index bdf4071..9974192 100644 (file)
--- a/event.c
+++ b/event.c
@@ -109,10 +109,18 @@ buttonpress(XEvent *e)
                for(a.i = 0; a.i < ntags; a.i++) {
                        x += textw(tags[a.i]);
                        if(ev->x < x) {
-                               if(ev->button == Button1)
-                                       view(&a);
-                               else if(ev->button == Button3)
-                                       toggleview(&a);
+                               if(ev->button == Button1) {
+                                       if(ev->state & MODKEY)
+                                               tag(&a);
+                                       else
+                                               view(&a);
+                               }
+                               else if(ev->button == Button3) {
+                                       if(ev->state & MODKEY)
+                                               toggletag(&a);
+                                       else
+                                               toggleview(&a);
+                               }
                                return;
                        }
                }
@@ -123,26 +131,17 @@ buttonpress(XEvent *e)
        }
        else if((c = getclient(ev->window))) {
                focus(c);
-               if(CLEANMASK(ev->state) != MODKEY)
+               if(maximized || CLEANMASK(ev->state) != MODKEY)
                        return;
-               switch(ev->button) {
-               default:
-                       break;
-               case Button1:
-                       if(!c->ismax && (arrange == dofloat || c->isfloat)) {
-                               restack(c);
-                               movemouse(c);
-                       }
-                       break;
-               case Button2:
+               if(ev->button == Button1 && (arrange == dofloat || c->isfloat)) {
+                       restack(c);
+                       movemouse(c);
+               }
+               else if(ev->button == Button2)
                        zoom(NULL);
-                       break;
-               case Button3:
-                       if(!c->ismax && (arrange == dofloat || c->isfloat)) {
-                               restack(c);
-                               resizemouse(c);
-                       }
-                       break;
+               else if(ev->button == Button3 && (arrange == dofloat || c->isfloat)) {
+                       restack(c);
+                       resizemouse(c);
                }
        }
 }
@@ -174,7 +173,7 @@ configurerequest(XEvent *e)
        XWindowChanges wc;
 
        if((c = getclient(ev->window))) {
-               if(!c->isfloat && (arrange != dofloat) && c->ismax) {
+               if((c == sel) && !c->isfloat && (arrange != dofloat) && maximized) {
                        synconfig(c, sx, sy + bh, sw - 2, sh - 2 - bh, ev->border_width);
                        XSync(dpy, False);
                        return;