gtk+ r21580 - in trunk: . gtk
- From: matthiasc svn gnome org
- To: svn-commits-list gnome org
- Subject: gtk+ r21580 - in trunk: . gtk
- Date: Fri, 3 Oct 2008 01:16:48 +0000 (UTC)
Author: matthiasc
Date: Fri Oct 3 01:16:48 2008
New Revision: 21580
URL: http://svn.gnome.org/viewvc/gtk+?rev=21580&view=rev
Log:
2008-10-02 Matthias Clasen <mclasen redhat com>
Bug 530575 â GtkEntry with invisible chars has a confused cursor in
overwrite mode
* gtk/gtkentry.c (gtk_entry_draw_cursor): Use the visible text
in the layout when positioning the cursor, not the actual text
content of the entry. This makes a different when using overwrite
mode in an invisible entry.
Problem noticed by Jonathan Blandford
* gtk/gtktextutil.c: Fix a typo in a comment
Modified:
trunk/ChangeLog
trunk/gtk/gtkentry.c
trunk/gtk/gtktextutil.c
Modified: trunk/gtk/gtkentry.c
==============================================================================
--- trunk/gtk/gtkentry.c (original)
+++ trunk/gtk/gtkentry.c Fri Oct 3 01:16:48 2008
@@ -3794,6 +3794,8 @@
gint cursor_index;
gboolean block;
gboolean block_at_line_end;
+ PangoLayout *layout;
+ const char *text;
_gtk_entry_effective_inner_border (entry, &inner_border);
@@ -3801,11 +3803,13 @@
gdk_drawable_get_size (entry->text_area, NULL, &text_area_height);
- cursor_index = g_utf8_offset_to_pointer (entry->text, entry->current_pos + entry->preedit_cursor) - entry->text;
+ layout = gtk_entry_ensure_layout (entry, TRUE);
+ text = pango_layout_get_text (layout);
+ cursor_index = g_utf8_offset_to_pointer (text, entry->current_pos + entry->preedit_cursor) - text;
if (!entry->overwrite_mode)
block = FALSE;
else
- block = _gtk_text_util_get_block_cursor_location (gtk_entry_ensure_layout (entry, TRUE),
+ block = _gtk_text_util_get_block_cursor_location (layout,
cursor_index, &cursor_rect, &block_at_line_end);
if (!block)
@@ -3861,7 +3865,6 @@
}
else /* overwrite_mode */
{
- PangoLayout *layout = gtk_entry_ensure_layout (entry, TRUE);
GdkColor cursor_color;
GdkRectangle rect;
cairo_t *cr;
Modified: trunk/gtk/gtktextutil.c
==============================================================================
--- trunk/gtk/gtktextutil.c (original)
+++ trunk/gtk/gtktextutil.c Fri Oct 3 01:16:48 2008
@@ -406,7 +406,7 @@
* @layout: a #PangoLayout
* @index: index at which cursor is located
* @pos: cursor location
- * @at_line_end: whether cursor i sdrawn at line end, not over some
+ * @at_line_end: whether cursor is drawn at line end, not over some
* character
*
* Returns: whether cursor should actually be drawn as a rectangle.
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]