1 #ifdef HAVE_CONFIG_H 2 # include <config.h> 3 #endif 4 5 #include <Ecore.h> 6 #include <ecore_private.h> 7 8 #include "Ecore_IMF.h" 9 #include "ecore_imf_private.h" 10 11 EAPI int ECORE_IMF_EVENT_PREEDIT_START = 0; 12 EAPI int ECORE_IMF_EVENT_PREEDIT_END = 0; 13 EAPI int ECORE_IMF_EVENT_PREEDIT_CHANGED = 0; 14 EAPI int ECORE_IMF_EVENT_COMMIT = 0; 15 EAPI int ECORE_IMF_EVENT_DELETE_SURROUNDING = 0; 16 17 int _ecore_imf_log_dom = -1; 18 static int _ecore_imf_init_count = 0; 19 extern Ecore_IMF_Context *show_req_ctx; 20 21 EAPI int ecore_imf_init(void)22ecore_imf_init(void) 23 { 24 if (++_ecore_imf_init_count != 1) return _ecore_imf_init_count; 25 26 if (!ecore_init()) return --_ecore_imf_init_count; 27 _ecore_imf_log_dom = eina_log_domain_register 28 ("ecore_imf", ECORE_IMF_DEFAULT_LOG_COLOR); 29 if (_ecore_imf_log_dom < 0) 30 { 31 EINA_LOG_ERR("Impossible to create a log domain for the Ecore IMF module."); 32 ecore_shutdown(); 33 return --_ecore_imf_init_count; 34 } 35 ecore_imf_module_init(); 36 37 ECORE_IMF_EVENT_PREEDIT_START = ecore_event_type_new(); 38 ECORE_IMF_EVENT_PREEDIT_END = ecore_event_type_new(); 39 ECORE_IMF_EVENT_PREEDIT_CHANGED = ecore_event_type_new(); 40 ECORE_IMF_EVENT_COMMIT = ecore_event_type_new(); 41 ECORE_IMF_EVENT_DELETE_SURROUNDING = ecore_event_type_new(); 42 43 return _ecore_imf_init_count; 44 } 45 46 EAPI int ecore_imf_shutdown(void)47ecore_imf_shutdown(void) 48 { 49 if (--_ecore_imf_init_count != 0) return _ecore_imf_init_count; 50 51 ecore_event_type_flush(ECORE_IMF_EVENT_PREEDIT_START, 52 ECORE_IMF_EVENT_PREEDIT_END, 53 ECORE_IMF_EVENT_PREEDIT_CHANGED, 54 ECORE_IMF_EVENT_COMMIT, 55 ECORE_IMF_EVENT_DELETE_SURROUNDING); 56 57 ecore_imf_module_shutdown(); 58 eina_log_domain_unregister(_ecore_imf_log_dom); 59 _ecore_imf_log_dom = -1; 60 ecore_shutdown(); 61 return _ecore_imf_init_count; 62 } 63 64 EAPI Eina_Bool ecore_imf_input_panel_hide(void)65ecore_imf_input_panel_hide(void) 66 { 67 if (show_req_ctx) 68 { 69 if (ecore_imf_context_input_panel_state_get(show_req_ctx) != ECORE_IMF_INPUT_PANEL_STATE_HIDE) 70 { 71 ecore_imf_context_input_panel_hide(show_req_ctx); 72 return EINA_TRUE; 73 } 74 } 75 76 return EINA_FALSE; 77 } 78