[Xfce4-commits] [xfce/xfwm4] 01/04: Fix size increment

noreply at xfce.org noreply at xfce.org
Tue Jan 20 21:41:46 CET 2015


This is an automated email from the git hooks/post-receive script.

olivier pushed a commit to branch master
in repository xfce/xfwm4.

commit 5c1c8ca7216cf2fd968fb60775a45358e3192d1d
Author: Olivier Fourdan <fourdan at xfce.org>
Date:   Tue Jan 20 20:29:08 2015 +0100

    Fix size increment
    
    Use the base size and not the min size when computing size of a
    window with size increment (this bug is probably as old as xfwm
    itself!)
    
    Signed-off-by: Olivier Fourdan <fourdan at xfce.org>
---
 src/moveresize.c |   33 ++++++++++++++++++++-------------
 1 file changed, 20 insertions(+), 13 deletions(-)

diff --git a/src/moveresize.c b/src/moveresize.c
index 558fcb2..53eb443 100644
--- a/src/moveresize.c
+++ b/src/moveresize.c
@@ -86,10 +86,8 @@ struct _MoveResizeData
 };
 
 static void
-clientSetSize (Client * c, int *size, int size_min, int size_max, int size_inc, gboolean source_is_application)
+clientSetSize (Client * c, int *size, int base, int min, int max, int incr, gboolean source_is_application)
 {
-    int temp;
-
     g_return_if_fail (c != NULL);
     g_return_if_fail (size != NULL);
     TRACE ("entering clientSetSize");
@@ -99,25 +97,34 @@ clientSetSize (Client * c, int *size, int size_min, int size_max, int size_inc,
         && !(FLAG_TEST (c->flags, CLIENT_FLAG_MAXIMIZED)
              && (c->screen_info->params->borderless_maximize)))
     {
-        if (!source_is_application && (c->size->flags & PResizeInc) && (size_inc))
+
+        if (!source_is_application && (c->size->flags & PResizeInc) && (incr))
         {
-            temp = (*size - size_min) / size_inc;
-            *size = size_min + (temp * size_inc);
+            int a;
+            int b = 0;
+
+            if (c->size->flags & PBaseSize)
+            {
+                b = base;
+            }
+
+            a = (*size - b) / incr;
+            *size = b + (a * incr);
         }
         if (c->size->flags & PMaxSize)
         {
-            if (*size > size_max)
+            if (*size > max)
             {
-                *size = size_max;
+                *size = max;
             }
         }
     }
 
     if (c->size->flags & PMinSize)
     {
-        if (*size < size_min)
+        if (*size < min)
         {
-            *size = size_min;
+            *size = min;
         }
     }
     if (*size < 1)
@@ -136,7 +143,7 @@ clientSetWidth (Client * c, int w, gboolean source_is_application)
     TRACE ("setting width %i for client \"%s\" (0x%lx)", w, c->name, c->window);
 
     temp = w;
-    clientSetSize (c, &temp, c->size->min_width, c->size->max_width, c->size->width_inc, source_is_application);
+    clientSetSize (c, &temp,  c->size->base_width, c->size->min_width, c->size->max_width, c->size->width_inc, source_is_application);
     c->width = temp;
 }
 
@@ -150,7 +157,7 @@ clientSetHeight (Client * c, int h, gboolean source_is_application)
     TRACE ("setting height %i for client \"%s\" (0x%lx)", h, c->name, c->window);
 
     temp = h;
-    clientSetSize (c, &temp, c->size->min_height, c->size->max_height, c->size->height_inc, source_is_application);
+    clientSetSize (c, &temp, c->size->base_height, c->size->min_height, c->size->max_height, c->size->height_inc, source_is_application);
     c->height = temp;
 }
 
@@ -1553,7 +1560,7 @@ clientResizeEventFilter (XEvent * xevent, gpointer data)
         }
 
         clientSetHeight (c, c->height, FALSE);
-        if (!FLAG_TEST (c->flags, CLIENT_FLAG_SHADED) && move_top)
+        if (move_top && !FLAG_TEST (c->flags, CLIENT_FLAG_SHADED))
         {
             c->y =  bottom_edge - c->height;
         }

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.


More information about the Xfce4-commits mailing list