JasonWoof Got questions, comments, patches, etc.? Contact Jason Woofenden
aspects hints seem broken for fullscreen apps
[dwm.git] / dwm.c
diff --git a/dwm.c b/dwm.c
index e1c8c20..1080d2d 100644 (file)
--- a/dwm.c
+++ b/dwm.c
@@ -178,6 +178,7 @@ void scan(void);
 void setclientstate(Client *c, long state);
 void setgeom(const char *arg);
 void setlayout(const char *arg);
+void setmfact(const char *arg);
 void setup(void);
 void spawn(const char *arg);
 void tag(const char *arg);
@@ -329,7 +330,7 @@ buttonpress(XEvent *e) {
                x = bgw;
                for(i = 0; i < LENGTH(tags); i++) {
                        x += textw(tags[i]);
-                       if(ev->x > bgw && ev->x < x) {
+                       if(ev->x >= bgw && ev->x < x) {
                                if(ev->button == Button1) {
                                        if(ev->state & MODKEY)
                                                tag(tags[i]);
@@ -1195,9 +1196,9 @@ resize(Client *c, int x, int y, int w, int h, Bool sizehints) {
 
        if(sizehints) {
                /* set minimum possible */
-               if (w < 1)
+               if(w < 1)
                        w = 1;
-               if (h < 1)
+               if(h < 1)
                        h = 1;
 
                /* temporarily remove base dimensions */
@@ -1205,7 +1206,9 @@ resize(Client *c, int x, int y, int w, int h, Bool sizehints) {
                h -= c->baseh;
 
                /* adjust for aspect limits */
-               if (c->minay > 0 && c->maxay > 0 && c->minax > 0 && c->maxax > 0) {
+               if(c->minax != c->maxax && c->minay != c->maxay 
+               && c->minax > 0 && c->maxax > 0 && c->minay > 0 && c->maxay > 0)
+               {
                        if (w * c->maxay > h * c->maxax)
                                w = h * c->maxax / c->maxay;
                        else if (w * c->minay < h * c->minax)
@@ -1463,6 +1466,26 @@ setlayout(const char *arg) {
 }
 
 void
+setmfact(const char *arg) {
+       double delta;
+
+       if(!arg || lt->isfloating)
+               return;
+       delta = strtod(arg, NULL);
+       if(arg[0] == '-' || arg[0] == '+') {
+               if(mfact + delta < 0.1 || mfact + delta > 0.9)
+                       return;
+               mfact += delta;
+       }
+       else {
+               if(delta < 0.1 || delta > 0.9)
+                       return;
+               mfact = delta;
+       }
+       setgeom(geom->symbol);
+}
+
+void
 setup(void) {
        unsigned int i, w;
        XSetWindowAttributes wa;