diff options
-rw-r--r-- | ChangeLog | 15 | ||||
-rw-r--r-- | gtk/gtkentry.c | 9 | ||||
-rw-r--r-- | gtk/gtktextutil.c | 2 |
3 files changed, 21 insertions, 5 deletions
@@ -1,3 +1,16 @@ +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 + 2008-10-02 Christian Persch Bug 554704 – gtkfilesystemmodel does too much work @@ -215,7 +228,7 @@ Bug 552959 – GtkTrayIcon: _NET_SYSTEM_TRAY_VISUAL and real transparency - * gtk/gtktrayicon-x11.c: Add support for the _BET_SYSTEM_TRAY_VISUAL + * gtk/gtktrayicon-x11.c: Add support for the _NET_SYSTEM_TRAY_VISUAL property described in http://lists.freedesktop.org/archives/xdg/2008-September/009919.html If _NET_SYSTEM_TRAY_VISUAL is a visual with an alpha channel, the diff --git a/gtk/gtkentry.c b/gtk/gtkentry.c index 3bcf0e087e..cf510a318d 100644 --- a/gtk/gtkentry.c +++ b/gtk/gtkentry.c @@ -3794,6 +3794,8 @@ gtk_entry_draw_cursor (GtkEntry *entry, 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 @@ gtk_entry_draw_cursor (GtkEntry *entry, 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 @@ gtk_entry_draw_cursor (GtkEntry *entry, } else /* overwrite_mode */ { - PangoLayout *layout = gtk_entry_ensure_layout (entry, TRUE); GdkColor cursor_color; GdkRectangle rect; cairo_t *cr; diff --git a/gtk/gtktextutil.c b/gtk/gtktextutil.c index dc05880d41..145ef2b5fe 100644 --- a/gtk/gtktextutil.c +++ b/gtk/gtktextutil.c @@ -406,7 +406,7 @@ layout_get_char_width (PangoLayout *layout) * @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. |