summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRoss Burton <ross@openedhand.com>2007-07-26 11:14:45 +0000
committerRoss Burton <ross@openedhand.com>2007-07-26 11:14:45 +0000
commit4b4ccd9f2a2e39e9159a7270e0ecfdc3470eb9ba (patch)
treec9dca3a8970c20a6cd1cc1976d52a55cc42ee9ec
parent3e918fc21f241a27bf1035df1048826b0a2c39c1 (diff)
downloadpoky-4b4ccd9f2a2e39e9159a7270e0ecfdc3470eb9ba.tar.gz
Add a patch from 2.12 to size combo arrows based on the font size
git-svn-id: https://svn.o-hand.com/repos/poky/trunk@2231 311d38ba-8fff-0310-9ca6-ca027cbcb966
-rw-r--r--meta/packages/gtk+/gtk+-2.10.12/combo-arrow-size.patch67
-rw-r--r--meta/packages/gtk+/gtk+-2.6.10/combo-arrow-size.patch67
-rw-r--r--meta/packages/gtk+/gtk+_2.10.12.bb3
-rw-r--r--meta/packages/gtk+/gtk+_2.6.10.bb3
4 files changed, 138 insertions, 2 deletions
diff --git a/meta/packages/gtk+/gtk+-2.10.12/combo-arrow-size.patch b/meta/packages/gtk+/gtk+-2.10.12/combo-arrow-size.patch
new file mode 100644
index 0000000000..d44c454ce3
--- /dev/null
+++ b/meta/packages/gtk+/gtk+-2.10.12/combo-arrow-size.patch
@@ -0,0 +1,67 @@
1Index: gtk/gtkcombobox.c
2===================================================================
3RCS file: /cvs/gnome/gtk+/gtk/gtkcombobox.c,v
4retrieving revision 1.185
5diff -u -p -r1.185 gtkcombobox.c
6--- gtk/gtkcombobox.c 12 Oct 2006 13:48:07 -0000 1.185
7+++ gtk/gtkcombobox.c 1 Nov 2006 19:01:09 -0000
8@@ -756,6 +756,25 @@ gtk_combo_box_class_init (GtkComboBoxCla
9 FALSE,
10 GTK_PARAM_READABLE));
11
12+ /**
13+ * GtkComboBox:arrow-size:
14+ *
15+ * Sets the minimum size of the arrow in the combo box. Note
16+ * that the arrow size is coupled to the font size, so in case
17+ * a larger font is used, the arrow will be larger than set
18+ * by arrow size.
19+ *
20+ * Since: 2.12
21+ */
22+ gtk_widget_class_install_style_property (widget_class,
23+ g_param_spec_int ("arrow-size",
24+ P_("Arrow Size"),
25+ P_("The minimum size of the arrow in the combo box"),
26+ 0,
27+ G_MAXINT,
28+ 15,
29+ GTK_PARAM_READABLE));
30+
31 g_type_class_add_private (object_class, sizeof (GtkComboBoxPrivate));
32 }
33
34@@ -1897,7 +1916,12 @@ gtk_combo_box_size_request (GtkWidget
35 {
36 gint width, height;
37 gint focus_width, focus_pad;
38+ gint font_size;
39+ gint arrow_size;
40 GtkRequisition bin_req;
41+ PangoContext *context;
42+ PangoFontMetrics *metrics;
43+ PangoFontDescription *font_desc;
44
45 GtkComboBox *combo_box = GTK_COMBO_BOX (widget);
46
47@@ -1910,7 +1934,20 @@ gtk_combo_box_size_request (GtkWidget
48 gtk_widget_style_get (GTK_WIDGET (widget),
49 "focus-line-width", &focus_width,
50 "focus-padding", &focus_pad,
51+ "arrow-size", &arrow_size,
52 NULL);
53+
54+ font_desc = GTK_BIN (widget)->child->style->font_desc;
55+ context = gtk_widget_get_pango_context (widget);
56+ metrics = pango_context_get_metrics (context, font_desc,
57+ pango_context_get_language (context));
58+ font_size = PANGO_PIXELS (pango_font_metrics_get_ascent (metrics) +
59+ pango_font_metrics_get_descent (metrics));
60+ pango_font_metrics_unref (metrics);
61+
62+ arrow_size = MAX (arrow_size, font_size);
63+
64+ gtk_widget_set_size_request (combo_box->priv->arrow, arrow_size, arrow_size);
65
66 if (!combo_box->priv->tree_view)
67 {
diff --git a/meta/packages/gtk+/gtk+-2.6.10/combo-arrow-size.patch b/meta/packages/gtk+/gtk+-2.6.10/combo-arrow-size.patch
new file mode 100644
index 0000000000..aecbd4366a
--- /dev/null
+++ b/meta/packages/gtk+/gtk+-2.6.10/combo-arrow-size.patch
@@ -0,0 +1,67 @@
1Index: gtk/gtkcombobox.c
2===================================================================
3RCS file: /cvs/gnome/gtk+/gtk/gtkcombobox.c,v
4retrieving revision 1.185
5diff -u -p -r1.185 gtkcombobox.c
6--- gtk/gtkcombobox.c 12 Oct 2006 13:48:07 -0000 1.185
7+++ gtk/gtkcombobox.c 1 Nov 2006 19:01:09 -0000
8@@ -756,6 +756,25 @@ gtk_combo_box_class_init (GtkComboBoxCla
9 FALSE,
10 GTK_PARAM_READABLE));
11
12+ /**
13+ * GtkComboBox:arrow-size:
14+ *
15+ * Sets the minimum size of the arrow in the combo box. Note
16+ * that the arrow size is coupled to the font size, so in case
17+ * a larger font is used, the arrow will be larger than set
18+ * by arrow size.
19+ *
20+ * Since: 2.12
21+ */
22+ gtk_widget_class_install_style_property (widget_class,
23+ g_param_spec_int ("arrow-size",
24+ P_("Arrow Size"),
25+ P_("The minimum size of the arrow in the combo box"),
26+ 0,
27+ G_MAXINT,
28+ 15,
29+ G_PARAM_READABLE));
30+
31 g_type_class_add_private (object_class, sizeof (GtkComboBoxPrivate));
32 }
33
34@@ -1897,7 +1916,12 @@ gtk_combo_box_size_request (GtkWidget
35 {
36 gint width, height;
37 gint focus_width, focus_pad;
38+ gint font_size;
39+ gint arrow_size;
40 GtkRequisition bin_req;
41+ PangoContext *context;
42+ PangoFontMetrics *metrics;
43+ PangoFontDescription *font_desc;
44
45 GtkComboBox *combo_box = GTK_COMBO_BOX (widget);
46
47@@ -1910,7 +1934,20 @@ gtk_combo_box_size_request (GtkWidget
48 gtk_widget_style_get (GTK_WIDGET (widget),
49 "focus-line-width", &focus_width,
50 "focus-padding", &focus_pad,
51+ "arrow-size", &arrow_size,
52 NULL);
53+
54+ font_desc = GTK_BIN (widget)->child->style->font_desc;
55+ context = gtk_widget_get_pango_context (widget);
56+ metrics = pango_context_get_metrics (context, font_desc,
57+ pango_context_get_language (context));
58+ font_size = PANGO_PIXELS (pango_font_metrics_get_ascent (metrics) +
59+ pango_font_metrics_get_descent (metrics));
60+ pango_font_metrics_unref (metrics);
61+
62+ arrow_size = MAX (arrow_size, font_size);
63+
64+ gtk_widget_set_size_request (combo_box->priv->arrow, arrow_size, arrow_size);
65
66 if (!combo_box->priv->tree_view)
67 {
diff --git a/meta/packages/gtk+/gtk+_2.10.12.bb b/meta/packages/gtk+/gtk+_2.10.12.bb
index e7e5a9f763..64241a79b1 100644
--- a/meta/packages/gtk+/gtk+_2.10.12.bb
+++ b/meta/packages/gtk+/gtk+_2.10.12.bb
@@ -1,7 +1,7 @@
1require gtk+.inc 1require gtk+.inc
2 2
3DEPENDS += "cairo" 3DEPENDS += "cairo"
4PR = "r10" 4PR = "r11"
5 5
6# disable per default - untested and not all patches included. 6# disable per default - untested and not all patches included.
7DEFAULT_PREFERENCE = "-1" 7DEFAULT_PREFERENCE = "-1"
@@ -22,6 +22,7 @@ SRC_URI = "ftp://ftp.gtk.org/pub/gtk/v2.10/gtk+-${PV}.tar.bz2 \
22 file://cellrenderer-cairo.patch;patch=1;pnum=0 \ 22 file://cellrenderer-cairo.patch;patch=1;pnum=0 \
23 file://entry-cairo.patch;patch=1;pnum=0 \ 23 file://entry-cairo.patch;patch=1;pnum=0 \
24 file://toggle-font.diff;patch=1;pnum=0 \ 24 file://toggle-font.diff;patch=1;pnum=0 \
25 file://combo-arrow-size.patch;patch=1;pnum=0 \
25 file://scrolled-placement.patch;patch=1;pnum=0" 26 file://scrolled-placement.patch;patch=1;pnum=0"
26# file://scroll-timings.patch;patch=1 \ 27# file://scroll-timings.patch;patch=1 \
27# file://pangoxft2.10.6.diff;patch=1" 28# file://pangoxft2.10.6.diff;patch=1"
diff --git a/meta/packages/gtk+/gtk+_2.6.10.bb b/meta/packages/gtk+/gtk+_2.6.10.bb
index 86fc8fcb17..0ec21848ff 100644
--- a/meta/packages/gtk+/gtk+_2.6.10.bb
+++ b/meta/packages/gtk+/gtk+_2.6.10.bb
@@ -1,6 +1,6 @@
1require gtk+.inc 1require gtk+.inc
2 2
3PR = "r10" 3PR = "r11"
4 4
5SRC_URI = "ftp://ftp.gtk.org/pub/gtk/v2.6/gtk+-${PV}.tar.bz2 \ 5SRC_URI = "ftp://ftp.gtk.org/pub/gtk/v2.6/gtk+-${PV}.tar.bz2 \
6 file://no-demos.patch;patch=1 \ 6 file://no-demos.patch;patch=1 \
@@ -16,6 +16,7 @@ SRC_URI = "ftp://ftp.gtk.org/pub/gtk/v2.6/gtk+-${PV}.tar.bz2 \
16 file://filechooser-respect-style.patch;patch=1 \ 16 file://filechooser-respect-style.patch;patch=1 \
17 file://filechooser-default.patch;patch=1 \ 17 file://filechooser-default.patch;patch=1 \
18 file://toggle-font.diff;patch=1;pnum=0 \ 18 file://toggle-font.diff;patch=1;pnum=0 \
19 file://combo-arrow-size.patch;patch=1;pnum=0 \
19 " 20 "
20 21
21EXTRA_OECONF = "--without-libtiff --disable-xkb --disable-glibtest" 22EXTRA_OECONF = "--without-libtiff --disable-xkb --disable-glibtest"