entry: fix cursor position initialization issues when theme is changed 63/165263/1 accepted/tizen/4.0/unified/20180111.044033 submit/tizen_4.0/20180103.115053
authorYoungbok Shin <youngb.shin@samsung.com>
Wed, 27 Dec 2017 10:28:31 +0000 (19:28 +0900)
committerYoungbok Shin <youngb.shin@samsung.com>
Wed, 27 Dec 2017 10:28:31 +0000 (19:28 +0900)
The issue was caused by the following patch.
"elm_entry: Save cursor position before entry text clear"

It needed to get cursor position at the text_set function to avoid
cursor position issue by delaying signal callback functions.
So, we can't remove the patch. In the theme_apply, we need to handle
cursor position more carefully to fix this side effect.

@tizen_fix

Change-Id: Id63aa401ba2572559bc241f54350b781c72f5092

src/lib/elm_entry.c

index aad5e0a..0584188 100644 (file)
@@ -1842,9 +1842,20 @@ _elm_entry_elm_widget_theme_apply(Eo *obj, Elm_Entry_Data *sd)
      edje_object_part_text_select_allow_set
         (sd->entry_edje, "elm.text", EINA_FALSE);
 
+   /* TIZEN_ONLY(20171227): fix cursor position initialization issues when theme is changed */
+   int cursor_pos = sd->cursor_pos;
+   /* END */
    elm_object_text_set(obj, t);
    eina_stringshare_del(t);
 
+   /* TIZEN_ONLY(20171227): fix cursor position initialization issues when theme is changed */
+   if (sd->cursor_pos != cursor_pos)
+     {
+        sd->cursor_pos = cursor_pos;
+        edje_object_part_text_cursor_pos_set(sd->entry_edje, "elm.text", EDJE_CURSOR_MAIN, cursor_pos);
+     }
+   /* END */
+
    if (elm_widget_disabled_get(obj))
      edje_object_signal_emit(sd->entry_edje, "elm,state,disabled", "elm");