Forgot to check base size is set before using for ratio check release-3.6.0
authorMikael Magnusson <mikachu@gmail.com>
Sun, 22 Mar 2015 13:00:25 +0000 (14:00 +0100)
committerMikael Magnusson <mikachu@gmail.com>
Sun, 22 Mar 2015 13:08:16 +0000 (14:08 +0100)
This resulted in ratio checks for mplayer2 and mpv being off by one.

openbox/client.c

index 3ff278a..f110a66 100644 (file)
@@ -3118,8 +3118,10 @@ void client_try_configure(ObClient *self, gint *x, gint *y, gint *w, gint *h,
 
         /* adjust the height to match the width for the aspect ratios.
            for this, min size is not substituted for base size ever. */
-        *w -= self->base_size.width;
-        *h -= self->base_size.height;
+        if (self->base_size.width >= 0 && self->base_size.height >= 0) {
+            *w -= self->base_size.width;
+            *h -= self->base_size.height;
+        }
 
         if (minratio)
             if (*h * minratio > *w) {
@@ -3142,8 +3144,10 @@ void client_try_configure(ObClient *self, gint *x, gint *y, gint *w, gint *h,
                 }
             }
 
-        *w += self->base_size.width;
-        *h += self->base_size.height;
+        if (self->base_size.width >= 0 && self->base_size.height >= 0) {
+            *w += self->base_size.width;
+            *h += self->base_size.height;
+        }
     }
 
     /* these override the above states! if you cant move you can't move! */