From df40586f655678fc43b2c1ef747fa5ea5b7ac3fe Mon Sep 17 00:00:00 2001 From: Youngbok Shin Date: Mon, 11 Jul 2016 17:09:31 +0900 Subject: [PATCH] Edje entry: Skip codes for updating cursor when cursor position is not changed Summary: When ever a Edje's cursor function is called, "cursor,changed" signal is emitted. Even if the position is not changed. And, in Elementary, the signal will trigger evas_smart_objects_calculate() from elm_widget_show_region_set(). It causes bad performace. @fix Test Plan: N/A Reviewers: tasn, herdsman, cedric, woohyun Subscribers: jpeg, z-wony, Blackmole Differential Revision: https://phab.enlightenment.org/D3902 --- src/lib/edje/edje_entry.c | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/src/lib/edje/edje_entry.c b/src/lib/edje/edje_entry.c index c5ed2b3d7a..251946196c 100644 --- a/src/lib/edje/edje_entry.c +++ b/src/lib/edje/edje_entry.c @@ -3822,6 +3822,7 @@ _edje_entry_cursor_begin(Edje_Real_Part *rp, Edje_Cursor cur) { Entry *en; Evas_Textblock_Cursor *c = _cursor_get(rp, cur); + int old_cur_pos; if ((rp->type != EDJE_RP_TYPE_TEXT) || (!rp->typedata.text)) return; @@ -3831,7 +3832,12 @@ _edje_entry_cursor_begin(Edje_Real_Part *rp, Edje_Cursor cur) _edje_entry_imf_context_reset(rp); + old_cur_pos = evas_textblock_cursor_pos_get(c); evas_textblock_cursor_paragraph_first(c); + + if (old_cur_pos == evas_textblock_cursor_pos_get(c)) + return; + _sel_update(en->ed, c, rp->object, rp->typedata.text->entry_data); _edje_entry_imf_cursor_info_set(en); @@ -3844,6 +3850,7 @@ _edje_entry_cursor_end(Edje_Real_Part *rp, Edje_Cursor cur) { Entry *en; Evas_Textblock_Cursor *c = _cursor_get(rp, cur); + int old_cur_pos; if ((rp->type != EDJE_RP_TYPE_TEXT) || (!rp->typedata.text)) return; @@ -3853,7 +3860,12 @@ _edje_entry_cursor_end(Edje_Real_Part *rp, Edje_Cursor cur) _edje_entry_imf_context_reset(rp); + old_cur_pos = evas_textblock_cursor_pos_get(c); _curs_end(c, rp->object, rp->typedata.text->entry_data); + + if (old_cur_pos == evas_textblock_cursor_pos_get(c)) + return; + _sel_update(en->ed, c, rp->object, rp->typedata.text->entry_data); _edje_entry_imf_cursor_info_set(en); @@ -3891,6 +3903,7 @@ _edje_entry_cursor_line_begin(Edje_Real_Part *rp, Edje_Cursor cur) { Entry *en; Evas_Textblock_Cursor *c = _cursor_get(rp, cur); + int old_cur_pos; if ((rp->type != EDJE_RP_TYPE_TEXT) || (!rp->typedata.text)) return; @@ -3899,7 +3912,12 @@ _edje_entry_cursor_line_begin(Edje_Real_Part *rp, Edje_Cursor cur) if (!c) return; _edje_entry_imf_context_reset(rp); + old_cur_pos = evas_textblock_cursor_pos_get(c); evas_textblock_cursor_line_char_first(c); + + if (old_cur_pos == evas_textblock_cursor_pos_get(c)) + return; + _sel_update(en->ed, c, rp->object, rp->typedata.text->entry_data); _edje_entry_imf_cursor_info_set(en); @@ -3913,6 +3931,7 @@ _edje_entry_cursor_line_end(Edje_Real_Part *rp, Edje_Cursor cur) { Entry *en; Evas_Textblock_Cursor *c = _cursor_get(rp, cur); + int old_cur_pos; if ((rp->type != EDJE_RP_TYPE_TEXT) || (!rp->typedata.text)) return; @@ -3920,7 +3939,13 @@ _edje_entry_cursor_line_end(Edje_Real_Part *rp, Edje_Cursor cur) if (!en) return; if (!c) return; _edje_entry_imf_context_reset(rp); + + old_cur_pos = evas_textblock_cursor_pos_get(c); evas_textblock_cursor_line_char_last(c); + + if (old_cur_pos == evas_textblock_cursor_pos_get(c)) + return; + _sel_update(en->ed, c, rp->object, rp->typedata.text->entry_data); _edje_entry_imf_cursor_info_set(en);