[gtk+] entry: don't force zero Y coordinate for insertion cursor



commit 7e78d75e7ad1ebcbbbc8ad134e01176b4ab7dfe5
Author: Cosimo Cecchi <cosimoc gnome org>
Date:   Sat Feb 18 19:28:21 2012 +0100

    entry: don't force zero Y coordinate for insertion cursor
    
    Subclasses of GtkEntry could set a larger height request, so we need to
    apply the same calculations to the insertion cursors than we do on the
    PangoLayout to render it centered under all circumstances.

 gtk/gtkentry.c |    7 +++----
 1 files changed, 3 insertions(+), 4 deletions(-)
---
diff --git a/gtk/gtkentry.c b/gtk/gtkentry.c
index d201aff..801dd96 100644
--- a/gtk/gtkentry.c
+++ b/gtk/gtkentry.c
@@ -5869,12 +5869,14 @@ gtk_entry_draw_cursor (GtkEntry  *entry,
   gboolean block_at_line_end;
   PangoLayout *layout;
   const char *text;
+  gint x, y;
 
   context = gtk_widget_get_style_context (widget);
 
   layout = gtk_entry_ensure_layout (entry, TRUE);
   text = pango_layout_get_text (layout);
   cursor_index = g_utf8_offset_to_pointer (text, priv->current_pos + priv->preedit_cursor) - text;
+  get_layout_position (entry, &x, &y);
 
   if (!priv->overwrite_mode)
     block = FALSE;
@@ -5885,19 +5887,16 @@ gtk_entry_draw_cursor (GtkEntry  *entry,
   if (!block)
     {
       gtk_render_insertion_cursor (context, cr,
-                                   - priv->scroll_offset, 0,
+                                   x, y,
                                    layout, cursor_index, priv->resolved_dir);
     }
   else /* overwrite_mode */
     {
       GdkRGBA cursor_color;
       GdkRectangle rect;
-      gint x, y;
 
       cairo_save (cr);
 
-      get_layout_position (entry, &x, &y);
-
       rect.x = PANGO_PIXELS (cursor_rect.x) + x;
       rect.y = PANGO_PIXELS (cursor_rect.y) + y;
       rect.width = PANGO_PIXELS (cursor_rect.width);



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]