[text] account for scrolling in clutter_text_position_to_coords
authorThomas Wood <thomas.wood@intel.com>
Thu, 14 May 2009 09:53:44 +0000 (10:53 +0100)
committerThomas Wood <thomas.wood@intel.com>
Thu, 14 May 2009 12:31:21 +0000 (13:31 +0100)
Add any scrolling offset to the x value when in single line mode.

Now that the offset is taken into account in the position_to_coords
function, we do not need to adjust the cursor x manually in
clutter_text_paint.

clutter/clutter-text.c

index 7e295a4..4a16921 100644 (file)
@@ -535,6 +535,15 @@ clutter_text_position_to_coords (ClutterText *self,
   if (line_height)
     *line_height = CLUTTER_UNITS_FROM_PANGO_UNIT (rect.height);
 
+  if (self->priv->single_line_mode)
+    {
+      /* Take any offset due to scrolling into account */
+      if (x)
+        *x += self->priv->text_x;
+    }
+
+
+
   /* FIXME: should return false if coords were outside text */
   return TRUE;
 }
@@ -1380,7 +1389,6 @@ clutter_text_paint (ClutterActor *self)
         {
           text_x = TEXT_PADDING;
         }
-      priv->cursor_pos.x += text_x;
     }
   else
     text_x = 0;