]> Pileus Git - ~andy/gtk/commitdiff
Make the size of the arrow depend only on the font size, not on the child
authorMatthias Clasen <mclasen@redhat.com>
Mon, 22 Nov 2004 17:07:41 +0000 (17:07 +0000)
committerMatthias Clasen <matthiasc@src.gnome.org>
Mon, 22 Nov 2004 17:07:41 +0000 (17:07 +0000)
2004-11-22  Matthias Clasen  <mclasen@redhat.com>

* gtk/gtkmenuitem.c (gtk_menu_item_paint): Make the size of
the arrow depend only on the font size, not on the child
allocation.  (#131345, Morten Welinder)

ChangeLog
ChangeLog.pre-2-10
ChangeLog.pre-2-6
ChangeLog.pre-2-8
gtk/gtkmenuitem.c

index 1b82c3a55602d2e6834183944b46c90e1fb7eb34..a4d174569e5f9dd61e3e4c4f64335ad59130ac29 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,9 @@
 2004-11-22  Matthias Clasen  <mclasen@redhat.com>
 
+       * gtk/gtkmenuitem.c (gtk_menu_item_paint): Make the size of 
+       the arrow depend only on the font size, not on the child 
+       allocation.  (#131345, Morten Welinder)
+
        * configure.in: Require Pango 1.7.0 for PangoRenderer (#159061,
        Crispin Flowerday)
        
index 1b82c3a55602d2e6834183944b46c90e1fb7eb34..a4d174569e5f9dd61e3e4c4f64335ad59130ac29 100644 (file)
@@ -1,5 +1,9 @@
 2004-11-22  Matthias Clasen  <mclasen@redhat.com>
 
+       * gtk/gtkmenuitem.c (gtk_menu_item_paint): Make the size of 
+       the arrow depend only on the font size, not on the child 
+       allocation.  (#131345, Morten Welinder)
+
        * configure.in: Require Pango 1.7.0 for PangoRenderer (#159061,
        Crispin Flowerday)
        
index 1b82c3a55602d2e6834183944b46c90e1fb7eb34..a4d174569e5f9dd61e3e4c4f64335ad59130ac29 100644 (file)
@@ -1,5 +1,9 @@
 2004-11-22  Matthias Clasen  <mclasen@redhat.com>
 
+       * gtk/gtkmenuitem.c (gtk_menu_item_paint): Make the size of 
+       the arrow depend only on the font size, not on the child 
+       allocation.  (#131345, Morten Welinder)
+
        * configure.in: Require Pango 1.7.0 for PangoRenderer (#159061,
        Crispin Flowerday)
        
index 1b82c3a55602d2e6834183944b46c90e1fb7eb34..a4d174569e5f9dd61e3e4c4f64335ad59130ac29 100644 (file)
@@ -1,5 +1,9 @@
 2004-11-22  Matthias Clasen  <mclasen@redhat.com>
 
+       * gtk/gtkmenuitem.c (gtk_menu_item_paint): Make the size of 
+       the arrow depend only on the font size, not on the child 
+       allocation.  (#131345, Morten Welinder)
+
        * configure.in: Require Pango 1.7.0 for PangoRenderer (#159061,
        Crispin Flowerday)
        
index 77e4c1362ea731f03be9ddfe0ce134f553ecfda8..acbf562715035803298e27cb2203e013744f9544 100644 (file)
@@ -725,6 +725,10 @@ gtk_menu_item_paint (GtkWidget    *widget,
          guint horizontal_padding;
          GtkTextDirection direction;
          GtkArrowType arrow_type;
+         PangoContext *context;
+         PangoFontMetrics *metrics;
+         gint ascent, descent;
+         PangoLayout *layout;
 
          direction = gtk_widget_get_direction (widget);
       
@@ -732,10 +736,17 @@ gtk_menu_item_paint (GtkWidget    *widget,
                                "horizontal_padding", &horizontal_padding,
                                NULL);
          
-         gtk_widget_get_child_requisition (GTK_BIN (menu_item)->child,
-                                           &child_requisition);
+         context = gtk_widget_get_pango_context (GTK_BIN (menu_item)->child);
+         metrics = pango_context_get_metrics (context, 
+                                              GTK_WIDGET (GTK_BIN (menu_item)->child)->style->font_desc,
+                                              pango_context_get_language (context));
+         
+         ascent = pango_font_metrics_get_ascent (metrics);
+         descent = pango_font_metrics_get_descent (metrics);
+         pango_font_metrics_unref (metrics);
+         
+         arrow_size = PANGO_PIXELS (ascent + descent) - 2 * widget->style->ythickness;
 
-         arrow_size = child_requisition.height - 2 * widget->style->ythickness;
          arrow_extent = arrow_size * 0.8;
          
          shadow_type = GTK_SHADOW_OUT;