aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/libraries/ecore/src/lib/ecore_imf/ecore_imf.c
diff options
context:
space:
mode:
Diffstat (limited to 'libraries/ecore/src/lib/ecore_imf/ecore_imf.c')
-rw-r--r--libraries/ecore/src/lib/ecore_imf/ecore_imf.c73
1 files changed, 73 insertions, 0 deletions
diff --git a/libraries/ecore/src/lib/ecore_imf/ecore_imf.c b/libraries/ecore/src/lib/ecore_imf/ecore_imf.c
new file mode 100644
index 0000000..7cf8a4a
--- /dev/null
+++ b/libraries/ecore/src/lib/ecore_imf/ecore_imf.c
@@ -0,0 +1,73 @@
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
11EAPI int ECORE_IMF_EVENT_PREEDIT_START = 0;
12EAPI int ECORE_IMF_EVENT_PREEDIT_END = 0;
13EAPI int ECORE_IMF_EVENT_PREEDIT_CHANGED = 0;
14EAPI int ECORE_IMF_EVENT_COMMIT = 0;
15EAPI int ECORE_IMF_EVENT_DELETE_SURROUNDING = 0;
16
17int _ecore_imf_log_dom = -1;
18static int _ecore_imf_init_count = 0;
19
20/**
21 * @defgroup Ecore_IMF_Lib_Group Ecore Input Method Library Functions
22 *
23 * Utility functions that set up and shut down the Ecore Input Method
24 * library.
25 */
26
27/**
28 * Initialises the Ecore_IMF library.
29 * @return Number of times the library has been initialised without being
30 * shut down.
31 * @ingroup Ecore_IMF_Lib_Group
32 */
33EAPI int
34ecore_imf_init(void)
35{
36 if (++_ecore_imf_init_count != 1) return _ecore_imf_init_count;
37
38 if (!ecore_init()) return --_ecore_imf_init_count;
39 _ecore_imf_log_dom = eina_log_domain_register
40 ("ecore_imf", ECORE_IMF_DEFAULT_LOG_COLOR);
41 if (_ecore_imf_log_dom < 0)
42 {
43 EINA_LOG_ERR("Impossible to create a log domain for the Ecore IMF module.");
44 ecore_shutdown();
45 return --_ecore_imf_init_count;
46 }
47 ecore_imf_module_init();
48
49 ECORE_IMF_EVENT_PREEDIT_START = ecore_event_type_new();
50 ECORE_IMF_EVENT_PREEDIT_END = ecore_event_type_new();
51 ECORE_IMF_EVENT_PREEDIT_CHANGED = ecore_event_type_new();
52 ECORE_IMF_EVENT_COMMIT = ecore_event_type_new();
53 ECORE_IMF_EVENT_DELETE_SURROUNDING = ecore_event_type_new();
54
55 return _ecore_imf_init_count;
56}
57
58/**
59 * Shuts down the Ecore_IMF library.
60 * @return Number of times the library has been initialised without being
61 * shut down.
62 * @ingroup Ecore_IMF_Lib_Group
63 */
64EAPI int
65ecore_imf_shutdown(void)
66{
67 if (--_ecore_imf_init_count != 0) return _ecore_imf_init_count;
68 ecore_imf_module_shutdown();
69 eina_log_domain_unregister(_ecore_imf_log_dom);
70 _ecore_imf_log_dom = -1;
71 ecore_shutdown();
72 return _ecore_imf_init_count;
73}