[oe-commits] org.oe.dev gtk 2.10.14: add some patches from poky to have some widgets behave better on high-dpi screens

koen commit openembedded-commits at lists.openembedded.org
Sat Jul 28 12:17:11 UTC 2007


gtk 2.10.14: add some patches from poky to have some widgets behave better on high-dpi screens

Author: koen at openembedded.org
Branch: org.openembedded.dev
Revision: 89643518c0556cc8aaa9971b6f9ca388750dfef7
ViewMTN: http://monotone.openembedded.org/revision.psp?id=89643518c0556cc8aaa9971b6f9ca388750dfef7
Files:
1
packages/gtk+/gtk+-2.10.14/combo-arrow-size.patch
packages/gtk+/gtk+-2.10.14/range-no-redraw.patch
packages/gtk+/gtk+-2.10.14/scrolled-placement.patch
packages/gtk+/gtk+-2.10.14/toggle-font.diff
packages/gtk+/gtk+_2.10.14.bb
Diffs:

#
# mt diff -rceaf972d4c569bdd7176857db28882bbee5e5587 -r89643518c0556cc8aaa9971b6f9ca388750dfef7
#
# 
# 
# add_file "packages/gtk+/gtk+-2.10.14/combo-arrow-size.patch"
#  content [86b154ddff681414b9ee93698f070af87eba8941]
# 
# add_file "packages/gtk+/gtk+-2.10.14/range-no-redraw.patch"
#  content [fadba3283e8dae1738b804181142adffac9acaf9]
# 
# add_file "packages/gtk+/gtk+-2.10.14/scrolled-placement.patch"
#  content [5595a91bea95e537af2a4b206b0d047577a92459]
# 
# add_file "packages/gtk+/gtk+-2.10.14/toggle-font.diff"
#  content [adee72a5d3cc2b226ad2c8ee4bb656ffc42ce676]
# 
# patch "packages/gtk+/gtk+_2.10.14.bb"
#  from [e6069d663f44b850fc362305e7de211e0f29afd7]
#    to [5334ae3cb851a4bd67bacc6373c37cb286d09808]
# 
============================================================
--- packages/gtk+/gtk+-2.10.14/combo-arrow-size.patch	86b154ddff681414b9ee93698f070af87eba8941
+++ packages/gtk+/gtk+-2.10.14/combo-arrow-size.patch	86b154ddff681414b9ee93698f070af87eba8941
@@ -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)
+     {
============================================================
--- packages/gtk+/gtk+-2.10.14/range-no-redraw.patch	fadba3283e8dae1738b804181142adffac9acaf9
+++ packages/gtk+/gtk+-2.10.14/range-no-redraw.patch	fadba3283e8dae1738b804181142adffac9acaf9
@@ -0,0 +1,41 @@
+Index: gtk/gtkrange.c
+===================================================================
+--- gtk/gtkrange.c	(revision 18523)
++++ gtk/gtkrange.c	(working copy)
+@@ -99,6 +99,8 @@
+ 
+   GtkSensitivityType lower_sensitivity;
+   GtkSensitivityType upper_sensitivity;
++
++  guint motion_idle;
+ };
+ 
+ 
+@@ -1721,6 +1723,16 @@
+                  &handled);
+ }
+ 
++static gboolean
++update_slider_position_idle (GtkRange *range)
++{
++  update_slider_position (range, range->layout->mouse_x,range->layout->mouse_y); 
++
++  range->layout->motion_idle = 0;
++
++  return FALSE;
++}
++
+ static void 
+ stop_scrolling (GtkRange *range)
+ {
+@@ -1860,8 +1872,8 @@
+   if (gtk_range_update_mouse_location (range))
+     gtk_widget_queue_draw (widget);
+ 
+-  if (range->layout->grab_location == MOUSE_SLIDER)
+-    update_slider_position (range, x, y);
++  if (range->layout->grab_location == MOUSE_SLIDER && !range->layout->motion_idle)
++    range->layout->motion_idle = g_idle_add ((GSourceFunc)update_slider_position_idle, range);
+ 
+   /* We handled the event if the mouse was in the range_rect */
+   return range->layout->mouse_location != MOUSE_OUTSIDE;
============================================================
--- packages/gtk+/gtk+-2.10.14/scrolled-placement.patch	5595a91bea95e537af2a4b206b0d047577a92459
+++ packages/gtk+/gtk+-2.10.14/scrolled-placement.patch	5595a91bea95e537af2a4b206b0d047577a92459
@@ -0,0 +1,35 @@
+Index: gtk/gtkscrolledwindow.c
+===================================================================
+--- gtk/gtkscrolledwindow.c	(revision 18493)
++++ gtk/gtkscrolledwindow.c	(working copy)
+@@ -885,7 +885,7 @@
+   if (GTK_IS_SCROLLED_WINDOW (widget))
+     {
+       gtk_scrolled_window_update_real_placement (GTK_SCROLLED_WINDOW (widget));
+-      gtk_widget_queue_draw (widget);
++      gtk_widget_queue_resize (widget);
+     }
+   else if (GTK_IS_CONTAINER (widget))
+     gtk_container_forall (GTK_CONTAINER (widget), traverse_container, NULL);
+Index: gdk/x11/gdksettings.c
+===================================================================
+--- gdk/x11/gdksettings.c	(revision 18493)
++++ gdk/x11/gdksettings.c	(working copy)
+@@ -65,7 +65,8 @@
+   "Xft/RGBA\0"                "gtk-xft-rgba\0"
+   "Xft/DPI\0"                 "gtk-xft-dpi\0"
+   "Net/FallbackIconTheme\0"   "gtk-fallback-icon-theme\0"
+-  "Gtk/TouchscreenMode\0"     "gtk-touchscreen-mode\0";
++  "Gtk/TouchscreenMode\0"     "gtk-touchscreen-mode\0"
++  "Gtk/ScrolledWindowPlacement\0" "gtk-scrolled-window-placement\0";
+ 
+ static const struct
+ {
+@@ -107,5 +108,6 @@
+   { 1197, 1206 },
+   { 1219, 1227 },
+   { 1239, 1261 },
+-  { 1285, 1305 }
++  { 1285, 1305 },
++  { 1326, 1354 }
+ };
============================================================
--- packages/gtk+/gtk+-2.10.14/toggle-font.diff	adee72a5d3cc2b226ad2c8ee4bb656ffc42ce676
+++ packages/gtk+/gtk+-2.10.14/toggle-font.diff	adee72a5d3cc2b226ad2c8ee4bb656ffc42ce676
@@ -0,0 +1,100 @@
+Index: gtk/gtkcellrenderertoggle.c
+===================================================================
+--- gtk/gtkcellrenderertoggle.c	(revision 18523)
++++ gtk/gtkcellrenderertoggle.c	(working copy)
+@@ -71,6 +71,8 @@
+   PROP_INDICATOR_SIZE
+ };
+ 
++/* This is a hard-coded default which promptly gets overridden by a size
++   calculated from the font size. */
+ #define TOGGLE_WIDTH 12
+ 
+ static guint toggle_cell_signals[LAST_SIGNAL] = { 0 };
+@@ -80,8 +82,9 @@
+ typedef struct _GtkCellRendererTogglePrivate GtkCellRendererTogglePrivate;
+ struct _GtkCellRendererTogglePrivate
+ {
+-  gint indicator_size;
+-
++  gint indicator_size; /* This is the real size */
++  gint override_size; /* This is the size set from the indicator-size property */
++  GtkWidget *cached_widget;
+   guint inconsistent : 1;
+ };
+ 
+@@ -104,6 +107,7 @@
+   GTK_CELL_RENDERER (celltoggle)->ypad = 2;
+ 
+   priv->indicator_size = TOGGLE_WIDTH;
++  priv->override_size = 0;
+   priv->inconsistent = FALSE;
+ }
+ 
+@@ -210,7 +214,7 @@
+       g_value_set_boolean (value, celltoggle->radio);
+       break;
+     case PROP_INDICATOR_SIZE:
+-      g_value_set_int (value, priv->indicator_size);
++      g_value_set_int (value, priv->override_size ? priv->override_size : priv->indicator_size);
+       break;
+     default:
+       G_OBJECT_WARN_INVALID_PROPERTY_ID (object, param_id, pspec);
+@@ -245,7 +249,7 @@
+       celltoggle->radio = g_value_get_boolean (value);
+       break;
+     case PROP_INDICATOR_SIZE:
+-      priv->indicator_size = g_value_get_int (value);
++      priv->override_size = g_value_get_int (value);
+       break;
+     default:
+       G_OBJECT_WARN_INVALID_PROPERTY_ID (object, param_id, pspec);
+@@ -273,6 +277,27 @@
+ }
+ 
+ static void
++on_widget_style_set (GtkWidget *widget, GtkStyle *previous, gpointer user_data)
++{
++  GtkCellRendererTogglePrivate *priv = user_data;
++  PangoContext *context;
++  PangoFontMetrics *metrics;
++  int height;
++  
++  context = gtk_widget_get_pango_context (widget);
++  metrics = pango_context_get_metrics (context,
++                                       widget->style->font_desc,
++                                       pango_context_get_language (context));
++
++  height = pango_font_metrics_get_ascent (metrics) +
++    pango_font_metrics_get_descent (metrics);
++  
++  pango_font_metrics_unref (metrics);
++  
++  priv->indicator_size = PANGO_PIXELS (height * 0.85);
++}
++
++static void
+ gtk_cell_renderer_toggle_get_size (GtkCellRenderer *cell,
+ 				   GtkWidget       *widget,
+ 				   GdkRectangle    *cell_area,
+@@ -287,6 +312,20 @@
+ 
+   priv = GTK_CELL_RENDERER_TOGGLE_GET_PRIVATE (cell);
+ 
++  if (priv->override_size) {
++    priv->indicator_size = priv->override_size;
++  } else if (priv->cached_widget != widget) {
++    if (priv->cached_widget) {
++      g_object_remove_weak_pointer (widget, &priv->cached_widget);
++      g_signal_handlers_disconnect_by_func (priv->cached_widget, on_widget_style_set, priv);
++    }
++    priv->cached_widget = widget;
++    g_object_add_weak_pointer (widget, &priv->cached_widget);
++    g_signal_connect (widget, "style-set", on_widget_style_set, priv);
++    
++    on_widget_style_set (widget, NULL, priv);
++  }
++
+   calc_width = (gint) cell->xpad * 2 + priv->indicator_size;
+   calc_height = (gint) cell->ypad * 2 + priv->indicator_size;
+ 
============================================================
--- packages/gtk+/gtk+_2.10.14.bb	e6069d663f44b850fc362305e7de211e0f29afd7
+++ packages/gtk+/gtk+_2.10.14.bb	5334ae3cb851a4bd67bacc6373c37cb286d09808
@@ -1,6 +1,6 @@ require gtk-2.10.inc
 require gtk-2.10.inc
 
-PR = "r0"
+PR = "r1"
 
 # disable per default - untested and not all patches included.
 DEFAULT_PREFERENCE = "-1"
@@ -22,7 +22,11 @@ SRC_URI = "ftp://ftp.gtk.org/pub/gtk/v2.
            file://spinbutton.patch;patch=1 \
            file://gtk+-handhelds.patch;patch=1 \
            file://filesel-fix-segfault.patch;patch=1 \
-	   "
+           file://toggle-font.diff;patch=1;pnum=0 \
+           file://combo-arrow-size.patch;patch=1;pnum=0 \
+           file://range-no-redraw.patch;patch=1;pnum=0 \
+           file://scrolled-placement.patch;patch=1;pnum=0 \
+           "
 
 #check for TARGET_FPU=soft and inform configure of the result so it can disable some floating points
 require gtk-fpu.inc






More information about the Openembedded-commits mailing list