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
This commit is contained in:
Carsten Haitzler 2012-06-28 08:17:13 +00:00
parent 1676ef5aad
commit 39c1554d8d
5 changed files with 9975 additions and 1 deletions

View File

@ -777,3 +777,10 @@
* Fix xim module to pass of Windows key as Mod4, not Mod5
* Add support for AltGr key in X
2012-06-28 Carsten Haitzler (The Rasterman)
* Add compose sequence handling to ecore_input to be able to
query a sequence of keysyms for a final compose string (utf8)
that you free if you get it.

View File

@ -92,6 +92,13 @@ extern "C" {
ECORE_OUT
} Ecore_Event_IO;
typedef enum _Ecore_Compose_State
{
ECORE_COMPOSE_NONE,
ECORE_COMPOSE_MIDDLE,
ECORE_COMPOSE_DONE
} Ecore_Compose_State;
struct _Ecore_Event_Key
{
const char *keyname;
@ -215,6 +222,8 @@ extern "C" {
EAPI unsigned int ecore_event_modifier_mask(Ecore_Event_Modifier modifier);
EAPI Ecore_Event_Modifier ecore_event_update_modifier(const char *key, Ecore_Event_Modifiers *modifiers, int inc);
EAPI Ecore_Compose_State ecore_compose_get(const Eina_List *seq, char **seqstr_ret);
#ifdef __cplusplus
}
#endif

View File

@ -12,7 +12,9 @@ includes_HEADERS = Ecore_Input.h
includesdir = $(includedir)/ecore-@VMAJ@
libecore_input_la_SOURCES = \
ecore_input.c
ecore_input.c \
ecore_input_compose.c \
ecore_input_compose.h
libecore_input_la_LIBADD = \
$(top_builddir)/src/lib/ecore/libecore.la \

View File

@ -0,0 +1,61 @@
#ifdef HAVE_CONFIG_H
# include <config.h>
#endif
#include <stdio.h>
#include <string.h>
#include "Ecore.h"
#include "ecore_private.h"
#include "Ecore_Input.h"
#include "ecore_input_private.h"
// some info on a big big big compose table
// http://cgit.freedesktop.org/xorg/lib/libX11/plain/nls/en_US.UTF-8/Compose.pre
// isolate compose tree into its own file - hand crafted into static const c
#include "ecore_input_compose.h"
EAPI Ecore_Compose_State
ecore_compose_get(const Eina_List *seq, char **seqstr_ret)
{
Comp *c, *cend;
Eina_List *l;
const char *s;
int i = 0;
if (!seq) return ECORE_COMPOSE_NONE;
l = (Eina_List *)seq;
s = l->data;
cend = (Comp *)comp + (sizeof(comp) / sizeof(comp[0]));
for (c = (Comp *)comp; c->s && s;)
{
// doesn't match -> jump to next level entry
if (!(!strcmp(s, c->s)))
{
c += c->jump + 1;
if (c >= cend)
{
return ECORE_COMPOSE_NONE;
}
}
else
{
cend = c + c->jump;
// advance to next sequence member
l = l->next;
i++;
if (l) s = l->data;
else s = NULL;
c++;
// if advanced item jump is an endpoint - it's the string we want
if (c->jump == 0)
{
if (seqstr_ret) *seqstr_ret = strdup(c->s);
return ECORE_COMPOSE_DONE;
}
}
}
if (i == 0) return ECORE_COMPOSE_NONE;
return ECORE_COMPOSE_MIDDLE;
}

File diff suppressed because it is too large Load Diff