From: Jihoon Kim Date: Sat, 31 Jan 2015 12:17:16 +0000 (+0900) Subject: Reuse ecore_imf_context when theme is changed X-Git-Tag: submit/sandbox/upgrade/efl120/20180319.053334~624 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=ca5a3900ab44d099f0ea1ebb5ac9ae4235464e10;p=platform%2Fupstream%2Fefl.git Reuse ecore_imf_context when theme is changed Change-Id: Ie0374f9e3839a5da1527a0eab381f4d4dc632c9c --- diff --git a/src/lib/edje/edje_entry.c b/src/lib/edje/edje_entry.c index 239246a..7c3a0c5 100644 --- a/src/lib/edje/edje_entry.c +++ b/src/lib/edje/edje_entry.c @@ -3092,7 +3092,7 @@ _edje_entry_shutdown(Edje *ed) } void -_edje_entry_real_part_init(Edje *ed, Edje_Real_Part *rp) +_edje_entry_real_part_init(Edje *ed, Edje_Real_Part *rp, Ecore_IMF_Context *ic) { Entry *en; #ifdef HAVE_ECORE_IMF @@ -3192,28 +3192,35 @@ _edje_entry_real_part_init(Edje *ed, Edje_Real_Part *rp) rp->part->name, _edje_entry_focus_out_cb, rp); - ctx_id = ecore_imf_context_default_id_get(); - if (ctx_id) + // TIZEN_ONLY(20131129): Reuse ecore_imf_context when theme is changed + + if (ic) + en->imf_context = ic; + else { - ctx_info = ecore_imf_context_info_by_id_get(ctx_id); - if (!ctx_info->canvas_type || - strcmp(ctx_info->canvas_type, "evas") == 0) - { - en->imf_context = ecore_imf_context_add(ctx_id); - } - else + ctx_id = ecore_imf_context_default_id_get(); + if (ctx_id) { - ctx_id = ecore_imf_context_default_id_by_canvas_type_get("evas"); - if (ctx_id) + ctx_info = ecore_imf_context_info_by_id_get(ctx_id); + if (!ctx_info->canvas_type || + strcmp(ctx_info->canvas_type, "evas") == 0) { en->imf_context = ecore_imf_context_add(ctx_id); } + else + { + ctx_id = ecore_imf_context_default_id_by_canvas_type_get("evas"); + if (ctx_id) + { + en->imf_context = ecore_imf_context_add(ctx_id); + } + } } - } - else - en->imf_context = NULL; + else + en->imf_context = NULL; - if (!en->imf_context) goto done; + if (!en->imf_context) goto done; + } ecore_imf_context_client_window_set (en->imf_context, @@ -3240,6 +3247,15 @@ _edje_entry_real_part_init(Edje *ed, Edje_Real_Part *rp) ecore_imf_context_input_panel_language_set(en->imf_context, ECORE_IMF_INPUT_PANEL_LANG_ALPHABET); #endif } + // TIZEN_ONLY(20131129): Reuse ecore_imf_context when theme is changed + else + { +#ifdef HAVE_ECORE_IMF + if (ic) + ecore_imf_context_del(ic); +#endif + } + // #ifdef HAVE_ECORE_IMF done: #endif @@ -3247,7 +3263,7 @@ done: } void -_edje_entry_real_part_shutdown(Edje *ed, Edje_Real_Part *rp) +_edje_entry_real_part_shutdown(Edje *ed, Edje_Real_Part *rp, Eina_Bool reuse_ic) { Entry *en; @@ -3290,8 +3306,13 @@ _edje_entry_real_part_shutdown(Edje *ed, Edje_Real_Part *rp) ecore_imf_context_event_callback_del(en->imf_context, ECORE_IMF_CALLBACK_PREEDIT_CHANGED, _edje_entry_imf_event_preedit_changed_cb); ecore_imf_context_event_callback_del(en->imf_context, ECORE_IMF_CALLBACK_SELECTION_SET, _edje_entry_imf_event_selection_set_cb); - ecore_imf_context_del(en->imf_context); - en->imf_context = NULL; + // TIZEN_ONLY(20131129): Reuse ecore_imf_context when theme is changed + if (!reuse_ic) + { + ecore_imf_context_del(en->imf_context); + en->imf_context = NULL; + } + // } edje_object_signal_callback_del(ed->obj, "focus,part,in,*", diff --git a/src/lib/edje/edje_load.c b/src/lib/edje/edje_load.c index 1765eb6..d735a16 100644 --- a/src/lib/edje/edje_load.c +++ b/src/lib/edje/edje_load.c @@ -37,6 +37,8 @@ struct _Edje_Nested_Support /* We builed nested-parts list using this struct */ unsigned char nested_children_count; /* Number of nested children */ }; +static Eina_List *ic_list = NULL; + Evas_Smart * _edje_smart_nested_smart_class_new(void) { @@ -798,7 +800,7 @@ _edje_object_file_set_internal(Evas_Object *obj, const Eina_File *file, const ch } #endif - _edje_file_del(ed); + _edje_file_del(ed, EINA_TRUE); eina_stringshare_replace(&ed->path, file ? eina_file_filename_get(file) : NULL); eina_stringshare_replace(&ed->group, group); @@ -828,7 +830,7 @@ _edje_object_file_set_internal(Evas_Object *obj, const Eina_File *file, const ch if (ed->collection->parts_count > 0xffff) { ed->load_error = EDJE_LOAD_ERROR_CORRUPT_FILE; - _edje_file_del(ed); + _edje_file_del(ed, EINA_TRUE); return 0; } eina_array_step_set(&parts, sizeof (Eina_Array), 8); @@ -1238,6 +1240,9 @@ _edje_object_file_set_internal(Evas_Object *obj, const Eina_File *file, const ch { ed->table_parts = malloc(sizeof(Edje_Real_Part *) * n); ed->table_parts_size = n; + // TIZEN_ONLY(20131129): Reuse ecore_imf_context when theme is changed + Eina_List *l = ic_list; + /* FIXME: check malloc return */ n = eina_array_count(&parts) - 1; while ((rp = eina_array_pop(&parts))) @@ -1327,12 +1332,26 @@ _edje_object_file_set_internal(Evas_Object *obj, const Eina_File *file, const ch if (rp->part->entry_mode > EDJE_ENTRY_EDIT_MODE_NONE) { - _edje_entry_real_part_init(ed, rp); + // TIZEN_ONLY(20131129): Reuse ecore_imf_context when theme is changed + Ecore_IMF_Context *ic = NULL; + if (l) + { + ic = l->data; + l = eina_list_next(l); + } + _edje_entry_real_part_init(ed, rp, ic); + // + if (!ed->has_entries) ed->has_entries = EINA_TRUE; } } } + + // TIZEN_ONLY(20131129): Reuse ecore_imf_context when theme is changed + if (ic_list) + ic_list = eina_list_free(ic_list); + // } _edje_ref(ed); @@ -1715,7 +1734,7 @@ on_error: _edje_util_thaw(ed); _edje_unblock(ed); _edje_unref(ed); - _edje_file_del(ed); + _edje_file_del(ed, EINA_FALSE); if (group_path_started) { const char *path; @@ -1848,7 +1867,7 @@ _edje_object_collect(Edje *ed) } void -_edje_file_del(Edje *ed) +_edje_file_del(Edje *ed, Eina_Bool reuse_ic) { Edje_User_Defined *eud; Evas *tev = NULL; @@ -1915,7 +1934,17 @@ _edje_file_del(Edje *ed) #endif if (rp->part->entry_mode > EDJE_ENTRY_EDIT_MODE_NONE) - _edje_entry_real_part_shutdown(ed, rp); + { + // TIZEN_ONLY(20131129): Reuse ecore_imf_context when theme is changed + if (reuse_ic) + { + Ecore_IMF_Context *ic = _edje_entry_imf_context_get (rp); + ic_list = eina_list_append(ic_list, ic); + } + + _edje_entry_real_part_shutdown(ed, rp, reuse_ic); + // + } if (rp->object) { diff --git a/src/lib/edje/edje_main.c b/src/lib/edje/edje_main.c index bd96acc..782469e 100644 --- a/src/lib/edje/edje_main.c +++ b/src/lib/edje/edje_main.c @@ -314,7 +314,7 @@ _edje_del(Edje *ed) _edje_message_del(ed); _edje_signal_callback_free(ed->callbacks); ed->callbacks = NULL; - _edje_file_del(ed); + _edje_file_del(ed, EINA_FALSE); if (ed->path) eina_stringshare_del(ed->path); if (ed->group) eina_stringshare_del(ed->group); if (ed->parent) eina_stringshare_del(ed->parent); diff --git a/src/lib/edje/edje_private.h b/src/lib/edje/edje_private.h index a6de973..a9246b5 100644 --- a/src/lib/edje/edje_private.h +++ b/src/lib/edje/edje_private.h @@ -2593,7 +2593,7 @@ EAPI void _edje_edd_shutdown(void); int _edje_object_file_set_internal(Evas_Object *obj, const Eina_File *file, const char *group, const char *parent, Eina_List *group_path, Eina_Array *nested); -void _edje_file_del(Edje *ed); +void _edje_file_del(Edje *ed, Eina_Bool reuse_ic); void _edje_file_free(Edje_File *edf); void _edje_file_cache_shutdown(void); void _edje_collection_free(Edje_File *edf, @@ -2905,8 +2905,8 @@ void _edje_lua_script_only_message(Edje *ed, Edje_Message *em); void _edje_entry_init(Edje *ed); void _edje_entry_shutdown(Edje *ed); -void _edje_entry_real_part_init(Edje *ed, Edje_Real_Part *rp); -void _edje_entry_real_part_shutdown(Edje *ed, Edje_Real_Part *rp); +void _edje_entry_real_part_init(Edje *ed, Edje_Real_Part *rp, Ecore_IMF_Context *ic); +void _edje_entry_real_part_shutdown(Edje *ed, Edje_Real_Part *rp, Eina_Bool reuse_ic); void _edje_entry_real_part_configure(Edje *ed, Edje_Real_Part *rp); const char *_edje_entry_selection_get(Edje_Real_Part *rp); const char *_edje_entry_text_get(Edje_Real_Part *rp); diff --git a/src/lib/edje/edje_smart.c b/src/lib/edje/edje_smart.c index 5cda974..e5a7e34 100644 --- a/src/lib/edje/edje_smart.c +++ b/src/lib/edje/edje_smart.c @@ -148,7 +148,7 @@ _efl_canvas_layout_efl_canvas_group_group_del(Eo *obj, Edje *ed) } #endif if (ed->persp) edje_object_perspective_set(obj, NULL); - _edje_file_del(ed); + _edje_file_del(ed, EINA_FALSE); _edje_unref(ed); _edje_lib_unref(); efl_canvas_group_del(efl_super(obj, MY_CLASS));