]> Dogcows Code - chaz/openbox/commitdiff
Fix negative ResizeRelative values with terminal windows (Fix bug 5228)
authorDana Jansens <danakj@orodu.net>
Mon, 1 Oct 2012 04:11:04 +0000 (00:11 -0400)
committerDana Jansens <danakj@orodu.net>
Sun, 7 Oct 2012 02:12:22 +0000 (22:12 -0400)
Inspired by patches from Brian Mock <mock.brian@gmail.com>.

openbox/actions/resizerelative.c

index 7ac9f06ef14ea57c36d8fd6da88821c2bb52ea20..a4739104631f22a510469cb99b1dbe8e273b394e 100644 (file)
@@ -78,17 +78,26 @@ static gboolean run_func(ObActionsData *data, gpointer options)
         if (o->bottom_denom)
             bottom = bottom * c->area.height / o->bottom_denom;
 
+        if (left && ABS(left) < c->size_inc.width)
+            left = left < 0 ? -c->size_inc.width : c->size_inc.width;
+        if (right && ABS(right) < c->size_inc.width)
+            right = right < 0 ? -c->size_inc.width : c->size_inc.width;
+        if (top && ABS(top) < c->size_inc.height)
+            top = top < 0 ? -c->size_inc.height : c->size_inc.height;
+        if (bottom && ABS(bottom) < c->size_inc.height)
+            bottom = bottom < 0 ? -c->size_inc.height : c->size_inc.height;
+
         // When resizing, if the resize has a non-zero value then make sure it
         // is at least as big as the size increment so the window does actually
         // resize.
         x = c->area.x;
         y = c->area.y;
         ow = c->area.width;
-        xoff = -MAX(left, (left ? c->size_inc.width : 0));
-        nw = ow + MAX(right + left, (right + left ? c->size_inc.width : 0));
+        xoff = -left;
+        nw = ow + right + left;
         oh = c->area.height;
-        yoff = -MAX(top, (top ? c->size_inc.height : 0));
-        nh = oh + MAX(bottom + top, (bottom + top ? c->size_inc.height : 0));
+        yoff = -top;
+        nh = oh + bottom + top;
 
         client_try_configure(c, &x, &y, &nw, &nh, &lw, &lh, TRUE);
         xoff = xoff == 0 ? 0 :
This page took 0.026922 seconds and 4 git commands to generate.