]> Dogcows Code - chaz/openbox/commitdiff
from icccm:
authorDana Jansens <danakj@orodu.net>
Sun, 8 Jun 2003 21:21:23 +0000 (21:21 +0000)
committerDana Jansens <danakj@orodu.net>
Sun, 8 Jun 2003 21:21:23 +0000 (21:21 +0000)
If a base size is not provided, the minimum size is to be used in its place and vice versa.

Added support for this.

openbox/client.c

index 0fe7881f617ff1c0448a84ff2d7e72383f0c03df..adc6ce0d1f38648ecf10a6d8a544d15281bfc0b7 100644 (file)
@@ -1601,6 +1601,7 @@ void client_configure(Client *self, Corner anchor, int x, int y, int w, int h,
                      gboolean user, gboolean final)
 {
     gboolean moved = FALSE, resized = FALSE;
+    int basew, baseh, minw, minh;
 
     /* gets the frame's position */
     frame_client_gravity(self->frame, &x, &y);
@@ -1657,9 +1658,25 @@ void client_configure(Client *self, Corner anchor, int x, int y, int w, int h,
         }
     }
 
+    /* find the base and min sizes */
+    if (self->base_size.width || self->base_size.height) {
+        basew = self->base_size.width;
+        baseh = self->base_size.height;
+    } else {
+        basew = self->min_size.width;
+        baseh = self->min_size.height;
+    }
+    if (self->min_size.width || self->min_size.height) {
+        minw = self->min_size.width;
+        minh = self->min_size.height;
+    } else {
+        minw = self->base_size.width;
+        minh = self->base_size.height;
+    }
+
     if (!(w == self->area.width && h == self->area.height)) {
-        w -= self->base_size.width;
-        h -= self->base_size.height;
+        w -= basew;
+        h -= baseh;
 
         if (user) {
             /* for interactive resizing. have to move half an increment in each
@@ -1684,9 +1701,9 @@ void client_configure(Client *self, Corner anchor, int x, int y, int w, int h,
 
             /* smaller than min size or bigger than max size? */
             if (w > self->max_size.width) w = self->max_size.width;
-            if (w < self->min_size.width) w = self->min_size.width;
+            if (w < minw) w = minw;
             if (h > self->max_size.height) h = self->max_size.height;
-            if (h < self->min_size.height) h = self->min_size.height;
+            if (h < minh) h = minh;
 
             /* adjust the height ot match the width for the aspect ratios */
             if (self->min_ratio)
@@ -1709,8 +1726,8 @@ void client_configure(Client *self, Corner anchor, int x, int y, int w, int h,
         w *= self->size_inc.width;
         h *= self->size_inc.height;
 
-        w += self->base_size.width;
-        h += self->base_size.height;
+        w += basew;
+        h += baseh;
     }
 
     switch (anchor) {
This page took 0.028261 seconds and 4 git commands to generate.