summaryrefslogtreecommitdiffstats
path: root/meta/packages/gtk+/gtk+-2.10.0/entry-cairo.patch
diff options
context:
space:
mode:
Diffstat (limited to 'meta/packages/gtk+/gtk+-2.10.0/entry-cairo.patch')
-rw-r--r--meta/packages/gtk+/gtk+-2.10.0/entry-cairo.patch114
1 files changed, 114 insertions, 0 deletions
diff --git a/meta/packages/gtk+/gtk+-2.10.0/entry-cairo.patch b/meta/packages/gtk+/gtk+-2.10.0/entry-cairo.patch
new file mode 100644
index 0000000000..506b617d8e
--- /dev/null
+++ b/meta/packages/gtk+/gtk+-2.10.0/entry-cairo.patch
@@ -0,0 +1,114 @@
1Index: gtkentry.c
2===================================================================
3RCS file: /cvs/gnome/gtk+/gtk/gtkentry.c,v
4retrieving revision 1.317
5diff -u -r1.317 gtk+-2.10.0/gtk/gtkentry.c
6--- gtk+-2.10.0/gtk/gtkentry.c 29 Jun 2006 09:18:05 -0000 1.317
7+++ gtk+-2.10.0/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,37 @@
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+ get_inner_border (entry, &inner_border);
52+
53+#ifdef USE_CAIRO_INTERNALLY
54 if (GTK_WIDGET_HAS_FOCUS (entry))
55 {
56 selection_color = &widget->style->base [GTK_STATE_SELECTED];
57@@ -3373,8 +3389,6 @@
58 text_color = &widget->style->text [GTK_STATE_ACTIVE];
59 }
60
61- get_inner_border (entry, &inner_border);
62-
63 for (i = 0; i < n_ranges; ++i)
64 cairo_rectangle (cr,
65 inner_border.left - entry->scroll_offset + ranges[2 * i],
66@@ -3390,11 +3404,46 @@
67 cairo_move_to (cr, x, y);
68 gdk_cairo_set_source_color (cr, text_color);
69 pango_cairo_show_layout (cr, layout);
70-
71+#else
72+ if (GTK_WIDGET_HAS_FOCUS (entry))
73+ {
74+ selection_gc = widget->style->base_gc [GTK_STATE_SELECTED];
75+ text_gc = widget->style->text_gc [GTK_STATE_SELECTED];
76+ }
77+ else
78+ {
79+ selection_gc = widget->style->base_gc [GTK_STATE_ACTIVE];
80+ text_gc = widget->style->text_gc [GTK_STATE_ACTIVE];
81+ }
82+
83+ clip_region = gdk_region_new ();
84+ for (i = 0; i < n_ranges; ++i)
85+ {
86+ GdkRectangle rect;
87+
88+ rect.x = inner_border.left - entry->scroll_offset + ranges[2 * i];
89+ rect.y = y;
90+ rect.width = ranges[2 * i + 1];
91+ rect.height = logical_rect.height;
92+
93+ gdk_draw_rectangle (entry->text_area, selection_gc, TRUE,
94+ rect.x, rect.y, rect.width, rect.height);
95+
96+ gdk_region_union_with_rect (clip_region, &rect);
97+ }
98+
99+ gdk_gc_set_clip_region (text_gc, clip_region);
100+ gdk_draw_layout (entry->text_area, text_gc,
101+ x, y,
102+ layout);
103+ gdk_gc_set_clip_region (text_gc, NULL);
104+ gdk_region_destroy (clip_region);
105+#endif
106 g_free (ranges);
107 }
108-
109+#ifdef USE_CAIRO_INTERNALLY
110 cairo_destroy (cr);
111+#endif
112 }
113 }
114