[gtk+] viewport: Don't subtract borders and padding from -1



commit 352e28a1380e5a38ae04de7f7ff30ead8d68666a
Author: Benjamin Otte <otte redhat com>
Date:   Tue May 6 04:00:38 2014 +0200

    viewport: Don't subtract borders and padding from -1
    
    -1 is a special value for "undefined" and needs to stay that way
    
    https://bugzilla.gnome.org/show_bug.cgi?id=729607

 gtk/gtkviewport.c |   12 ++++++++----
 1 files changed, 8 insertions(+), 4 deletions(-)
---
diff --git a/gtk/gtkviewport.c b/gtk/gtkviewport.c
index ec6655f..c0bc437 100644
--- a/gtk/gtkviewport.c
+++ b/gtk/gtkviewport.c
@@ -1049,24 +1049,28 @@ gtk_viewport_get_preferred_size (GtkWidget      *widget,
 
       if (orientation == GTK_ORIENTATION_HORIZONTAL)
         {
-          for_size -= border.top + border.bottom;
+          if (for_size >= 0)
+            for_size -= border.top + border.bottom;
           minimum += border.left + border.right;
         }
       else
         {
-          for_size -= border.left + border.right;
+          if (for_size >= 0)
+            for_size -= border.left + border.right;
           minimum += border.top + border.bottom;
         }
     }
 
   if (orientation == GTK_ORIENTATION_HORIZONTAL)
     {
-      for_size -= padding.top + padding.bottom;
+      if (for_size >= 0)
+        for_size -= padding.top + padding.bottom;
       minimum += padding.left + padding.right;
     }
   else
     {
-      for_size -= padding.left + padding.right;
+      if (for_size >= 0)
+        for_size -= padding.left + padding.right;
       minimum += padding.top + padding.bottom;
     }
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]