summaryrefslogtreecommitdiff
path: root/legacy/ecore/src/lib/ecore_imf/ecore_imf.c
blob: acf7e8d6939e31ee557a22ec89b91d44a81612c8 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
/*
 * vim:ts=8:sw=3:sts=8:noexpandtab:cino=>5n-3f0^-2{2
 */

#include "config.h"

#include "Ecore_IMF.h"

EAPI int ECORE_IMF_EVENT_PREEDIT_START = 0;
EAPI int ECORE_IMF_EVENT_PREEDIT_END = 0;
EAPI int ECORE_IMF_EVENT_PREEDIT_CHANGED = 0;
EAPI int ECORE_IMF_EVENT_COMMIT = 0;
EAPI int ECORE_IMF_EVENT_RETRIEVE_SURROUNDIND = 0;
EAPI int ECORE_IMF_EVENT_DELETE_SURROUNDIND = 0;

static int init_count = 0;

/**
 * @defgroup Ecore_IMF_Lib_Group Ecore Input Method Library Functions
 *
 * Utility functions that set up and shut down the Ecore Input Method
 * library.
 */

/**
 * Initialises the Ecore_IMF library.
 * @return  Number of times the library has been initialised without being
 *          shut down.
 * @ingroup Ecore_IMF_Lib_Group
 */
EAPI int
ecore_imf_init(void)
{
   if (++init_count != 1) return init_count;

   ecore_init();
   ecore_imf_module_init();

   ECORE_IMF_EVENT_PREEDIT_START = ecore_event_type_new();
   ECORE_IMF_EVENT_PREEDIT_END = ecore_event_type_new();
   ECORE_IMF_EVENT_PREEDIT_CHANGED = ecore_event_type_new();
   ECORE_IMF_EVENT_COMMIT = ecore_event_type_new();
   ECORE_IMF_EVENT_RETRIEVE_SURROUNDIND = ecore_event_type_new();
   ECORE_IMF_EVENT_DELETE_SURROUNDIND = ecore_event_type_new();

   return init_count;
}

/**
 * Shuts down the Ecore_IMF library.
 * @return  Number of times the library has been initialised without being
 *          shut down.
 * @ingroup Ecore_IMF_Lib_Group
 */
EAPI int
ecore_imf_shutdown(void)
{
   if (--init_count != 0) return init_count;

   ecore_shutdown();
   ecore_imf_module_shutdown();

   return init_count;
}