summaryrefslogtreecommitdiff
path: root/gtk/gtktextdisplay.c
diff options
context:
space:
mode:
authorOwen Taylor <otaylor@redhat.com>2001-09-25 20:40:20 +0000
committerOwen Taylor <otaylor@src.gnome.org>2001-09-25 20:40:20 +0000
commit0c3be55498e388015bcba07791177be9d1225bd9 (patch)
treeadcafce7f55404b0b8a6ab1f86967a54fe2cf69c /gtk/gtktextdisplay.c
parentefae27a3a5d7ed8cb7063e1f0ac5634fc162284f (diff)
downloadgtk+-0c3be55498e388015bcba07791177be9d1225bd9.tar.gz
ue Sep 25 12:41:17 2001 Owen Taylor <otaylor@redhat.com>GTK_1_3_9
* configure.in: Version 1.3.9, interface age 0, binary age 0. * configure.in: Require GLib-1.39, Pango 0.20, Atk 0.5. * NEWS: Updates. Mon Sep 24 11:59:09 2001 Owen Taylor <otaylor@redhat.com> * gtk/gtkstyle.[ch] (_gtk_draw_insertion_cursor): Shared function for drawing cursors between gtkentry/gtklabel/gtktextview. Should this be public? It has a bit of an odd interface, but custom editing widgets probably should be using it. Function will draw with wider width for taller cursors, and draws a little indicator arrow to indicate directoin for split cursors. * gtk/gtktextview.c: Add a "cursor_color" property. * gtk/gtktextdisplay.[ch]: Add a cursor_gc parameter to gtk_text_layout_draw(). * gtk/gtkentry.c gtk/gtklabel.c gtk/gtktextdisplay.c: Use _gtk_draw_insertion_cursor(). Tue Sep 25 11:22:23 2001 Owen Taylor <otaylor@redhat.com> * gtk/gtkcellrenderertext.c gtk/gtktexttag.c: Restore the behavior where you could turn family_set (etc) back on and get back the values you had before. * demos/gtk-demo/stock_browser.c (id_to_macro): Use g_string_ascii_up() rather than looping through the string ourself.
Diffstat (limited to 'gtk/gtktextdisplay.c')
-rw-r--r--gtk/gtktextdisplay.c47
1 files changed, 40 insertions, 7 deletions
diff --git a/gtk/gtktextdisplay.c b/gtk/gtktextdisplay.c
index d605a1ba1d..51ef0ae125 100644
--- a/gtk/gtktextdisplay.c
+++ b/gtk/gtktextdisplay.c
@@ -716,6 +716,7 @@ void
gtk_text_layout_draw (GtkTextLayout *layout,
GtkWidget *widget,
GdkDrawable *drawable,
+ GdkGC *cursor_gc,
/* Location of the drawable
in layout coordinates */
gint x_offset,
@@ -775,6 +776,8 @@ gtk_text_layout_draw (GtkTextLayout *layout,
GtkTextLineDisplay *line_display;
gint selection_start_index = -1;
gint selection_end_index = -1;
+ gboolean have_strong;
+ gboolean have_weak;
GtkTextLine *line = tmp_list->data;
@@ -823,23 +826,53 @@ gtk_text_layout_draw (GtkTextLayout *layout,
/* We paint the cursors last, because they overlap another chunk
and need to appear on top. */
+ have_strong = FALSE;
+ have_weak = FALSE;
+
+ cursor_list = line_display->cursors;
+ while (cursor_list)
+ {
+ GtkTextCursorDisplay *cursor = cursor_list->data;
+ if (cursor->is_strong)
+ have_strong = TRUE;
+ else
+ have_weak = TRUE;
+
+ cursor_list = cursor_list->next;
+ }
+
cursor_list = line_display->cursors;
while (cursor_list)
{
GtkTextCursorDisplay *cursor = cursor_list->data;
+ GtkTextDirection dir;
+ GdkRectangle cursor_location;
+
GdkGC *gc;
if (cursor->is_strong)
- gc = widget->style->base_gc[GTK_STATE_SELECTED];
+ gc = cursor_gc;
else
gc = widget->style->text_gc[GTK_STATE_NORMAL];
- gdk_gc_set_clip_rectangle (gc, &clip);
- gdk_draw_line (drawable, gc,
- line_display->x_offset + cursor->x - x_offset,
- current_y + line_display->top_margin + cursor->y,
- line_display->x_offset + cursor->x - x_offset,
- current_y + line_display->top_margin + cursor->y + cursor->height - 1);
+ if (have_strong && have_weak)
+ {
+ dir = line_display->direction;
+ if (!cursor->is_strong)
+ dir = (dir == GTK_TEXT_DIR_RTL) ? GTK_TEXT_DIR_LTR : GTK_TEXT_DIR_RTL;
+ }
+ else
+ {
+ dir = GTK_TEXT_DIR_NONE;
+ }
+
+ cursor_location.x = line_display->x_offset + cursor->x - x_offset;
+ cursor_location.y = current_y + line_display->top_margin + cursor->y;
+ cursor_location.width = 0;
+ cursor_location.height = cursor->height;
+
+ gdk_gc_set_clip_rectangle(gc, &clip);
+ _gtk_draw_insertion_cursor (drawable, gc, &cursor_location, dir);
gdk_gc_set_clip_rectangle (gc, NULL);
cursor_list = cursor_list->next;