summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKoen Kooi <koen@openembedded.org>2007-07-28 12:09:24 +0000
committerKoen Kooi <koen@openembedded.org>2007-07-28 12:09:24 +0000
commit14b8cf01f0745d97ad21d17f979b469dfcc3bbc4 (patch)
treed85d8c6c8a315d0c0002c839014f820010fdfe5d
parentda2c653f899b4fcc10e2aeda1f7cb7a231f808ab (diff)
gtk 2.10.14: add some patches from poky to have some widgets behave better on high-dpi screens
-rw-r--r--packages/gtk+/gtk+-2.10.14/combo-arrow-size.patch67
-rw-r--r--packages/gtk+/gtk+-2.10.14/range-no-redraw.patch41
-rw-r--r--packages/gtk+/gtk+-2.10.14/scrolled-placement.patch35
-rw-r--r--packages/gtk+/gtk+-2.10.14/toggle-font.diff100
-rw-r--r--packages/gtk+/gtk+_2.10.14.bb8
5 files changed, 249 insertions, 2 deletions
diff --git a/packages/gtk+/gtk+-2.10.14/combo-arrow-size.patch b/packages/gtk+/gtk+-2.10.14/combo-arrow-size.patch
new file mode 100644
index 0000000000..d44c454ce3
--- /dev/null
+++ b/packages/gtk+/gtk+-2.10.14/combo-arrow-size.patch
@@ -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/packages/gtk+/gtk+-2.10.14/range-no-redraw.patch b/packages/gtk+/gtk+-2.10.14/range-no-redraw.patch
new file mode 100644
index 0000000000..e3603d7700
--- /dev/null
+++ b/packages/gtk+/gtk+-2.10.14/range-no-redraw.patch
@@ -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;
diff --git a/packages/gtk+/gtk+-2.10.14/scrolled-placement.patch b/packages/gtk+/gtk+-2.10.14/scrolled-placement.patch
new file mode 100644
index 0000000000..09ded531ea
--- /dev/null
+++ b/packages/gtk+/gtk+-2.10.14/scrolled-placement.patch
@@ -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 }
+ };
diff --git a/packages/gtk+/gtk+-2.10.14/toggle-font.diff b/packages/gtk+/gtk+-2.10.14/toggle-font.diff
new file mode 100644
index 0000000000..928da72430
--- /dev/null
+++ b/packages/gtk+/gtk+-2.10.14/toggle-font.diff
@@ -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;
+
diff --git a/packages/gtk+/gtk+_2.10.14.bb b/packages/gtk+/gtk+_2.10.14.bb
index 4e85db45af..3aaa0d6bec 100644
--- a/packages/gtk+/gtk+_2.10.14.bb
+++ b/packages/gtk+/gtk+_2.10.14.bb
@@ -1,6 +1,6 @@
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.10/gtk+-${PV}.tar.bz2 \
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