Edje entry: Don't emit cursor,changed when not needed.
authortasn <tasn@7cbeb6ba-43b4-40fd-8cce-4c39aea84d33>
Thu, 19 May 2011 12:08:29 +0000 (12:08 +0000)
committertasn <tasn@7cbeb6ba-43b4-40fd-8cce-4c39aea84d33>
Thu, 19 May 2011 12:08:29 +0000 (12:08 +0000)
This includes setting the text and setting cursor position to the already
set position.

git-svn-id: svn+ssh://svn.enlightenment.org/var/svn/e/trunk/edje@59531 7cbeb6ba-43b4-40fd-8cce-4c39aea84d33

ChangeLog
src/lib/edje_entry.c

index 1512504..d0e0c29 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -97,3 +97,9 @@
         BOUNCE, SPRING (also made short name versions of the long ones
         possible too).
 
+2011-05-19  Tom Hacohen (TAsn)
+
+        * Entry: Don't emit "cursor,changed" when setting the text, because
+          the cursor really didn't change, it's more like a new cursor.
+          Also, when setting position, don't do anything if position is as it
+          was.
index b504da3..316c5f3 100644 (file)
@@ -2035,11 +2035,14 @@ _edje_entry_text_markup_set(Edje_Real_Part *rp, const char *text)
    // set text as markup
    _sel_clear(en->cursor, rp->object, en);
    evas_object_textblock_text_markup_set(rp->object, text);
+   _edje_entry_set_cursor_start(rp);
 
    _anchors_get(en->cursor, rp->object, en);
    _edje_emit(rp->edje, "entry,changed", rp->part->name);
+#if 0
+   /* Don't emit cursor changed cause it didn't. It's just init to 0. */
    _edje_emit(rp->edje, "cursor,changed", rp->part->name);
-   _edje_entry_set_cursor_start(rp);
+#endif
 }
 
 void
@@ -2057,10 +2060,6 @@ _edje_entry_text_markup_append(Edje_Real_Part *rp, const char *text)
    /* We are updating according to the real cursor on purpose */
    _anchors_get(en->cursor, rp->object, en);
    _edje_emit(rp->edje, "entry,changed", rp->part->name);
-#if 0
-   /* Cursor didn't really change, don't say it did. */
-   _edje_emit(rp->edje, "cursor,changed", rp->part->name);
-#endif
 
    _edje_entry_real_part_configure(rp);
 }
@@ -2669,6 +2668,10 @@ _edje_entry_cursor_pos_set(Edje_Real_Part *rp, Edje_Cursor cur, int pos)
    Entry *en = rp->entry_data;
    Evas_Textblock_Cursor *c = _cursor_get(rp, cur);
    if (!c) return;
+   /* Abort if cursor position didn't really change */
+   if (evas_textblock_cursor_pos_get(c) == pos)
+      return;
+
    evas_textblock_cursor_pos_set(c, pos);
    _sel_update(c, rp->object, rp->entry_data);