Forgot to check base size is set before using for ratio check
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:02:19 +0000 (14:02 +0100)
This resulted in ratio checks for mplayer2 and mpv being off by one.

openbox/client.c

index 1e70398..f7798a8 100644 (file)
@@ -3134,8 +3134,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) {
@@ -3158,8 +3160,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! */