[gtk+] menuitem: force odd height if we're not using wide separators



commit 713df0c72b85e990505dee7939497ab166f27d39
Author: Cosimo Cecchi <cosimoc gnome org>
Date:   Thu Dec 15 15:54:59 2011 +0100

    menuitem: force odd height if we're not using wide separators
    
    So that the 1px line can receive the same amount of space above and
    below.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=666242

 gtk/gtkmenuitem.c |   20 ++++++++++++++++++++
 1 files changed, 20 insertions(+), 0 deletions(-)
---
diff --git a/gtk/gtkmenuitem.c b/gtk/gtkmenuitem.c
index 4649147..e9c2bea 100644
--- a/gtk/gtkmenuitem.c
+++ b/gtk/gtkmenuitem.c
@@ -945,6 +945,16 @@ gtk_menu_item_get_preferred_height (GtkWidget *widget,
           min_height += separator_height;
           nat_height += separator_height;
         }
+      else
+        {
+          /* force odd, so that we can have the same space above and
+           * below the line.
+           */
+          if (min_height % 2 == 0)
+            min_height += 1;
+          if (nat_height % 2 == 0)
+            nat_height += 1;
+        }
     }
 
   accel_width = 0;
@@ -1071,6 +1081,16 @@ gtk_menu_item_get_preferred_height_for_width (GtkWidget *widget,
           min_height += separator_height;
           nat_height += separator_height;
         }
+      else
+        {
+          /* force odd, so that we can have the same space above and
+           * below the line.
+           */
+          if (min_height % 2 == 0)
+            min_height += 1;
+          if (nat_height % 2 == 0)
+            nat_height += 1;
+        }
     }
 
   if (minimum_size)



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