From 2ff31dfbaaad3056265b05efe57eac63f8e3ce61 Mon Sep 17 00:00:00 2001 From: Emmanuele Bassi Date: Fri, 16 Oct 2009 14:22:15 +0100 Subject: [PATCH] text: Notify :position when it changes The :position property is not notified when changed. http://bugzilla.openedhand.com/show_bug.cgi?id=1830 --- clutter/clutter-text.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/clutter/clutter-text.c b/clutter/clutter-text.c index 9c2f8ebb1..5abc57d6c 100644 --- a/clutter/clutter-text.c +++ b/clutter/clutter-text.c @@ -671,6 +671,7 @@ clutter_text_delete_selection (ClutterText *self) ClutterTextPrivate *priv; gint start_index; gint end_index; + gint old_position, old_selection; g_return_val_if_fail (CLUTTER_IS_TEXT (self), FALSE); @@ -692,11 +693,20 @@ clutter_text_delete_selection (ClutterText *self) end_index = temp; } + old_position = priv->position; + old_selection = priv->selection_bound; + clutter_text_delete_text (self, start_index, end_index); priv->position = start_index; priv->selection_bound = start_index; + if (priv->position != old_position) + g_object_notify (G_OBJECT (self), "position"); + + if (priv->selection_bound != old_selection) + g_object_notify (G_OBJECT (self), "selection-bound"); + return TRUE; } @@ -3964,6 +3974,9 @@ clutter_text_set_cursor_position (ClutterText *self, priv = self->priv; + if (priv->position == position) + return; + len = priv->n_chars; if (position < 0 || position >= len) @@ -3977,6 +3990,8 @@ clutter_text_set_cursor_position (ClutterText *self, if (CLUTTER_ACTOR_IS_VISIBLE (self)) clutter_actor_queue_redraw (CLUTTER_ACTOR (self)); + + g_object_notify (G_OBJECT (self), "position"); } /**