]> code.ossystems Code Review - openembedded-core.git/commitdiff
Add a patch from 2.12 to size combo arrows based on the font size
authorRoss Burton <ross@openedhand.com>
Thu, 26 Jul 2007 11:14:45 +0000 (11:14 +0000)
committerRoss Burton <ross@openedhand.com>
Thu, 26 Jul 2007 11:14:45 +0000 (11:14 +0000)
git-svn-id: https://svn.o-hand.com/repos/poky/trunk@2231 311d38ba-8fff-0310-9ca6-ca027cbcb966

meta/packages/gtk+/gtk+-2.10.12/combo-arrow-size.patch [new file with mode: 0644]
meta/packages/gtk+/gtk+-2.6.10/combo-arrow-size.patch [new file with mode: 0644]
meta/packages/gtk+/gtk+_2.10.12.bb
meta/packages/gtk+/gtk+_2.6.10.bb

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 (file)
index 0000000..d44c454
--- /dev/null
@@ -0,0 +1,67 @@
+Index: gtk/gtkcombobox.c
+===================================================================
+RCS file: /cvs/gnome/gtk+/gtk/gtkcombobox.c,v
+retrieving revision 1.185
+diff -u -p -r1.185 gtkcombobox.c
+--- gtk/gtkcombobox.c  12 Oct 2006 13:48:07 -0000      1.185
++++ gtk/gtkcombobox.c  1 Nov 2006 19:01:09 -0000
+@@ -756,6 +756,25 @@ gtk_combo_box_class_init (GtkComboBoxCla
+                                                                  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));
+ }
+@@ -1897,7 +1916,12 @@ gtk_combo_box_size_request (GtkWidget   
+ {
+   gint width, height;
+   gint focus_width, focus_pad;
++  gint font_size;
++  gint arrow_size;
+   GtkRequisition bin_req;
++  PangoContext *context;
++  PangoFontMetrics *metrics;
++  PangoFontDescription *font_desc;
+   GtkComboBox *combo_box = GTK_COMBO_BOX (widget);
+  
+@@ -1910,7 +1934,20 @@ gtk_combo_box_size_request (GtkWidget   
+   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)
+     {
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 (file)
index 0000000..aecbd43
--- /dev/null
@@ -0,0 +1,67 @@
+Index: gtk/gtkcombobox.c
+===================================================================
+RCS file: /cvs/gnome/gtk+/gtk/gtkcombobox.c,v
+retrieving revision 1.185
+diff -u -p -r1.185 gtkcombobox.c
+--- gtk/gtkcombobox.c  12 Oct 2006 13:48:07 -0000      1.185
++++ gtk/gtkcombobox.c  1 Nov 2006 19:01:09 -0000
+@@ -756,6 +756,25 @@ gtk_combo_box_class_init (GtkComboBoxCla
+                                                                  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,
++                                                           G_PARAM_READABLE));
++
+   g_type_class_add_private (object_class, sizeof (GtkComboBoxPrivate));
+ }
+@@ -1897,7 +1916,12 @@ gtk_combo_box_size_request (GtkWidget   
+ {
+   gint width, height;
+   gint focus_width, focus_pad;
++  gint font_size;
++  gint arrow_size;
+   GtkRequisition bin_req;
++  PangoContext *context;
++  PangoFontMetrics *metrics;
++  PangoFontDescription *font_desc;
+   GtkComboBox *combo_box = GTK_COMBO_BOX (widget);
+  
+@@ -1910,7 +1934,20 @@ gtk_combo_box_size_request (GtkWidget   
+   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)
+     {
index e7e5a9f7632e04ceebc2f20417f6a5284e815dfa..64241a79b1839206ddef9286511ec8191d5af576 100644 (file)
@@ -1,7 +1,7 @@
 require gtk+.inc
 
 DEPENDS += "cairo"
-PR = "r10"
+PR = "r11"
 
 # disable per default - untested and not all patches included.
 DEFAULT_PREFERENCE = "-1" 
@@ -22,6 +22,7 @@ SRC_URI = "ftp://ftp.gtk.org/pub/gtk/v2.10/gtk+-${PV}.tar.bz2 \
         file://cellrenderer-cairo.patch;patch=1;pnum=0 \
         file://entry-cairo.patch;patch=1;pnum=0 \
         file://toggle-font.diff;patch=1;pnum=0 \
+        file://combo-arrow-size.patch;patch=1;pnum=0 \
         file://scrolled-placement.patch;patch=1;pnum=0"
 #           file://scroll-timings.patch;patch=1 \
 #           file://pangoxft2.10.6.diff;patch=1"
index 86fc8fcb1704e3b2edb4bf9e21103ccc254c6b7d..0ec21848ff37c051be960151715cb022ec0212e8 100644 (file)
@@ -1,6 +1,6 @@
 require gtk+.inc
 
-PR = "r10"
+PR = "r11"
 
 SRC_URI = "ftp://ftp.gtk.org/pub/gtk/v2.6/gtk+-${PV}.tar.bz2 \
            file://no-demos.patch;patch=1 \
@@ -16,6 +16,7 @@ SRC_URI = "ftp://ftp.gtk.org/pub/gtk/v2.6/gtk+-${PV}.tar.bz2 \
           file://filechooser-respect-style.patch;patch=1 \
           file://filechooser-default.patch;patch=1 \
           file://toggle-font.diff;patch=1;pnum=0 \
+          file://combo-arrow-size.patch;patch=1;pnum=0 \
           "
 
 EXTRA_OECONF = "--without-libtiff --disable-xkb --disable-glibtest"