edje: Add edje_object_part_text_freeze, thaw APIs for freezing cursor movements
authorYoungbok Shin <youngb.shin@samsung.com>
Tue, 16 Jan 2018 05:24:25 +0000 (14:24 +0900)
committerYoungbok Shin <youngb.shin@samsung.com>
Tue, 16 Jan 2018 05:25:05 +0000 (14:25 +0900)
It also apply the internal functions to elm_entry.

@tizen_feature

src/lib/edje/Edje_Common.h
src/lib/edje/edje_entry.c
src/lib/edje/edje_private.h
src/lib/edje/edje_util.c
src/lib/elementary/elm_entry.c

index dba97e7..91880ae 100644 (file)
@@ -2388,6 +2388,38 @@ EAPI Eina_Bool edje_3d_object_add(Evas_Object *obj, Eo **root_node, Eo *scene);
 
 #endif
 
+/****************************************************************************************************
+ * TIZEN_ONLY(20150716): Add edje_object_part_text_freeze, thaw APIs for freezing cursor movements. *
+ ****************************************************************************************************/
+/**
+ * @internal
+ * @brief These APIs are for communicating with edje_entry for not moving
+ *        cursor position meanwhile.
+ *
+ * @remarks Tizen only feature (2015.07.16)
+ *
+ * @remarks Applications NEVER USE THESE APIs for private purporse.
+ *
+ * @see edje_object_part_text_thaw()
+ */
+EAPI void                    edje_object_part_text_freeze    (Evas_Object *obj, const char *part);
+
+/**
+ * @internal
+ * @brief These APIs are for communicating with edje_entry for not moving
+ *        cursor position meanwhile.
+ *
+ * @remarks Tizen only feature (2015.07.16)
+ *
+ * @remarks Applications NEVER USE THESE APIs for private purporse.
+ *
+ * @see edje_object_part_text_freeze()
+ */
+EAPI void                    edje_object_part_text_thaw      (Evas_Object *obj, const char *part);
+/*******
+ * END *
+ *******/
+
 /**
  * @}
  */
index 403960d..94e37b6 100644 (file)
@@ -67,6 +67,14 @@ struct _Entry
    Eina_Bool              commit_cancel : 1; // For skipping useless commit
    Ecore_IMF_Context     *imf_context;
 #endif
+
+   /****************************************************************************************************
+    * TIZEN_ONLY(20150716): Add edje_object_part_text_freeze, thaw APIs for freezing cursor movements. *
+    ****************************************************************************************************/
+   Eina_Bool freeze : 1;
+   /*******
+    * END *
+    *******/
 };
 
 struct _Sel
@@ -3602,9 +3610,22 @@ _edje_entry_text_markup_set(Edje_Real_Part *rp, const char *text)
 
    _anchors_get(en->cursor, rp->object, en);
    _edje_emit(en->ed, "entry,changed", rp->part->name);
+
+   /****************************************************************************************************
+    * TIZEN_ONLY(20150716): Add edje_object_part_text_freeze, thaw APIs for freezing cursor movements. *
+    ****************************************************************************************************
    _edje_entry_imf_cursor_info_set(en);
 
    _edje_entry_real_part_configure(en->ed, rp);
+    */
+   if (!en->freeze)
+     {
+        _edje_entry_imf_cursor_info_set(en);
+        _edje_entry_real_part_configure(en->ed, rp);
+     }
+   /*******
+    * END *
+    *******/
 #if 0
    /* Don't emit cursor changed cause it didn't. It's just init to 0. */
    _edje_emit(en->ed, "cursor,changed", rp->part->name);
@@ -3667,7 +3688,16 @@ _edje_entry_set_cursor_start(Edje_Real_Part *rp)
    if (!en) return;
    _curs_start(en->cursor, rp->object, en);
 
+   /****************************************************************************************************
+    * TIZEN_ONLY(20150716): Add edje_object_part_text_freeze, thaw APIs for freezing cursor movements. *
+    ****************************************************************************************************
    _edje_entry_imf_cursor_info_set(en);
+    */
+   if (!en->freeze)
+     _edje_entry_imf_cursor_info_set(en);
+   /*******
+    * END *
+    *******/
 }
 
 void
@@ -4900,9 +4930,22 @@ _edje_text_cursor_pos_set(Edje_Real_Part *rp, Efl_Text_Cursor_Cursor *c, int pos
    evas_textblock_cursor_pos_set(c, pos);
    _sel_update(en->ed, c, rp->object, rp->typedata.text->entry_data);
 
+   /****************************************************************************************************
+    * TIZEN_ONLY(20150716): Add edje_object_part_text_freeze, thaw APIs for freezing cursor movements. *
+    ****************************************************************************************************
    _edje_entry_imf_cursor_info_set(en);
    _edje_emit(en->ed, "cursor,changed", rp->part->name);
    _edje_entry_real_part_configure(en->ed, rp);
+    */
+   _edje_emit(en->ed, "cursor,changed", rp->part->name);
+   if (!en->freeze)
+     {
+        _edje_entry_imf_cursor_info_set(en);
+        _edje_entry_real_part_configure(en->ed, rp);
+     }
+   /*******
+    * END *
+    *******/
 }
 
 void
@@ -5591,4 +5634,39 @@ _edje_text_cursor_get(Edje_Real_Part *rp, Edje_Cursor cur)
    return _cursor_get(rp, cur);
 }
 
+/****************************************************************************************************
+ * TIZEN_ONLY(20150716): Add edje_object_part_text_freeze, thaw APIs for freezing cursor movements. *
+ ****************************************************************************************************/
+void _edje_entry_freeze(Edje_Real_Part *rp)
+{
+   Entry *en = NULL;
+
+   if ((rp->type != EDJE_RP_TYPE_TEXT) ||
+       (!rp->typedata.text)) return;
+
+   en = rp->typedata.text->entry_data;
+   if (!en) return;
+
+   en->freeze = EINA_TRUE;
+}
+
+void _edje_entry_thaw(Edje_Real_Part *rp)
+{
+   Entry *en = NULL;
+
+   if ((rp->type != EDJE_RP_TYPE_TEXT) ||
+       (!rp->typedata.text)) return;
+
+   en = rp->typedata.text->entry_data;
+   if (!en) return;
+
+   en->freeze = EINA_FALSE;
+
+   _edje_entry_imf_cursor_info_set(en);
+   _edje_entry_real_part_configure(en->ed, rp);
+}
+/*******
+ * END *
+ *******/
+
 /* vim:set ts=8 sw=3 sts=3 expandtab cino=>5n-2f0^-2{2(0W1st0 :*/
index 4988726..0497f27 100644 (file)
@@ -3047,6 +3047,14 @@ void _edje_entry_input_panel_show_on_demand_set(Edje_Real_Part *rp, Eina_Bool on
 Eina_Bool _edje_entry_input_panel_show_on_demand_get(Edje_Real_Part *rp);
 void _edje_entry_prediction_hint_set(Edje_Real_Part *rp, const char *prediction_hint);
 Eina_Bool _edje_entry_hide_visible_password(Edje *edje, Edje_Real_Part *rp);
+/****************************************************************************************************
+ * TIZEN_ONLY(20150716): Add edje_object_part_text_freeze, thaw APIs for freezing cursor movements. *
+ ****************************************************************************************************/
+void _edje_entry_freeze(Edje_Real_Part *rp);
+void _edje_entry_thaw(Edje_Real_Part *rp);
+/*******
+ * END *
+ *******/
 
 void _edje_external_init(void);
 void _edje_external_shutdown(void);
index dea072b..f7457a1 100644 (file)
@@ -7087,4 +7087,43 @@ _efl_canvas_layout_part_text_cursor_on_mouse_geometry_get(Eo *obj EINA_UNUSED, E
  * END *
  *******/
 
+/****************************************************************************************************
+ * TIZEN_ONLY(20150716): Add edje_object_part_text_freeze, thaw APIs for freezing cursor movements. *
+ ****************************************************************************************************/
+EAPI void
+edje_object_part_text_freeze(Evas_Object *obj, const char *part)
+{
+   Edje *ed;
+   Edje_Real_Part *rp;
+
+   ed = _edje_fetch(obj);
+   if ((!ed) || (!part)) return;
+   rp = _edje_real_part_recursive_get(&ed, part);
+   if (!rp) return;
+   if ((rp->part->type != EDJE_PART_TYPE_TEXTBLOCK)) return;
+   if (rp->part->entry_mode <= EDJE_ENTRY_EDIT_MODE_NONE) return;
+
+   _edje_entry_freeze(rp);
+}
+
+EAPI void
+edje_object_part_text_thaw(Evas_Object *obj, const char *part)
+{
+   Edje *ed;
+   Edje_Real_Part *rp;
+
+   ed = _edje_fetch(obj);
+   if ((!ed) || (!part)) return;
+   rp = _edje_real_part_recursive_get(&ed, part);
+   if (!rp) return;
+   if ((rp->part->type != EDJE_PART_TYPE_TEXTBLOCK)) return;
+   if (rp->part->entry_mode <= EDJE_ENTRY_EDIT_MODE_NONE) return;
+
+   _edje_entry_thaw(rp);
+}
+/*******
+ * END *
+ *******/
+
+
 /* vim:set ts=8 sw=3 sts=3 expandtab cino=>5n-2f0^-2{2(0W1st0 :*/
index 43a0662..01a757f 100644 (file)
@@ -903,6 +903,14 @@ _elm_entry_efl_ui_widget_theme_apply(Eo *obj, Elm_Entry_Data *sd)
 
    evas_event_freeze(evas_object_evas_get(obj));
 
+   /****************************************************************************************************
+    * TIZEN_ONLY(20150716): Add edje_object_part_text_freeze, thaw APIs for freezing cursor movements. *
+    ****************************************************************************************************/
+   edje_object_part_text_freeze(sd->entry_edje, "elm.text");
+   /*******
+    * END *
+    *******/
+
    edje_object_part_text_hide_visible_password(sd->entry_edje, "elm.text");
 
    edje_object_mirrored_set
@@ -1029,6 +1037,14 @@ _elm_entry_efl_ui_widget_theme_apply(Eo *obj, Elm_Entry_Data *sd)
    evas_event_thaw(evas_object_evas_get(obj));
    evas_event_thaw_eval(evas_object_evas_get(obj));
 
+   /****************************************************************************************************
+    * TIZEN_ONLY(20150716): Add edje_object_part_text_freeze, thaw APIs for freezing cursor movements. *
+    ****************************************************************************************************/
+   edje_object_part_text_thaw(sd->entry_edje, "elm.text");
+   /*******
+    * END *
+    *******/
+
    efl_event_callback_legacy_call(obj, EFL_UI_LAYOUT_EVENT_THEME_CHANGED, NULL);
 
    evas_object_unref(obj);