summaryrefslogtreecommitdiff
path: root/legacy/ecore/src/lib/ecore_input/ecore_input_compose.c
diff options
context:
space:
mode:
authorCarsten Haitzler <raster@rasterman.com>2012-06-28 08:17:13 +0000
committerCarsten Haitzler <raster@rasterman.com>2012-06-28 08:17:13 +0000
commit39c1554d8d86d9d4549f6881dae2bed2a84bb0dc (patch)
tree19db0b7d1d6b80728a5e406836a3b7790b3d749e /legacy/ecore/src/lib/ecore_input/ecore_input_compose.c
parent1676ef5aad8ee8f4ab93b1c7ed1ef1650752bd28 (diff)
add compose sequence decode/hanling to ecore-input. needs manual use
to detect though. needs to be added to edje_entry and terminology. SVN revision: 72982
Diffstat (limited to 'legacy/ecore/src/lib/ecore_input/ecore_input_compose.c')
-rw-r--r--legacy/ecore/src/lib/ecore_input/ecore_input_compose.c61
1 files changed, 61 insertions, 0 deletions
diff --git a/legacy/ecore/src/lib/ecore_input/ecore_input_compose.c b/legacy/ecore/src/lib/ecore_input/ecore_input_compose.c
new file mode 100644
index 0000000000..5335a7fe0c
--- /dev/null
+++ b/legacy/ecore/src/lib/ecore_input/ecore_input_compose.c
@@ -0,0 +1,61 @@
1#ifdef HAVE_CONFIG_H
2# include <config.h>
3#endif
4
5#include <stdio.h>
6#include <string.h>
7
8#include "Ecore.h"
9#include "ecore_private.h"
10
11#include "Ecore_Input.h"
12#include "ecore_input_private.h"
13
14// some info on a big big big compose table
15// http://cgit.freedesktop.org/xorg/lib/libX11/plain/nls/en_US.UTF-8/Compose.pre
16// isolate compose tree into its own file - hand crafted into static const c
17#include "ecore_input_compose.h"
18
19EAPI Ecore_Compose_State
20ecore_compose_get(const Eina_List *seq, char **seqstr_ret)
21{
22 Comp *c, *cend;
23 Eina_List *l;
24 const char *s;
25 int i = 0;
26
27 if (!seq) return ECORE_COMPOSE_NONE;
28 l = (Eina_List *)seq;
29 s = l->data;
30 cend = (Comp *)comp + (sizeof(comp) / sizeof(comp[0]));
31 for (c = (Comp *)comp; c->s && s;)
32 {
33 // doesn't match -> jump to next level entry
34 if (!(!strcmp(s, c->s)))
35 {
36 c += c->jump + 1;
37 if (c >= cend)
38 {
39 return ECORE_COMPOSE_NONE;
40 }
41 }
42 else
43 {
44 cend = c + c->jump;
45 // advance to next sequence member
46 l = l->next;
47 i++;
48 if (l) s = l->data;
49 else s = NULL;
50 c++;
51 // if advanced item jump is an endpoint - it's the string we want
52 if (c->jump == 0)
53 {
54 if (seqstr_ret) *seqstr_ret = strdup(c->s);
55 return ECORE_COMPOSE_DONE;
56 }
57 }
58 }
59 if (i == 0) return ECORE_COMPOSE_NONE;
60 return ECORE_COMPOSE_MIDDLE;
61}