diff options
Diffstat (limited to 'meta/recipes-gnome/gtk+/gtk+-2.24.13/entry-cairo.patch')
-rw-r--r-- | meta/recipes-gnome/gtk+/gtk+-2.24.13/entry-cairo.patch | 105 |
1 files changed, 105 insertions, 0 deletions
diff --git a/meta/recipes-gnome/gtk+/gtk+-2.24.13/entry-cairo.patch b/meta/recipes-gnome/gtk+/gtk+-2.24.13/entry-cairo.patch new file mode 100644 index 0000000000..3083b77830 --- /dev/null +++ b/meta/recipes-gnome/gtk+/gtk+-2.24.13/entry-cairo.patch | |||
@@ -0,0 +1,105 @@ | |||
1 | Upstream-Status: Pending | ||
2 | |||
3 | Index: gtk/gtkentry.c | ||
4 | =================================================================== | ||
5 | RCS file: /cvs/gnome/gtk+/gtk/gtkentry.c,v | ||
6 | retrieving revision 1.317 | ||
7 | diff -u -r1.317 gtkentry.c | ||
8 | --- gtk/gtkentry.c 29 Jun 2006 09:18:05 -0000 1.317 | ||
9 | +++ gtk/gtkentry.c 2 Jul 2006 14:14:24 -0000 | ||
10 | @@ -3337,7 +3337,9 @@ | ||
11 | if (GTK_WIDGET_DRAWABLE (entry)) | ||
12 | { | ||
13 | PangoLayout *layout = gtk_entry_ensure_layout (entry, TRUE); | ||
14 | +#ifdef USE_CAIRO_INTERNALLY | ||
15 | cairo_t *cr; | ||
16 | +#endif | ||
17 | gint x, y; | ||
18 | gint start_pos, end_pos; | ||
19 | |||
20 | @@ -3345,23 +3347,35 @@ | ||
21 | |||
22 | get_layout_position (entry, &x, &y); | ||
23 | |||
24 | +#ifdef USE_CAIRO_INTERNALLY | ||
25 | cr = gdk_cairo_create (entry->text_area); | ||
26 | |||
27 | cairo_move_to (cr, x, y); | ||
28 | gdk_cairo_set_source_color (cr, &widget->style->text [widget->state]); | ||
29 | pango_cairo_show_layout (cr, layout); | ||
30 | +#else | ||
31 | + gdk_draw_layout (entry->text_area, widget->style->text_gc [widget->state], | ||
32 | + x, y, | ||
33 | + layout); | ||
34 | +#endif | ||
35 | |||
36 | if (gtk_editable_get_selection_bounds (GTK_EDITABLE (entry), &start_pos, &end_pos)) | ||
37 | { | ||
38 | gint *ranges; | ||
39 | gint n_ranges, i; | ||
40 | PangoRectangle logical_rect; | ||
41 | - GdkColor *selection_color, *text_color; | ||
42 | GtkBorder inner_border; | ||
43 | +#ifdef USE_CAIRO_INTERNALLY | ||
44 | + GdkColor *selection_color, *text_color; | ||
45 | +#else | ||
46 | + GdkGC *selection_gc, *text_gc; | ||
47 | + GdkRegion *clip_region; | ||
48 | +#endif | ||
49 | |||
50 | pango_layout_get_pixel_extents (layout, NULL, &logical_rect); | ||
51 | gtk_entry_get_pixel_ranges (entry, &ranges, &n_ranges); | ||
52 | |||
53 | +#ifdef USE_CAIRO_INTERNALLY | ||
54 | if (GTK_WIDGET_HAS_FOCUS (entry)) | ||
55 | { | ||
56 | selection_color = &widget->style->base [GTK_STATE_SELECTED]; | ||
57 | @@ -3390,11 +3404,46 @@ | ||
58 | cairo_move_to (cr, x, y); | ||
59 | gdk_cairo_set_source_color (cr, text_color); | ||
60 | pango_cairo_show_layout (cr, layout); | ||
61 | - | ||
62 | +#else | ||
63 | + if (GTK_WIDGET_HAS_FOCUS (entry)) | ||
64 | + { | ||
65 | + selection_gc = widget->style->base_gc [GTK_STATE_SELECTED]; | ||
66 | + text_gc = widget->style->text_gc [GTK_STATE_SELECTED]; | ||
67 | + } | ||
68 | + else | ||
69 | + { | ||
70 | + selection_gc = widget->style->base_gc [GTK_STATE_ACTIVE]; | ||
71 | + text_gc = widget->style->text_gc [GTK_STATE_ACTIVE]; | ||
72 | + } | ||
73 | + | ||
74 | + clip_region = gdk_region_new (); | ||
75 | + for (i = 0; i < n_ranges; ++i) | ||
76 | + { | ||
77 | + GdkRectangle rect; | ||
78 | + | ||
79 | + rect.x = inner_border.left - entry->scroll_offset + ranges[2 * i]; | ||
80 | + rect.y = y; | ||
81 | + rect.width = ranges[2 * i + 1]; | ||
82 | + rect.height = logical_rect.height; | ||
83 | + | ||
84 | + gdk_draw_rectangle (entry->text_area, selection_gc, TRUE, | ||
85 | + rect.x, rect.y, rect.width, rect.height); | ||
86 | + | ||
87 | + gdk_region_union_with_rect (clip_region, &rect); | ||
88 | + } | ||
89 | + | ||
90 | + gdk_gc_set_clip_region (text_gc, clip_region); | ||
91 | + gdk_draw_layout (entry->text_area, text_gc, | ||
92 | + x, y, | ||
93 | + layout); | ||
94 | + gdk_gc_set_clip_region (text_gc, NULL); | ||
95 | + gdk_region_destroy (clip_region); | ||
96 | +#endif | ||
97 | g_free (ranges); | ||
98 | } | ||
99 | - | ||
100 | +#ifdef USE_CAIRO_INTERNALLY | ||
101 | cairo_destroy (cr); | ||
102 | +#endif | ||
103 | } | ||
104 | } | ||
105 | |||