efl/edje: ecore_imf_init() only once.
authorGustavo Sverzut Barbieri <barbieri@gmail.com>
Sat, 5 Jan 2013 16:17:53 +0000 (16:17 +0000)
committerGustavo Sverzut Barbieri <barbieri@gmail.com>
Sat, 5 Jan 2013 16:17:53 +0000 (16:17 +0000)
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
src/lib/edje/edje_main.c
src/lib/edje/edje_private.h

index 67be8b3..b9f767b 100644 (file)
@@ -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);
index a87d668..f98f8c9 100644 (file)
@@ -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
+}
index 4e44b79..a1f27a1 100644 (file)
@@ -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)
 {