summaryrefslogtreecommitdiff
path: root/gtk/gtkstyle.c
diff options
context:
space:
mode:
authorTim Janik <timj@imendio.com>2007-01-26 12:26:01 +0000
committerTim Janik <timj@src.gnome.org>2007-01-26 12:26:01 +0000
commit8c2c327d34daa0d93f9865cbadb8642a7844dd95 (patch)
treebf2c507ad35638965af62036ed0b890d5084effb /gtk/gtkstyle.c
parent0c5f393ad6ca6ec059b6267910857732898b2b08 (diff)
downloadgtk+-8c2c327d34daa0d93f9865cbadb8642a7844dd95.tar.gz
clamp cursor coordinates to window bounds (fix from Maemo Gtk).
Fri Jan 26 13:07:07 2007 Tim Janik <timj@imendio.com> * gtk/gtkstyle.c (draw_insertion_cursor): clamp cursor coordinates to window bounds (fix from Maemo Gtk). svn path=/trunk/; revision=17217
Diffstat (limited to 'gtk/gtkstyle.c')
-rw-r--r--gtk/gtkstyle.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/gtk/gtkstyle.c b/gtk/gtkstyle.c
index 44b7d6eff7..a673e4fcfd 100644
--- a/gtk/gtkstyle.c
+++ b/gtk/gtkstyle.c
@@ -6677,6 +6677,7 @@ draw_insertion_cursor (GtkWidget *widget,
gint i;
gfloat cursor_aspect_ratio;
gint offset;
+ gint window_width;
/* When changing the shape or size of the cursor here,
* propagate the changes to gtktextview.c:text_window_invalidate_cursors().
@@ -6693,6 +6694,13 @@ draw_insertion_cursor (GtkWidget *widget,
else
offset = stem_width - stem_width / 2;
+ gdk_drawable_get_size (widget->window, &window_width, NULL);
+
+ if (location->x - offset < 0 && direction == GTK_TEXT_DIR_LTR)
+ location->x += ABS (location->x - offset);
+ else if (location->x + offset > window_width && direction == GTK_TEXT_DIR_RTL)
+ location->x -= location->x + offset - window_width;
+
for (i = 0; i < stem_width; i++)
gdk_draw_line (drawable, gc,
location->x + i - offset, location->y,