summaryrefslogtreecommitdiff
path: root/gtk
diff options
context:
space:
mode:
authorBenjamin Otte <otte@redhat.com>2010-07-15 14:50:36 +0200
committerBenjamin Otte <otte@redhat.com>2010-07-26 16:42:46 +0200
commitf1074be1ed7941352cd1b96677b977242136f7fe (patch)
tree7aacdaa1a3c9198eaac9bb8a680d0ae27648087e /gtk
parent8c035b60488c74b2b2e496e20d51d97038e54002 (diff)
downloadgtk+-f1074be1ed7941352cd1b96677b977242136f7fe.tar.gz
textview: Use _gtk_widget_get_cursor_color() and Cairo
Previously the code was using _gtk_widget_get_cursor_gc()
Diffstat (limited to 'gtk')
-rw-r--r--gtk/gtktextdisplay.c20
1 files changed, 9 insertions, 11 deletions
diff --git a/gtk/gtktextdisplay.c b/gtk/gtktextdisplay.c
index 3e74320f8a..bd2a935882 100644
--- a/gtk/gtktextdisplay.c
+++ b/gtk/gtktextdisplay.c
@@ -658,28 +658,26 @@ render_para (GtkTextRenderer *text_renderer,
(at_last_line && line_display->insert_index == byte_offset + line->length)))
{
GdkRectangle cursor_rect;
- GdkGC *cursor_gc;
+ GdkColor cursor_color;
+ cairo_t *cr;
/* we draw text using base color on filled cursor rectangle of cursor color
* (normally white on black) */
- cursor_gc = _gtk_widget_get_cursor_gc (text_renderer->widget);
+ _gtk_widget_get_cursor_color (text_renderer->widget, &cursor_color);
cursor_rect.x = x + line_display->x_offset + line_display->block_cursor.x;
cursor_rect.y = y + line_display->block_cursor.y + line_display->top_margin;
cursor_rect.width = line_display->block_cursor.width;
cursor_rect.height = line_display->block_cursor.height;
- gdk_gc_set_clip_rectangle (cursor_gc, &cursor_rect);
+ cr = gdk_cairo_create (text_renderer->drawable);
+ gdk_cairo_rectangle (cr, &cursor_rect);
+ cairo_clip (cr);
- gdk_draw_rectangle (text_renderer->drawable,
- cursor_gc,
- TRUE,
- cursor_rect.x,
- cursor_rect.y,
- cursor_rect.width,
- cursor_rect.height);
+ gdk_cairo_set_source_color (cr, &cursor_color);
+ cairo_paint (cr);
- gdk_gc_set_clip_region (cursor_gc, NULL);
+ cairo_destroy (cr);
/* draw text under the cursor if any */
if (!line_display->cursor_at_line_end)