[gtk+/resolution-independence: 22/24] Change GtkMenu from using gtk_style_get() to gtk_style_get_units().



commit 1b5b4812b9adecb2f760d779ec52d196f0c1e3cd
Author: Davyd Madeley <davyd madeley id au>
Date:   Thu Apr 30 15:43:22 2009 +0800

    Change GtkMenu from using gtk_style_get() to gtk_style_get_units().
    
    gtk_style_get() returns values in pixels but with no reference to the monitor
    that the widget is being displayed on. Thus it shouldn't be used when accessing
    sizes.
---
 gtk/gtkmenu.c |    7 +++++--
 1 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/gtk/gtkmenu.c b/gtk/gtkmenu.c
index c135c5b..2040974 100644
--- a/gtk/gtkmenu.c
+++ b/gtk/gtkmenu.c
@@ -2430,13 +2430,16 @@ gtk_menu_size_request (GtkWidget      *widget,
       guint toggle_spacing;
       guint indicator_size;
 
-      gtk_style_get (widget->style,
+      /* gtk_style_get() returns sizes in pixels with no consideration for
+         the monitor the widget is displayed on */
+      gtk_style_get_unit (widget->style,
                      GTK_TYPE_CHECK_MENU_ITEM,
                      "toggle-spacing", &toggle_spacing,
                      "indicator-size", &indicator_size,
                      NULL);
 
-      max_toggle_size = indicator_size + toggle_spacing;
+      max_toggle_size = gtk_widget_size_to_pixel (widget, indicator_size) +
+                        gtk_widget_size_to_pixel (widget, toggle_spacing);
     }
 
   for (i = 0; i < gtk_menu_get_n_rows (menu); i++)



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