[text] Do not ensure the cursor if not needed
authorEmmanuele Bassi <ebassi@linux.intel.com>
Wed, 7 Jan 2009 13:14:13 +0000 (13:14 +0000)
committerEmmanuele Bassi <ebassi@linux.intel.com>
Wed, 7 Jan 2009 13:16:11 +0000 (13:16 +0000)
If the Text actor is neither editable nor has its cursor set
to visible, then we should not be ensuring the cursor position.

This fixes a failure in the conformance test unit for the
layout cache.

clutter/clutter-text.c

index fa3fbb4..56db985 100644 (file)
@@ -1030,12 +1030,13 @@ clutter_text_paint (ClutterActor *self)
       return;
     }
 
-  clutter_text_ensure_cursor_position (text);
-
   clutter_actor_get_allocation_box (self, &alloc);
   layout = clutter_text_create_layout (text, alloc.x2 - alloc.x1);
 
-  if (priv->single_line_mode)
+  if (priv->editable && priv->cursor_visible)
+    clutter_text_ensure_cursor_position (text);
+
+  if (priv->editable && priv->single_line_mode)
     {
       PangoRectangle logical_rect = { 0, };
       gint actor_width, text_width;