summaryrefslogtreecommitdiffstats
path: root/meta/packages
diff options
context:
space:
mode:
authorRoss Burton <ross@openedhand.com>2007-08-01 19:06:33 +0000
committerRoss Burton <ross@openedhand.com>2007-08-01 19:06:33 +0000
commit7944fb200e56ea888c48e971c5af7e074f59f71a (patch)
tree550663703355289d51aa8fdaca718ce7d9f7e58a /meta/packages
parent5c53fff8cc6a533e661b5228208cce2f8650f2de (diff)
downloadpoky-7944fb200e56ea888c48e971c5af7e074f59f71a.tar.gz
Add GTK+ 2.11.6 for poky-bleeding
git-svn-id: https://svn.o-hand.com/repos/poky/trunk@2300 311d38ba-8fff-0310-9ca6-ca027cbcb966
Diffstat (limited to 'meta/packages')
-rw-r--r--meta/packages/gtk+/gtk+-2.11.6/automake-lossage.patch24
-rw-r--r--meta/packages/gtk+/gtk+-2.11.6/cellrenderer-cairo.patch32
-rw-r--r--meta/packages/gtk+/gtk+-2.11.6/combo-arrow-size.patch67
-rw-r--r--meta/packages/gtk+/gtk+-2.11.6/disable-print.patch50
-rw-r--r--meta/packages/gtk+/gtk+-2.11.6/disable-tooltips.patch11
-rw-r--r--meta/packages/gtk+/gtk+-2.11.6/entry-cairo.patch103
-rw-r--r--meta/packages/gtk+/gtk+-2.11.6/gtk+-handhelds.patch149
-rw-r--r--meta/packages/gtk+/gtk+-2.11.6/gtklabel-resize-patch10
-rw-r--r--meta/packages/gtk+/gtk+-2.11.6/hardcoded_libtool.patch29
-rw-r--r--meta/packages/gtk+/gtk+-2.11.6/menu-deactivate.patch51
-rw-r--r--meta/packages/gtk+/gtk+-2.11.6/migration.patch611
-rw-r--r--meta/packages/gtk+/gtk+-2.11.6/no-demos.patch10
-rw-r--r--meta/packages/gtk+/gtk+-2.11.6/no-xwc.patch151
-rw-r--r--meta/packages/gtk+/gtk+-2.11.6/pangoxft2.10.6.diff2456
-rw-r--r--meta/packages/gtk+/gtk+-2.11.6/range-no-redraw.patch41
-rw-r--r--meta/packages/gtk+/gtk+-2.11.6/run-iconcache.patch19
-rw-r--r--meta/packages/gtk+/gtk+-2.11.6/scroll-timings.patch11
-rw-r--r--meta/packages/gtk+/gtk+-2.11.6/scrolled-placement.patch35
-rw-r--r--meta/packages/gtk+/gtk+-2.11.6/single-click.patch56
-rw-r--r--meta/packages/gtk+/gtk+-2.11.6/small-gtkfilesel.patch267
-rw-r--r--meta/packages/gtk+/gtk+-2.11.6/spinbutton.patch130
-rw-r--r--meta/packages/gtk+/gtk+-2.11.6/toggle-font.diff100
-rw-r--r--meta/packages/gtk+/gtk+-2.11.6/xsettings.patch16
-rw-r--r--meta/packages/gtk+/gtk+_2.11.6.bb57
24 files changed, 4486 insertions, 0 deletions
diff --git a/meta/packages/gtk+/gtk+-2.11.6/automake-lossage.patch b/meta/packages/gtk+/gtk+-2.11.6/automake-lossage.patch
new file mode 100644
index 0000000000..0d423ddbb9
--- /dev/null
+++ b/meta/packages/gtk+/gtk+-2.11.6/automake-lossage.patch
@@ -0,0 +1,24 @@
1--- gtk+-2.4.1/docs/tutorial/Makefile.am~ 2003-05-06 22:54:20.000000000 +0100
2+++ gtk+-2.4.1/docs/tutorial/Makefile.am 2004-05-08 12:31:41.000000000 +0100
3@@ -52,21 +52,5 @@
4
5 dist-hook: html
6 cp -Rp $(srcdir)/html $(distdir)
7-else
8-html:
9- echo "***"
10- echo "*** Warning: Tutorial not built"
11- echo "***"
12-
13-pdf:
14- echo "***"
15- echo "*** Warning: Tutorial not built"
16- echo "***"
17-
18-dist-hook:
19- echo "***"
20- echo "*** Warning: Tutorial not built"
21- echo "*** DISTRIBUTION IS INCOMPLETE"
22- echo "***"
23 endif
24
diff --git a/meta/packages/gtk+/gtk+-2.11.6/cellrenderer-cairo.patch b/meta/packages/gtk+/gtk+-2.11.6/cellrenderer-cairo.patch
new file mode 100644
index 0000000000..4439e69fb6
--- /dev/null
+++ b/meta/packages/gtk+/gtk+-2.11.6/cellrenderer-cairo.patch
@@ -0,0 +1,32 @@
1Index: gtk/gtkcellrenderer.c
2===================================================================
3RCS file: /cvs/gnome/gtk+/gtk/gtkcellrenderer.c,v
4retrieving revision 1.55
5diff -u -r1.55 gtkcellrenderer.c
6--- gtk/gtkcellrenderer.c 14 May 2006 04:25:28 -0000 1.55
7+++ gtk/gtkcellrenderer.c 30 Jun 2006 10:57:43 -0000
8@@ -551,6 +551,7 @@
9
10 if (cell->cell_background_set && !selected)
11 {
12+#ifdef USE_CAIRO_INTERNALLY
13 cairo_t *cr = gdk_cairo_create (window);
14
15 gdk_cairo_rectangle (cr, background_area);
16@@ -558,6 +559,16 @@
17 cairo_fill (cr);
18
19 cairo_destroy (cr);
20+#else
21+ GdkGC *gc;
22+
23+ gc = gdk_gc_new (window);
24+ gdk_gc_set_rgb_fg_color (gc, &priv->cell_background);
25+ gdk_draw_rectangle (window, gc, TRUE,
26+ background_area->x, background_area->y,
27+ background_area->width, background_area->height);
28+ g_object_unref (gc);
29+#endif
30 }
31
32 GTK_CELL_RENDERER_GET_CLASS (cell)->render (cell,
diff --git a/meta/packages/gtk+/gtk+-2.11.6/combo-arrow-size.patch b/meta/packages/gtk+/gtk+-2.11.6/combo-arrow-size.patch
new file mode 100644
index 0000000000..d44c454ce3
--- /dev/null
+++ b/meta/packages/gtk+/gtk+-2.11.6/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.11.6/disable-print.patch b/meta/packages/gtk+/gtk+-2.11.6/disable-print.patch
new file mode 100644
index 0000000000..1067773f12
--- /dev/null
+++ b/meta/packages/gtk+/gtk+-2.11.6/disable-print.patch
@@ -0,0 +1,50 @@
1--- gtk+-2.10.0/configure.in~ 2006-07-05 18:11:44.000000000 +0200
2+++ gtk+-2.10.0/configure.in 2006-07-05 18:11:44.000000000 +0200
3@@ -1539,26 +1539,27 @@
4 # Printing system checks
5 ################################################################
6
7-AC_PATH_PROG(CUPS_CONFIG, cups-config, no)
8-if test "x$CUPS_CONFIG" != "xno"; then
9- CUPS_CFLAGS=`cups-config --cflags | sed 's/-O[0-9]*//' | sed 's/-m[^\t]*//g'`
10- CUPS_LIBS=`cups-config --libs`
11-
12- CUPS_API_VERSION=`cups-config --api-version`
13- CUPS_API_MAJOR=`echo -n $CUPS_API_VERSION | awk -F. '{print $1}'`
14- CUPS_API_MINOR=`echo -n $CUPS_API_VERSION | awk -F. '{print $2}'`
15-
16- if test $CUPS_API_MAJOR -gt 1 -o \
17- $CUPS_API_MAJOR -eq 1 -a $CUPS_API_MINOR -ge 2; then
18- AC_DEFINE(HAVE_CUPS_API_1_2)
19- fi
20-
21- AC_SUBST(CUPS_API_MAJOR)
22- AC_SUBST(CUPS_API_MINOR)
23- AC_SUBST(CUPS_CFLAGS)
24- AC_SUBST(CUPS_LIBS)
25-fi
26-AM_CONDITIONAL(HAVE_CUPS, test "x$CUPS_CONFIG" != "xno")
27+#AC_PATH_PROG(CUPS_CONFIG, cups-config, no)
28+#if test "x$CUPS_CONFIG" != "xno"; then
29+# CUPS_CFLAGS=`cups-config --cflags | sed 's/-O[0-9]*//' | sed 's/-m[^\t]*//g'`
30+# CUPS_LIBS=`cups-config --libs`
31+#
32+# CUPS_API_VERSION=`cups-config --api-version`
33+# CUPS_API_MAJOR=`echo -n $CUPS_API_VERSION | awk -F. '{print $1}'`
34+# CUPS_API_MINOR=`echo -n $CUPS_API_VERSION | awk -F. '{print $2}'`
35+#
36+# if test $CUPS_API_MAJOR -gt 1 -o \
37+# $CUPS_API_MAJOR -eq 1 -a $CUPS_API_MINOR -ge 2; then
38+# AC_DEFINE(HAVE_CUPS_API_1_2)
39+# fi
40+#
41+# AC_SUBST(CUPS_API_MAJOR)
42+# AC_SUBST(CUPS_API_MINOR)
43+# AC_SUBST(CUPS_CFLAGS)
44+# AC_SUBST(CUPS_LIBS)
45+#fi
46+#AM_CONDITIONAL(HAVE_CUPS, test "x$CUPS_CONFIG" != "xno")
47+AM_CONDITIONAL(HAVE_CUPS,false)
48
49 gtk_save_cppflags="$CPPFLAGS"
50 CPPFLAGS="$CPPFLAGS $GTK_DEP_CFLAGS"
diff --git a/meta/packages/gtk+/gtk+-2.11.6/disable-tooltips.patch b/meta/packages/gtk+/gtk+-2.11.6/disable-tooltips.patch
new file mode 100644
index 0000000000..d71d839c3c
--- /dev/null
+++ b/meta/packages/gtk+/gtk+-2.11.6/disable-tooltips.patch
@@ -0,0 +1,11 @@
1--- gtk+-2.4.3/gtk/gtktooltips.c.old 2004-07-04 18:52:04.000000000 +0100
2+++ gtk+-2.4.3/gtk/gtktooltips.c 2004-07-04 18:52:08.000000000 +0100
3@@ -118,7 +118,7 @@
4 tooltips->tips_data_list = NULL;
5
6 tooltips->delay = DEFAULT_DELAY;
7- tooltips->enabled = TRUE;
8+ tooltips->enabled = FALSE;
9 tooltips->timer_tag = 0;
10 tooltips->use_sticky_delay = FALSE;
11 tooltips->last_popdown.tv_sec = -1;
diff --git a/meta/packages/gtk+/gtk+-2.11.6/entry-cairo.patch b/meta/packages/gtk+/gtk+-2.11.6/entry-cairo.patch
new file mode 100644
index 0000000000..3313e7f132
--- /dev/null
+++ b/meta/packages/gtk+/gtk+-2.11.6/entry-cairo.patch
@@ -0,0 +1,103 @@
1Index: gtk/gtkentry.c
2===================================================================
3RCS file: /cvs/gnome/gtk+/gtk/gtkentry.c,v
4retrieving revision 1.317
5diff -u -r1.317 gtkentry.c
6--- gtk/gtkentry.c 29 Jun 2006 09:18:05 -0000 1.317
7+++ gtk/gtkentry.c 2 Jul 2006 14:14:24 -0000
8@@ -3337,7 +3337,9 @@
9 if (GTK_WIDGET_DRAWABLE (entry))
10 {
11 PangoLayout *layout = gtk_entry_ensure_layout (entry, TRUE);
12+#ifdef USE_CAIRO_INTERNALLY
13 cairo_t *cr;
14+#endif
15 gint x, y;
16 gint start_pos, end_pos;
17
18@@ -3345,23 +3347,35 @@
19
20 get_layout_position (entry, &x, &y);
21
22+#ifdef USE_CAIRO_INTERNALLY
23 cr = gdk_cairo_create (entry->text_area);
24
25 cairo_move_to (cr, x, y);
26 gdk_cairo_set_source_color (cr, &widget->style->text [widget->state]);
27 pango_cairo_show_layout (cr, layout);
28+#else
29+ gdk_draw_layout (entry->text_area, widget->style->text_gc [widget->state],
30+ x, y,
31+ layout);
32+#endif
33
34 if (gtk_editable_get_selection_bounds (GTK_EDITABLE (entry), &start_pos, &end_pos))
35 {
36 gint *ranges;
37 gint n_ranges, i;
38 PangoRectangle logical_rect;
39- GdkColor *selection_color, *text_color;
40 GtkBorder inner_border;
41+#ifdef USE_CAIRO_INTERNALLY
42+ GdkColor *selection_color, *text_color;
43+#else
44+ GdkGC *selection_gc, *text_gc;
45+ GdkRegion *clip_region;
46+#endif
47
48 pango_layout_get_pixel_extents (layout, NULL, &logical_rect);
49 gtk_entry_get_pixel_ranges (entry, &ranges, &n_ranges);
50
51+#ifdef USE_CAIRO_INTERNALLY
52 if (GTK_WIDGET_HAS_FOCUS (entry))
53 {
54 selection_color = &widget->style->base [GTK_STATE_SELECTED];
55@@ -3390,11 +3404,46 @@
56 cairo_move_to (cr, x, y);
57 gdk_cairo_set_source_color (cr, text_color);
58 pango_cairo_show_layout (cr, layout);
59-
60+#else
61+ if (GTK_WIDGET_HAS_FOCUS (entry))
62+ {
63+ selection_gc = widget->style->base_gc [GTK_STATE_SELECTED];
64+ text_gc = widget->style->text_gc [GTK_STATE_SELECTED];
65+ }
66+ else
67+ {
68+ selection_gc = widget->style->base_gc [GTK_STATE_ACTIVE];
69+ text_gc = widget->style->text_gc [GTK_STATE_ACTIVE];
70+ }
71+
72+ clip_region = gdk_region_new ();
73+ for (i = 0; i < n_ranges; ++i)
74+ {
75+ GdkRectangle rect;
76+
77+ rect.x = inner_border.left - entry->scroll_offset + ranges[2 * i];
78+ rect.y = y;
79+ rect.width = ranges[2 * i + 1];
80+ rect.height = logical_rect.height;
81+
82+ gdk_draw_rectangle (entry->text_area, selection_gc, TRUE,
83+ rect.x, rect.y, rect.width, rect.height);
84+
85+ gdk_region_union_with_rect (clip_region, &rect);
86+ }
87+
88+ gdk_gc_set_clip_region (text_gc, clip_region);
89+ gdk_draw_layout (entry->text_area, text_gc,
90+ x, y,
91+ layout);
92+ gdk_gc_set_clip_region (text_gc, NULL);
93+ gdk_region_destroy (clip_region);
94+#endif
95 g_free (ranges);
96 }
97-
98+#ifdef USE_CAIRO_INTERNALLY
99 cairo_destroy (cr);
100+#endif
101 }
102 }
103
diff --git a/meta/packages/gtk+/gtk+-2.11.6/gtk+-handhelds.patch b/meta/packages/gtk+/gtk+-2.11.6/gtk+-handhelds.patch
new file mode 100644
index 0000000000..1ea86ce6b2
--- /dev/null
+++ b/meta/packages/gtk+/gtk+-2.11.6/gtk+-handhelds.patch
@@ -0,0 +1,149 @@
1Index: gtk+-2.10.6/gtk/gtkarrow.c
2===================================================================
3--- gtk+-2.10.6.orig/gtk/gtkarrow.c 2006-05-14 05:25:28.000000000 +0100
4+++ gtk+-2.10.6/gtk/gtkarrow.c 2006-11-14 12:03:45.000000000 +0000
5@@ -31,7 +31,7 @@
6 #include "gtkintl.h"
7 #include "gtkalias.h"
8
9-#define MIN_ARROW_SIZE 15
10+#define MIN_ARROW_SIZE 7
11
12 enum {
13 PROP_0,
14@@ -53,6 +53,8 @@
15 guint prop_id,
16 GValue *value,
17 GParamSpec *pspec);
18+static void gtk_arrow_size_request (GtkWidget *arrow,
19+ GtkRequisition *requisition);
20
21
22 G_DEFINE_TYPE (GtkArrow, gtk_arrow, GTK_TYPE_MISC)
23@@ -88,6 +90,7 @@
24 GTK_PARAM_READWRITE));
25
26 widget_class->expose_event = gtk_arrow_expose;
27+ widget_class->size_request = gtk_arrow_size_request;
28 }
29
30 static void
31@@ -143,13 +146,18 @@
32 }
33
34 static void
35+gtk_arrow_size_request (GtkWidget *arrow,
36+ GtkRequisition *requisition)
37+{
38+ requisition->width = MIN_ARROW_SIZE + GTK_MISC (arrow)->xpad * 2;
39+ requisition->height = MIN_ARROW_SIZE + GTK_MISC (arrow)->ypad * 2;
40+}
41+
42+static void
43 gtk_arrow_init (GtkArrow *arrow)
44 {
45 GTK_WIDGET_SET_FLAGS (arrow, GTK_NO_WINDOW);
46
47- GTK_WIDGET (arrow)->requisition.width = MIN_ARROW_SIZE + GTK_MISC (arrow)->xpad * 2;
48- GTK_WIDGET (arrow)->requisition.height = MIN_ARROW_SIZE + GTK_MISC (arrow)->ypad * 2;
49-
50 arrow->arrow_type = GTK_ARROW_RIGHT;
51 arrow->shadow_type = GTK_SHADOW_OUT;
52 }
53Index: gtk+-2.10.6/gtk/gtkentry.c
54===================================================================
55--- gtk+-2.10.6.orig/gtk/gtkentry.c 2006-11-14 12:03:45.000000000 +0000
56+++ gtk+-2.10.6/gtk/gtkentry.c 2006-11-14 12:07:02.000000000 +0000
57@@ -577,6 +577,18 @@
58 0.0,
59 GTK_PARAM_READWRITE));
60
61+ // Added by gtk+-handhelds.patch
62+ gtk_widget_class_install_style_property (widget_class,
63+ g_param_spec_int ("min_width",
64+ P_("Minimum width"),
65+ P_("Minimum width of the entry field"),
66+ 0,
67+ G_MAXINT,
68+ MIN_ENTRY_WIDTH,
69+ G_PARAM_READABLE));
70+
71+
72+
73 /**
74 * GtkEntry:truncate-multiline:
75 *
76@@ -1286,7 +1298,7 @@
77 {
78 GtkEntry *entry = GTK_ENTRY (widget);
79 PangoFontMetrics *metrics;
80- gint xborder, yborder;
81+ gint xborder, yborder, min_width;
82 GtkBorder inner_border;
83 PangoContext *context;
84
85@@ -1302,8 +1314,10 @@
86 _gtk_entry_get_borders (entry, &xborder, &yborder);
87 _gtk_entry_effective_inner_border (entry, &inner_border);
88
89+ gtk_widget_style_get (widget, "min_width", &min_width, NULL);
90+
91 if (entry->width_chars < 0)
92- requisition->width = MIN_ENTRY_WIDTH + xborder * 2 + inner_border.left + inner_border.right;
93+ requisition->width = min_width + xborder * 2 + inner_border.left + inner_border.right;
94 else
95 {
96 gint char_width = pango_font_metrics_get_approximate_char_width (metrics);
97Index: gtk+-2.10.6/gtk/gtkrange.c
98===================================================================
99--- gtk+-2.10.6.orig/gtk/gtkrange.c 2006-11-14 12:03:44.000000000 +0000
100+++ gtk+-2.10.6/gtk/gtkrange.c 2006-11-14 12:07:40.000000000 +0000
101@@ -197,6 +197,7 @@
102 static gboolean gtk_range_key_press (GtkWidget *range,
103 GdkEventKey *event);
104
105+static GdkAtom recognize_protocols_atom, atom_atom;
106
107 static guint signals[LAST_SIGNAL];
108
109@@ -213,6 +214,9 @@
110 object_class = (GtkObjectClass*) class;
111 widget_class = (GtkWidgetClass*) class;
112
113+ recognize_protocols_atom = gdk_atom_intern ("RECOGNIZE_PROTOCOLS", FALSE);
114+ atom_atom = gdk_atom_intern ("ATOM", FALSE);
115+
116 gobject_class->set_property = gtk_range_set_property;
117 gobject_class->get_property = gtk_range_get_property;
118 gobject_class->finalize = gtk_range_finalize;
119@@ -1020,6 +1024,12 @@
120 &attributes, attributes_mask);
121 gdk_window_set_user_data (range->event_window, range);
122
123+ gdk_property_change (range->event_window,
124+ recognize_protocols_atom,
125+ atom_atom,
126+ 32, GDK_PROP_MODE_REPLACE,
127+ NULL, 0);
128+
129 widget->style = gtk_style_attach (widget->style, widget->window);
130 }
131
132@@ -1569,7 +1579,7 @@
133
134 /* ignore presses when we're already doing something else. */
135 if (range->layout->grab_location != MOUSE_OUTSIDE)
136- return FALSE;
137+ return TRUE;
138
139 range->layout->mouse_x = event->x;
140 range->layout->mouse_y = event->y;
141@@ -1778,7 +1788,7 @@
142 return TRUE;
143 }
144
145- return FALSE;
146+ return TRUE;
147 }
148
149 /**
diff --git a/meta/packages/gtk+/gtk+-2.11.6/gtklabel-resize-patch b/meta/packages/gtk+/gtk+-2.11.6/gtklabel-resize-patch
new file mode 100644
index 0000000000..df29656343
--- /dev/null
+++ b/meta/packages/gtk+/gtk+-2.11.6/gtklabel-resize-patch
@@ -0,0 +1,10 @@
1--- gtk+-2.4.3/gtk/gtklabel.c~ 2004-06-11 13:50:34.000000000 +0100
2+++ gtk+-2.4.3/gtk/gtklabel.c 2004-07-05 13:33:57.000000000 +0100
3@@ -1623,6 +1623,7 @@
4
5 /* We have to clear the layout, fonts etc. may have changed */
6 gtk_label_clear_layout (label);
7+ gtk_widget_queue_resize (GTK_WIDGET (label));
8 }
9
10 static void
diff --git a/meta/packages/gtk+/gtk+-2.11.6/hardcoded_libtool.patch b/meta/packages/gtk+/gtk+-2.11.6/hardcoded_libtool.patch
new file mode 100644
index 0000000000..6adb0cfef6
--- /dev/null
+++ b/meta/packages/gtk+/gtk+-2.11.6/hardcoded_libtool.patch
@@ -0,0 +1,29 @@
1--- /tmp/configure.in 2007-01-08 17:50:49.000000000 +0100
2+++ gtk+-2.10.7/configure.in 2007-01-08 17:52:33.495251000 +0100
3@@ -371,7 +371,7 @@
4 case $enable_explicit_deps in
5 auto)
6 export SED
7- deplibs_check_method=`(./libtool --config; echo 'eval echo $deplibs_check_method') | sh`
8+ deplibs_check_method=`(./$host_alias-libtool --config; echo 'eval echo $deplibs_check_method') | sh`
9 if test "x$deplibs_check_method" '!=' xpass_all || test "x$enable_static" = xyes ; then
10 enable_explicit_deps=yes
11 else
12@@ -773,7 +773,7 @@
13 dnl Now we check to see if our libtool supports shared lib deps
14 dnl (in a rather ugly way even)
15 if $dynworks; then
16- pixbuf_libtool_config="${CONFIG_SHELL-/bin/sh} ./libtool --config"
17+ pixbuf_libtool_config="${CONFIG_SHELL-/bin/sh} ./$host_alias-libtool --config"
18 pixbuf_deplibs_check=`$pixbuf_libtool_config | \
19 grep '^[[a-z_]]*check[[a-z_]]*_method=[['\''"]]' | \
20 sed 's/.*[['\''"]]\(.*\)[['\''"]]$/\1/'`
21@@ -1611,7 +1611,7 @@
22 # We are using gmodule-no-export now, but I'm leaving the stripping
23 # code in place for now, since pango and atk still require gmodule.
24 export SED
25-export_dynamic=`(./libtool --config; echo eval echo \\$export_dynamic_flag_spec) | sh`
26+export_dynamic=`(./$host_alias-libtool --config; echo eval echo \\$export_dynamic_flag_spec) | sh`
27 if test -n "$export_dynamic"; then
28 GDK_PIXBUF_DEP_LIBS=`echo $GDK_PIXBUF_DEP_LIBS | sed -e "s/$export_dynamic//"`
29 GDK_PIXBUF_XLIB_DEP_LIBS=`echo $GDK_PIXBUF_XLIB_DEP_LIBS | sed -e "s/$export_dynamic//"`
diff --git a/meta/packages/gtk+/gtk+-2.11.6/menu-deactivate.patch b/meta/packages/gtk+/gtk+-2.11.6/menu-deactivate.patch
new file mode 100644
index 0000000000..cfb8849e9f
--- /dev/null
+++ b/meta/packages/gtk+/gtk+-2.11.6/menu-deactivate.patch
@@ -0,0 +1,51 @@
1--- gtk+-2.10.0/gtk/gtkmenushell.c.orig 2006-07-05 17:17:34.000000000 +0200
2+++ gtk+-2.10.0/gtk/gtkmenushell.c 2006-07-05 17:19:01.000000000 +0200
3@@ -42,7 +42,7 @@
4 #include "gtkintl.h"
5 #include "gtkalias.h"
6
7-#define MENU_SHELL_TIMEOUT 500
8+#define MENU_SHELL_TIMEOUT 2000
9
10 #define PACK_DIRECTION(m) \
11 (GTK_IS_MENU_BAR (m) \
12@@ -203,6 +203,8 @@
13
14 G_DEFINE_TYPE (GtkMenuShell, gtk_menu_shell, GTK_TYPE_CONTAINER)
15
16+static int last_crossing_time;
17+
18 static void
19 gtk_menu_shell_class_init (GtkMenuShellClass *klass)
20 {
21@@ -517,6 +519,7 @@
22 gtk_grab_add (GTK_WIDGET (menu_shell));
23 menu_shell->have_grab = TRUE;
24 menu_shell->active = TRUE;
25+ last_crossing_time = 0;
26 }
27 }
28
29@@ -669,6 +672,13 @@
30 menu_shell->activate_time = 0;
31 deactivate = FALSE;
32 }
33+
34+ if (last_crossing_time != 0
35+ && ((event->time - last_crossing_time) < 500))
36+ {
37+ last_crossing_time = 0;
38+ deactivate = FALSE;
39+ }
40
41 if (deactivate)
42 {
43@@ -716,6 +726,8 @@
44 {
45 menu_item = gtk_get_event_widget ((GdkEvent*) event);
46
47+ last_crossing_time = event->time;
48+
49 if (!menu_item ||
50 (GTK_IS_MENU_ITEM (menu_item) &&
51 !_gtk_menu_item_is_selectable (menu_item)))
diff --git a/meta/packages/gtk+/gtk+-2.11.6/migration.patch b/meta/packages/gtk+/gtk+-2.11.6/migration.patch
new file mode 100644
index 0000000000..4ee786e688
--- /dev/null
+++ b/meta/packages/gtk+/gtk+-2.11.6/migration.patch
@@ -0,0 +1,611 @@
1Index: configure.in
2===================================================================
3--- configure.in.orig 2006-10-03 17:54:09.000000000 +0100
4+++ configure.in 2006-10-30 12:58:33.000000000 +0000
5@@ -1529,6 +1529,16 @@
6 GTK_EXTRA_CFLAGS="$msnative_struct"
7 fi
8
9+AC_ARG_ENABLE(display-migration,
10+ [AC_HELP_STRING([--enable-display-migration],
11+ [include support for GPE_CHANGE_DISPLAY protocol])],
12+ enable_migration=yes, enable_migration=no)
13+if test "$enable_migration" = "yes"; then
14+ AC_DEFINE([ENABLE_MIGRATION], 1, [Define if display migration is enabled])
15+ GTK_DEP_LIBS="$GTK_DEP_LIBS -lgcrypt"
16+fi
17+AM_CONDITIONAL(ENABLE_MIGRATION, test $enable_migration = "yes")
18+
19 AC_SUBST(GTK_PACKAGES)
20 AC_SUBST(GTK_EXTRA_LIBS)
21 AC_SUBST(GTK_EXTRA_CFLAGS)
22Index: gtk/Makefile.am
23===================================================================
24--- gtk/Makefile.am.orig 2006-10-02 18:27:53.000000000 +0100
25+++ gtk/Makefile.am 2006-10-30 12:59:14.000000000 +0000
26@@ -589,6 +589,11 @@
27 gtkwindow-decorate.c \
28 gtkwindow.c \
29 $(gtk_clipboard_dnd_c_sources)
30+
31+if ENABLE_MIGRATION
32+gtk_base_c_sources += gtkmigration.c
33+endif
34+
35 gtk_c_sources = $(gtk_base_c_sources)
36 gtk_all_c_sources = $(gtk_base_c_sources)
37
38Index: gtk/gtkmain.c
39===================================================================
40--- gtk/gtkmain.c.orig 2006-09-03 06:31:21.000000000 +0100
41+++ gtk/gtkmain.c 2006-10-30 12:56:34.000000000 +0000
42@@ -507,6 +507,10 @@
43 _gtk_accel_map_init ();
44 _gtk_rc_init ();
45
46+#ifdef ENABLE_MIGRATION
47+ gtk_migration_init ();
48+#endif
49+
50 /* Set the 'initialized' flag.
51 */
52 gtk_initialized = TRUE;
53Index: gtk/gtkmigration.c
54===================================================================
55--- /dev/null 1970-01-01 00:00:00.000000000 +0000
56+++ gtk/gtkmigration.c 2006-10-30 12:56:34.000000000 +0000
57@@ -0,0 +1,529 @@
58+/*
59+ * Copyright (C) 2003, 2005 Philip Blundell <philb@gnu.org>
60+ *
61+ * This program is free software; you can redistribute it and/or
62+ * modify it under the terms of the GNU General Public License
63+ * as published by the Free Software Foundation; either version
64+ * 2 of the License, or (at your option) any later version.
65+ */
66+
67+#include <stdlib.h>
68+#include <ctype.h>
69+#include <libintl.h>
70+#include <string.h>
71+#include <assert.h>
72+
73+#include <X11/X.h>
74+#include <X11/Xlib.h>
75+#include <X11/Xatom.h>
76+
77+#include <gcrypt.h>
78+
79+#include "gtk.h"
80+#include "gdk.h"
81+#include "x11/gdkx.h"
82+
83+#define _(x) gettext(x)
84+
85+static GdkAtom string_gdkatom, display_change_gdkatom;
86+static GdkAtom rsa_challenge_gdkatom;
87+
88+#define DISPLAY_CHANGE_SUCCESS 0
89+#define DISPLAY_CHANGE_UNABLE_TO_CONNECT 1
90+#define DISPLAY_CHANGE_NO_SUCH_SCREEN 2
91+#define DISPLAY_CHANGE_AUTHENTICATION_BAD 3
92+#define DISPLAY_CHANGE_INDETERMINATE_ERROR 4
93+
94+static gboolean no_auth;
95+
96+static GSList *all_widgets;
97+
98+static gboolean gtk_migration_initialised;
99+
100+#define CHALLENGE_LEN 64
101+
102+gchar *gtk_migration_auth_challenge_string;
103+
104+static unsigned char challenge_bytes[CHALLENGE_LEN];
105+static unsigned long challenge_seq;
106+
107+#define hexbyte(x) ((x) >= 10 ? (x) + 'a' - 10 : (x) + '0')
108+
109+struct rsa_key
110+{
111+ gcry_mpi_t n, e, d, p, q, u;
112+};
113+
114+static gcry_mpi_t
115+mpi_from_sexp (gcry_sexp_t r, char *tag)
116+{
117+ gcry_sexp_t s = gcry_sexp_find_token (r, tag, 0);
118+ return gcry_sexp_nth_mpi (s, 1, GCRYMPI_FMT_USG);
119+}
120+
121+static char *
122+hex_from_mpi (gcry_mpi_t m)
123+{
124+ char *buf;
125+ gcry_mpi_aprint (GCRYMPI_FMT_HEX, (void *)&buf, NULL, m);
126+ return buf;
127+}
128+
129+static void
130+gtk_migration_crypt_create_hash (char *display, char *challenge, size_t len, char *result)
131+{
132+ size_t dlen = strlen (display);
133+ gchar *buf = g_malloc (dlen + 1 + len);
134+ strcpy (buf, display);
135+ memcpy (buf + dlen + 1, challenge, len);
136+ gcry_md_hash_buffer (GCRY_MD_SHA1, result, buf, len + dlen + 1);
137+ g_free (buf);
138+}
139+
140+static int
141+do_encode_md (const unsigned char *digest, size_t digestlen, int algo,
142+ unsigned int nbits, gcry_mpi_t *r_val)
143+{
144+ int nframe = (nbits+7) / 8;
145+ unsigned char *frame;
146+ int i, n;
147+ unsigned char asn[100];
148+ size_t asnlen;
149+
150+ asnlen = sizeof(asn);
151+ if (gcry_md_algo_info (algo, GCRYCTL_GET_ASNOID, asn, &asnlen))
152+ return -1;
153+
154+ if (digestlen + asnlen + 4 > nframe )
155+ return -1;
156+
157+ /* We encode the MD in this way:
158+ *
159+ * 0 1 PAD(n bytes) 0 ASN(asnlen bytes) MD(len bytes)
160+ *
161+ * PAD consists of FF bytes.
162+ */
163+ frame = g_malloc (nframe);
164+ n = 0;
165+ frame[n++] = 0;
166+ frame[n++] = 1; /* block type */
167+ i = nframe - digestlen - asnlen -3 ;
168+ assert ( i > 1 );
169+ memset ( frame+n, 0xff, i ); n += i;
170+ frame[n++] = 0;
171+ memcpy ( frame+n, asn, asnlen ); n += asnlen;
172+ memcpy ( frame+n, digest, digestlen ); n += digestlen;
173+ assert ( n == nframe );
174+
175+ gcry_mpi_scan (r_val, GCRYMPI_FMT_USG, frame, nframe, &nframe);
176+ g_free (frame);
177+ return 0;
178+}
179+
180+static gboolean
181+gtk_migration_crypt_check_signature (struct rsa_key *k, char *hash, char *sigbuf)
182+{
183+ gcry_mpi_t mpi, mpi2;
184+ gcry_sexp_t data, sig, key;
185+ int rc;
186+
187+ do_encode_md (hash, 20, GCRY_MD_SHA1, 1024, &mpi);
188+
189+ gcry_sexp_build (&data, NULL, "(data (value %m))", mpi);
190+
191+ gcry_mpi_release (mpi);
192+
193+ gcry_sexp_build (&key, NULL, "(public-key (rsa (n %m) (e %m)))", k->n, k->e);
194+
195+ if (gcry_mpi_scan (&mpi2, GCRYMPI_FMT_HEX, sigbuf, 0, NULL))
196+ {
197+ gcry_sexp_release (data);
198+ return FALSE;
199+ }
200+
201+ gcry_sexp_build (&sig, NULL, "(sig-val (rsa (s %m)))", mpi2);
202+
203+ rc = gcry_pk_verify (sig, data, key);
204+
205+ gcry_sexp_release (data);
206+ gcry_sexp_release (key);
207+ gcry_sexp_release (sig);
208+ gcry_mpi_release (mpi2);
209+
210+ if (rc)
211+ return FALSE;
212+
213+ return TRUE;
214+}
215+
216+static void
217+gtk_migration_auth_update_challenge (void)
218+{
219+ int i;
220+ unsigned char *p;
221+
222+ if (gtk_migration_auth_challenge_string == NULL)
223+ gtk_migration_auth_challenge_string = g_malloc ((CHALLENGE_LEN * 2) + 9);
224+
225+ p = gtk_migration_auth_challenge_string;
226+
227+ for (i = 0; i < CHALLENGE_LEN; i++)
228+ {
229+ *p++ = hexbyte (challenge_bytes[i] >> 4);
230+ *p++ = hexbyte (challenge_bytes[i] & 15);
231+ }
232+
233+ sprintf (p, "%08lx", challenge_seq++);
234+}
235+
236+static void
237+gtk_migration_auth_generate_challenge (void)
238+{
239+ gcry_randomize (challenge_bytes, sizeof (challenge_bytes), GCRY_STRONG_RANDOM);
240+ gtk_migration_auth_update_challenge ();
241+}
242+
243+static struct rsa_key *
244+parse_pubkey (char *s)
245+{
246+ struct rsa_key *r;
247+ gcry_mpi_t n, e;
248+ gchar *sp;
249+
250+ sp = strtok (s, " \n");
251+ gcry_mpi_scan (&e, GCRYMPI_FMT_HEX, sp, 0, NULL);
252+ sp = strtok (NULL, " \n");
253+ gcry_mpi_scan (&n, GCRYMPI_FMT_HEX, sp, 0, NULL);
254+
255+ r = g_malloc0 (sizeof (struct rsa_key));
256+ r->e = e;
257+ r->n = n;
258+ return r;
259+}
260+
261+static struct rsa_key *
262+lookup_pubkey (u_int32_t id)
263+{
264+ const gchar *home_dir = g_get_home_dir ();
265+ gchar *filename = g_strdup_printf ("%s/.gpe/migrate/public", home_dir);
266+ FILE *fp = fopen (filename, "r");
267+ struct rsa_key *r = NULL;
268+
269+ if (fp)
270+ {
271+ while (!feof (fp))
272+ {
273+ char buffer[4096];
274+ if (fgets (buffer, 4096, fp))
275+ {
276+ char *p;
277+ u_int32_t this_id = strtoul (buffer, &p, 16);
278+ if (p != buffer && *p == ' ')
279+ {
280+#ifdef DEBUG
281+ fprintf (stderr, "found id %x\n", this_id);
282+#endif
283+ if (this_id == id)
284+ {
285+ r = parse_pubkey (++p);
286+ break;
287+ }
288+ }
289+ }
290+ }
291+ fclose (fp);
292+ }
293+
294+ g_free (filename);
295+ return r;
296+}
297+
298+static void
299+free_pubkey (struct rsa_key *k)
300+{
301+ gcry_mpi_release (k->n);
302+ gcry_mpi_release (k->e);
303+
304+ g_free (k);
305+}
306+
307+static gboolean
308+gtk_migration_auth_validate_request (char *display, char *data)
309+{
310+ u_int32_t key_id;
311+ char *ep;
312+ char *p;
313+ struct rsa_key *k;
314+ char hash[20];
315+ gboolean rc;
316+
317+ p = strchr (data, ' ');
318+ if (p == NULL)
319+ return FALSE;
320+ *p++ = 0;
321+
322+ key_id = strtoul (data, &ep, 16);
323+ if (*ep)
324+ return FALSE;
325+
326+ k = lookup_pubkey (key_id);
327+ if (k == NULL)
328+ return FALSE;
329+
330+ gtk_migration_crypt_create_hash (display, gtk_migration_auth_challenge_string,
331+ strlen (gtk_migration_auth_challenge_string), hash);
332+
333+ rc = gtk_migration_crypt_check_signature (k, hash, p);
334+
335+ free_pubkey (k);
336+
337+ return rc;
338+}
339+
340+static int
341+do_change_display (GtkWidget *w, char *display_name)
342+{
343+ GdkDisplay *newdisplay;
344+ guint screen_nr = 1;
345+ guint i;
346+
347+ if (display_name[0] == 0)
348+ return DISPLAY_CHANGE_INDETERMINATE_ERROR;
349+
350+ i = strlen (display_name) - 1;
351+ while (i > 0 && isdigit (display_name[i]))
352+ i--;
353+
354+ if (display_name[i] == '.')
355+ {
356+ screen_nr = atoi (display_name + i + 1);
357+ display_name[i] = 0;
358+ }
359+
360+ newdisplay = gdk_display_open (display_name);
361+ if (newdisplay)
362+ {
363+ GdkScreen *screen = gdk_display_get_screen (newdisplay, screen_nr);
364+ if (screen)
365+ {
366+ gtk_window_set_screen (GTK_WINDOW (w), screen);
367+ gdk_display_manager_set_default_display (gdk_display_manager_get (),
368+ newdisplay);
369+ return DISPLAY_CHANGE_SUCCESS;
370+ }
371+ else
372+ return DISPLAY_CHANGE_NO_SUCH_SCREEN;
373+ }
374+
375+ return DISPLAY_CHANGE_UNABLE_TO_CONNECT;
376+}
377+
378+static void
379+set_challenge_on_window (GdkWindow *window)
380+{
381+ gdk_property_change (window, rsa_challenge_gdkatom, string_gdkatom,
382+ 8, GDK_PROP_MODE_REPLACE, gtk_migration_auth_challenge_string,
383+ strlen (gtk_migration_auth_challenge_string));
384+}
385+
386+static void
387+update_challenge_on_windows (void)
388+{
389+ GSList *i;
390+
391+ gtk_migration_auth_update_challenge ();
392+
393+ for (i = all_widgets; i; i = i->next)
394+ {
395+ GtkWidget *w = GTK_WIDGET (i->data);
396+ if (w->window)
397+ set_challenge_on_window (w->window);
398+ }
399+}
400+
401+static void
402+reset_state (GdkWindow *window)
403+{
404+ gdk_property_change (window, display_change_gdkatom, string_gdkatom,
405+ 8, GDK_PROP_MODE_REPLACE, NULL, 0);
406+}
407+
408+static void
409+generate_response (GdkDisplay *gdisplay, Display *dpy, Window window, int code)
410+{
411+ XClientMessageEvent ev;
412+ Atom atom = gdk_x11_atom_to_xatom_for_display (gdisplay,
413+ display_change_gdkatom);
414+
415+ memset (&ev, 0, sizeof (ev));
416+
417+ ev.type = ClientMessage;
418+ ev.window = window;
419+ ev.message_type = atom;
420+ ev.format = 32;
421+
422+ ev.data.l[0] = window;
423+ ev.data.l[1] = code;
424+
425+ XSendEvent (dpy, DefaultRootWindow (dpy), False, SubstructureNotifyMask, (XEvent *)&ev);
426+}
427+
428+static int
429+handle_request (GdkWindow *gwindow, char *prop)
430+{
431+ GtkWidget *widget;
432+ char *target, *auth_method, *auth_data;
433+ char *p;
434+
435+ target = prop;
436+ auth_method = "NULL";
437+ auth_data = NULL;
438+
439+ p = strchr (prop, ' ');
440+ if (p)
441+ {
442+ *p = 0;
443+ auth_method = ++p;
444+
445+ p = strchr (p, ' ');
446+ if (p)
447+ {
448+ *p = 0;
449+ auth_data = ++p;
450+ }
451+ }
452+
453+ if (no_auth == FALSE)
454+ {
455+ if (!strcasecmp (auth_method, "null"))
456+ return DISPLAY_CHANGE_AUTHENTICATION_BAD;
457+ else if (!strcasecmp (auth_method, "rsa-sig"))
458+ {
459+ if (gtk_migration_auth_validate_request (target, auth_data) == FALSE)
460+ return DISPLAY_CHANGE_AUTHENTICATION_BAD;
461+ }
462+ else
463+ return DISPLAY_CHANGE_AUTHENTICATION_BAD;
464+ }
465+
466+ gdk_window_get_user_data (gwindow, (gpointer*) &widget);
467+
468+ if (widget)
469+ return do_change_display (widget, target);
470+
471+ return DISPLAY_CHANGE_INDETERMINATE_ERROR;
472+}
473+
474+static GdkFilterReturn
475+filter_func (GdkXEvent *xevp, GdkEvent *ev, gpointer p)
476+{
477+ XPropertyEvent *xev = (XPropertyEvent *)xevp;
478+
479+ if (xev->type == PropertyNotify)
480+ {
481+ GdkDisplay *gdisplay;
482+ Atom atom;
483+
484+ gdisplay = gdk_x11_lookup_xdisplay (xev->display);
485+ if (gdisplay)
486+ {
487+ atom = gdk_x11_atom_to_xatom_for_display (gdisplay, display_change_gdkatom);
488+
489+ if (xev->atom == atom)
490+ {
491+ GdkWindow *gwindow;
492+
493+ gwindow = gdk_window_lookup_for_display (gdisplay, xev->window);
494+
495+ if (gwindow)
496+ {
497+ GdkAtom actual_type;
498+ gint actual_format;
499+ gint actual_length;
500+ unsigned char *prop = NULL;
501+
502+ if (gdk_property_get (gwindow, display_change_gdkatom, string_gdkatom,
503+ 0, G_MAXLONG, FALSE, &actual_type, &actual_format,
504+ &actual_length, &prop))
505+ {
506+ if (actual_length != 0)
507+ {
508+ if (actual_type == string_gdkatom && actual_length > 8)
509+ {
510+ gchar *buf = g_malloc (actual_length + 1);
511+ int rc;
512+
513+ memcpy (buf, prop, actual_length);
514+ buf[actual_length] = 0;
515+
516+ rc = handle_request (gwindow, buf);
517+
518+ g_free (buf);
519+ generate_response (gdisplay, xev->display, xev->window, rc);
520+
521+ if (rc == DISPLAY_CHANGE_SUCCESS)
522+ update_challenge_on_windows ();
523+ }
524+
525+ reset_state (gwindow);
526+ }
527+ }
528+
529+ if (prop)
530+ g_free (prop);
531+ }
532+ }
533+
534+ return GDK_FILTER_REMOVE;
535+ }
536+ }
537+
538+ return GDK_FILTER_CONTINUE;
539+}
540+
541+static void
542+unrealize_window (GtkWidget *w)
543+{
544+ all_widgets = g_slist_remove (all_widgets, w);
545+}
546+
547+void
548+gtk_migration_mark_window (GtkWidget *w)
549+{
550+ if (! gtk_migration_initialised)
551+ {
552+ g_warning ("gtk_migration not initialised yet");
553+ return;
554+ }
555+
556+ if (GTK_WIDGET_REALIZED (w))
557+ {
558+ GdkWindow *window = w->window;
559+
560+ gdk_window_add_filter (window, filter_func, NULL);
561+
562+ reset_state (window);
563+ set_challenge_on_window (window);
564+
565+ all_widgets = g_slist_append (all_widgets, w);
566+
567+ g_signal_connect (G_OBJECT (w), "unrealize", G_CALLBACK (unrealize_window), NULL);
568+ }
569+ else
570+ g_signal_connect (G_OBJECT (w), "realize", G_CALLBACK (gtk_migration_mark_window), NULL);
571+}
572+
573+void
574+gtk_migration_init (void)
575+{
576+ if (getenv ("GPE_DISPLAY_MIGRATION_NO_AUTH") != NULL)
577+ no_auth = TRUE;
578+
579+ string_gdkatom = gdk_atom_intern ("STRING", FALSE);
580+ display_change_gdkatom = gdk_atom_intern ("_GPE_DISPLAY_CHANGE", FALSE);
581+ rsa_challenge_gdkatom = gdk_atom_intern ("_GPE_DISPLAY_CHANGE_RSA_CHALLENGE", FALSE);
582+
583+ gtk_migration_auth_generate_challenge ();
584+
585+ gtk_migration_initialised = TRUE;
586+}
587Index: gtk/gtkwindow.c
588===================================================================
589--- gtk/gtkwindow.c.orig 2006-10-03 16:51:46.000000000 +0100
590+++ gtk/gtkwindow.c 2006-10-30 12:56:34.000000000 +0000
591@@ -50,6 +50,9 @@
592 #include "x11/gdkx.h"
593 #endif
594
595+extern void gtk_migration_mark_window (GtkWidget *w);
596+
597+
598 enum {
599 SET_FOCUS,
600 FRAME_EVENT,
601@@ -823,6 +826,10 @@
602
603 g_signal_connect (window->screen, "composited_changed",
604 G_CALLBACK (gtk_window_on_composited_changed), window);
605+
606+#ifdef ENABLE_MIGRATION
607+ gtk_migration_mark_window (window);
608+#endif
609 }
610
611 static void
diff --git a/meta/packages/gtk+/gtk+-2.11.6/no-demos.patch b/meta/packages/gtk+/gtk+-2.11.6/no-demos.patch
new file mode 100644
index 0000000000..0fc4c48d1a
--- /dev/null
+++ b/meta/packages/gtk+/gtk+-2.11.6/no-demos.patch
@@ -0,0 +1,10 @@
1--- gtk+-2.10.1/Makefile.am.orig 2006-08-08 12:37:30.000000000 +0100
2+++ gtk+-2.10.1/Makefile.am 2006-08-08 12:37:48.000000000 +0100
3@@ -1,6 +1,6 @@
4 ## Makefile.am for GTK+
5
6-SRC_SUBDIRS = gdk-pixbuf gdk gtk modules demos tests perf contrib
7+SRC_SUBDIRS = gdk-pixbuf gdk gtk modules tests perf contrib
8 SUBDIRS = po po-properties $(SRC_SUBDIRS) docs m4macros
9
10 # require automake 1.4
diff --git a/meta/packages/gtk+/gtk+-2.11.6/no-xwc.patch b/meta/packages/gtk+/gtk+-2.11.6/no-xwc.patch
new file mode 100644
index 0000000000..affb4a303e
--- /dev/null
+++ b/meta/packages/gtk+/gtk+-2.11.6/no-xwc.patch
@@ -0,0 +1,151 @@
1diff -urNd ../gtk+-2.6.0-r2/gtk+-2.6.0/gdk/x11/gdkdrawable-x11.c gtk+-2.6.0/gdk/x11/gdkdrawable-x11.c
2--- ../gtk+-2.6.0-r2/gtk+-2.6.0/gdk/x11/gdkdrawable-x11.c 2004-11-30 14:57:14 +00:00
3+++ gtk+-2.6.0/gdk/x11/gdkdrawable-x11.c 2005-01-02 15:38:06 +00:00
4@@ -576,12 +576,14 @@
5 GDK_GC_GET_XGC (gc), x, y, (XChar2b *) text, text_length / 2);
6 }
7 }
8+#ifdef HAVE_XWC
9 else if (font->type == GDK_FONT_FONTSET)
10 {
11 XFontSet fontset = (XFontSet) GDK_FONT_XFONT (font);
12 XmbDrawString (xdisplay, impl->xid,
13 fontset, GDK_GC_GET_XGC (gc), x, y, text, text_length);
14 }
15+#endif
16 else
17 g_error("undefined font type\n");
18 }
19@@ -613,6 +615,7 @@
20 GDK_GC_GET_XGC (gc), x, y, text_8bit, text_length);
21 g_free (text_8bit);
22 }
23+#ifdef HAVE_XWC
24 else if (font->type == GDK_FONT_FONTSET)
25 {
26 if (sizeof(GdkWChar) == sizeof(wchar_t))
27@@ -633,6 +636,7 @@
28 g_free (text_wchar);
29 }
30 }
31+#endif
32 else
33 g_error("undefined font type\n");
34 }
35diff -urNd ../gtk+-2.6.0-r2/gtk+-2.6.0/gdk/x11/gdkfont-x11.c gtk+-2.6.0/gdk/x11/gdkfont-x11.c
36--- ../gtk+-2.6.0-r2/gtk+-2.6.0/gdk/x11/gdkfont-x11.c 2004-08-26 01:23:46 +01:00
37+++ gtk+-2.6.0/gdk/x11/gdkfont-x11.c 2005-01-02 15:45:39 +00:00
38@@ -525,10 +525,12 @@
39 width = XTextWidth16 (xfont, (XChar2b *) text, text_length / 2);
40 }
41 break;
42+#ifdef HAVE_XWC
43 case GDK_FONT_FONTSET:
44 fontset = (XFontSet) private->xfont;
45 width = XmbTextEscapement (fontset, text, text_length);
46 break;
47+#endif
48 default:
49 width = 0;
50 }
51@@ -578,6 +580,7 @@
52 width = 0;
53 }
54 break;
55+#ifdef HAVE_XWC
56 case GDK_FONT_FONTSET:
57 if (sizeof(GdkWChar) == sizeof(wchar_t))
58 {
59@@ -595,6 +598,7 @@
60 g_free (text_wchar);
61 }
62 break;
63+#endif
64 default:
65 width = 0;
66 }
67@@ -667,6 +671,7 @@
68 if (descent)
69 *descent = overall.descent;
70 break;
71+#ifdef HAVE_XWC
72 case GDK_FONT_FONTSET:
73 fontset = (XFontSet) private->xfont;
74 XmbTextExtents (fontset, text, text_length, &ink, &logical);
75@@ -681,6 +686,7 @@
76 if (descent)
77 *descent = ink.y + ink.height;
78 break;
79+#endif
80 }
81
82 }
83@@ -753,6 +759,7 @@
84 *descent = overall.descent;
85 break;
86 }
87+#ifdef HAVE_XWC
88 case GDK_FONT_FONTSET:
89 fontset = (XFontSet) private->xfont;
90
91@@ -780,6 +787,7 @@
92 if (descent)
93 *descent = ink.y + ink.height;
94 break;
95+#endif
96 }
97
98 }
99diff -urNd ../gtk+-2.6.0-r2/gtk+-2.6.0/gdk/x11/gdkim-x11.c gtk+-2.6.0/gdk/x11/gdkim-x11.c
100--- ../gtk+-2.6.0-r2/gtk+-2.6.0/gdk/x11/gdkim-x11.c 2004-11-17 00:55:10 +00:00
101+++ gtk+-2.6.0/gdk/x11/gdkim-x11.c 2005-01-02 15:42:04 +00:00
102@@ -48,6 +48,7 @@
103 void
104 _gdk_x11_initialize_locale (void)
105 {
106+#ifdef HAVE_XWC
107 wchar_t result;
108 gchar *current_locale;
109 static char *last_locale = NULL;
110@@ -93,7 +94,8 @@
111 GDK_NOTE (XIM,
112 g_message ("%s multi-byte string functions.",
113 gdk_use_mb ? "Using" : "Not using"));
114-
115+#endif
116+
117 return;
118 }
119
120@@ -136,6 +138,7 @@
121 {
122 gchar *mbstr;
123
124+#ifdef HAVE_XWC
125 if (gdk_use_mb)
126 {
127 GdkDisplay *display = find_a_display ();
128@@ -178,6 +181,7 @@
129 XFree (tpr.value);
130 }
131 else
132+#endif
133 {
134 gint length = 0;
135 gint i;
136@@ -210,6 +214,7 @@
137 gint
138 gdk_mbstowcs (GdkWChar *dest, const gchar *src, gint dest_max)
139 {
140+#ifdef HAVE_XWC
141 if (gdk_use_mb)
142 {
143 GdkDisplay *display = find_a_display ();
144@@ -242,6 +247,7 @@
145 return len_cpy;
146 }
147 else
148+#endif
149 {
150 gint i;
151
diff --git a/meta/packages/gtk+/gtk+-2.11.6/pangoxft2.10.6.diff b/meta/packages/gtk+/gtk+-2.11.6/pangoxft2.10.6.diff
new file mode 100644
index 0000000000..63828cec63
--- /dev/null
+++ b/meta/packages/gtk+/gtk+-2.11.6/pangoxft2.10.6.diff
@@ -0,0 +1,2456 @@
1http://mail.gnome.org/archives/performance-list/2006-October/msg00063.html
2
3From: Xan Lópe
4To: ext Matt Hoosier
5Cc: performance-list gnome org
6Subject: Re: [patch] Remove pangocairo from Gtk+ 2.8.20
7Date: Mon, 30 Oct 2006 14:31:56 +0200
8Hi,
9
10I've upgraded your patch against GTK+ 2.10.6, and we are getting great
11performance figures compared to GTK+ 2.10.6 with pangocairo too
12(basically at the level of GTK+ 2.6.10 again). Right now I'm working on
13a python/cairo script to get some nice graphics from a torture test
14session with several GTK+s, hope to get it ready soon.
15
16Index: gtk+-2.10.6/configure.in
17===================================================================
18--- gtk+-2.10.6.orig/configure.in 2006-10-30 12:59:28.000000000 +0000
19+++ gtk+-2.10.6/configure.in 2006-10-30 12:59:30.000000000 +0000
20@@ -1435,7 +1435,7 @@
21 if test "x$gdktarget" = "xwin32"; then
22 PANGO_PACKAGES="pangowin32 pangocairo"
23 else
24- PANGO_PACKAGES="pango pangocairo"
25+ PANGO_PACKAGES="pango pangocairo pangoxft"
26 fi
27
28 AC_MSG_CHECKING(Pango flags)
29Index: gtk+-2.10.6/gdk/gdkaliasdef.c
30===================================================================
31--- gtk+-2.10.6.orig/gdk/gdkaliasdef.c 2006-10-30 12:58:29.000000000 +0000
32+++ gtk+-2.10.6/gdk/gdkaliasdef.c 2006-10-30 12:59:30.000000000 +0000
33@@ -1799,9 +1799,6 @@
34 #undef gdk_pango_context_get
35 extern __typeof (gdk_pango_context_get) gdk_pango_context_get __attribute((alias("IA__gdk_pango_context_get"), visibility("default")));
36
37-#undef gdk_pango_context_get_for_screen
38-extern __typeof (gdk_pango_context_get_for_screen) gdk_pango_context_get_for_screen __attribute((alias("IA__gdk_pango_context_get_for_screen"), visibility("default")));
39-
40 #ifndef GDK_DISABLE_DEPRECATED
41 #undef gdk_pango_context_set_colormap
42 extern __typeof (gdk_pango_context_set_colormap) gdk_pango_context_set_colormap __attribute((alias("IA__gdk_pango_context_set_colormap"), visibility("default")));
43@@ -1836,6 +1833,13 @@
44
45 #endif
46 #endif
47+#if IN_HEADER(__GDK_PANGO_H__)
48+#if IN_FILE(__GDK_PANGO_X11_C__)
49+#undef gdk_pango_context_get_for_screen
50+extern __typeof (gdk_pango_context_get_for_screen) gdk_pango_context_get_for_screen __attribute((alias("IA__gdk_pango_context_get_for_screen"), visibility("default")));
51+
52+#endif
53+#endif
54 #if IN_HEADER(__GDK_PIXBUF_H__)
55 #if IN_FILE(__GDK_PIXBUF_DRAWABLE_C__)
56 #undef gdk_pixbuf_get_from_drawable
57Index: gtk+-2.10.6/gdk/gdkalias.h
58===================================================================
59--- gtk+-2.10.6.orig/gdk/gdkalias.h 2006-10-30 12:58:29.000000000 +0000
60+++ gtk+-2.10.6/gdk/gdkalias.h 2006-10-30 12:59:30.000000000 +0000
61@@ -1796,9 +1796,6 @@
62 extern __typeof (gdk_pango_context_get) IA__gdk_pango_context_get __attribute((visibility("hidden")));
63 #define gdk_pango_context_get IA__gdk_pango_context_get
64
65-extern __typeof (gdk_pango_context_get_for_screen) IA__gdk_pango_context_get_for_screen __attribute((visibility("hidden")));
66-#define gdk_pango_context_get_for_screen IA__gdk_pango_context_get_for_screen
67-
68 #ifndef GDK_DISABLE_DEPRECATED
69 extern __typeof (gdk_pango_context_set_colormap) IA__gdk_pango_context_set_colormap __attribute((visibility("hidden")));
70 #define gdk_pango_context_set_colormap IA__gdk_pango_context_set_colormap
71@@ -1833,6 +1830,13 @@
72
73 #endif
74 #endif
75+#if IN_HEADER(__GDK_PANGO_H__)
76+#if IN_FILE(__GDK_PANGO_X11_C__)
77+extern __typeof (gdk_pango_context_get_for_screen) IA__gdk_pango_context_get_for_screen __attribute((visibility("hidden")));
78+#define gdk_pango_context_get_for_screen IA__gdk_pango_context_get_for_screen
79+
80+#endif
81+#endif
82 #if IN_HEADER(__GDK_PIXBUF_H__)
83 #if IN_FILE(__GDK_PIXBUF_DRAWABLE_C__)
84 extern __typeof (gdk_pixbuf_get_from_drawable) IA__gdk_pixbuf_get_from_drawable __attribute((visibility("hidden")));
85Index: gtk+-2.10.6/gdk/gdkdraw.c
86===================================================================
87--- gtk+-2.10.6.orig/gdk/gdkdraw.c 2006-10-30 12:58:29.000000000 +0000
88+++ gtk+-2.10.6/gdk/gdkdraw.c 2006-10-30 12:59:30.000000000 +0000
89@@ -909,9 +909,9 @@
90 {
91 g_return_if_fail (GDK_IS_DRAWABLE (drawable));
92 g_return_if_fail (GDK_IS_GC (gc));
93-
94- real_draw_glyphs (drawable, gc, NULL, font,
95- x, y, glyphs);
96+
97+
98+ GDK_DRAWABLE_GET_CLASS (drawable)->draw_glyphs (drawable, gc, font, x, y, glyphs);
99 }
100
101 /**
102@@ -949,8 +949,9 @@
103 g_return_if_fail (GDK_IS_DRAWABLE (drawable));
104 g_return_if_fail (GDK_IS_GC (gc));
105
106- real_draw_glyphs (drawable, gc, matrix, font,
107- x / PANGO_SCALE, y / PANGO_SCALE, glyphs);
108+ if (GDK_DRAWABLE_GET_CLASS (drawable)->draw_glyphs_transformed)
109+ GDK_DRAWABLE_GET_CLASS (drawable)->draw_glyphs_transformed (drawable, gc, matrix,
110+ font, x, y, glyphs);
111 }
112
113 /**
114@@ -974,28 +975,12 @@
115 GdkTrapezoid *trapezoids,
116 gint n_trapezoids)
117 {
118- cairo_t *cr;
119- int i;
120-
121 g_return_if_fail (GDK_IS_DRAWABLE (drawable));
122 g_return_if_fail (GDK_IS_GC (gc));
123 g_return_if_fail (n_trapezoids == 0 || trapezoids != NULL);
124
125- cr = gdk_cairo_create (drawable);
126- _gdk_gc_update_context (gc, cr, NULL, NULL, TRUE);
127-
128- for (i = 0; i < n_trapezoids; i++)
129- {
130- cairo_move_to (cr, trapezoids[i].x11, trapezoids[i].y1);
131- cairo_line_to (cr, trapezoids[i].x21, trapezoids[i].y1);
132- cairo_line_to (cr, trapezoids[i].x22, trapezoids[i].y2);
133- cairo_line_to (cr, trapezoids[i].x21, trapezoids[i].y2);
134- cairo_close_path (cr);
135- }
136-
137- cairo_fill (cr);
138-
139- cairo_destroy (cr);
140+ GDK_DRAWABLE_GET_CLASS (drawable)->draw_trapezoids (drawable, gc,
141+ trapezoids, n_trapezoids);
142 }
143
144 /**
145Index: gtk+-2.10.6/gdk/gdkpango.c
146===================================================================
147--- gtk+-2.10.6.orig/gdk/gdkpango.c 2006-10-30 12:58:29.000000000 +0000
148+++ gtk+-2.10.6/gdk/gdkpango.c 2006-10-30 12:59:30.000000000 +0000
149@@ -50,19 +50,34 @@
150 GdkBitmap *stipple[MAX_RENDER_PART + 1];
151 gboolean embossed;
152
153- cairo_t *cr;
154- PangoRenderPart last_part;
155+ /* When switching between the normal and shadow copies when
156+ * drawing shadows we can get unexpected recursion into the
157+ * drawing functions; the 'in_emboss' flag guards against that.
158+ */
159+ gboolean in_emboss;
160
161 /* Current target */
162 GdkDrawable *drawable;
163 GdkGC *base_gc;
164
165 gboolean gc_changed;
166+
167+ /* Cached GC, derived from base_gc */
168+ GdkGC *gc;
169+ PangoColor gc_color;
170+ gboolean gc_color_set;
171+ GdkBitmap *gc_stipple;
172+
173+ /* we accumulate trapezoids for the same PangoRenderPart */
174+ GArray *trapezoids;
175+ PangoRenderPart trapezoid_part;
176 };
177
178 static PangoAttrType gdk_pango_attr_stipple_type;
179 static PangoAttrType gdk_pango_attr_embossed_type;
180
181+static void flush_trapezoids (GdkPangoRenderer *gdk_renderer);
182+
183 enum {
184 PROP_0,
185 PROP_SCREEN
186@@ -77,6 +92,10 @@
187 GdkPangoRendererPrivate *priv = gdk_renderer->priv;
188 int i;
189
190+ if (priv->gc)
191+ g_object_unref (priv->gc);
192+ if (priv->gc_stipple)
193+ g_object_unref (priv->gc_stipple);
194 if (priv->base_gc)
195 g_object_unref (priv->base_gc);
196 if (priv->drawable)
197@@ -86,6 +105,8 @@
198 if (priv->stipple[i])
199 g_object_unref (priv->stipple[i]);
200
201+ g_array_free (priv->trapezoids, TRUE);
202+
203 G_OBJECT_CLASS (gdk_pango_renderer_parent_class)->finalize (object);
204 }
205
206@@ -112,25 +133,6 @@
207 return object;
208 }
209
210-/* Adjusts matrix and color for the renderer to draw the secondary
211- * "shadow" copy for embossed text */
212-static void
213-emboss_context (cairo_t *cr)
214-{
215- cairo_matrix_t tmp_matrix;
216-
217- /* The gymnastics here to adjust the matrix are because we want
218- * to offset by +1,+1 in device-space, not in user-space,
219- * so we can't just draw the layout at x + 1, y + 1
220- */
221- cairo_get_matrix (cr, &tmp_matrix);
222- tmp_matrix.x0 += 1.0;
223- tmp_matrix.y0 += 1.0;
224- cairo_set_matrix (cr, &tmp_matrix);
225-
226- cairo_set_source_rgb (cr, 1.0, 1.0, 1.0);
227-}
228-
229 static inline gboolean
230 color_equal (PangoColor *c1, PangoColor *c2)
231 {
232@@ -146,74 +148,154 @@
233 return FALSE;
234 }
235
236-static cairo_t *
237-get_cairo_context (GdkPangoRenderer *gdk_renderer,
238- PangoRenderPart part)
239+/* Adjusts matrix and color for the renderer to draw the secondar
240+ * "shadow" copy for embossed text */
241+static void
242+emboss_renderer (PangoRenderer *renderer,
243+ PangoRenderPart part,
244+ PangoMatrix **save_matrix,
245+ PangoColor **save_color)
246+{
247+ GdkPangoRendererPrivate *priv = GDK_PANGO_RENDERER(renderer)->priv;
248+ static const PangoColor white = { 0xffff, 0xffff, 0xffff };
249+ PangoMatrix tmp_matrix = PANGO_MATRIX_INIT;
250+
251+ priv->in_emboss = TRUE;
252+
253+ *save_color = pango_renderer_get_color (renderer, part);
254+ if (*save_color)
255+ *save_color = pango_color_copy (*save_color);
256+
257+ *save_matrix = renderer->matrix;
258+ if (*save_matrix)
259+ {
260+ *save_matrix = pango_matrix_copy (*save_matrix);
261+ tmp_matrix = **save_matrix;
262+ }
263+
264+ /* The gymnastics here to adjust the matrix are because we want
265+ * to offset by +1,+1 in device-space, not in user-space,
266+ * so we can't just draw the layout at x + 1, y + 1
267+ */
268+ tmp_matrix.x0 += 1;
269+ tmp_matrix.y0 += 1;
270+
271+ pango_renderer_set_matrix (renderer, &tmp_matrix);
272+ pango_renderer_set_color (renderer, part, &white);
273+}
274+
275+/* Restores from emboss_renderer() */
276+static void
277+unemboss_renderer (PangoRenderer *renderer,
278+ PangoRenderPart part,
279+ PangoMatrix **save_matrix,
280+ PangoColor **save_color)
281+{
282+ GdkPangoRendererPrivate *priv = GDK_PANGO_RENDERER(renderer)->priv;
283+ pango_renderer_set_matrix (renderer, *save_matrix);
284+ pango_renderer_set_color (renderer, part, *save_color);
285+
286+ if (*save_matrix)
287+ pango_matrix_free (*save_matrix);
288+ if (*save_color)
289+ pango_color_free (*save_color);
290+
291+ priv->in_emboss = FALSE;
292+}
293+
294+/* Gets the GC for drawing @part. This make involve copying the base GC
295+ * for the renderer, in which case we keep a one-GC cache. */
296+static GdkGC *
297+get_gc (GdkPangoRenderer *gdk_renderer,
298+ PangoRenderPart part)
299 {
300 PangoRenderer *renderer = PANGO_RENDERER (gdk_renderer);
301+ PangoColor *color;
302+ GdkBitmap *stipple;
303 GdkPangoRendererPrivate *priv = gdk_renderer->priv;
304
305- if (!priv->cr)
306+ color = pango_renderer_get_color (renderer, part);
307+
308+ if (part <= MAX_RENDER_PART)
309+ stipple = priv->stipple[part];
310+ else
311+ stipple = NULL;
312+
313+ if (!color && !stipple) /* nothing override, use base_gc */
314+ return priv->base_gc;
315+ else
316 {
317- const PangoMatrix *matrix;
318+ gboolean new_stipple = FALSE;
319+ gboolean new_color = FALSE;
320
321- priv->cr = gdk_cairo_create (priv->drawable);
322+ if (stipple != priv->gc_stipple)
323+ new_stipple = TRUE;
324
325- matrix = pango_renderer_get_matrix (renderer);
326- if (matrix)
327+ if ((priv->gc_color_set && !color) ||
328+ (!priv->gc_color_set && color) ||
329+ priv->gc_color.red != color->red ||
330+ priv->gc_color.green != color->green ||
331+ priv->gc_color.blue != color->blue)
332+ new_color = TRUE;
333+
334+ if (!priv->gc)
335 {
336- cairo_matrix_t cairo_matrix;
337-
338- cairo_matrix_init (&cairo_matrix,
339- matrix->xx, matrix->yx,
340- matrix->xy, matrix->yy,
341- matrix->x0, matrix->y0);
342- cairo_set_matrix (priv->cr, &cairo_matrix);
343+ priv->gc = gdk_gc_new (priv->drawable);
344+ gdk_gc_copy (priv->gc, priv->base_gc);
345+ }
346+ else if (new_color && priv->gc_color_set && !color)
347+ {
348+ /* We have to recopy the original GC onto the cached GC
349+ * to get the default color */
350+ new_stipple = TRUE;
351+ gdk_gc_copy (priv->gc, priv->base_gc);
352+ }
353+ else if (new_stipple && priv->gc_stipple && !stipple)
354+ {
355+ /* Similarly, we need to make a new copy to restore to the
356+ * default stipple state (the caller may have set a stipple
357+ * on the GC, and even if not, gdk_gc_set_stipple (gc, NULL)
358+ * doesn't work currently to restore to the default X stipple) */
359+ new_color = TRUE;
360+ gdk_gc_copy (priv->gc, priv->base_gc);
361 }
362- }
363-
364- if (part != priv->last_part)
365- {
366- PangoColor *pango_color;
367- GdkColor *color;
368- GdkColor tmp_color;
369- gboolean changed;
370
371- pango_color = pango_renderer_get_color (renderer, part);
372-
373- if (priv->last_part != -1)
374- changed = priv->gc_changed ||
375- priv->stipple[priv->last_part] != priv->stipple[part] ||
376- !color_equal (pango_color,
377- pango_renderer_get_color (renderer, priv->last_part));
378- else
379- changed = TRUE;
380-
381- if (changed)
382+ if (new_color)
383 {
384- if (pango_color)
385+ if (color)
386 {
387- tmp_color.red = pango_color->red;
388- tmp_color.green = pango_color->green;
389- tmp_color.blue = pango_color->blue;
390+ GdkColor gdk_color;
391+
392+ gdk_color.red = color->red;
393+ gdk_color.green = color->green;
394+ gdk_color.blue = color->blue;
395
396- color = &tmp_color;
397+ gdk_gc_set_rgb_fg_color (priv->gc, &gdk_color);
398+
399+ priv->gc_color = *color;
400+ priv->gc_color_set = TRUE;
401 }
402 else
403- color = NULL;
404+ priv->gc_color_set = FALSE;
405+ }
406
407- _gdk_gc_update_context (priv->base_gc,
408- priv->cr,
409- color,
410- priv->stipple[part],
411- priv->gc_changed);
412+ if (new_stipple)
413+ {
414+ if (priv->gc_stipple)
415+ g_object_unref (priv->gc_stipple);
416+
417+ if (stipple)
418+ {
419+ gdk_gc_set_stipple (priv->gc, stipple);
420+ gdk_gc_set_fill (priv->gc, GDK_STIPPLED);
421+ priv->gc_stipple = g_object_ref (stipple);
422+ }
423+ else
424+ priv->gc_stipple = NULL;
425 }
426
427- priv->last_part = part;
428- priv->gc_changed = FALSE;
429+ return priv->gc;
430 }
431-
432- return priv->cr;
433 }
434
435 static void
436@@ -225,133 +307,78 @@
437 {
438 GdkPangoRenderer *gdk_renderer = GDK_PANGO_RENDERER (renderer);
439 GdkPangoRendererPrivate *priv = gdk_renderer->priv;
440- cairo_t *cr;
441
442- cr = get_cairo_context (gdk_renderer,
443- PANGO_RENDER_PART_FOREGROUND);
444+ flush_trapezoids (gdk_renderer);
445
446- if (priv->embossed)
447+ if (!priv->in_emboss && priv->embossed)
448 {
449- cairo_save (cr);
450- emboss_context (cr);
451- cairo_move_to (cr, (double)x / PANGO_SCALE, (double)y / PANGO_SCALE);
452- pango_cairo_show_glyph_string (cr, font, glyphs);
453- cairo_restore (cr);
454- }
455-
456- cairo_move_to (cr, (double)x / PANGO_SCALE, (double)y / PANGO_SCALE);
457- pango_cairo_show_glyph_string (cr, font, glyphs);
458-}
459-
460-/* Draws an error underline that looks like one of:
461- * H E H
462- * /\ /\ /\ /\ /\ -
463- * A/ \ / \ / \ A/ \ / \ |
464- * \ \ / \ / /D \ \ / \ |
465- * \ \/ C \/ / \ \/ C \ | height = HEIGHT_SQUARES * square
466- * \ /\ F / \ F /\ \ |
467- * \ / \ / \ / \ \G |
468- * \ / \ / \ / \ / |
469- * \/ \/ \/ \/ -
470- * B B
471- * |----|
472- * unit_width = (HEIGHT_SQUARES - 1) * square
473- *
474- * The x, y, width, height passed in give the desired bounding box;
475- * x/width are adjusted to make the underline a integer number of units
476- * wide.
477- */
478-#define HEIGHT_SQUARES 2.5
479+ PangoMatrix *save_matrix;
480+ PangoColor *save_color;
481
482-/* Cut-and-pasted between here and pango/pango/pangocairo-render.c */
483+ emboss_renderer (renderer, PANGO_RENDER_PART_FOREGROUND, &save_matrix, &save_color);
484+ gdk_draw_glyphs_transformed (priv->drawable,
485+ get_gc (gdk_renderer, PANGO_RENDER_PART_FOREGROUND),
486+ renderer->matrix, font, x, y, glyphs);
487+ unemboss_renderer (renderer, PANGO_RENDER_PART_FOREGROUND, &save_matrix, &save_color);
488+ }
489+
490+ gdk_draw_glyphs_transformed (priv->drawable,
491+ get_gc (gdk_renderer, PANGO_RENDER_PART_FOREGROUND),
492+ renderer->matrix, font, x, y, glyphs);
493+}
494+
495+/* Outputs any pending trapezoids, we do this when the part or
496+ * part color changes, when we are about to draw text, etc. */
497 static void
498-draw_error_underline (cairo_t *cr,
499- double x,
500- double y,
501- double width,
502- double height)
503-{
504- double square = height / HEIGHT_SQUARES;
505- double unit_width = (HEIGHT_SQUARES - 1) * square;
506- int width_units = (width + unit_width / 2) / unit_width;
507- double y_top, y_bottom;
508- int i;
509+flush_trapezoids (GdkPangoRenderer *gdk_renderer)
510+{
511+ GdkPangoRendererPrivate *priv = gdk_renderer->priv;
512
513- x += (width - width_units * unit_width) / 2;
514- width = width_units * unit_width;
515+ if (!priv->trapezoids || priv->trapezoids->len == 0)
516+ return;
517
518- y_top = y;
519- y_bottom = y + height;
520-
521- /* Bottom of squiggle */
522- cairo_move_to (cr, x - square / 2, y_top + square / 2); /* A */
523- for (i = 0; i < width_units; i += 2)
524- {
525- double x_middle = x + (i + 1) * unit_width;
526- double x_right = x + (i + 2) * unit_width;
527-
528- cairo_line_to (cr, x_middle, y_bottom); /* B */
529-
530- if (i + 1 == width_units)
531- /* Nothing */;
532- else if (i + 2 == width_units)
533- cairo_line_to (cr, x_right + square / 2, y_top + square / 2); /* D */
534- else
535- cairo_line_to (cr, x_right, y_top + square); /* C */
536- }
537-
538- /* Top of squiggle */
539- for (i -= 2; i >= 0; i -= 2)
540- {
541- double x_left = x + i * unit_width;
542- double x_middle = x + (i + 1) * unit_width;
543- double x_right = x + (i + 2) * unit_width;
544-
545- if (i + 1 == width_units)
546- cairo_line_to (cr, x_middle + square / 2, y_bottom - square / 2); /* G */
547- else {
548- if (i + 2 == width_units)
549- cairo_line_to (cr, x_right, y_top); /* E */
550- cairo_line_to (cr, x_middle, y_bottom - square); /* F */
551- }
552-
553- cairo_line_to (cr, x_left, y_top); /* H */
554- }
555+ gdk_draw_trapezoids (priv->drawable,
556+ get_gc (gdk_renderer, priv->trapezoid_part),
557+ (GdkTrapezoid *)priv->trapezoids->data,
558+ priv->trapezoids->len);
559
560- cairo_close_path (cr);
561- cairo_fill (cr);
562+ g_array_set_size (priv->trapezoids, 0);
563 }
564
565+/* Draws a single trapezoid ... we don't draw it immediately, but rather
566+ * cache it to join together with other trapezoids that form part of the
567+ * same logical shape */
568 static void
569-gdk_pango_renderer_draw_rectangle (PangoRenderer *renderer,
570- PangoRenderPart part,
571- int x,
572- int y,
573- int width,
574- int height)
575+gdk_pango_renderer_draw_trapezoid (PangoRenderer *renderer,
576+ PangoRenderPart part,
577+ double y1,
578+ double x11,
579+ double x21,
580+ double y2,
581+ double x12,
582+ double x22)
583 {
584 GdkPangoRenderer *gdk_renderer = GDK_PANGO_RENDERER (renderer);
585- GdkPangoRendererPrivate *priv = gdk_renderer->priv;
586- cairo_t *cr;
587-
588- cr = get_cairo_context (gdk_renderer, part);
589-
590- if (priv->embossed && part != PANGO_RENDER_PART_BACKGROUND)
591- {
592- cairo_save (cr);
593- emboss_context (cr);
594- cairo_rectangle (cr,
595- (double)x / PANGO_SCALE, (double)y / PANGO_SCALE,
596- (double)width / PANGO_SCALE, (double)height / PANGO_SCALE);
597+ GdkTrapezoid trap;
598
599- cairo_fill (cr);
600- cairo_restore (cr);
601- }
602+ if (!gdk_renderer->priv->trapezoids)
603+ gdk_renderer->priv->trapezoids = g_array_new (FALSE, FALSE,
604+ sizeof (GdkTrapezoid));
605+
606+ if (gdk_renderer->priv->trapezoids->len > 0 &&
607+ gdk_renderer->priv->trapezoid_part != part)
608+ flush_trapezoids (gdk_renderer);
609+
610+ gdk_renderer->priv->trapezoid_part = part;
611+
612+ trap.y1 = y1;
613+ trap.x11 = x11 / 2;
614+ trap.x21 = x21;
615+ trap.y2 = y2;
616+ trap.x12 = x12;
617+ trap.x22 = x22;
618
619- cairo_rectangle (cr,
620- (double)x / PANGO_SCALE, (double)y / PANGO_SCALE,
621- (double)width / PANGO_SCALE, (double)height / PANGO_SCALE);
622- cairo_fill (cr);
623+ g_array_append_val (gdk_renderer->priv->trapezoids, trap);
624 }
625
626 static void
627@@ -363,23 +390,51 @@
628 {
629 GdkPangoRenderer *gdk_renderer = GDK_PANGO_RENDERER (renderer);
630 GdkPangoRendererPrivate *priv = gdk_renderer->priv;
631- cairo_t *cr;
632-
633- cr = get_cairo_context (gdk_renderer, PANGO_RENDER_PART_UNDERLINE);
634-
635- if (priv->embossed)
636+
637+ if (!priv->in_emboss && priv->embossed)
638 {
639- cairo_save (cr);
640- emboss_context (cr);
641- draw_error_underline (cr,
642- (double)x / PANGO_SCALE, (double)y / PANGO_SCALE,
643- (double)width / PANGO_SCALE, (double)height / PANGO_SCALE);
644- cairo_restore (cr);
645+ PangoMatrix *save_matrix;
646+ PangoColor *save_color;
647+
648+ emboss_renderer (renderer, PANGO_RENDER_PART_UNDERLINE, &save_matrix, &save_color);
649+ PANGO_RENDERER_CLASS (gdk_pango_renderer_parent_class)->draw_error_underline (renderer,
650+ x, y, width, height);
651+ unemboss_renderer (renderer, PANGO_RENDER_PART_UNDERLINE, &save_matrix, &save_color);
652 }
653
654- draw_error_underline (cr,
655- (double)x / PANGO_SCALE, (double)y / PANGO_SCALE,
656- (double)width / PANGO_SCALE, (double)height / PANGO_SCALE);
657+ PANGO_RENDERER_CLASS (gdk_pango_renderer_parent_class)->draw_error_underline (renderer,
658+ x, y, width, height);
659+}
660+
661+/* We can't handle embossing at the level of trapezoids, because when an
662+ * underline is split into multiple trapezoids, the normal and shadow
663+ * trapezoids will be drawn mixed together. Instead, we have to emboss
664+ * and entire rectangle or error underline
665+ */
666+static void
667+gdk_pango_renderer_draw_rectangle (PangoRenderer *renderer,
668+ PangoRenderPart part,
669+ int x,
670+ int y,
671+ int width,
672+ int height)
673+{
674+ GdkPangoRenderer *gdk_renderer = GDK_PANGO_RENDERER (renderer);
675+ GdkPangoRendererPrivate *priv = gdk_renderer->priv;
676+
677+ if (!priv->in_emboss && priv->embossed && part != PANGO_RENDER_PART_BACKGROUND)
678+ {
679+ PangoMatrix *save_matrix;
680+ PangoColor *save_color;
681+
682+ emboss_renderer (renderer, part, &save_matrix, &save_color);
683+ PANGO_RENDERER_CLASS (gdk_pango_renderer_parent_class)->draw_rectangle (renderer, part,
684+ x, y, width, height);
685+ unemboss_renderer (renderer, part, &save_matrix, &save_color);
686+ }
687+
688+ PANGO_RENDERER_CLASS (gdk_pango_renderer_parent_class)->draw_rectangle (renderer, part,
689+ x, y, width, height);
690 }
691
692 static void
693@@ -388,8 +443,8 @@
694 {
695 GdkPangoRenderer *gdk_renderer = GDK_PANGO_RENDERER (renderer);
696
697- if (gdk_renderer->priv->last_part == part)
698- gdk_renderer->priv->last_part = (PangoRenderPart)-1;
699+ if (part == gdk_renderer->priv->trapezoid_part)
700+ flush_trapezoids (gdk_renderer);
701 }
702
703 static void
704@@ -410,13 +465,8 @@
705 {
706 GdkPangoRenderer *gdk_renderer = GDK_PANGO_RENDERER (renderer);
707 GdkPangoRendererPrivate *priv = gdk_renderer->priv;
708-
709- if (priv->cr)
710- {
711- cairo_destroy (priv->cr);
712- priv->cr = NULL;
713- }
714- priv->last_part = (PangoRenderPart)-1;
715+
716+ flush_trapezoids (gdk_renderer);
717 }
718
719 static void
720@@ -515,7 +565,6 @@
721 GDK_TYPE_PANGO_RENDERER,
722 GdkPangoRendererPrivate);
723
724- renderer->priv->last_part = (PangoRenderPart)-1;
725 renderer->priv->gc_changed = TRUE;
726 }
727
728@@ -527,6 +576,7 @@
729 PangoRendererClass *renderer_class = PANGO_RENDERER_CLASS (klass);
730
731 renderer_class->draw_glyphs = gdk_pango_renderer_draw_glyphs;
732+ renderer_class->draw_trapezoid = gdk_pango_renderer_draw_trapezoid;
733 renderer_class->draw_rectangle = gdk_pango_renderer_draw_rectangle;
734 renderer_class->draw_error_underline = gdk_pango_renderer_draw_error_underline;
735 renderer_class->part_changed = gdk_pango_renderer_part_changed;
736@@ -647,6 +697,8 @@
737
738 priv = gdk_renderer->priv;
739
740+ flush_trapezoids (gdk_renderer);
741+
742 if (priv->drawable != drawable)
743 {
744 if (priv->drawable)
745@@ -681,6 +733,8 @@
746
747 priv = gdk_renderer->priv;
748
749+ flush_trapezoids (gdk_renderer);
750+
751 if (priv->base_gc != gc)
752 {
753 if (priv->base_gc)
754@@ -689,6 +743,20 @@
755 if (priv->base_gc)
756 g_object_ref (priv->base_gc);
757
758+ if (priv->gc)
759+ {
760+ g_object_unref (priv->gc);
761+ priv->gc = NULL;
762+ }
763+
764+ priv->gc_color_set = FALSE;
765+
766+ if (priv->gc_stipple)
767+ {
768+ g_object_unref (priv->gc_stipple);
769+ priv->gc_stipple = NULL;
770+ }
771+
772 priv->gc_changed = TRUE;
773 }
774 }
775@@ -1414,50 +1482,5 @@
776 return gdk_pango_context_get_for_screen (gdk_screen_get_default ());
777 }
778
779-/**
780- * gdk_pango_context_get_for_screen:
781- * @screen: the #GdkScreen for which the context is to be created.
782- *
783- * Creates a #PangoContext for @screen.
784- *
785- * The context must be freed when you're finished with it.
786- *
787- * When using GTK+, normally you should use gtk_widget_get_pango_context()
788- * instead of this function, to get the appropriate context for
789- * the widget you intend to render text onto.
790- *
791- * The newly created context will have the default font options
792- * (see #cairo_font_options_t) for the screen; if these options
793- * change it will not be updated. Using gtk_widget_get_pango_context()
794- * is more convenient if you want to keep a context around and track
795- * changes to the screen's font rendering settings.
796- *
797- * Return value: a new #PangoContext for @screen
798- *
799- * Since: 2.2
800- **/
801-PangoContext *
802-gdk_pango_context_get_for_screen (GdkScreen *screen)
803-{
804- PangoFontMap *fontmap;
805- PangoContext *context;
806- const cairo_font_options_t *options;
807- double dpi;
808-
809- g_return_val_if_fail (GDK_IS_SCREEN (screen), NULL);
810-
811- fontmap = pango_cairo_font_map_get_default ();
812-
813- context = pango_cairo_font_map_create_context (PANGO_CAIRO_FONT_MAP (fontmap));
814-
815- options = gdk_screen_get_font_options (screen);
816- pango_cairo_context_set_font_options (context, options);
817-
818- dpi = gdk_screen_get_resolution (screen);
819- pango_cairo_context_set_resolution (context, dpi);
820-
821- return context;
822-}
823-
824 #define __GDK_PANGO_C__
825 #include "gdkaliasdef.c"
826Index: gtk+-2.10.6/gdk/gdk.symbols
827===================================================================
828--- gtk+-2.10.6.orig/gdk/gdk.symbols 2006-10-30 12:58:29.000000000 +0000
829+++ gtk+-2.10.6/gdk/gdk.symbols 2006-10-30 12:59:30.000000000 +0000
830@@ -861,7 +861,6 @@
831 gdk_pango_attr_embossed_new
832 gdk_pango_attr_stipple_new
833 gdk_pango_context_get
834-gdk_pango_context_get_for_screen
835 #ifndef GDK_DISABLE_DEPRECATED
836 gdk_pango_context_set_colormap
837 #endif
838@@ -877,6 +876,12 @@
839 #endif
840 #endif
841
842+#if IN_HEADER(__GDK_PANGO_H__)
843+#if IN_FILE(__GDK_PANGO_X11_C__)
844+gdk_pango_context_get_for_screen
845+#endif
846+#endif
847+
848 #if IN_HEADER(__GDK_PIXBUF_H__)
849 #if IN_FILE(__GDK_PIXBUF_DRAWABLE_C__)
850 gdk_pixbuf_get_from_drawable
851Index: gtk+-2.10.6/gdk/gdkwindow.c
852===================================================================
853--- gtk+-2.10.6.orig/gdk/gdkwindow.c 2006-10-30 12:58:29.000000000 +0000
854+++ gtk+-2.10.6/gdk/gdkwindow.c 2006-10-30 12:59:30.000000000 +0000
855@@ -1834,9 +1834,14 @@
856 }
857 else
858 {
859- method->cr = cairo_create (paint->surface);
860+ /*method->cr = cairo_create (paint->surface);
861
862- gdk_cairo_set_source_color (method->cr, &private->bg_color);
863+ gdk_cairo_set_source_color (method->cr, &private->bg_color);*/
864+ GdkGC *gc = _gdk_drawable_get_scratch_gc (paint->pixmap, FALSE);
865+
866+ gdk_gc_set_foreground (gc, &(private->bg_color));
867+
868+ method->gc = g_object_ref (gc);
869 }
870 }
871
872Index: gtk+-2.10.6/gdk/x11/gdkdisplay-x11.c
873===================================================================
874--- gtk+-2.10.6.orig/gdk/x11/gdkdisplay-x11.c 2006-10-30 12:58:29.000000000 +0000
875+++ gtk+-2.10.6/gdk/x11/gdkdisplay-x11.c 2006-10-30 12:59:30.000000000 +0000
876@@ -190,7 +190,8 @@
877 display_x11->leader_window_title_set = FALSE;
878
879 display_x11->have_render = GDK_UNKNOWN;
880-
881+ display_x11->have_render_with_trapezoids = GDK_UNKNOWN;
882+
883 #ifdef HAVE_XFIXES
884 if (XFixesQueryExtension (display_x11->xdisplay,
885 &display_x11->xfixes_event_base,
886Index: gtk+-2.10.6/gdk/x11/gdkdisplay-x11.h
887===================================================================
888--- gtk+-2.10.6.orig/gdk/x11/gdkdisplay-x11.h 2006-10-30 12:58:29.000000000 +0000
889+++ gtk+-2.10.6/gdk/x11/gdkdisplay-x11.h 2006-10-30 12:59:30.000000000 +0000
890@@ -78,6 +78,7 @@
891 gboolean use_xshm;
892 gboolean have_shm_pixmaps;
893 GdkTristate have_render;
894+ GdkTristate have_render_with_trapezoids;
895 gboolean have_xfixes;
896 gint xfixes_event_base;
897
898Index: gtk+-2.10.6/gdk/x11/gdkdrawable-x11.c
899===================================================================
900--- gtk+-2.10.6.orig/gdk/x11/gdkdrawable-x11.c 2006-10-30 12:58:30.000000000 +0000
901+++ gtk+-2.10.6/gdk/x11/gdkdrawable-x11.c 2006-10-30 12:59:30.000000000 +0000
902@@ -26,6 +26,8 @@
903
904 #include <config.h>
905
906+#include <pango/pangoxft.h>
907+
908 #include "gdkx.h"
909 #include "gdkregion-generic.h"
910
911@@ -106,7 +108,21 @@
912 GdkGC *gc,
913 GdkPoint *points,
914 gint npoints);
915-
916+
917+static void gdk_x11_draw_glyphs (GdkDrawable *drawable,
918+ GdkGC *gc,
919+ PangoFont *font,
920+ gint x,
921+ gint y,
922+ PangoGlyphString *glyphs);
923+static void gdk_x11_draw_glyphs_transformed (GdkDrawable *drawable,
924+ GdkGC *gc,
925+ PangoMatrix *matrix,
926+ PangoFont *font,
927+ gint x,
928+ gint y,
929+ PangoGlyphString *glyphs);
930+
931 static void gdk_x11_draw_image (GdkDrawable *drawable,
932 GdkGC *gc,
933 GdkImage *image,
934@@ -129,6 +145,11 @@
935 gint x_dither,
936 gint y_dither);
937
938+static void gdk_x11_draw_trapezoids (GdkDrawable *drawable,
939+ GdkGC *gc,
940+ GdkTrapezoid *trapezoids,
941+ gint n_trapezoids);
942+
943 static cairo_surface_t *gdk_x11_ref_cairo_surface (GdkDrawable *drawable);
944
945 static void gdk_x11_set_colormap (GdkDrawable *drawable,
946@@ -163,8 +184,11 @@
947 drawable_class->draw_points = gdk_x11_draw_points;
948 drawable_class->draw_segments = gdk_x11_draw_segments;
949 drawable_class->draw_lines = gdk_x11_draw_lines;
950+ drawable_class->draw_glyphs = gdk_x11_draw_glyphs;
951+ drawable_class->draw_glyphs_transformed = gdk_x11_draw_glyphs_transformed;
952 drawable_class->draw_image = gdk_x11_draw_image;
953 drawable_class->draw_pixbuf = gdk_x11_draw_pixbuf;
954+ drawable_class->draw_trapezoids = gdk_x11_draw_trapezoids;
955
956 drawable_class->ref_cairo_surface = gdk_x11_ref_cairo_surface;
957
958@@ -327,6 +351,72 @@
959 return x11display->have_render == GDK_YES;
960 }
961
962+gboolean
963+_gdk_x11_have_render_with_trapezoids (GdkDisplay *display)
964+{
965+ Display *xdisplay = GDK_DISPLAY_XDISPLAY (display);
966+ GdkDisplayX11 *x11display = GDK_DISPLAY_X11 (display);
967+
968+ if (x11display->have_render_with_trapezoids == GDK_UNKNOWN)
969+ {
970+ x11display->have_render_with_trapezoids = GDK_NO;
971+ if (_gdk_x11_have_render (display))
972+ {
973+ /*
974+ * Require protocol >= 0.4 for CompositeTrapezoids support.
975+ */
976+ int major_version, minor_version;
977+
978+#define XRENDER_TETRAPEZOIDS_MAJOR 0
979+#define XRENDER_TETRAPEZOIDS_MINOR 4
980+
981+ if (XRenderQueryVersion (xdisplay, &major_version,
982+ &minor_version))
983+ if ((major_version == XRENDER_TETRAPEZOIDS_MAJOR) &&
984+ (minor_version >= XRENDER_TETRAPEZOIDS_MINOR))
985+ x11display->have_render_with_trapezoids = GDK_YES;
986+ }
987+ }
988+
989+ return x11display->have_render_with_trapezoids == GDK_YES;
990+}
991+
992+static XftDraw *
993+gdk_x11_drawable_get_xft_draw (GdkDrawable *drawable)
994+{
995+ GdkDrawableImplX11 *impl = GDK_DRAWABLE_IMPL_X11 (drawable);
996+
997+ if (impl->xft_draw == NULL)
998+ {
999+ GdkColormap *colormap = gdk_drawable_get_colormap (drawable);
1000+
1001+ if (colormap)
1002+ {
1003+ GdkVisual *visual;
1004+
1005+ visual = gdk_colormap_get_visual (colormap);
1006+
1007+ impl->xft_draw = XftDrawCreate (GDK_SCREEN_XDISPLAY (impl->screen), impl->xid,
1008+ GDK_VISUAL_XVISUAL (visual), GDK_COLORMAP_XCOLORMAP (colormap));
1009+ }
1010+ else if (gdk_drawable_get_depth (drawable) == 1)
1011+ {
1012+ impl->xft_draw = XftDrawCreateBitmap (GDK_SCREEN_XDISPLAY (impl->screen), impl->xid);
1013+ }
1014+ else
1015+ {
1016+ g_warning ("Using Xft rendering requires the drawable argument to\n"
1017+ "have a specified colormap. All windows have a colormap,\n"
1018+ "however, pixmaps only have colormap by default if they\n"
1019+ "were created with a non-NULL window argument. Otherwise\n"
1020+ "a colormap must be set on them with gdk_drawable_set_colormap");
1021+ return NULL;
1022+ }
1023+ }
1024+
1025+ return impl->xft_draw;
1026+}
1027+
1028 static Picture
1029 gdk_x11_drawable_get_picture (GdkDrawable *drawable)
1030 {
1031@@ -393,6 +483,57 @@
1032 }
1033 }
1034
1035+static void
1036+gdk_x11_drawable_update_xft_clip (GdkDrawable *drawable,
1037+ GdkGC *gc)
1038+{
1039+ XftDraw *xft_draw = gdk_x11_drawable_get_xft_draw (drawable);
1040+ GdkRegion *clip_region = _gdk_gc_get_clip_region (gc);
1041+
1042+ if (gc && clip_region)
1043+ {
1044+ GdkRegionBox *boxes = clip_region->rects;
1045+ gint n_boxes = clip_region->numRects;
1046+#if 0 /* Until XftDrawSetClipRectangles is there */
1047+ XRectangle *rects = g_new (XRectangle, n_boxes);
1048+ int i;
1049+
1050+ for (i=0; i < n_boxes; i++)
1051+ {
1052+ rects[i].x = CLAMP (boxes[i].x1 + gc->clip_x_origin, G_MINSHORT, G_MAXSHORT);
1053+ rects[i].y = CLAMP (boxes[i].y1 + gc->clip_y_origin, G_MINSHORT, G_MAXSHORT);
1054+ rects[i].width = CLAMP (boxes[i].x2 + gc->clip_x_origin, G_MINSHORT, G_MAXSHORT) - rects[i].x;
1055+ rects[i].height = CLAMP (boxes[i].y2 + gc->clip_y_origin, G_MINSHORT, G_MAXSHORT) - rects[i].y;
1056+ }
1057+ XftDrawSetClipRectangles (xft_draw, 0, 0, rects, n_boxes);
1058+
1059+ g_free (rects);
1060+#else
1061+ Region xregion = XCreateRegion ();
1062+ int i;
1063+
1064+ for (i=0; i < n_boxes; i++)
1065+ {
1066+ XRectangle rect;
1067+
1068+ rect.x = CLAMP (boxes[i].x1 + gc->clip_x_origin, G_MINSHORT, G_MAXSHORT);
1069+ rect.y = CLAMP (boxes[i].y1 + gc->clip_y_origin, G_MINSHORT, G_MAXSHORT);
1070+ rect.width = CLAMP (boxes[i].x2 + gc->clip_x_origin, G_MINSHORT, G_MAXSHORT) - rect.x;
1071+ rect.height = CLAMP (boxes[i].y2 + gc->clip_y_origin, G_MINSHORT, G_MAXSHORT) - rect.y;
1072+
1073+ XUnionRectWithRegion (&rect, xregion, xregion);
1074+ }
1075+
1076+ XftDrawSetClip (xft_draw, xregion);
1077+ XDestroyRegion (xregion);
1078+#endif
1079+ }
1080+ else
1081+ {
1082+ XftDrawSetClip (xft_draw, NULL);
1083+ }
1084+}
1085+
1086 /*****************************************************
1087 * X11 specific implementations of generic functions *
1088 *****************************************************/
1089@@ -780,6 +921,45 @@
1090 }
1091
1092 static void
1093+gdk_x11_draw_glyphs (GdkDrawable *drawable,
1094+ GdkGC *gc,
1095+ PangoFont *font,
1096+ gint x,
1097+ gint y,
1098+ PangoGlyphString *glyphs)
1099+{
1100+ gdk_x11_draw_glyphs_transformed (drawable, gc, NULL,
1101+ font,
1102+ x * PANGO_SCALE,
1103+ y * PANGO_SCALE,
1104+ glyphs);
1105+}
1106+
1107+static void
1108+gdk_x11_draw_glyphs_transformed (GdkDrawable *drawable,
1109+ GdkGC *gc,
1110+ PangoMatrix *matrix,
1111+ PangoFont *font,
1112+ gint x,
1113+ gint y,
1114+ PangoGlyphString *glyphs)
1115+{
1116+ GdkDrawableImplX11 *impl;
1117+ PangoRenderer *renderer;
1118+
1119+ impl = GDK_DRAWABLE_IMPL_X11 (drawable);
1120+
1121+ g_return_if_fail (PANGO_XFT_IS_FONT (font));
1122+
1123+ renderer = _gdk_x11_renderer_get (drawable, gc);
1124+ if (matrix)
1125+ pango_renderer_set_matrix (renderer, matrix);
1126+ pango_renderer_draw_glyphs (renderer, font, glyphs, x, y);
1127+ if (matrix)
1128+ pango_renderer_set_matrix (renderer, NULL);
1129+}
1130+
1131+static void
1132 gdk_x11_draw_image (GdkDrawable *drawable,
1133 GdkGC *gc,
1134 GdkImage *image,
1135@@ -1444,6 +1624,47 @@
1136 }
1137
1138 static void
1139+gdk_x11_draw_trapezoids (GdkDrawable *drawable,
1140+ GdkGC *gc,
1141+ GdkTrapezoid *trapezoids,
1142+ gint n_trapezoids)
1143+{
1144+ GdkScreen *screen = GDK_DRAWABLE_IMPL_X11 (drawable)->screen;
1145+ GdkDisplay *display = gdk_screen_get_display (screen);
1146+ XTrapezoid *xtrapezoids;
1147+ gint i;
1148+
1149+ if (!_gdk_x11_have_render_with_trapezoids (display))
1150+ {
1151+ GdkDrawable *wrapper = GDK_DRAWABLE_IMPL_X11 (drawable)->wrapper;
1152+ GDK_DRAWABLE_CLASS (_gdk_drawable_impl_x11_parent_class)->draw_trapezoids (wrapper, gc,
1153+ trapezoids, n_trapezoids);
1154+ return;
1155+ }
1156+
1157+ xtrapezoids = g_new (XTrapezoid, n_trapezoids);
1158+
1159+ for (i = 0; i < n_trapezoids; i++)
1160+ {
1161+ xtrapezoids[i].top = XDoubleToFixed (trapezoids[i].y1);
1162+ xtrapezoids[i].bottom = XDoubleToFixed (trapezoids[i].y2);
1163+ xtrapezoids[i].left.p1.x = XDoubleToFixed (trapezoids[i].x11);
1164+ xtrapezoids[i].left.p1.y = XDoubleToFixed (trapezoids[i].y1);
1165+ xtrapezoids[i].left.p2.x = XDoubleToFixed (trapezoids[i].x12);
1166+ xtrapezoids[i].left.p2.y = XDoubleToFixed (trapezoids[i].y2);
1167+ xtrapezoids[i].right.p1.x = XDoubleToFixed (trapezoids[i].x21);
1168+ xtrapezoids[i].right.p1.y = XDoubleToFixed (trapezoids[i].y1);
1169+ xtrapezoids[i].right.p2.x = XDoubleToFixed (trapezoids[i].x22);
1170+ xtrapezoids[i].right.p2.y = XDoubleToFixed (trapezoids[i].y2);
1171+ }
1172+
1173+ _gdk_x11_drawable_draw_xtrapezoids (drawable, gc,
1174+ xtrapezoids, n_trapezoids);
1175+
1176+ g_free (xtrapezoids);
1177+}
1178+
1179+static void
1180 gdk_x11_cairo_surface_destroy (void *data)
1181 {
1182 GdkDrawableImplX11 *impl = data;
1183@@ -1498,5 +1719,89 @@
1184 return impl->cairo_surface;
1185 }
1186
1187+void
1188+_gdk_x11_drawable_draw_xtrapezoids (GdkDrawable *drawable,
1189+ GdkGC *gc,
1190+ XTrapezoid *xtrapezoids,
1191+ int n_trapezoids)
1192+{
1193+ GdkScreen *screen = GDK_DRAWABLE_IMPL_X11 (drawable)->screen;
1194+ GdkDisplay *display = gdk_screen_get_display (screen);
1195+ GdkDisplayX11 *x11display = GDK_DISPLAY_X11 (display);
1196+
1197+ XftDraw *draw;
1198+
1199+ if (!_gdk_x11_have_render_with_trapezoids (display))
1200+ {
1201+ /* This is the case of drawing the borders of the unknown glyph box
1202+ * without render on the display, we need to feed it back to
1203+ * fallback code. Not efficient, but doesn't matter.
1204+ */
1205+ GdkTrapezoid *trapezoids = g_new (GdkTrapezoid, n_trapezoids);
1206+ int i;
1207+
1208+ for (i = 0; i < n_trapezoids; i++)
1209+ {
1210+ trapezoids[i].y1 = XFixedToDouble (xtrapezoids[i].top);
1211+ trapezoids[i].y2 = XFixedToDouble (xtrapezoids[i].bottom);
1212+ trapezoids[i].x11 = XFixedToDouble (xtrapezoids[i].left.p1.x);
1213+ trapezoids[i].x12 = XFixedToDouble (xtrapezoids[i].left.p2.x);
1214+ trapezoids[i].x21 = XFixedToDouble (xtrapezoids[i].right.p1.x);
1215+ trapezoids[i].x22 = XFixedToDouble (xtrapezoids[i].right.p2.x);
1216+ }
1217+
1218+ gdk_x11_draw_trapezoids (drawable, gc, trapezoids, n_trapezoids);
1219+ g_free (trapezoids);
1220+
1221+ return;
1222+ }
1223+
1224+ gdk_x11_drawable_update_xft_clip (drawable, gc);
1225+ draw = gdk_x11_drawable_get_xft_draw (drawable);
1226+
1227+ if (!x11display->mask_format)
1228+ x11display->mask_format = XRenderFindStandardFormat (x11display->xdisplay,
1229+ PictStandardA8);
1230+
1231+ XRenderCompositeTrapezoids (x11display->xdisplay, PictOpOver,
1232+ _gdk_x11_gc_get_fg_picture (gc),
1233+ XftDrawPicture (draw),
1234+ x11display->mask_format,
1235+ - gc->ts_x_origin, - gc->ts_y_origin,
1236+ xtrapezoids, n_trapezoids);
1237+}
1238+
1239+void
1240+_gdk_x11_drawable_draw_xft_glyphs (GdkDrawable *drawable,
1241+ GdkGC *gc,
1242+ XftFont *xft_font,
1243+ XftGlyphSpec *glyphs,
1244+ gint n_glyphs)
1245+{
1246+ GdkScreen *screen = GDK_DRAWABLE_IMPL_X11 (drawable)->screen;
1247+ GdkDisplay *display = gdk_screen_get_display (screen);
1248+ GdkDisplayX11 *x11display = GDK_DISPLAY_X11 (display);
1249+ XftDraw *draw;
1250+
1251+ gdk_x11_drawable_update_xft_clip (drawable, gc);
1252+ draw = gdk_x11_drawable_get_xft_draw (drawable);
1253+
1254+ if (_gdk_x11_have_render (display))
1255+ {
1256+ XftGlyphSpecRender (x11display->xdisplay, PictOpOver,
1257+ _gdk_x11_gc_get_fg_picture (gc),
1258+ xft_font,
1259+ XftDrawPicture (draw),
1260+ - gc->ts_x_origin, - gc->ts_y_origin,
1261+ glyphs, n_glyphs);
1262+ }
1263+ else
1264+ {
1265+ XftColor color;
1266+
1267+ _gdk_gc_x11_get_fg_xft_color (gc, &color);
1268+ XftDrawGlyphSpec (draw, &color, xft_font, glyphs, n_glyphs);
1269+ }
1270+}
1271 #define __GDK_DRAWABLE_X11_C__
1272 #include "gdkaliasdef.c"
1273Index: gtk+-2.10.6/gdk/x11/gdkdrawable-x11.h
1274===================================================================
1275--- gtk+-2.10.6.orig/gdk/x11/gdkdrawable-x11.h 2006-10-30 12:58:30.000000000 +0000
1276+++ gtk+-2.10.6/gdk/x11/gdkdrawable-x11.h 2006-10-30 12:59:30.000000000 +0000
1277@@ -33,6 +33,7 @@
1278
1279 #include <X11/Xlib.h>
1280 #include <X11/extensions/Xrender.h>
1281+#include <X11/Xft/Xft.h>
1282
1283 G_BEGIN_DECLS
1284
1285@@ -68,6 +69,8 @@
1286 Window xid;
1287 GdkScreen *screen;
1288
1289+ XftDraw *xft_draw;
1290+
1291 Picture picture;
1292 cairo_surface_t *cairo_surface;
1293 };
1294@@ -92,7 +95,15 @@
1295 /* Note that the following take GdkDrawableImplX11, not the wrapper drawable */
1296 void _gdk_x11_drawable_finish (GdkDrawable *drawable);
1297 void _gdk_x11_drawable_update_size (GdkDrawable *drawable);
1298-
1299+void _gdk_x11_drawable_draw_xtrapezoids (GdkDrawable *drawable,
1300+ GdkGC *gc,
1301+ XTrapezoid *xtrapezoids,
1302+ int n_trapezoids);
1303+void _gdk_x11_drawable_draw_xft_glyphs (GdkDrawable *drawable,
1304+ GdkGC *gc,
1305+ XftFont *xft_font,
1306+ XftGlyphSpec *glyphs,
1307+ gint n_glyphs);
1308 G_END_DECLS
1309
1310 #endif /* __GDK_DRAWABLE_X11_H__ */
1311Index: gtk+-2.10.6/gdk/x11/gdkgc-x11.c
1312===================================================================
1313--- gtk+-2.10.6.orig/gdk/x11/gdkgc-x11.c 2006-10-30 12:58:30.000000000 +0000
1314+++ gtk+-2.10.6/gdk/x11/gdkgc-x11.c 2006-10-30 12:59:30.000000000 +0000
1315@@ -80,7 +80,10 @@
1316 gdk_gc_x11_finalize (GObject *object)
1317 {
1318 GdkGCX11 *x11_gc = GDK_GC_X11 (object);
1319-
1320+
1321+ if (x11_gc->fg_picture != None)
1322+ XRenderFreePicture (GDK_GC_XDISPLAY (x11_gc), x11_gc->fg_picture);
1323+
1324 XFreeGC (GDK_GC_XDISPLAY (x11_gc), GDK_GC_XGC (x11_gc));
1325
1326 G_OBJECT_CLASS (_gdk_gc_x11_parent_class)->finalize (object);
1327@@ -110,7 +113,7 @@
1328
1329 private->dirty_mask = 0;
1330 private->have_clip_mask = FALSE;
1331-
1332+
1333 private->screen = GDK_DRAWABLE_IMPL_X11 (drawable)->screen;
1334
1335 private->depth = gdk_drawable_get_depth (drawable);
1336@@ -339,6 +342,18 @@
1337 }
1338
1339 static void
1340+clear_fg_picture (GdkGC *gc)
1341+{
1342+ GdkGCX11 *x11_gc = GDK_GC_X11 (gc);
1343+
1344+ if (x11_gc->fg_picture != None)
1345+ {
1346+ XRenderFreePicture (GDK_GC_XDISPLAY (x11_gc), x11_gc->fg_picture);
1347+ x11_gc->fg_picture = None;
1348+ }
1349+}
1350+
1351+static void
1352 gdk_x11_gc_set_values (GdkGC *gc,
1353 GdkGCValues *values,
1354 GdkGCValuesMask values_mask)
1355@@ -367,6 +382,29 @@
1356 x11_gc->have_clip_mask = values->clip_mask != NULL;
1357 }
1358
1359+ if (values_mask & GDK_GC_BACKGROUND)
1360+ {
1361+ if (_gdk_gc_get_fill (gc) == GDK_OPAQUE_STIPPLED)
1362+ clear_fg_picture (gc);
1363+ }
1364+
1365+ if (values_mask & GDK_GC_FILL)
1366+ {
1367+ clear_fg_picture (gc);
1368+ }
1369+
1370+ if (values_mask & GDK_GC_STIPPLE)
1371+ {
1372+ if (_gdk_gc_get_fill (gc) == GDK_STIPPLED || _gdk_gc_get_fill (gc) == GDK_OPAQUE_STIPPLED)
1373+ clear_fg_picture (gc);
1374+ }
1375+
1376+ if (values_mask & GDK_GC_TILE)
1377+ {
1378+ if (_gdk_gc_get_fill (gc) == GDK_TILED)
1379+ clear_fg_picture (gc);
1380+ }
1381+
1382 gdk_x11_gc_values_to_xvalues (values, values_mask, &xvalues, &xvalues_mask);
1383
1384 XChangeGC (GDK_GC_XDISPLAY (gc),
1385@@ -642,6 +680,8 @@
1386 x11_dst_gc->dirty_mask = x11_src_gc->dirty_mask;
1387 x11_dst_gc->have_clip_region = x11_src_gc->have_clip_region;
1388 x11_dst_gc->have_clip_mask = x11_src_gc->have_clip_mask;
1389+
1390+ clear_fg_picture (dst_gc);
1391 }
1392
1393 /**
1394@@ -701,5 +741,359 @@
1395 return gc_x11->xgc;
1396 }
1397
1398+/* Various bits of the below are roughly cribbed from XFree86
1399+ * lib/Xft/xftdraw.c, Copyright 2000, Keith Packard
1400+ */
1401+
1402+static XRenderPictFormat *
1403+foreground_format (GdkGC *gc)
1404+{
1405+ XRenderPictFormat pf;
1406+
1407+ pf.type = PictTypeDirect;
1408+ pf.depth = 32;
1409+ pf.direct.redMask = 0xff;
1410+ pf.direct.greenMask = 0xff;
1411+ pf.direct.blueMask = 0xff;
1412+ pf.direct.alphaMask = 0xff;
1413+
1414+ return XRenderFindFormat (GDK_GC_XDISPLAY (gc),
1415+ (PictFormatType |
1416+ PictFormatDepth |
1417+ PictFormatRedMask |
1418+ PictFormatGreenMask |
1419+ PictFormatBlueMask |
1420+ PictFormatAlphaMask),
1421+ &pf,
1422+ 0);
1423+}
1424+
1425+static Picture
1426+make_fg_tile_picture (GdkGC *gc)
1427+{
1428+ GdkGCX11 *x11_gc = GDK_GC_X11 (gc);
1429+ GdkVisual *visual = gdk_drawable_get_visual (_gdk_gc_get_tile (gc));
1430+ XRenderPictFormat *format = NULL;
1431+
1432+ if (visual)
1433+ {
1434+ format = XRenderFindVisualFormat (GDK_GC_XDISPLAY (gc),
1435+ GDK_VISUAL_XVISUAL (visual));
1436+ }
1437+ else if (x11_gc->depth == 1)
1438+ {
1439+ format = XRenderFindStandardFormat (GDK_GC_XDISPLAY (gc),
1440+ PictStandardA1);
1441+ }
1442+
1443+ if (format)
1444+ {
1445+ XRenderPictureAttributes pa;
1446+ pa.repeat = True;
1447+
1448+ return XRenderCreatePicture (GDK_GC_XDISPLAY (gc),
1449+ GDK_PIXMAP_XID (_gdk_gc_get_tile (gc)),
1450+ format,
1451+ CPRepeat, &pa);
1452+ }
1453+
1454+ return None;
1455+}
1456+
1457+static Picture
1458+make_stipple_picture (GdkGC *gc)
1459+{
1460+ XRenderPictFormat *format = NULL;
1461+ XRenderPictureAttributes pa;
1462+
1463+ format = XRenderFindStandardFormat (GDK_GC_XDISPLAY (gc),
1464+ PictStandardA1);
1465+
1466+ pa.repeat = True;
1467+ return XRenderCreatePicture (GDK_GC_XDISPLAY (gc),
1468+ GDK_PIXMAP_XID (_gdk_gc_get_stipple (gc)),
1469+ format,
1470+ CPRepeat, &pa);
1471+}
1472+
1473+static Picture
1474+make_color_picture (GdkGC *gc,
1475+ XRenderColor *color)
1476+{
1477+ GdkGCX11 *x11_gc = GDK_GC_X11 (gc);
1478+ XRenderPictureAttributes pa;
1479+ XRenderPictFormat *pix_format = foreground_format (gc);
1480+ Pixmap pix;
1481+ Picture picture;
1482+
1483+ if (!pix_format)
1484+ return None;
1485+
1486+ pix = XCreatePixmap (GDK_GC_XDISPLAY (gc),
1487+ GDK_SCREEN_XROOTWIN (x11_gc->screen),
1488+ 1, 1, pix_format->depth);
1489+ pa.repeat = True;
1490+ picture = XRenderCreatePicture (GDK_GC_XDISPLAY (gc),
1491+ pix,
1492+ pix_format,
1493+ CPRepeat, &pa);
1494+ XFreePixmap (GDK_GC_XDISPLAY (gc), pix);
1495+
1496+ XRenderFillRectangle (GDK_GC_XDISPLAY (gc), PictOpSrc,
1497+ picture, color,
1498+ 0, 0, 1, 1);
1499+
1500+ return picture;
1501+}
1502+
1503+static void
1504+get_bg_color (GdkGC *gc,
1505+ XRenderColor *render_color)
1506+{
1507+ GdkColormap *cmap;
1508+
1509+ cmap = gdk_gc_get_colormap (gc);
1510+
1511+ if (cmap)
1512+ {
1513+ GdkColor color;
1514+
1515+ gdk_colormap_query_color (cmap, _gdk_gc_get_bg_pixel (gc), &color);
1516+
1517+ render_color->alpha = 0xffff;
1518+ render_color->red = color.red;
1519+ render_color->green = color.green;
1520+ render_color->blue = color.blue;
1521+ }
1522+ else /* Not worth warning, just use black */
1523+ {
1524+ render_color->alpha = 0xffff;
1525+ render_color->red = 0;
1526+ render_color->green = 0;
1527+ render_color->blue = 0;
1528+ }
1529+}
1530+
1531+/**
1532+ * _gdk_x11_gc_get_fg_picture:
1533+ * @gc: a #GdkGC
1534+ *
1535+ * Gets a Xrender Picture object suitable for being the source
1536+ * drawable for drawing with the foreground the graphics context.
1537+ *
1538+ * Return value: a Picture, owned by the GC; this cannot be
1539+ * used over subsequent modification of the GC.
1540+ **/
1541+Picture
1542+_gdk_x11_gc_get_fg_picture (GdkGC *gc)
1543+{
1544+ GdkGCX11 *x11_gc;
1545+ gboolean new = FALSE;
1546+ XftColor xftcolor;
1547+ GdkFill fill;
1548+ int width, height;
1549+
1550+ g_return_val_if_fail (GDK_IS_GC_X11 (gc), None);
1551+
1552+ if (!_gdk_x11_have_render (GDK_GC_DISPLAY (gc)))
1553+ return None;
1554+
1555+ x11_gc = GDK_GC_X11 (gc);
1556+
1557+ fill = GDK_SOLID;
1558+ width = 1;
1559+ height = 1;
1560+
1561+ switch (_gdk_gc_get_fill (gc))
1562+ {
1563+ case GDK_SOLID:
1564+ break;
1565+ case GDK_TILED:
1566+ if (_gdk_gc_get_tile (gc))
1567+ {
1568+ if (!x11_gc->fg_picture)
1569+ x11_gc->fg_picture = make_fg_tile_picture (gc);
1570+
1571+ if (x11_gc->fg_picture != None)
1572+ return x11_gc->fg_picture;
1573+ }
1574+ break;
1575+ case GDK_STIPPLED:
1576+ case GDK_OPAQUE_STIPPLED:
1577+ if (_gdk_gc_get_stipple (gc))
1578+ {
1579+ gdk_drawable_get_size (_gdk_gc_get_stipple (gc), &width, &height);
1580+ fill = _gdk_gc_get_fill (gc);
1581+ }
1582+ break;
1583+ }
1584+
1585+ if (x11_gc->fg_picture == None)
1586+ {
1587+ XRenderPictureAttributes pa;
1588+ XRenderPictFormat *pix_format = foreground_format (gc);
1589+ Pixmap pix;
1590+
1591+ if (!pix_format)
1592+ return None;
1593+
1594+ pix = XCreatePixmap (GDK_GC_XDISPLAY (gc),
1595+ GDK_SCREEN_XROOTWIN (x11_gc->screen),
1596+ width, height, pix_format->depth);
1597+ pa.repeat = True;
1598+ x11_gc->fg_picture = XRenderCreatePicture (GDK_GC_XDISPLAY (gc),
1599+ pix,
1600+ pix_format,
1601+ CPRepeat, &pa);
1602+ XFreePixmap (GDK_GC_XDISPLAY (gc), pix);
1603+
1604+ new = TRUE;
1605+ }
1606+
1607+ _gdk_gc_x11_get_fg_xft_color (gc, &xftcolor);
1608+
1609+ if (x11_gc->fg_picture_color.alpha != 0xffff ||
1610+ x11_gc->fg_picture_color.red != xftcolor.color.red ||
1611+ x11_gc->fg_picture_color.green != xftcolor.color.green ||
1612+ x11_gc->fg_picture_color.blue != xftcolor.color.blue)
1613+ {
1614+ x11_gc->fg_picture_color.alpha = 0xffff;
1615+ x11_gc->fg_picture_color.red = xftcolor.color.red;
1616+ x11_gc->fg_picture_color.green = xftcolor.color.green;
1617+ x11_gc->fg_picture_color.blue = xftcolor.color.blue;
1618+
1619+ new = TRUE;
1620+ }
1621+
1622+ switch (fill)
1623+ {
1624+ case GDK_SOLID:
1625+ XRenderFillRectangle (GDK_GC_XDISPLAY (gc), PictOpSrc,
1626+ x11_gc->fg_picture, &x11_gc->fg_picture_color,
1627+ 0, 0, width, height);
1628+ break;
1629+ case GDK_STIPPLED:
1630+ {
1631+ Picture stipple_picture = make_stipple_picture (gc);
1632+
1633+ XRenderFillRectangle (GDK_GC_XDISPLAY (gc), PictOpSrc,
1634+ x11_gc->fg_picture, &x11_gc->fg_picture_color,
1635+ 0, 0, width, height);
1636+ XRenderComposite (GDK_GC_XDISPLAY (gc),
1637+ PictOpInReverse,
1638+ stipple_picture, None, x11_gc->fg_picture,
1639+ 0, 0, 0, 0, 0, 0, width, height);
1640+
1641+ XRenderFreePicture (GDK_GC_XDISPLAY (x11_gc), stipple_picture);
1642+ }
1643+ break;
1644+ case GDK_OPAQUE_STIPPLED:
1645+ {
1646+ XRenderColor bg_color;
1647+
1648+ Picture stipple_picture = make_stipple_picture (gc);
1649+ Picture fg_picture = make_color_picture (gc, &x11_gc->fg_picture_color);
1650+
1651+ get_bg_color (gc, &bg_color);
1652+
1653+ XRenderFillRectangle (GDK_GC_XDISPLAY (gc), PictOpSrc,
1654+ x11_gc->fg_picture, &bg_color,
1655+ 0, 0, width, height);
1656+ XRenderComposite (GDK_GC_XDISPLAY (gc),
1657+ PictOpOver,
1658+ fg_picture, stipple_picture, x11_gc->fg_picture,
1659+ 0, 0, 0, 0, 0, 0, width, height);
1660+
1661+ XRenderFreePicture (GDK_GC_XDISPLAY (x11_gc), stipple_picture);
1662+ XRenderFreePicture (GDK_GC_XDISPLAY (x11_gc), fg_picture);
1663+ }
1664+ break;
1665+ case GDK_TILED:
1666+ g_assert_not_reached (); /* handled above */
1667+ break;
1668+ }
1669+
1670+ return x11_gc->fg_picture;
1671+}
1672+
1673+/**
1674+ * _gdk_gc_x11_get_fg_xft_color:
1675+ * @gc: a #GdkGC
1676+ * @xftcolor: location to store the color
1677+ *
1678+ * Gets the foreground color of the GC as a XftColor.
1679+ **/
1680+void
1681+_gdk_gc_x11_get_fg_xft_color (GdkGC *gc,
1682+ XftColor *xftcolor)
1683+{
1684+ GdkGCX11 *x11_gc;
1685+ GdkColormap *cmap;
1686+ GdkColor color;
1687+
1688+ g_return_if_fail (GDK_IS_GC_X11 (gc));
1689+
1690+ x11_gc = GDK_GC_X11 (gc);
1691+
1692+ cmap = gdk_gc_get_colormap (gc);
1693+
1694+ xftcolor->pixel = _gdk_gc_get_fg_pixel (gc);
1695+
1696+ if (cmap)
1697+ {
1698+ gdk_colormap_query_color (cmap, xftcolor->pixel, &color);
1699+ xftcolor->color.alpha = 0xffff;
1700+ xftcolor->color.red = color.red;
1701+ xftcolor->color.green = color.green;
1702+ xftcolor->color.blue = color.blue;
1703+ }
1704+ else if (x11_gc->depth == 1)
1705+ {
1706+ /* Drawing with Xft on a bitmap is a bit bizzare; it
1707+ * takes alpha >= 0x8000 to mean 'set to 1' and
1708+ * alpha < 0x8000 to mean 'set to 0'.
1709+ */
1710+ if (xftcolor->pixel)
1711+ {
1712+ xftcolor->color.red = 0xffff;
1713+ xftcolor->color.green = 0xffff;
1714+ xftcolor->color.blue = 0xffff;
1715+ xftcolor->color.alpha = 0xffff;
1716+ }
1717+ else
1718+ {
1719+ xftcolor->color.red = 0;
1720+ xftcolor->color.green = 0;
1721+ xftcolor->color.blue = 0;
1722+ xftcolor->color.alpha = 0;
1723+ }
1724+ }
1725+ else
1726+ {
1727+ g_warning ("Using Xft rendering requires the GC argument to have a\n"
1728+ "specified colormap. If the GC was created for a drawable\n"
1729+ "with a colormap, the colormap will be set on the GC\n"
1730+ "automatically. Otherwise, a colormap must be set on it with"
1731+ "gdk_gc_set_colormap");
1732+ }
1733+}
1734+
1735+void
1736+_gdk_windowing_gc_get_foreground (GdkGC *gc,
1737+ GdkColor *color)
1738+{
1739+ GdkColormap *cmap;
1740+
1741+ g_return_if_fail (GDK_IS_GC_X11 (gc));
1742+
1743+ color->pixel = _gdk_gc_get_fg_pixel (gc);
1744+
1745+ cmap = gdk_gc_get_colormap (gc);
1746+
1747+ if (cmap)
1748+ gdk_colormap_query_color (cmap, _gdk_gc_get_fg_pixel (gc), color);
1749+ else
1750+ g_warning ("No colormap in _gdk_windowing_gc_get_foreground");
1751+}
1752 #define __GDK_GC_X11_C__
1753 #include "gdkaliasdef.c"
1754Index: gtk+-2.10.6/gdk/x11/gdkprivate-x11.h
1755===================================================================
1756--- gtk+-2.10.6.orig/gdk/x11/gdkprivate-x11.h 2006-10-30 12:58:30.000000000 +0000
1757+++ gtk+-2.10.6/gdk/x11/gdkprivate-x11.h 2006-10-30 12:59:30.000000000 +0000
1758@@ -63,6 +63,9 @@
1759 guint have_clip_region : 1;
1760 guint have_clip_mask : 1;
1761 guint depth : 8;
1762+
1763+ Picture fg_picture;
1764+ XRenderColor fg_picture_color;
1765 };
1766
1767 struct _GdkGCX11Class
1768@@ -102,6 +105,11 @@
1769 GType _gdk_gc_x11_get_type (void);
1770
1771 gboolean _gdk_x11_have_render (GdkDisplay *display);
1772+gboolean _gdk_x11_have_render_with_trapezoids (GdkDisplay *display);
1773+
1774+Picture _gdk_x11_gc_get_fg_picture (GdkGC *gc);
1775+void _gdk_gc_x11_get_fg_xft_color (GdkGC *gc,
1776+ XftColor *xftcolor);
1777
1778 GdkGC *_gdk_x11_gc_new (GdkDrawable *drawable,
1779 GdkGCValues *values,
1780Index: gtk+-2.10.6/gdk/x11/gdkwindow-x11.c
1781===================================================================
1782--- gtk+-2.10.6.orig/gdk/x11/gdkwindow-x11.c 2006-10-30 12:58:30.000000000 +0000
1783+++ gtk+-2.10.6/gdk/x11/gdkwindow-x11.c 2006-10-30 12:59:30.000000000 +0000
1784@@ -1114,7 +1114,8 @@
1785 {
1786 GdkWindowObject *private = (GdkWindowObject *)window;
1787 GdkToplevelX11 *toplevel;
1788-
1789+ GdkDrawableImplX11 *draw_impl;
1790+
1791 g_return_if_fail (GDK_IS_WINDOW (window));
1792
1793 _gdk_selection_window_destroyed (window);
1794@@ -1126,6 +1127,11 @@
1795 if (toplevel)
1796 gdk_toplevel_x11_free_contents (GDK_WINDOW_DISPLAY (window), toplevel);
1797
1798+ draw_impl = GDK_DRAWABLE_IMPL_X11 (private->impl);
1799+
1800+ if (draw_impl->xft_draw)
1801+ XftDrawDestroy (draw_impl->xft_draw);
1802+
1803 _gdk_x11_drawable_finish (private->impl);
1804
1805 if (!recursing && !foreign_destroy)
1806Index: gtk+-2.10.6/gdk/x11/Makefile.am
1807===================================================================
1808--- gtk+-2.10.6.orig/gdk/x11/Makefile.am 2006-10-30 12:58:30.000000000 +0000
1809+++ gtk+-2.10.6/gdk/x11/Makefile.am 2006-10-30 12:59:30.000000000 +0000
1810@@ -37,6 +37,7 @@
1811 gdkinput.c \
1812 gdkkeys-x11.c \
1813 gdkmain-x11.c \
1814+ gdkpango-x11.c \
1815 gdkpixmap-x11.c \
1816 gdkpixmap-x11.h \
1817 gdkproperty-x11.c \
1818Index: gtk+-2.10.6/gtk/gtkcalendar.c
1819===================================================================
1820--- gtk+-2.10.6.orig/gtk/gtkcalendar.c 2006-10-30 12:58:30.000000000 +0000
1821+++ gtk+-2.10.6/gtk/gtkcalendar.c 2006-10-30 12:59:30.000000000 +0000
1822@@ -1821,7 +1821,7 @@
1823 }
1824 }
1825
1826-
1827+
1828 /****************************************
1829 * Repainting *
1830 ****************************************/
1831@@ -1831,7 +1831,7 @@
1832 {
1833 GtkWidget *widget = GTK_WIDGET (calendar);
1834 GtkCalendarPrivate *priv = GTK_CALENDAR_GET_PRIVATE (calendar);
1835- cairo_t *cr;
1836+ GdkGC *gc;
1837 char buffer[255];
1838 int x, y;
1839 gint header_width;
1840@@ -1849,7 +1849,7 @@
1841 else
1842 year_left = !priv->year_before;
1843
1844- cr = gdk_cairo_create (priv->header_win);
1845+ gc = calendar->gc;
1846
1847 header_width = widget->allocation.width - 2 * widget->style->xthickness;
1848
1849@@ -1902,9 +1902,9 @@
1850 - (max_year_width - logical_rect.width)/2);
1851
1852
1853- gdk_cairo_set_source_color (cr, HEADER_FG_COLOR (GTK_WIDGET (calendar)));
1854- cairo_move_to (cr, x, y);
1855- pango_cairo_show_layout (cr, layout);
1856+ gdk_gc_set_foreground (gc, HEADER_FG_COLOR (GTK_WIDGET (calendar)));
1857+ gdk_draw_layout (priv->header_win, gc, x, y, layout);
1858+
1859
1860 /* Draw month */
1861 g_snprintf (buffer, sizeof (buffer), "%s", default_monthname[calendar->month]);
1862@@ -1924,19 +1924,19 @@
1863 else
1864 x = 3 + priv->arrow_width + (max_month_width - logical_rect.width)/2;
1865
1866- cairo_move_to (cr, x, y);
1867- pango_cairo_show_layout (cr, layout);
1868-
1869+ gdk_draw_layout (priv->header_win, gc, x, y, layout);
1870+
1871+ gdk_gc_set_foreground (gc, BACKGROUND_COLOR (GTK_WIDGET (calendar)));
1872+
1873 g_object_unref (layout);
1874- cairo_destroy (cr);
1875 }
1876
1877 static void
1878 calendar_paint_day_names (GtkCalendar *calendar)
1879 {
1880 GtkWidget *widget = GTK_WIDGET (calendar);
1881+ GdkGC *gc;
1882 GtkCalendarPrivate *priv = GTK_CALENDAR_GET_PRIVATE (calendar);
1883- cairo_t *cr;
1884 char buffer[255];
1885 int day,i;
1886 int day_width, cal_width;
1887@@ -1946,8 +1946,7 @@
1888 gint focus_padding;
1889 gint focus_width;
1890
1891- cr = gdk_cairo_create (priv->day_name_win);
1892-
1893+ gc = calendar->gc;
1894 gtk_widget_style_get (GTK_WIDGET (widget),
1895 "focus-line-width", &focus_width,
1896 "focus-padding", &focus_padding,
1897@@ -1961,22 +1960,19 @@
1898 * Draw rectangles as inverted background for the labels.
1899 */
1900
1901- gdk_cairo_set_source_color (cr, SELECTED_BG_COLOR (widget));
1902- cairo_rectangle (cr,
1903- CALENDAR_MARGIN, CALENDAR_MARGIN,
1904- cal_width-CALENDAR_MARGIN * 2,
1905- priv->day_name_h - CALENDAR_MARGIN);
1906- cairo_fill (cr);
1907-
1908+ gdk_gc_set_foreground (gc, SELECTED_BG_COLOR (widget));
1909+ gdk_draw_rectangle (priv->day_name_win, gc, TRUE,
1910+ CALENDAR_MARGIN, CALENDAR_MARGIN,
1911+ cal_width-CALENDAR_MARGIN * 2,
1912+ priv->day_name_h - CALENDAR_MARGIN);
1913+
1914 if (calendar->display_flags & GTK_CALENDAR_SHOW_WEEK_NUMBERS)
1915- {
1916- cairo_rectangle (cr,
1917- CALENDAR_MARGIN,
1918- priv->day_name_h - CALENDAR_YSEP,
1919- priv->week_width - CALENDAR_YSEP - CALENDAR_MARGIN,
1920- CALENDAR_YSEP);
1921- cairo_fill (cr);
1922- }
1923+ gdk_draw_rectangle (priv->day_name_win, gc, TRUE,
1924+ CALENDAR_MARGIN,
1925+ priv->day_name_h - CALENDAR_YSEP,
1926+ priv->week_width - CALENDAR_YSEP - CALENDAR_MARGIN,
1927+ CALENDAR_YSEP);
1928+
1929
1930 /*
1931 * Write the labels
1932@@ -1984,7 +1980,7 @@
1933
1934 layout = gtk_widget_create_pango_layout (widget, NULL);
1935
1936- gdk_cairo_set_source_color (cr, SELECTED_FG_COLOR (widget));
1937+ gdk_gc_set_foreground (gc, SELECTED_FG_COLOR (widget));
1938 for (i = 0; i < 7; i++)
1939 {
1940 if (gtk_widget_get_direction (GTK_WIDGET (calendar)) == GTK_TEXT_DIR_RTL)
1941@@ -1997,19 +1993,18 @@
1942 pango_layout_set_text (layout, buffer, -1);
1943 pango_layout_get_pixel_extents (layout, NULL, &logical_rect);
1944
1945- cairo_move_to (cr,
1946- (CALENDAR_MARGIN +
1947- + (gtk_widget_get_direction (widget) == GTK_TEXT_DIR_LTR ?
1948- (priv->week_width + (priv->week_width ? CALENDAR_XSEP : 0))
1949- : 0)
1950- + day_wid_sep * i
1951- + (day_width - logical_rect.width)/2),
1952- CALENDAR_MARGIN + focus_width + focus_padding + logical_rect.y);
1953- pango_cairo_show_layout (cr, layout);
1954+ gdk_draw_layout (priv->day_name_win, gc,
1955+ (CALENDAR_MARGIN +
1956+ + (gtk_widget_get_direction (widget) == GTK_TEXT_DIR_LTR ?
1957+ (priv->week_width + (priv->week_width ? CALENDAR_XSEP : 0))
1958+ : 0)
1959+ + day_wid_sep * i
1960+ + (day_width - logical_rect.width)/2),
1961+ CALENDAR_MARGIN + focus_width + focus_padding + logical_rect.y,
1962+ layout);
1963 }
1964
1965 g_object_unref (layout);
1966- cairo_destroy (cr);
1967 }
1968
1969 static void
1970@@ -2017,7 +2012,7 @@
1971 {
1972 GtkWidget *widget = GTK_WIDGET (calendar);
1973 GtkCalendarPrivate *priv = GTK_CALENDAR_GET_PRIVATE (calendar);
1974- cairo_t *cr;
1975+ GdkGC *gc;
1976 gint row, week = 0, year;
1977 gint x_loc;
1978 char buffer[32];
1979@@ -2027,7 +2022,7 @@
1980 gint focus_padding;
1981 gint focus_width;
1982
1983- cr = gdk_cairo_create (priv->week_win);
1984+ gc = calendar->gc;
1985
1986 gtk_widget_style_get (GTK_WIDGET (widget),
1987 "focus-line-width", &focus_width,
1988@@ -2038,20 +2033,20 @@
1989 * Draw a rectangle as inverted background for the labels.
1990 */
1991
1992- gdk_cairo_set_source_color (cr, SELECTED_BG_COLOR (widget));
1993+ gdk_gc_set_foreground (gc, SELECTED_BG_COLOR (widget));
1994 if (priv->day_name_win)
1995- cairo_rectangle (cr,
1996- CALENDAR_MARGIN,
1997- 0,
1998- priv->week_width - CALENDAR_MARGIN,
1999- priv->main_h - CALENDAR_MARGIN);
2000+ gdk_draw_rectangle (priv->week_win, gc, TRUE,
2001+ CALENDAR_MARGIN,
2002+ 0,
2003+ priv->week_width - CALENDAR_MARGIN,
2004+ priv->main_h - CALENDAR_MARGIN);
2005 else
2006- cairo_rectangle (cr,
2007- CALENDAR_MARGIN,
2008- CALENDAR_MARGIN,
2009- priv->week_width - CALENDAR_MARGIN,
2010- priv->main_h - 2 * CALENDAR_MARGIN);
2011- cairo_fill (cr);
2012+ gdk_draw_rectangle (priv->week_win, gc, TRUE,
2013+ CALENDAR_MARGIN,
2014+ CALENDAR_MARGIN,
2015+ priv->week_width - CALENDAR_MARGIN,
2016+ priv->main_h - 2 * CALENDAR_MARGIN);
2017+
2018
2019 /*
2020 * Write the labels
2021@@ -2059,7 +2054,7 @@
2022
2023 layout = gtk_widget_create_pango_layout (widget, NULL);
2024
2025- gdk_cairo_set_source_color (cr, SELECTED_FG_COLOR (widget));
2026+ gdk_gc_set_foreground (gc, SELECTED_FG_COLOR (widget));
2027 day_height = calendar_row_height (calendar);
2028 for (row = 0; row < 6; row++)
2029 {
2030@@ -2095,12 +2090,10 @@
2031 - logical_rect.width
2032 - CALENDAR_XSEP - focus_padding - focus_width);
2033
2034- cairo_move_to (cr, x_loc, y_loc);
2035- pango_cairo_show_layout (cr, layout);
2036+ gdk_draw_layout (priv->week_win, gc, x_loc, y_loc, layout);
2037 }
2038
2039 g_object_unref (layout);
2040- cairo_destroy (cr);
2041 }
2042
2043 static void
2044@@ -2149,7 +2142,7 @@
2045 {
2046 GtkWidget *widget = GTK_WIDGET (calendar);
2047 GtkCalendarPrivate *priv = GTK_CALENDAR_GET_PRIVATE (calendar);
2048- cairo_t *cr;
2049+ GdkGC *gc;
2050 GdkColor *text_color;
2051 gchar buffer[32];
2052 gint day;
2053@@ -2162,7 +2155,7 @@
2054 g_return_if_fail (row < 6);
2055 g_return_if_fail (col < 7);
2056
2057- cr = gdk_cairo_create (priv->main_win);
2058+ gc = calendar->gc;
2059
2060 day = calendar->day[row][col];
2061
2062@@ -2170,11 +2163,11 @@
2063
2064 if (calendar->day_month[row][col] == MONTH_PREV)
2065 {
2066- text_color = PREV_MONTH_COLOR (widget);
2067+ gdk_gc_set_foreground (gc, PREV_MONTH_COLOR (GTK_WIDGET (calendar)));
2068 }
2069 else if (calendar->day_month[row][col] == MONTH_NEXT)
2070 {
2071- text_color = NEXT_MONTH_COLOR (widget);
2072+ gdk_gc_set_foreground (gc, NEXT_MONTH_COLOR (GTK_WIDGET (calendar)));
2073 }
2074 else
2075 {
2076@@ -2188,16 +2181,16 @@
2077 #endif
2078 if (calendar->selected_day == day)
2079 {
2080- gdk_cairo_set_source_color (cr, SELECTED_BG_COLOR (widget));
2081- gdk_cairo_rectangle (cr, &day_rect);
2082- cairo_fill (cr);
2083+ gdk_gc_set_foreground (gc, SELECTED_BG_COLOR (GTK_WIDGET (calendar)));
2084+ gdk_draw_rectangle (priv->main_win, gc, TRUE, day_rect.x, day_rect.y,
2085+ day_rect.width, day_rect.height);
2086 }
2087 if (calendar->selected_day == day)
2088- text_color = SELECTED_FG_COLOR (widget);
2089+ gdk_gc_set_foreground (gc, SELECTED_FG_COLOR (GTK_WIDGET (calendar)));
2090 else if (calendar->marked_date[day-1])
2091- text_color = MARKED_COLOR (widget);
2092+ gdk_gc_set_foreground (gc, MARKED_COLOR (GTK_WIDGET (calendar)));
2093 else
2094- text_color = NORMAL_DAY_COLOR (widget);
2095+ gdk_gc_set_foreground (gc, NORMAL_DAY_COLOR (GTK_WIDGET (calendar)));
2096 }
2097
2098 /* Translators: this defines whether the day numbers should use
2099@@ -2219,16 +2212,13 @@
2100 x_loc -= logical_rect.width;
2101 y_loc = day_rect.y + (day_rect.height - logical_rect.height) / 2;
2102
2103- gdk_cairo_set_source_color (cr, text_color);
2104- cairo_move_to (cr, x_loc, y_loc);
2105- pango_cairo_show_layout (cr, layout);
2106+ gdk_draw_layout (priv->main_win, gc,
2107+ x_loc, y_loc, layout);
2108
2109 if (calendar->marked_date[day-1]
2110 && calendar->day_month[row][col] == MONTH_CURRENT)
2111- {
2112- cairo_move_to (cr, x_loc - 1, y_loc);
2113- pango_cairo_show_layout (cr, layout);
2114- }
2115+ gdk_draw_layout (priv->main_win, gc,
2116+ x_loc-1, y_loc, layout);
2117
2118 if (GTK_WIDGET_HAS_FOCUS (calendar)
2119 && calendar->focus_row == row && calendar->focus_col == col)
2120@@ -2253,7 +2243,6 @@
2121 }
2122
2123 g_object_unref (layout);
2124- cairo_destroy (cr);
2125 }
2126
2127 static void
2128Index: gtk+-2.10.6/gtk/gtkentry.c
2129===================================================================
2130--- gtk+-2.10.6.orig/gtk/gtkentry.c 2006-10-30 12:58:30.000000000 +0000
2131+++ gtk+-2.10.6/gtk/gtkentry.c 2006-10-30 12:59:30.000000000 +0000
2132@@ -3333,7 +3333,6 @@
2133 if (GTK_WIDGET_DRAWABLE (entry))
2134 {
2135 PangoLayout *layout = gtk_entry_ensure_layout (entry, TRUE);
2136- cairo_t *cr;
2137 gint x, y;
2138 gint start_pos, end_pos;
2139
2140@@ -3341,56 +3340,60 @@
2141
2142 get_layout_position (entry, &x, &y);
2143
2144- cr = gdk_cairo_create (entry->text_area);
2145-
2146- cairo_move_to (cr, x, y);
2147- gdk_cairo_set_source_color (cr, &widget->style->text [widget->state]);
2148- pango_cairo_show_layout (cr, layout);
2149-
2150+ gdk_draw_layout (entry->text_area, widget->style->text_gc [widget->state],
2151+ x, y,
2152+ layout);
2153+
2154 if (gtk_editable_get_selection_bounds (GTK_EDITABLE (entry), &start_pos, &end_pos))
2155 {
2156 gint *ranges;
2157 gint n_ranges, i;
2158 PangoRectangle logical_rect;
2159- GdkColor *selection_color, *text_color;
2160+ GdkGC *selection_gc, *text_gc;
2161 GtkBorder inner_border;
2162-
2163+ GdkRegion *clip_region;
2164+
2165 pango_layout_get_pixel_extents (layout, NULL, &logical_rect);
2166 gtk_entry_get_pixel_ranges (entry, &ranges, &n_ranges);
2167
2168 if (GTK_WIDGET_HAS_FOCUS (entry))
2169 {
2170- selection_color = &widget->style->base [GTK_STATE_SELECTED];
2171- text_color = &widget->style->text [GTK_STATE_SELECTED];
2172+ selection_gc = widget->style->base_gc [GTK_STATE_SELECTED];
2173+ text_gc = widget->style->text_gc [GTK_STATE_SELECTED];
2174 }
2175 else
2176 {
2177- selection_color = &widget->style->base [GTK_STATE_ACTIVE];
2178- text_color = &widget->style->text [GTK_STATE_ACTIVE];
2179+ selection_gc = widget->style->base_gc [GTK_STATE_ACTIVE];
2180+ text_gc = widget->style->text_gc [GTK_STATE_ACTIVE];
2181 }
2182-
2183+
2184+ clip_region = gdk_region_new ();
2185 _gtk_entry_effective_inner_border (entry, &inner_border);
2186
2187 for (i = 0; i < n_ranges; ++i)
2188- cairo_rectangle (cr,
2189- inner_border.left - entry->scroll_offset + ranges[2 * i],
2190- y,
2191- ranges[2 * i + 1],
2192- logical_rect.height);
2193+ {
2194+ GdkRectangle rect;
2195
2196- cairo_clip (cr);
2197-
2198- gdk_cairo_set_source_color (cr, selection_color);
2199- cairo_paint (cr);
2200+ rect.x = inner_border.left - entry->scroll_offset + ranges[2 * i];
2201+ rect.y = y;
2202+ rect.width = ranges[2 * i + 1];
2203+ rect.height = logical_rect.height;
2204+
2205+ gdk_draw_rectangle (entry->text_area, selection_gc, TRUE,
2206+ rect.x, rect.y, rect.width, rect.height);
2207
2208- cairo_move_to (cr, x, y);
2209- gdk_cairo_set_source_color (cr, text_color);
2210- pango_cairo_show_layout (cr, layout);
2211+ gdk_region_union_with_rect (clip_region, &rect);
2212+ }
2213
2214+ gdk_gc_set_clip_region (text_gc, clip_region);
2215+ gdk_draw_layout (entry->text_area, text_gc,
2216+ x, y,
2217+ layout);
2218+ gdk_gc_set_clip_region (text_gc, NULL);
2219+
2220+ gdk_region_destroy (clip_region);
2221 g_free (ranges);
2222 }
2223-
2224- cairo_destroy (cr);
2225 }
2226 }
2227
2228Index: gtk+-2.10.6/gtk/gtkwidget.c
2229===================================================================
2230--- gtk+-2.10.6.orig/gtk/gtkwidget.c 2006-10-30 12:58:30.000000000 +0000
2231+++ gtk+-2.10.6/gtk/gtkwidget.c 2006-10-30 12:59:30.000000000 +0000
2232@@ -5445,7 +5445,8 @@
2233 GdkScreen *screen;
2234
2235 update_pango_context (widget, context);
2236-
2237+/* TODO: Figure out the proper way to handle this in a pangoxft setting
2238+
2239 screen = gtk_widget_get_screen_unchecked (widget);
2240 if (screen)
2241 {
2242@@ -5453,7 +5454,7 @@
2243 gdk_screen_get_resolution (screen));
2244 pango_cairo_context_set_font_options (context,
2245 gdk_screen_get_font_options (screen));
2246- }
2247+ }*/
2248 }
2249 }
2250
2251Index: gtk+-2.10.6/gdk/x11/gdkpango-x11.c
2252===================================================================
2253--- /dev/null 1970-01-01 00:00:00.000000000 +0000
2254+++ gtk+-2.10.6/gdk/x11/gdkpango-x11.c 2006-10-30 12:59:30.000000000 +0000
2255@@ -0,0 +1,174 @@
2256+/* GDK - The GIMP Drawing Kit
2257+ * Copyright (C) 2000 Red Hat, Inc.
2258+ *
2259+ * This library is free software; you can redistribute it and/or
2260+ * modify it under the terms of the GNU Lesser General Public
2261+ * License as published by the Free Software Foundation; either
2262+ * version 2 of the License, or (at your option) any later version.
2263+ *
2264+ * This library is distributed in the hope that it will be useful,
2265+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
2266+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
2267+ * Lesser General Public License for more details.
2268+ *
2269+ * You should have received a copy of the GNU Lesser General Public
2270+ * License along with this library; if not, write to the
2271+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
2272+ * Boston, MA 02111-1307, USA.
2273+ */
2274+
2275+#include <config.h>
2276+#include <stdlib.h>
2277+
2278+#include "gdkx.h"
2279+#include "gdkdisplay-x11.h"
2280+#include "gdkpango.h"
2281+#include <pango/pangoxft.h>
2282+#include <pango/pangoxft-render.h>
2283+#include "gdkalias.h"
2284+
2285+#include <math.h>
2286+
2287+typedef struct _GdkX11Renderer GdkX11Renderer;
2288+typedef struct _GdkX11RendererClass GdkX11RendererClass;
2289+
2290+#define GDK_TYPE_X11_RENDERER (_gdk_x11_renderer_get_type())
2291+#define GDK_X11_RENDERER(object) (G_TYPE_CHECK_INSTANCE_CAST ((object), GDK_TYPE_X11_RENDERER, GdkX11Renderer))
2292+#define GDK_IS_X11_RENDERER(object) (G_TYPE_CHECK_INSTANCE_TYPE ((object), GDK_TYPE_X11_RENDERER))
2293+#define GDK_X11_RENDERER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GDK_TYPE_X11_RENDERER, GdkX11RendererClass))
2294+#define GDK_IS_X11_RENDERER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GDK_TYPE_X11_RENDERER))
2295+#define GDK_X11_RENDERER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GDK_TYPE_X11_RENDERER, GdkX11RendererClass))
2296+
2297+#define MAX_RENDER_PART PANGO_RENDER_PART_STRIKETHROUGH
2298+
2299+struct _GdkX11Renderer
2300+{
2301+ PangoXftRenderer parent_instance;
2302+
2303+ XRenderPictFormat *mask_format;
2304+
2305+ GdkDrawable *drawable;
2306+ GdkGC *gc;
2307+};
2308+
2309+struct _GdkX11RendererClass
2310+{
2311+ PangoXftRendererClass parent_class;
2312+};
2313+
2314+G_DEFINE_TYPE (GdkX11Renderer, _gdk_x11_renderer, PANGO_TYPE_XFT_RENDERER)
2315+
2316+static void
2317+gdk_x11_renderer_finalize (GObject *object)
2318+{
2319+ G_OBJECT_CLASS (_gdk_x11_renderer_parent_class)->finalize (object);
2320+}
2321+
2322+static void
2323+gdk_x11_renderer_composite_trapezoids (PangoXftRenderer *xftrenderer,
2324+ PangoRenderPart part,
2325+ XTrapezoid *trapezoids,
2326+ int n_trapezoids)
2327+{
2328+ /* Because we only use this renderer for "draw_glyphs()" calls, we
2329+ * won't hit this code path much. However, it is hit for drawing
2330+ * the "unknown glyph" hex squares. We can safely ignore the part,
2331+ */
2332+ GdkX11Renderer *x11_renderer = GDK_X11_RENDERER (xftrenderer);
2333+
2334+ _gdk_x11_drawable_draw_xtrapezoids (x11_renderer->drawable,
2335+ x11_renderer->gc,
2336+ trapezoids, n_trapezoids);
2337+
2338+}
2339+
2340+static void
2341+gdk_x11_renderer_composite_glyphs (PangoXftRenderer *xftrenderer,
2342+ XftFont *xft_font,
2343+ XftGlyphSpec *glyphs,
2344+ gint n_glyphs)
2345+{
2346+ GdkX11Renderer *x11_renderer = GDK_X11_RENDERER (xftrenderer);
2347+
2348+ _gdk_x11_drawable_draw_xft_glyphs (x11_renderer->drawable,
2349+ x11_renderer->gc,
2350+ xft_font, glyphs, n_glyphs);
2351+}
2352+
2353+static void
2354+_gdk_x11_renderer_init (GdkX11Renderer *renderer)
2355+{
2356+}
2357+
2358+static void
2359+_gdk_x11_renderer_class_init (GdkX11RendererClass *klass)
2360+{
2361+ PangoXftRendererClass *xftrenderer_class = PANGO_XFT_RENDERER_CLASS (klass);
2362+ GObjectClass *object_class = G_OBJECT_CLASS (klass);
2363+
2364+ xftrenderer_class->composite_glyphs = gdk_x11_renderer_composite_glyphs;
2365+ xftrenderer_class->composite_trapezoids = gdk_x11_renderer_composite_trapezoids;
2366+
2367+ object_class->finalize = gdk_x11_renderer_finalize;
2368+}
2369+
2370+PangoRenderer *
2371+_gdk_x11_renderer_get (GdkDrawable *drawable,
2372+ GdkGC *gc)
2373+{
2374+ GdkScreen *screen = GDK_DRAWABLE_IMPL_X11 (drawable)->screen;
2375+ GdkScreenX11 *screen_x11 = GDK_SCREEN_X11 (screen);
2376+ GdkX11Renderer *x11_renderer;
2377+
2378+ if (!screen_x11->renderer)
2379+ {
2380+ screen_x11->renderer = g_object_new (GDK_TYPE_X11_RENDERER,
2381+ "display", GDK_SCREEN_XDISPLAY (screen),
2382+ "screen", GDK_SCREEN_XNUMBER (screen),
2383+ NULL);
2384+ }
2385+
2386+ x11_renderer = GDK_X11_RENDERER (screen_x11->renderer);
2387+
2388+ x11_renderer->drawable = drawable;
2389+ x11_renderer->gc = gc;
2390+
2391+ return screen_x11->renderer;
2392+}
2393+
2394+/**
2395+ * gdk_pango_context_get_for_screen:
2396+ * @screen: the #GdkScreen for which the context is to be created.
2397+ *
2398+ * Creates a #PangoContext for @screen.
2399+ *
2400+ * The context must be freed when you're finished with it.
2401+ *
2402+ * When using GTK+, normally you should use gtk_widget_get_pango_context()
2403+ * instead of this function, to get the appropriate context for
2404+ * the widget you intend to render text onto.
2405+ *
2406+ * Return value: a new #PangoContext for @screen
2407+ *
2408+ * Since: 2.2
2409+ **/
2410+PangoContext *
2411+gdk_pango_context_get_for_screen (GdkScreen *screen)
2412+{
2413+ PangoContext *context;
2414+
2415+ g_return_val_if_fail (GDK_IS_SCREEN (screen), NULL);
2416+
2417+ if (screen->closed)
2418+ return NULL;
2419+
2420+ context = pango_xft_get_context (GDK_SCREEN_XDISPLAY (screen),
2421+ GDK_SCREEN_X11 (screen)->screen_num);
2422+
2423+ g_object_set_data (G_OBJECT (context), "gdk-pango-screen", screen);
2424+
2425+ return context;
2426+}
2427+
2428+#define __GDK_PANGO_X11_C__
2429+#include "gdkaliasdef.c"
2430Index: gtk+-2.10.6/gdk/x11/gdkpixmap-x11.c
2431===================================================================
2432--- gtk+-2.10.6.orig/gdk/x11/gdkpixmap-x11.c 2006-10-30 12:58:30.000000000 +0000
2433+++ gtk+-2.10.6/gdk/x11/gdkpixmap-x11.c 2006-10-30 12:59:30.000000000 +0000
2434@@ -119,6 +119,9 @@
2435 {
2436 GdkDrawableImplX11 *draw_impl = GDK_DRAWABLE_IMPL_X11 (impl);
2437
2438+ if (draw_impl->xft_draw)
2439+ XftDrawDestroy (draw_impl->xft_draw);
2440+
2441 _gdk_x11_drawable_finish (GDK_DRAWABLE (draw_impl));
2442 }
2443
2444--- gtk+-2.10.6.orig/gtk/gtkcalendar.c.orig 2006-11-14 14:39:34.000000000 -0800
2445+++ gtk+-2.10.6/gtk/gtkcalendar.c 2006-11-14 14:37:34.000000000 -0800
2446@@ -1495,6 +1495,10 @@ gtk_calendar_realize (GtkWidget *widget)
2447 BACKGROUND_COLOR ( GTK_WIDGET ( calendar)));
2448 gdk_window_show (priv->main_win);
2449 gdk_window_set_user_data (priv->main_win, widget);
2450+
2451+ /* Set widgets gc */
2452+ calendar->gc = gdk_gc_new (widget->window);
2453+
2454 gdk_window_set_background (widget->window, BACKGROUND_COLOR (widget));
2455 gdk_window_show (widget->window);
2456 gdk_window_set_user_data (widget->window, widget);
diff --git a/meta/packages/gtk+/gtk+-2.11.6/range-no-redraw.patch b/meta/packages/gtk+/gtk+-2.11.6/range-no-redraw.patch
new file mode 100644
index 0000000000..e3603d7700
--- /dev/null
+++ b/meta/packages/gtk+/gtk+-2.11.6/range-no-redraw.patch
@@ -0,0 +1,41 @@
1Index: gtk/gtkrange.c
2===================================================================
3--- gtk/gtkrange.c (revision 18523)
4+++ gtk/gtkrange.c (working copy)
5@@ -99,6 +99,8 @@
6
7 GtkSensitivityType lower_sensitivity;
8 GtkSensitivityType upper_sensitivity;
9+
10+ guint motion_idle;
11 };
12
13
14@@ -1721,6 +1723,16 @@
15 &handled);
16 }
17
18+static gboolean
19+update_slider_position_idle (GtkRange *range)
20+{
21+ update_slider_position (range, range->layout->mouse_x,range->layout->mouse_y);
22+
23+ range->layout->motion_idle = 0;
24+
25+ return FALSE;
26+}
27+
28 static void
29 stop_scrolling (GtkRange *range)
30 {
31@@ -1860,8 +1872,8 @@
32 if (gtk_range_update_mouse_location (range))
33 gtk_widget_queue_draw (widget);
34
35- if (range->layout->grab_location == MOUSE_SLIDER)
36- update_slider_position (range, x, y);
37+ if (range->layout->grab_location == MOUSE_SLIDER && !range->layout->motion_idle)
38+ range->layout->motion_idle = g_idle_add ((GSourceFunc)update_slider_position_idle, range);
39
40 /* We handled the event if the mouse was in the range_rect */
41 return range->layout->mouse_location != MOUSE_OUTSIDE;
diff --git a/meta/packages/gtk+/gtk+-2.11.6/run-iconcache.patch b/meta/packages/gtk+/gtk+-2.11.6/run-iconcache.patch
new file mode 100644
index 0000000000..ac15e9ab24
--- /dev/null
+++ b/meta/packages/gtk+/gtk+-2.11.6/run-iconcache.patch
@@ -0,0 +1,19 @@
1--- /tmp/Makefile.am 2007-01-08 17:44:47.000000000 +0100
2+++ gtk+-2.10.7/gtk/Makefile.am 2007-01-08 17:45:17.025251000 +0100
3@@ -1128,11 +1128,11 @@
4 ./gtk-update-icon-cache
5 endif
6
7-gtkbuiltincache.h: @REBUILD@ stamp-icons
8- $(MAKE) $(AM_MAKEFLAGS) gtk-update-icon-cache$(EXEEXT)
9- $(gtk_update_icon_cache_program) --force --ignore-theme-index \
10- --source builtin_icons stock-icons > gtkbuiltincache.h.tmp && \
11- mv gtkbuiltincache.h.tmp gtkbuiltincache.h
12+#gtkbuiltincache.h: @REBUILD@ stamp-icons
13+# $(MAKE) $(AM_MAKEFLAGS) gtk-update-icon-cache$(EXEEXT)
14+# $(gtk_update_icon_cache_program) --force --ignore-theme-index \
15+# --source builtin_icons stock-icons > gtkbuiltincache.h.tmp && \
16+# mv gtkbuiltincache.h.tmp gtkbuiltincache.h
17
18 EXTRA_DIST += \
19 $(STOCK_ICONS) \
diff --git a/meta/packages/gtk+/gtk+-2.11.6/scroll-timings.patch b/meta/packages/gtk+/gtk+-2.11.6/scroll-timings.patch
new file mode 100644
index 0000000000..3f823a7880
--- /dev/null
+++ b/meta/packages/gtk+/gtk+-2.11.6/scroll-timings.patch
@@ -0,0 +1,11 @@
1--- gtk+-2.10.0/gtk/gtkrange.c.orig 2006-07-05 12:41:39.000000000 +0200
2+++ gtk+-2.10.0/gtk/gtkrange.c 2006-07-05 12:41:58.000000000 +0200
3@@ -39,7 +39,7 @@
4 #include "gtkalias.h"
5
6 #define SCROLL_DELAY_FACTOR 5 /* Scroll repeat multiplier */
7-#define UPDATE_DELAY 300 /* Delay for queued update */
8+#define UPDATE_DELAY 1000 /* Delay for queued update */
9
10 enum {
11 PROP_0,
diff --git a/meta/packages/gtk+/gtk+-2.11.6/scrolled-placement.patch b/meta/packages/gtk+/gtk+-2.11.6/scrolled-placement.patch
new file mode 100644
index 0000000000..09ded531ea
--- /dev/null
+++ b/meta/packages/gtk+/gtk+-2.11.6/scrolled-placement.patch
@@ -0,0 +1,35 @@
1Index: gtk/gtkscrolledwindow.c
2===================================================================
3--- gtk/gtkscrolledwindow.c (revision 18493)
4+++ gtk/gtkscrolledwindow.c (working copy)
5@@ -885,7 +885,7 @@
6 if (GTK_IS_SCROLLED_WINDOW (widget))
7 {
8 gtk_scrolled_window_update_real_placement (GTK_SCROLLED_WINDOW (widget));
9- gtk_widget_queue_draw (widget);
10+ gtk_widget_queue_resize (widget);
11 }
12 else if (GTK_IS_CONTAINER (widget))
13 gtk_container_forall (GTK_CONTAINER (widget), traverse_container, NULL);
14Index: gdk/x11/gdksettings.c
15===================================================================
16--- gdk/x11/gdksettings.c (revision 18493)
17+++ gdk/x11/gdksettings.c (working copy)
18@@ -65,7 +65,8 @@
19 "Xft/RGBA\0" "gtk-xft-rgba\0"
20 "Xft/DPI\0" "gtk-xft-dpi\0"
21 "Net/FallbackIconTheme\0" "gtk-fallback-icon-theme\0"
22- "Gtk/TouchscreenMode\0" "gtk-touchscreen-mode\0";
23+ "Gtk/TouchscreenMode\0" "gtk-touchscreen-mode\0"
24+ "Gtk/ScrolledWindowPlacement\0" "gtk-scrolled-window-placement\0";
25
26 static const struct
27 {
28@@ -107,5 +108,6 @@
29 { 1197, 1206 },
30 { 1219, 1227 },
31 { 1239, 1261 },
32- { 1285, 1305 }
33+ { 1285, 1305 },
34+ { 1326, 1354 }
35 };
diff --git a/meta/packages/gtk+/gtk+-2.11.6/single-click.patch b/meta/packages/gtk+/gtk+-2.11.6/single-click.patch
new file mode 100644
index 0000000000..250f1629f5
--- /dev/null
+++ b/meta/packages/gtk+/gtk+-2.11.6/single-click.patch
@@ -0,0 +1,56 @@
1Index: gtk+-2.10.6/gtk/gtkcalendar.c
2===================================================================
3--- gtk+-2.10.6.orig/gtk/gtkcalendar.c
4+++ gtk+-2.10.6/gtk/gtkcalendar.c
5@@ -2482,9 +2482,11 @@ calendar_main_button_press (GtkCalendar
6 }
7
8 calendar_select_and_focus_day (calendar, day);
9- }
10+
11+ // This change causes the calendar to disappear after choosing a day
12+/* }
13 else if (event->type == GDK_2BUTTON_PRESS)
14- {
15+ {*/
16 priv->in_drag = 0;
17 if (day_month == MONTH_CURRENT)
18 g_signal_emit (calendar,
19Index: gtk+-2.10.6/gtk/gtkfilesel.c
20===================================================================
21--- gtk+-2.10.6.orig/gtk/gtkfilesel.c
22+++ gtk+-2.10.6/gtk/gtkfilesel.c
23@@ -2426,6 +2426,33 @@ gtk_file_selection_file_changed (GtkTree
24 if (fs->last_selected != NULL)
25 g_free (fs->last_selected);
26
27+ // Single-click directory entry
28+ if (new_names->len == 1)
29+ {
30+ GtkTreeView *tree_view;
31+ GtkTreeModel *model;
32+ GtkTreePath *path;
33+ GtkTreeIter iter;
34+ gboolean is_file;
35+
36+ tree_view = gtk_tree_selection_get_tree_view (selection);
37+
38+ if (gtk_tree_selection_get_selected (selection, &model, &iter))
39+ {
40+ path = gtk_tree_model_get_path (model, &iter);
41+ gtk_tree_model_get (model, &iter, ISFILE_COLUMN, &is_file, -1);
42+
43+ if (!is_file)
44+ {
45+ gtk_file_selection_dir_activate (tree_view, path,
46+ gtk_tree_view_get_column (tree_view, DIR_COLUMN),
47+ user_data);
48+ }
49+
50+ gtk_tree_path_free (path);
51+ }
52+ }
53+
54 fs->last_selected = g_strdup (g_ptr_array_index (new_names, index));
55 filename = get_real_filename (fs->last_selected, FALSE);
56
diff --git a/meta/packages/gtk+/gtk+-2.11.6/small-gtkfilesel.patch b/meta/packages/gtk+/gtk+-2.11.6/small-gtkfilesel.patch
new file mode 100644
index 0000000000..20bf4cf366
--- /dev/null
+++ b/meta/packages/gtk+/gtk+-2.11.6/small-gtkfilesel.patch
@@ -0,0 +1,267 @@
1diff -urNd ../gtk+-2.4.4-r5/gtk+-2.4.4/gtk/gtkfilesel.c gtk+-2.4.4/gtk/gtkfilesel.c
2--- ../gtk+-2.4.4-r5/gtk+-2.4.4/gtk/gtkfilesel.c 2004-07-10 05:02:10.000000000 +0100
3+++ gtk+-2.4.4/gtk/gtkfilesel.c 2004-09-13 13:40:09.000000000 +0100
4@@ -68,6 +68,7 @@
5 #include "gtkprivate.h"
6 #include "gtkscrolledwindow.h"
7 #include "gtkstock.h"
8+#include "gtksignal.h"
9 #include "gtktreeselection.h"
10 #include "gtktreeview.h"
11 #include "gtkvbox.h"
12@@ -77,6 +78,7 @@
13 #include "gtkmessagedialog.h"
14 #include "gtkdnd.h"
15 #include "gtkeventbox.h"
16+#include "gtkimage.h"
17
18 #undef GTK_DISABLE_DEPRECATED
19 #include "gtkoptionmenu.h"
20@@ -245,7 +247,8 @@
21 };
22
23 enum {
24- DIR_COLUMN
25+ DIR_COLUMN,
26+ ISFILE_COLUMN
27 };
28
29 enum {
30@@ -400,6 +403,12 @@
31 GtkTreePath *path,
32 GtkTreeViewColumn *column,
33 gpointer user_data);
34+
35+static void gtk_file_selection_activate (GtkTreeView *tree_view,
36+ GtkTreePath *path,
37+ GtkTreeViewColumn *column,
38+ gpointer user_data);
39+
40 static void gtk_file_selection_file_changed (GtkTreeSelection *selection,
41 gpointer user_data);
42 static void gtk_file_selection_dir_activate (GtkTreeView *tree_view,
43@@ -419,6 +428,7 @@
44 static void gtk_file_selection_create_dir (GtkWidget *widget, gpointer data);
45 static void gtk_file_selection_delete_file (GtkWidget *widget, gpointer data);
46 static void gtk_file_selection_rename_file (GtkWidget *widget, gpointer data);
47+static void gtk_file_selection_style_set (GtkWidget *widget, GtkStyle *prev_style);
48
49 static void free_selected_names (GPtrArray *names);
50
51@@ -578,6 +588,23 @@
52 G_PARAM_WRITABLE));
53 object_class->destroy = gtk_file_selection_destroy;
54 widget_class->map = gtk_file_selection_map;
55+ widget_class->style_set = gtk_file_selection_style_set;
56+
57+ gtk_widget_class_install_style_property (widget_class,
58+ g_param_spec_boolean ("show_fileops_default",
59+ _("Show fileop buttons by default"),
60+ _("Whether file operation buttons are shown by default"),
61+ TRUE,
62+ G_PARAM_READABLE));
63+
64+ gtk_widget_class_install_style_property (widget_class,
65+ g_param_spec_int ("border_width",
66+ _("Border width"),
67+ _("Width of border around the main dialog area"),
68+ 0,
69+ G_MAXINT,
70+ 10,
71+ G_PARAM_READABLE));
72 }
73
74 static void gtk_file_selection_set_property (GObject *object,
75@@ -649,7 +676,29 @@
76 gtk_widget_grab_default (widget);
77 return FALSE;
78 }
79-
80+
81+static void
82+gtk_file_selection_style_set (GtkWidget *filesel,
83+ GtkStyle *prev_style)
84+{
85+ gboolean show_fileops;
86+ gint border_width;
87+
88+ gtk_widget_style_get (filesel,
89+ "show_fileops_default",
90+ &show_fileops,
91+ "border_width",
92+ &border_width,
93+ NULL);
94+
95+ gtk_container_set_border_width (GTK_CONTAINER (filesel), border_width);
96+
97+ if (show_fileops)
98+ gtk_file_selection_show_fileop_buttons (GTK_FILE_SELECTION (filesel));
99+ else
100+ gtk_file_selection_hide_fileop_buttons (GTK_FILE_SELECTION (filesel));
101+}
102+
103 static void
104 gtk_file_selection_init (GtkFileSelection *filesel)
105 {
106@@ -674,17 +723,15 @@
107
108 /* The dialog-sized vertical box */
109 filesel->main_vbox = dialog->vbox;
110- gtk_container_set_border_width (GTK_CONTAINER (filesel), 10);
111
112 /* The horizontal box containing create, rename etc. buttons */
113 filesel->button_area = gtk_hbutton_box_new ();
114 gtk_button_box_set_layout (GTK_BUTTON_BOX (filesel->button_area), GTK_BUTTONBOX_START);
115- gtk_box_set_spacing (GTK_BOX (filesel->button_area), 0);
116 gtk_box_pack_start (GTK_BOX (filesel->main_vbox), filesel->button_area,
117 FALSE, FALSE, 0);
118 gtk_widget_show (filesel->button_area);
119
120- gtk_file_selection_show_fileop_buttons (filesel);
121+ gtk_file_selection_style_set (GTK_WIDGET (filesel), NULL);
122
123 /* hbox for pulldown menu */
124 pulldown_hbox = gtk_hbox_new (TRUE, 5);
125@@ -723,25 +770,32 @@
126
127 /* The directories list */
128
129- model = gtk_list_store_new (1, G_TYPE_STRING);
130+ model = gtk_list_store_new (2, G_TYPE_STRING, G_TYPE_BOOLEAN); /* MA */
131 filesel->dir_list = gtk_tree_view_new_with_model (GTK_TREE_MODEL (model));
132 g_object_unref (model);
133
134- column = gtk_tree_view_column_new_with_attributes (_("Folders"),
135+ column = gtk_tree_view_column_new_with_attributes (/*_("Folders")*/ NULL,
136 gtk_cell_renderer_text_new (),
137 "text", DIR_COLUMN,
138 NULL);
139 label = gtk_label_new_with_mnemonic (_("Fol_ders"));
140 gtk_label_set_mnemonic_widget (GTK_LABEL (label), filesel->dir_list);
141 gtk_widget_show (label);
142- gtk_tree_view_column_set_widget (column, label);
143+
144+ /* gtk_tree_view_column_set_widget (column, label); */
145+ gtk_tree_view_set_headers_visible (GTK_TREE_VIEW (filesel->dir_list), FALSE);
146+
147 gtk_tree_view_column_set_sizing (column, GTK_TREE_VIEW_COLUMN_AUTOSIZE);
148 gtk_tree_view_append_column (GTK_TREE_VIEW (filesel->dir_list), column);
149
150 gtk_widget_set_size_request (filesel->dir_list,
151 DIR_LIST_WIDTH, DIR_LIST_HEIGHT);
152 g_signal_connect (filesel->dir_list, "row_activated",
153- G_CALLBACK (gtk_file_selection_dir_activate), filesel);
154+ G_CALLBACK (gtk_file_selection_activate), filesel);
155+
156+ g_signal_connect (gtk_tree_view_get_selection (GTK_TREE_VIEW (filesel->dir_list)), "changed",
157+ G_CALLBACK (gtk_file_selection_file_changed), filesel);
158+
159
160 /* gtk_clist_column_titles_passive (GTK_CLIST (filesel->dir_list)); */
161
162@@ -758,41 +812,6 @@
163 gtk_widget_show (filesel->dir_list);
164 gtk_widget_show (scrolled_win);
165
166- /* The files list */
167- model = gtk_list_store_new (1, G_TYPE_STRING);
168- filesel->file_list = gtk_tree_view_new_with_model (GTK_TREE_MODEL (model));
169- g_object_unref (model);
170-
171- column = gtk_tree_view_column_new_with_attributes (_("Files"),
172- gtk_cell_renderer_text_new (),
173- "text", FILE_COLUMN,
174- NULL);
175- label = gtk_label_new_with_mnemonic (_("_Files"));
176- gtk_label_set_mnemonic_widget (GTK_LABEL (label), filesel->file_list);
177- gtk_widget_show (label);
178- gtk_tree_view_column_set_widget (column, label);
179- gtk_tree_view_column_set_sizing (column, GTK_TREE_VIEW_COLUMN_AUTOSIZE);
180- gtk_tree_view_append_column (GTK_TREE_VIEW (filesel->file_list), column);
181-
182- gtk_widget_set_size_request (filesel->file_list,
183- FILE_LIST_WIDTH, FILE_LIST_HEIGHT);
184- g_signal_connect (filesel->file_list, "row_activated",
185- G_CALLBACK (gtk_file_selection_file_activate), filesel);
186- g_signal_connect (gtk_tree_view_get_selection (GTK_TREE_VIEW (filesel->file_list)), "changed",
187- G_CALLBACK (gtk_file_selection_file_changed), filesel);
188-
189- /* gtk_clist_column_titles_passive (GTK_CLIST (filesel->file_list)); */
190-
191- scrolled_win = gtk_scrolled_window_new (NULL, NULL);
192- gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW (scrolled_win), GTK_SHADOW_IN);
193- gtk_container_add (GTK_CONTAINER (scrolled_win), filesel->file_list);
194- gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrolled_win),
195- GTK_POLICY_AUTOMATIC, GTK_POLICY_ALWAYS);
196- gtk_container_set_border_width (GTK_CONTAINER (scrolled_win), 0);
197- gtk_container_add (GTK_CONTAINER (list_container), scrolled_win);
198- gtk_widget_show (filesel->file_list);
199- gtk_widget_show (scrolled_win);
200-
201 /* action area for packing buttons into. */
202 filesel->action_area = gtk_hbox_new (TRUE, 0);
203 gtk_box_pack_start (GTK_BOX (filesel->main_vbox), filesel->action_area,
204@@ -2008,6 +2027,23 @@
205 }
206
207 static void
208+gtk_file_selection_activate (GtkTreeView *tree_view,
209+ GtkTreePath *path,
210+ GtkTreeViewColumn *column,
211+ gpointer user_data)
212+{
213+ GtkTreeModel *model = gtk_tree_view_get_model (tree_view);
214+ GtkTreeIter iter;
215+ gboolean is_file;
216+
217+ gtk_tree_model_get_iter (model, &iter, path);
218+ gtk_tree_model_get (model, &iter, ISFILE_COLUMN, &is_file, -1);
219+
220+ if (! is_file)
221+ gtk_file_selection_dir_activate (tree_view, path, column, user_data);
222+}
223+
224+static void
225 gtk_file_selection_file_activate (GtkTreeView *tree_view,
226 GtkTreePath *path,
227 GtkTreeViewColumn *column,
228@@ -2103,7 +2139,6 @@
229 PossibleCompletion* poss;
230 GtkTreeIter iter;
231 GtkListStore *dir_model;
232- GtkListStore *file_model;
233 gchar* filename;
234 gchar* rem_path = rel_path;
235 gchar* sel_text;
236@@ -2125,10 +2160,8 @@
237 g_assert (cmpl_state->reference_dir);
238
239 dir_model = GTK_LIST_STORE (gtk_tree_view_get_model (GTK_TREE_VIEW (fs->dir_list)));
240- file_model = GTK_LIST_STORE (gtk_tree_view_get_model (GTK_TREE_VIEW (fs->file_list)));
241
242 gtk_list_store_clear (dir_model);
243- gtk_list_store_clear (file_model);
244
245 /* Set the dir list to include ./ and ../ */
246 gtk_list_store_append (dir_model, &iter);
247@@ -2150,13 +2183,17 @@
248 strcmp (filename, ".." G_DIR_SEPARATOR_S) != 0)
249 {
250 gtk_list_store_append (dir_model, &iter);
251- gtk_list_store_set (dir_model, &iter, DIR_COLUMN, filename, -1);
252+ gtk_list_store_set (dir_model, &iter,
253+ DIR_COLUMN, filename,
254+ ISFILE_COLUMN, FALSE, -1);
255 }
256 }
257 else
258 {
259- gtk_list_store_append (file_model, &iter);
260- gtk_list_store_set (file_model, &iter, DIR_COLUMN, filename, -1);
261+ gtk_list_store_append (dir_model, &iter);
262+ gtk_list_store_set (dir_model, &iter,
263+ DIR_COLUMN, filename,
264+ ISFILE_COLUMN, TRUE, -1);
265 }
266 }
267
diff --git a/meta/packages/gtk+/gtk+-2.11.6/spinbutton.patch b/meta/packages/gtk+/gtk+-2.11.6/spinbutton.patch
new file mode 100644
index 0000000000..c26dc6d93c
--- /dev/null
+++ b/meta/packages/gtk+/gtk+-2.11.6/spinbutton.patch
@@ -0,0 +1,130 @@
1Index: gtk+-2.10.6/gtk/gtkspinbutton.c
2===================================================================
3--- gtk+-2.10.6.orig/gtk/gtkspinbutton.c
4+++ gtk+-2.10.6/gtk/gtkspinbutton.c
5@@ -682,7 +682,7 @@ gtk_spin_button_size_allocate (GtkWidget
6
7 spin = GTK_SPIN_BUTTON (widget);
8 arrow_size = spin_button_get_arrow_size (spin);
9- panel_width = arrow_size + 2 * widget->style->xthickness;
10+ panel_width = (2 * arrow_size) + 4 * widget->style->xthickness;
11
12 widget->allocation = *allocation;
13
14@@ -815,19 +815,16 @@ gtk_spin_button_draw_arrow (GtkSpinButto
15 {
16 width = spin_button_get_arrow_size (spin_button) + 2 * widget->style->xthickness;
17
18+ y = widget->style->ythickness;
19+ height = widget->requisition.height - (2 * y);
20+
21 if (arrow_type == GTK_ARROW_UP)
22 {
23 x = 0;
24- y = 0;
25-
26- height = widget->requisition.height / 2;
27 }
28 else
29 {
30- x = 0;
31- y = widget->requisition.height / 2;
32-
33- height = (widget->requisition.height + 1) / 2;
34+ x = width;
35 }
36
37 if (spin_button_at_limit (spin_button, arrow_type))
38@@ -857,32 +854,17 @@ gtk_spin_button_draw_arrow (GtkSpinButto
39 shadow_type = GTK_SHADOW_OUT;
40 }
41 }
42-
43+
44 gtk_paint_box (widget->style, spin_button->panel,
45 state_type, shadow_type,
46 NULL, widget,
47- (arrow_type == GTK_ARROW_UP)? "spinbutton_up" : "spinbutton_down",
48+ NULL,
49 x, y, width, height);
50
51 height = widget->requisition.height;
52
53- if (arrow_type == GTK_ARROW_DOWN)
54- {
55- y = height / 2;
56- height = height - y - 2;
57- }
58- else
59- {
60- y = 2;
61- height = height / 2 - 2;
62- }
63-
64 width -= 3;
65-
66- if (widget && gtk_widget_get_direction (widget) == GTK_TEXT_DIR_RTL)
67- x = 2;
68- else
69- x = 1;
70+ height -= 3;
71
72 w = width / 2;
73 w -= w % 2 - 1; /* force odd */
74@@ -1062,7 +1044,7 @@ gtk_spin_button_button_press (GtkWidget
75 if (GTK_ENTRY (widget)->editable)
76 gtk_spin_button_update (spin);
77
78- if (event->y <= widget->requisition.height / 2)
79+ if (event->x <= (spin_button_get_arrow_size (spin) + widget->style->xthickness))
80 {
81 if (event->button == 1)
82 start_spinning (spin, GTK_ARROW_UP, spin->adjustment->step_increment);
83@@ -1097,44 +1079,11 @@ gtk_spin_button_button_release (GtkWidge
84
85 arrow_size = spin_button_get_arrow_size (spin);
86
87- if (event->button == spin->button)
88- {
89- int click_child = spin->click_child;
90+ gtk_spin_button_stop_spinning (spin);
91
92- gtk_spin_button_stop_spinning (spin);
93-
94- if (event->button == 3)
95- {
96- if (event->y >= 0 && event->x >= 0 &&
97- event->y <= widget->requisition.height &&
98- event->x <= arrow_size + 2 * widget->style->xthickness)
99- {
100- if (click_child == GTK_ARROW_UP &&
101- event->y <= widget->requisition.height / 2)
102- {
103- gdouble diff;
104-
105- diff = spin->adjustment->upper - spin->adjustment->value;
106- if (diff > EPSILON)
107- gtk_spin_button_real_spin (spin, diff);
108- }
109- else if (click_child == GTK_ARROW_DOWN &&
110- event->y > widget->requisition.height / 2)
111- {
112- gdouble diff;
113-
114- diff = spin->adjustment->value - spin->adjustment->lower;
115- if (diff > EPSILON)
116- gtk_spin_button_real_spin (spin, -diff);
117- }
118- }
119- }
120- spin_button_redraw (spin);
121+ spin_button_redraw (spin);
122
123- return TRUE;
124- }
125- else
126- return GTK_WIDGET_CLASS (gtk_spin_button_parent_class)->button_release_event (widget, event);
127+ return TRUE;
128 }
129
130 static gint
diff --git a/meta/packages/gtk+/gtk+-2.11.6/toggle-font.diff b/meta/packages/gtk+/gtk+-2.11.6/toggle-font.diff
new file mode 100644
index 0000000000..928da72430
--- /dev/null
+++ b/meta/packages/gtk+/gtk+-2.11.6/toggle-font.diff
@@ -0,0 +1,100 @@
1Index: gtk/gtkcellrenderertoggle.c
2===================================================================
3--- gtk/gtkcellrenderertoggle.c (revision 18523)
4+++ gtk/gtkcellrenderertoggle.c (working copy)
5@@ -71,6 +71,8 @@
6 PROP_INDICATOR_SIZE
7 };
8
9+/* This is a hard-coded default which promptly gets overridden by a size
10+ calculated from the font size. */
11 #define TOGGLE_WIDTH 12
12
13 static guint toggle_cell_signals[LAST_SIGNAL] = { 0 };
14@@ -80,8 +82,9 @@
15 typedef struct _GtkCellRendererTogglePrivate GtkCellRendererTogglePrivate;
16 struct _GtkCellRendererTogglePrivate
17 {
18- gint indicator_size;
19-
20+ gint indicator_size; /* This is the real size */
21+ gint override_size; /* This is the size set from the indicator-size property */
22+ GtkWidget *cached_widget;
23 guint inconsistent : 1;
24 };
25
26@@ -104,6 +107,7 @@
27 GTK_CELL_RENDERER (celltoggle)->ypad = 2;
28
29 priv->indicator_size = TOGGLE_WIDTH;
30+ priv->override_size = 0;
31 priv->inconsistent = FALSE;
32 }
33
34@@ -210,7 +214,7 @@
35 g_value_set_boolean (value, celltoggle->radio);
36 break;
37 case PROP_INDICATOR_SIZE:
38- g_value_set_int (value, priv->indicator_size);
39+ g_value_set_int (value, priv->override_size ? priv->override_size : priv->indicator_size);
40 break;
41 default:
42 G_OBJECT_WARN_INVALID_PROPERTY_ID (object, param_id, pspec);
43@@ -245,7 +249,7 @@
44 celltoggle->radio = g_value_get_boolean (value);
45 break;
46 case PROP_INDICATOR_SIZE:
47- priv->indicator_size = g_value_get_int (value);
48+ priv->override_size = g_value_get_int (value);
49 break;
50 default:
51 G_OBJECT_WARN_INVALID_PROPERTY_ID (object, param_id, pspec);
52@@ -273,6 +277,27 @@
53 }
54
55 static void
56+on_widget_style_set (GtkWidget *widget, GtkStyle *previous, gpointer user_data)
57+{
58+ GtkCellRendererTogglePrivate *priv = user_data;
59+ PangoContext *context;
60+ PangoFontMetrics *metrics;
61+ int height;
62+
63+ context = gtk_widget_get_pango_context (widget);
64+ metrics = pango_context_get_metrics (context,
65+ widget->style->font_desc,
66+ pango_context_get_language (context));
67+
68+ height = pango_font_metrics_get_ascent (metrics) +
69+ pango_font_metrics_get_descent (metrics);
70+
71+ pango_font_metrics_unref (metrics);
72+
73+ priv->indicator_size = PANGO_PIXELS (height * 0.85);
74+}
75+
76+static void
77 gtk_cell_renderer_toggle_get_size (GtkCellRenderer *cell,
78 GtkWidget *widget,
79 GdkRectangle *cell_area,
80@@ -287,6 +312,20 @@
81
82 priv = GTK_CELL_RENDERER_TOGGLE_GET_PRIVATE (cell);
83
84+ if (priv->override_size) {
85+ priv->indicator_size = priv->override_size;
86+ } else if (priv->cached_widget != widget) {
87+ if (priv->cached_widget) {
88+ g_object_remove_weak_pointer (widget, &priv->cached_widget);
89+ g_signal_handlers_disconnect_by_func (priv->cached_widget, on_widget_style_set, priv);
90+ }
91+ priv->cached_widget = widget;
92+ g_object_add_weak_pointer (widget, &priv->cached_widget);
93+ g_signal_connect (widget, "style-set", on_widget_style_set, priv);
94+
95+ on_widget_style_set (widget, NULL, priv);
96+ }
97+
98 calc_width = (gint) cell->xpad * 2 + priv->indicator_size;
99 calc_height = (gint) cell->ypad * 2 + priv->indicator_size;
100
diff --git a/meta/packages/gtk+/gtk+-2.11.6/xsettings.patch b/meta/packages/gtk+/gtk+-2.11.6/xsettings.patch
new file mode 100644
index 0000000000..b63e262d34
--- /dev/null
+++ b/meta/packages/gtk+/gtk+-2.11.6/xsettings.patch
@@ -0,0 +1,16 @@
1--- gtk+-2.4.4/gdk/x11/gdkevents-x11.c.old Sun Aug 22 17:14:00 2004
2+++ gtk+-2.4.4/gdk/x11/gdkevents-x11.c Sun Aug 22 17:14:00 2004
3@@ -2827,10 +2827,9 @@
4 {
5 GdkScreenX11 *screen = data;
6
7- if (xsettings_client_process_event (screen->xsettings_client, (XEvent *)xevent))
8- return GDK_FILTER_REMOVE;
9- else
10- return GDK_FILTER_CONTINUE;
11+ xsettings_client_process_event (screen->xsettings_client, (XEvent *)xevent);
12+
13+ return GDK_FILTER_CONTINUE;
14 }
15
16 static void
diff --git a/meta/packages/gtk+/gtk+_2.11.6.bb b/meta/packages/gtk+/gtk+_2.11.6.bb
new file mode 100644
index 0000000000..570a782b12
--- /dev/null
+++ b/meta/packages/gtk+/gtk+_2.11.6.bb
@@ -0,0 +1,57 @@
1require gtk+.inc
2
3DEPENDS += "cairo"
4
5# disable per default - untested and not all patches included.
6DEFAULT_PREFERENCE = "-1"
7
8SRC_URI = "http://download.gnome.org/sources/gtk+/2.11/gtk+-${PV}.tar.bz2 \
9 file://no-xwc.patch;patch=1 \
10 file://automake-lossage.patch;patch=1 \
11 file://disable-tooltips.patch;patch=1 \
12 file://xsettings.patch;patch=1 \
13 file://small-gtkfilesel.patch;patch=1 \
14 file://migration.patch;patch=1;pnum=0 \
15 file://run-iconcache.patch;patch=1 \
16 file://disable-print.patch;patch=1 \
17 file://hardcoded_libtool.patch;patch=1 \
18 file://no-demos.patch;patch=1 \
19 file://cellrenderer-cairo.patch;patch=1;pnum=0 \
20 file://entry-cairo.patch;patch=1;pnum=0 \
21 file://toggle-font.diff;patch=1;pnum=0 \
22 file://scrolled-placement.patch;patch=1;pnum=0"
23# temporary
24# file://gtklabel-resize-patch;patch=1 \
25# file://menu-deactivate.patch;patch=1 \
26# file://combo-arrow-size.patch;patch=1;pnum=0 \
27# file://range-no-redraw.patch;patch=1;pnum=0 \
28# die die die
29# file://scroll-timings.patch;patch=1 \
30# file://pangoxft2.10.6.diff;patch=1"
31# file://gtk+-handhelds.patch;patch=1
32# file://single-click.patch;patch=1
33# file://spinbutton.patch;patch=1 \
34
35EXTRA_OECONF = "--without-libtiff --disable-xkb --disable-glibtest --enable-display-migration"
36
37LIBV = "2.10.0"
38
39PACKAGES_DYNAMIC = "gdk-pixbuf-loader-* gtk-immodule-* gtk-printbackend-*"
40
41python populate_packages_prepend () {
42 import os.path
43
44 prologue = bb.data.getVar("postinst_prologue", d, 1)
45
46 gtk_libdir = bb.data.expand('${libdir}/gtk-2.0/${LIBV}', d)
47 loaders_root = os.path.join(gtk_libdir, 'loaders')
48 immodules_root = os.path.join(gtk_libdir, 'immodules')
49 printmodules_root = os.path.join(gtk_libdir, 'printbackends');
50
51 do_split_packages(d, loaders_root, '^libpixbufloader-(.*)\.so$', 'gdk-pixbuf-loader-%s', 'GDK pixbuf loader for %s', prologue + 'gdk-pixbuf-query-loaders > /etc/gtk-2.0/gdk-pixbuf.loaders')
52 do_split_packages(d, immodules_root, '^im-(.*)\.so$', 'gtk-immodule-%s', 'GTK input module for %s', prologue + 'gtk-query-immodules-2.0 > /etc/gtk-2.0/gtk.immodules')
53 do_split_packages(d, printmodules_root, '^libprintbackend-(.*)\.so$', 'gtk-printbackend-%s', 'GTK printbackend module for %s')
54
55 if (bb.data.getVar('DEBIAN_NAMES', d, 1)):
56 bb.data.setVar('PKG_${PN}', 'libgtk-2.0', d)
57}