From e79fd1055d5d220a2460fc5ada0e74d7456aedf2 Mon Sep 17 00:00:00 2001 From: Thomas Wood Date: Thu, 14 May 2009 10:53:44 +0100 Subject: [PATCH] [text] account for scrolling in clutter_text_position_to_coords 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 | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/clutter/clutter-text.c b/clutter/clutter-text.c index 7e295a497..4a169219f 100644 --- a/clutter/clutter-text.c +++ b/clutter/clutter-text.c @@ -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;