entry: fix cursor position initialization issues when theme is changed 68/165268/1 accepted/tizen/unified/20180105.065619 submit/tizen/20180103.114435 submit/tizen/20180104.104342
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 11:32:11 +0000 (11:32 +0000)
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 4d2f7f9..b3d9815 100644 (file)
@@ -1819,9 +1819,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");