efl - edje entry - dont emit changed on markup set unless text changed 17/83217/2
authorCarsten Haitzler (Rasterman) <raster@rasterman.com>
Mon, 8 Aug 2016 05:27:26 +0000 (14:27 +0900)
committerJaehyun Cho <jae_hyun.cho@samsung.com>
Thu, 11 Aug 2016 04:38:06 +0000 (21:38 -0700)
if the text didnt actually change we generat a lot of noise in changed
signals for no change at all in text. shortcut this and check the new
and old text and compare ptrs, 0 length and strings etc.

this fixes T4045

@fix

Change-Id: I889f7e0e7bfa449d991169ee395d2c0c4b6a6178
Signed-off-by: Youngbok Shin <youngb.shin@samsung.com>
src/lib/edje/edje_entry.c

index 29f4bd0..0dfcd5b 100644 (file)
@@ -2992,11 +2992,22 @@ void
 _edje_entry_text_markup_set(Edje_Real_Part *rp, const char *text)
 {
    Entry *en;
+   const char *ptext;
 
    if ((rp->type != EDJE_RP_TYPE_TEXT) ||
        (!rp->typedata.text)) return;
    en = rp->typedata.text->entry_data;
    if (!en) return;
+   ptext = evas_object_textblock_text_markup_get(rp->object);
+   // some simple "do nothing if the text is the same" logic
+   if (ptext == text) return;
+   // if prev and cur is empty
+   if (!ptext) ptext = "";
+   if (!text) text = "";
+   if ((!ptext[0]) && (!text[0])) return;
+   // same content
+   if (!strcmp(ptext, text)) return;
+
    _edje_entry_imf_context_reset(rp);
    // set text as markup
    _sel_clear(en->ed, en->cursor, rp->object, en);