[clutter] clutter-text: Always update cursor positions when painting



commit 037138d3bf0be118a7e3559fef0a93667e6d1fe4
Author: Jasper St. Pierre <jstpierre mecheye net>
Date:   Sun Jul 3 16:43:17 2011 -0400

    clutter-text: Always update cursor positions when painting
    
    The cursor's on-screen rectangle is defined in terms of the text
    length, the current index, and text_x and text_y, which hold the text
    offset in overflowing text fields.
    
    When deleting large amounts of text, text_x is set to 0. In some
    edge case branch paths, the cursor rectangle could be calculated
    after the current index and text length were updated, but before
    the text_x offset could be. This left a negative x position, which
    consequently blew up Cogl and the widget.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=651079

 clutter/clutter-text.c |   10 +++++-----
 1 files changed, 5 insertions(+), 5 deletions(-)
---
diff --git a/clutter/clutter-text.c b/clutter/clutter-text.c
index 85912cc..ea783ad 100644
--- a/clutter/clutter-text.c
+++ b/clutter/clutter-text.c
@@ -2015,10 +2015,6 @@ clutter_text_paint (ClutterActor *self)
                   text_x = text_x + (actor_width - cursor_x) - TEXT_PADDING;
                 }
             }
-          /* Update the absolute cursor position as it may have moved due to
-           * scrolling */
-          priv->text_x = text_x;
-          clutter_text_ensure_cursor_position (text);
         }
       else
         {
@@ -2028,7 +2024,11 @@ clutter_text_paint (ClutterActor *self)
   else
     text_x = 0;
 
-  priv->text_x = text_x;
+  if (priv->text_x != text_x)
+    {
+      priv->text_x = text_x;
+      clutter_text_ensure_cursor_position (text);
+    }
 
   real_opacity = clutter_actor_get_paint_opacity (self)
                * priv->text_color.alpha



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