From 9b5958ce91007a6d6605c01dc475bd8e2ba2dd67 Mon Sep 17 00:00:00 2001 From: Gustavo Sverzut Barbieri Date: Sat, 5 Jan 2013 16:17:53 +0000 Subject: [PATCH] efl/edje: ecore_imf_init() only once. use technique similar to elementary and delay init() of module, but once you do, do it only once and avoid shutdown() until edje_shutdown(). This is good if we keep creating and deleting edje objects with entry, the count could go to 0 and ecore_imf_shutdown() would unload everything, just to load it soon. SVN revision: 82281 --- src/lib/edje/edje_entry.c | 3 +-- src/lib/edje/edje_main.c | 16 ++++++++++++++++ src/lib/edje/edje_private.h | 2 ++ 3 files changed, 19 insertions(+), 2 deletions(-) diff --git a/src/lib/edje/edje_entry.c b/src/lib/edje/edje_entry.c index 67be8b3618..b9f767b25e 100644 --- a/src/lib/edje/edje_entry.c +++ b/src/lib/edje/edje_entry.c @@ -2318,7 +2318,7 @@ _edje_entry_real_part_init(Edje_Real_Part *rp) en->input_panel_enable = EINA_TRUE; #ifdef HAVE_ECORE_IMF - ecore_imf_init(); + _edje_need_imf(); edje_object_signal_callback_add(rp->edje->obj, "focus,part,in", rp->part->name, _edje_entry_focus_in_cb, rp); edje_object_signal_callback_add(rp->edje->obj, "focus,part,out", rp->part->name, _edje_entry_focus_out_cb, rp); @@ -2410,7 +2410,6 @@ _edje_entry_real_part_shutdown(Edje_Real_Part *rp) edje_object_signal_callback_del(rp->edje->obj, "focus,part,in", rp->part->name, _edje_entry_focus_in_cb); edje_object_signal_callback_del(rp->edje->obj, "focus,part,out", rp->part->name, _edje_entry_focus_out_cb); - ecore_imf_shutdown(); } #endif _compose_seq_reset(en); diff --git a/src/lib/edje/edje_main.c b/src/lib/edje/edje_main.c index a87d6686e9..f98f8c9263 100644 --- a/src/lib/edje/edje_main.c +++ b/src/lib/edje/edje_main.c @@ -7,6 +7,7 @@ static int _edje_init_count = 0; int _edje_default_log_dom = -1; Eina_Mempool *_edje_real_part_mp = NULL; Eina_Mempool *_edje_real_part_state_mp = NULL; +static Eina_Bool _need_imf = EINA_FALSE; /*============================================================================* * API * @@ -142,6 +143,11 @@ _edje_shutdown_core(void) _edje_text_class_hash_free(); _edje_edd_shutdown(); +#ifdef HAVE_ECORE_IMF + if (_need_imf) + ecore_imf_shutdown(); +#endif + #ifdef HAVE_EIO eio_shutdown(); #endif @@ -293,3 +299,13 @@ _edje_unref(Edje *ed) ed->references--; if (ed->references == 0) _edje_del(ed); } + +void +_edje_need_imf(void) +{ + if (_need_imf) return; +#ifdef HAVE_ECORE_IMF + _need_imf = EINA_TRUE; + ecore_imf_init(); +#endif +} diff --git a/src/lib/edje/edje_private.h b/src/lib/edje/edje_private.h index 4e44b791a9..a1f27a1d1c 100644 --- a/src/lib/edje/edje_private.h +++ b/src/lib/edje/edje_private.h @@ -2260,6 +2260,8 @@ Eina_Module *_edje_module_handle_load(const char *module); void _edje_module_init(void); void _edje_module_shutdown(void); +void _edje_need_imf(void); + static inline Eina_Bool edje_program_is_strncmp(const char *str) {