From 3d817a2e47a3ec08063f3819fa90bce69888c6a2 Mon Sep 17 00:00:00 2001 From: tasn Date: Thu, 19 May 2011 12:08:29 +0000 Subject: [PATCH] Edje entry: Don't emit cursor,changed when not needed. This includes setting the text and setting cursor position to the already set position. git-svn-id: http://svn.enlightenment.org/svn/e/trunk/edje@59531 7cbeb6ba-43b4-40fd-8cce-4c39aea84d33 --- ChangeLog | 6 ++++++ src/lib/edje_entry.c | 13 ++++++++----- 2 files changed, 14 insertions(+), 5 deletions(-) diff --git a/ChangeLog b/ChangeLog index 1512504..d0e0c29 100644 --- 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. diff --git a/src/lib/edje_entry.c b/src/lib/edje_entry.c index b504da3..316c5f3 100644 --- a/src/lib/edje_entry.c +++ b/src/lib/edje_entry.c @@ -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); -- 2.7.4