summaryrefslogtreecommitdiff
path: root/packages/gtk+/gtk+-2.10.14/combo-arrow-size.patch
blob: ec408a5f28a95ebbdd838df01aea83f5b8788dfc (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
Index: gtk/gtkcombobox.c
===================================================================
--- gtk/gtkcombobox.c.orig	2007-08-21 11:10:15.000000000 +0000
+++ gtk/gtkcombobox.c	2007-08-21 11:13:00.000000000 +0000
@@ -692,6 +692,25 @@
                                                                  FALSE,
                                                                  GTK_PARAM_READABLE));
 
+  /**
+   * GtkComboBox:arrow-size:
+   *
+   * Sets the minimum size of the arrow in the combo box.  Note
+   * that the arrow size is coupled to the font size, so in case
+   * a larger font is used, the arrow will be larger than set
+   * by arrow size.
+   *
+   * Since: 2.12
+   */
+  gtk_widget_class_install_style_property (widget_class,
+					   g_param_spec_int ("arrow-size",
+							     P_("Arrow Size"),
+							     P_("The minimum size of the arrow in the combo box"),
+							     0,
+							     G_MAXINT,
+							     15,
+							     GTK_PARAM_READABLE));
+
   g_type_class_add_private (object_class, sizeof (GtkComboBoxPrivate));
 }
 
@@ -1926,8 +1945,13 @@
 {
   GtkComboBox *combo_box = GTK_COMBO_BOX (widget);
   gint focus_width, focus_pad;
+  gint font_size;
+  gint arrow_size;
   GtkAllocation child;
   GtkRequisition req;
+  PangoContext *context;
+  PangoFontMetrics *metrics;
+  PangoFontDescription *font_desc;
   gboolean is_rtl = gtk_widget_get_direction (widget) == GTK_TEXT_DIR_RTL;
 
   widget->allocation = *allocation;
@@ -1935,8 +1959,21 @@
   gtk_widget_style_get (GTK_WIDGET (widget),
 			"focus-line-width", &focus_width,
 			"focus-padding", &focus_pad,
+			"arrow-size", &arrow_size,
 			NULL);
 
+  font_desc = GTK_BIN (widget)->child->style->font_desc;
+  context = gtk_widget_get_pango_context (widget);
+  metrics = pango_context_get_metrics (context, font_desc,
+				       pango_context_get_language (context));
+  font_size = PANGO_PIXELS (pango_font_metrics_get_ascent (metrics) +
+			    pango_font_metrics_get_descent (metrics));
+  pango_font_metrics_unref (metrics);
+
+  arrow_size = MAX (arrow_size, font_size);
+
+  gtk_widget_set_size_request (combo_box->priv->arrow, arrow_size, arrow_size);
+
   if (!combo_box->priv->tree_view)
     {
       if (combo_box->priv->cell_view)