From c848fbbcfe7813b6347a00452a890aeb17e767bb Mon Sep 17 00:00:00 2001 From: Owen Taylor Date: Sun, 3 Mar 2002 19:59:29 +0000 Subject: Centralize lookup and caching of cursor GC's here. Sun Mar 3 14:26:33 2002 Owen Taylor * gtk/gtkstyle.[ch] (_gtk_get_insertion_cursor_gc): Centralize lookup and caching of cursor GC's here. * gtk/gtkentry.[ch] gtk/gtktextview.[ch] gtk/gtktextdisplay.c gtk/gtklabel.c: Move to using _gtk_get_insertion_cursor_gc(). * gtk/gtkentry.c (gtk_entry_expose): Draw cursors under the text, not over the text. * gtk/gtkwidget.c (gtk_widget_class_init): add a secondary-cursor-color property. * gtk/gtkwidget.c (gtk_widget_class_init): Decrease the default aspect ratio to 1/25 (0.04). * tests/testgtkrc (bell_duration): Comment out cursor color setting. --- gtk/gtktextdisplay.c | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) (limited to 'gtk/gtktextdisplay.c') diff --git a/gtk/gtktextdisplay.c b/gtk/gtktextdisplay.c index cfb5225d7..99b8631fc 100644 --- a/gtk/gtktextdisplay.c +++ b/gtk/gtktextdisplay.c @@ -834,14 +834,8 @@ gtk_text_layout_draw (GtkTextLayout *layout, GtkTextCursorDisplay *cursor = cursor_list->data; GtkTextDirection dir; GdkRectangle cursor_location; - GdkGC *gc; - if (cursor->is_strong) - gc = cursor_gc; - else - gc = widget->style->text_gc[GTK_STATE_NORMAL]; - dir = line_display->direction; if (have_strong && have_weak) { @@ -854,11 +848,14 @@ gtk_text_layout_draw (GtkTextLayout *layout, cursor_location.width = 0; cursor_location.height = cursor->height; + gc = _gtk_get_insertion_cursor_gc (widget, cursor->is_strong); gdk_gc_set_clip_rectangle(gc, &clip); _gtk_draw_insertion_cursor (widget, drawable, gc, &cursor_location, dir, have_strong && have_weak); gdk_gc_set_clip_rectangle (gc, NULL); + g_object_unref (gc); + cursor_list = cursor_list->next; } } /* line_display->height > 0 */ -- cgit v1.2.1