Added Ecore_IMF_Evas.

Removed Evas dependency from Ecore_IMF, that was requested by Ewl developers
in order to be able to integrate Ecore_IMF on it.

Added Ecore_IMF_Evas, a library with helper functions to use Ecore_IMF together
with Evas.

Now everybody should be happy.


SVN revision: 32812
This commit is contained in:
andrunko 2007-11-21 22:20:16 +00:00 committed by andrunko
parent 2e3bda35c9
commit 2204cc1927
15 changed files with 674 additions and 26 deletions

View File

@ -17,6 +17,7 @@ MAINTAINERCLEANFILES = Makefile.in aclocal.m4 config.guess \
ecore-fb.pc \
ecore-file.pc \
ecore-imf.pc \
ecore-imf-evas.pc \
ecore-ipc.pc \
ecore-job.pc \
ecore-txt.pc \
@ -38,6 +39,7 @@ EXTRA_DIST = AUTHORS COPYING COPYING-PLAIN ecore.c.in gendoc ecore.supp \
ecore-fb.pc.in \
ecore-file.pc.in \
ecore-imf.pc.in \
ecore-imf-evas.pc.in \
ecore-ipc.pc.in \
ecore-job.pc.in \
ecore-txt.pc.in \
@ -79,6 +81,10 @@ if BUILD_ECORE_IMF
pimf = ecore-imf.pc
endif
if BUILD_ECORE_IMF_EVAS
pimfevas = ecore-imf-evas.pc
endif
if BUILD_ECORE_IPC
pipc = ecore-ipc.pc
endif
@ -111,5 +117,5 @@ endif
pkgconfigdir = $(libdir)/pkgconfig
pkgconfig_DATA = \
ecore.pc $(pcon) $(pconfig) $(pdfb) $(pevas) \
$(pfb) $(pfile) $(pdesktop) $(pimf) $(pipc) $(pjob) $(ptxt) \
$(pfb) $(pfile) $(pdesktop) $(pimf) $(pimfevas) $(pipc) $(pjob) $(ptxt) \
$(px) $(pwin32) $(psdl)

View File

@ -715,7 +715,14 @@ ECORE_CHECK_MODULE([Desktop], [no], [$have_ecore_file],
[requirements_ecore_desktop="ecore-file"])
dnl ecore_imf
ECORE_CHECK_MODULE([IMF], [yes], [$have_evas])
ECORE_CHECK_MODULE([IMF], [yes])
try_ecore_imf_evas=no
if test "x$have_ecore_imf" = xyes -a "x$have_evas" = "xyes"; then
try_ecore_imf_evas=yes
fi
ECORE_CHECK_MODULE([IMF_EVAS], [yes], [$try_ecore_imf_evas])
dnl requirements
AC_SUBST(requirements_ecore_con)
@ -752,6 +759,7 @@ ecore-evas.pc
ecore-fb.pc
ecore-file.pc
ecore-imf.pc
ecore-imf-evas.pc
ecore-ipc.pc
ecore-job.pc
ecore-txt.pc
@ -770,6 +778,7 @@ src/lib/ecore_sdl/Makefile
src/lib/ecore_evas/Makefile
src/lib/ecore_con/Makefile
src/lib/ecore_imf/Makefile
src/lib/ecore_imf_evas/Makefile
src/lib/ecore_ipc/Makefile
src/lib/ecore_txt/Makefile
src/lib/ecore_config/Makefile
@ -816,6 +825,7 @@ echo " Ecore_File...................: $have_ecore_file (Inotify: $have_inotify)
echo " Ecore_Desktop................: $have_ecore_desktop"
echo " Ecore_IMF....................: $have_ecore_imf"
echo " Ecore_IMF_Evas...............: $have_ecore_imf_evas"
echo
echo "Now type 'make' ('gmake' on some systems) to compile $PACKAGE."
echo

View File

@ -0,0 +1,11 @@
prefix=@prefix@
exec_prefix=@exec_prefix@
libdir=@libdir@
includedir=@includedir@
Name: ecore-imf-evas
Description: E core library, IMF Evas module
Requires: ecore-imf evas
Version: @VERSION@
Libs: -L${libdir} -lecore_imf_evas
Cflags: -I${includedir}

View File

@ -5,7 +5,7 @@ includedir=@includedir@
Name: ecore-imf
Description: E core library, IMF module
Requires: ecore evas
Requires: ecore
Version: @VERSION@
Libs: -L${libdir} -lecore_imf
Cflags: -I${includedir}

View File

@ -14,4 +14,5 @@ ecore_evas \
ecore_config \
ecore_file \
ecore_desktop \
ecore_imf
ecore_imf \
ecore_imf_evas

View File

@ -26,18 +26,29 @@
#endif
#include <Ecore_Data.h>
#include <Evas.h>
#ifdef __cplusplus
extern "C" {
#endif
/* Events sent by the Input Method */
typedef struct _Ecore_IMF_Event_Preedit_Start Ecore_IMF_Event_Preedit_Start;
typedef struct _Ecore_IMF_Event_Preedit_End Ecore_IMF_Event_Preedit_End;
typedef struct _Ecore_IMF_Event_Preedit_Changed Ecore_IMF_Event_Preedit_Changed;
typedef struct _Ecore_IMF_Event_Commit Ecore_IMF_Event_Commit;
typedef struct _Ecore_IMF_Event_Delete_Surrounding Ecore_IMF_Event_Delete_Surrounding;
/* Events to filter */
typedef struct _Ecore_IMF_Event_Mouse_Down Ecore_IMF_Event_Mouse_Down;
typedef struct _Ecore_IMF_Event_Mouse_Up Ecore_IMF_Event_Mouse_Up;
typedef struct _Ecore_IMF_Event_Mouse_In Ecore_IMF_Event_Mouse_In;
typedef struct _Ecore_IMF_Event_Mouse_Out Ecore_IMF_Event_Mouse_Out;
typedef struct _Ecore_IMF_Event_Mouse_Move Ecore_IMF_Event_Mouse_Move;
typedef struct _Ecore_IMF_Event_Mouse_Wheel Ecore_IMF_Event_Mouse_Wheel;
typedef struct _Ecore_IMF_Event_Key_Down Ecore_IMF_Event_Key_Down;
typedef struct _Ecore_IMF_Event_Key_Up Ecore_IMF_Event_Key_Up;
typedef union _Ecore_IMF_Event Ecore_IMF_Event;
typedef struct _Ecore_IMF_Context Ecore_IMF_Context; /**< An Input Method Context */
typedef struct _Ecore_IMF_Context_Class Ecore_IMF_Context_Class; /**< An Input Method Context class */
typedef struct _Ecore_IMF_Context_Info Ecore_IMF_Context_Info; /**< An Input Method Context info */
@ -48,6 +59,42 @@ extern "C" {
EAPI extern int ECORE_IMF_EVENT_COMMIT;
EAPI extern int ECORE_IMF_EVENT_DELETE_SURROUNDIND;
typedef enum
{
ECORE_IMF_EVENT_MOUSE_DOWN,
ECORE_IMF_EVENT_MOUSE_UP,
ECORE_IMF_EVENT_MOUSE_IN,
ECORE_IMF_EVENT_MOUSE_OUT,
ECORE_IMF_EVENT_MOUSE_MOVE,
ECORE_IMF_EVENT_MOUSE_WHEEL,
ECORE_IMF_EVENT_KEY_DOWN,
ECORE_IMF_EVENT_KEY_UP
} Ecore_IMF_Event_Type;
typedef enum
{
ECORE_IMF_KEYBOARD_MODIFIER_NONE = 0, /**< No active modifiers */
ECORE_IMF_KEYBOARD_MODIFIER_CTRL = 1 << 0, /**< "Control" is pressed */
ECORE_IMF_KEYBOARD_MODIFIER_ALT = 1 << 1, /**< "Alt" is pressed */
ECORE_IMF_KEYBOARD_MODIFIER_SHIFT = 1 << 2, /**< "Shift" is pressed */
ECORE_IMF_KEYBOARD_MODIFIER_WIN = 1 << 3 /**< "Win" (between "Ctrl" and "Alt") is pressed */
} Ecore_IMF_Keyboard_Modifiers;
typedef enum
{
ECORE_IMF_KEYBOARD_LOCK_NONE = 0, /**< No locks are active */
ECORE_IMF_KEYBOARD_LOCK_NUM = 1 << 0, /**< "Num" lock is active */
ECORE_IMF_KEYBOARD_LOCK_CAPS = 1 << 1, /**< "Caps" lock is active */
ECORE_IMF_KEYBOARD_LOCK_SCROLL = 1 << 2 /**< "Scroll" lock is active */
} Ecore_IMF_Keyboard_Locks;
typedef enum
{
ECORE_IMF_MOUSE_NONE = 0, /**< A single click */
ECORE_IMF_MOUSE_DOUBLE_CLICK = 1 << 0, /**< A double click */
ECORE_IMF_MOUSE_TRIPLE_CLICK = 1 << 1 /**< A triple click */
} Ecore_IMF_Mouse_Flags;
typedef enum
{
ECORE_IMF_INPUT_MODE_ALPHA = 1 << 0,
@ -88,11 +135,135 @@ extern "C" {
int n_chars;
};
struct _Ecore_IMF_Event_Mouse_Down
{
int button; /**< The button which has been pressed */
struct {
int x, y;
} output;
struct {
int x, y;
} canvas;
Ecore_IMF_Keyboard_Modifiers modifiers; /**< The keyboard modifiers active when the event has been emitted */
Ecore_IMF_Keyboard_Locks locks; /**< The keyboard locks active when the event has been emitted */
Ecore_IMF_Mouse_Flags flags; /**< The flags corresponding the mouse click (single, double or triple click) */
unsigned int timestamp; /**< The timestamp when the event occured */
};
struct _Ecore_IMF_Event_Mouse_Up
{
int button; /**< The button which has been pressed */
struct {
int x, y;
} output;
struct {
int x, y;
} canvas;
Ecore_IMF_Keyboard_Modifiers modifiers; /**< The keyboard modifiers active when the event has been emitted */
Ecore_IMF_Keyboard_Locks locks; /**< The keyboard locks active when the event has been emitted */
Ecore_IMF_Mouse_Flags flags; /**< The flags corresponding the mouse click (single, double or triple click) */
unsigned int timestamp; /**< The timestamp when the event occured */
};
struct _Ecore_IMF_Event_Mouse_In
{
int buttons;
struct {
int x, y;
} output;
struct {
int x, y;
} canvas;
Ecore_IMF_Keyboard_Modifiers modifiers; /**< The keyboard modifiers active when the event has been emitted */
Ecore_IMF_Keyboard_Locks locks; /**< The keyboard locks active when the event has been emitted */
unsigned int timestamp; /**< The timestamp when the event occured */
};
struct _Ecore_IMF_Event_Mouse_Out
{
int buttons;
struct {
int x, y;
} output;
struct {
int x, y;
} canvas;
Ecore_IMF_Keyboard_Modifiers modifiers; /**< The keyboard modifiers active when the event has been emitted */
Ecore_IMF_Keyboard_Locks locks; /**< The keyboard locks active when the event has been emitted */
unsigned int timestamp; /**< The timestamp when the event occured */
};
struct _Ecore_IMF_Event_Mouse_Move
{
int buttons;
struct {
struct {
int x, y;
} output;
struct {
int x, y;
} canvas;
} cur, prev;
Ecore_IMF_Keyboard_Modifiers modifiers; /**< The keyboard modifiers active when the event has been emitted */
Ecore_IMF_Keyboard_Locks locks; /**< The keyboard locks active when the event has been emitted */
unsigned int timestamp; /**< The timestamp when the event occured */
};
struct _Ecore_IMF_Event_Mouse_Wheel
{
int direction; /* 0 = default up/down wheel */
int z; /* ...,-2,-1 = down, 1,2,... = up */
struct {
int x, y;
} output;
struct {
int x, y;
} canvas;
Ecore_IMF_Keyboard_Modifiers modifiers; /**< The keyboard modifiers active when the event has been emitted */
Ecore_IMF_Keyboard_Locks locks; /**< The keyboard locks active when the event has been emitted */
unsigned int timestamp; /**< The timestamp when the event occured */
};
struct _Ecore_IMF_Event_Key_Down
{
char *keyname; /**< The string name of the key pressed */
Ecore_IMF_Keyboard_Modifiers modifiers; /**< The keyboard modifiers active when the event has been emitted */
Ecore_IMF_Keyboard_Locks locks; /**< The keyboard locks active when the event has been emitted */
const char *key; /**< The logical key : (eg shift+1 == exclamation) */
const char *string; /**< A UTF8 string if this keystroke has produced a visible string to be ADDED */
const char *compose; /**< A UTF8 string if this keystroke has modified a string in the middle of being composed - this string replaces the previous one */
unsigned int timestamp; /**< The timestamp when the event occured */
};
struct _Ecore_IMF_Event_Key_Up
{
char *keyname; /**< The string name of the key pressed */
Ecore_IMF_Keyboard_Modifiers modifiers; /**< The keyboard modifiers active when the event has been emitted */
Ecore_IMF_Keyboard_Locks locks; /**< The keyboard locks active when the event has been emitted */
const char *key; /**< The logical key : (eg shift+1 == exclamation) */
const char *string; /**< A UTF8 string if this keystroke has produced a visible string to be ADDED */
const char *compose; /**< A UTF8 string if this keystroke has modified a string in the middle of being composed - this string replaces the previous one */
unsigned int timestamp; /**< The timestamp when the event occured */
};
union _Ecore_IMF_Event
{
Ecore_IMF_Event_Mouse_Down mouse_down;
Ecore_IMF_Event_Mouse_Up mouse_up;
Ecore_IMF_Event_Mouse_In mouse_in;
Ecore_IMF_Event_Mouse_Out mouse_out;
Ecore_IMF_Event_Mouse_Move mouse_move;
Ecore_IMF_Event_Mouse_Wheel mouse_wheel;
Ecore_IMF_Event_Key_Down key_down;
Ecore_IMF_Event_Key_Up key_up;
};
struct _Ecore_IMF_Context_Class
{
void (*add) (Ecore_IMF_Context *ctx);
void (*del) (Ecore_IMF_Context *ctx);
void (*client_window_set) (Ecore_IMF_Context *ctx, Evas *evas);
void (*client_window_set) (Ecore_IMF_Context *ctx, void *window);
void (*client_canvas_set) (Ecore_IMF_Context *ctx, void *canvas);
void (*show) (Ecore_IMF_Context *ctx);
void (*hide) (Ecore_IMF_Context *ctx);
void (*preedit_string_get) (Ecore_IMF_Context *ctx, char **str, int *cursor_pos);
@ -102,7 +273,7 @@ extern "C" {
void (*cursor_position_set) (Ecore_IMF_Context *ctx, int cursor_pos);
void (*use_preedit_set) (Ecore_IMF_Context *ctx, int use_preedit);
void (*input_mode_set) (Ecore_IMF_Context *ctx, Ecore_IMF_Input_Mode input_mode);
int (*filter_event) (Ecore_IMF_Context *ctx, Evas_Callback_Type type, void *event_info);
int (*filter_event) (Ecore_IMF_Context *ctx, Ecore_IMF_Event_Type type, Ecore_IMF_Event *event);
};
struct _Ecore_IMF_Context_Info
@ -110,18 +281,24 @@ extern "C" {
const char *id; /* ID */
const char *description; /* Human readable description */
const char *default_locales; /* Languages for which this context is the default, separated by : */
const char *canvas_type; /* The canvas type used by the input method. Eg.: evas */
int canvas_required; /* Whether the canvas usage is required for this input method */
};
EAPI int ecore_imf_init(void);
EAPI int ecore_imf_shutdown(void);
EAPI Ecore_List *ecore_imf_context_available_ids_get(void);
EAPI Ecore_List *ecore_imf_context_available_ids_by_canvas_type_get(const char *canvas_type);
EAPI const char *ecore_imf_context_default_id_get(void);
EAPI const char *ecore_imf_context_default_id_by_canvas_type_get(const char *canvas_type);
EAPI const Ecore_IMF_Context_Info *ecore_imf_context_info_by_id_get(const char *id);
EAPI Ecore_IMF_Context *ecore_imf_context_add(const char *id);
EAPI const Ecore_IMF_Context_Info *ecore_imf_context_info_get(Ecore_IMF_Context *ctx);
EAPI void ecore_imf_context_del(Ecore_IMF_Context *ctx);
EAPI void ecore_imf_context_client_window_set(Ecore_IMF_Context *ctx, Evas *evas);
EAPI void ecore_imf_context_client_window_set(Ecore_IMF_Context *ctx, void *window);
EAPI void ecore_imf_context_client_canvas_set(Ecore_IMF_Context *ctx, void *canvas);
EAPI void ecore_imf_context_show(Ecore_IMF_Context *ctx);
EAPI void ecore_imf_context_hide(Ecore_IMF_Context *ctx);
EAPI void ecore_imf_context_preedit_string_get(Ecore_IMF_Context *ctx, char **str, int *cursor_pos);
@ -133,7 +310,7 @@ extern "C" {
EAPI void ecore_imf_context_retrieve_surrounding_callback_set(Ecore_IMF_Context *ctx, int (*func)(void *data, Ecore_IMF_Context *ctx, char **text, int *cursor_pos), const void *data);
EAPI void ecore_imf_context_input_mode_set(Ecore_IMF_Context *ctx, Ecore_IMF_Input_Mode input_mode);
EAPI Ecore_IMF_Input_Mode ecore_imf_context_input_mode_get(Ecore_IMF_Context *ctx);
EAPI int ecore_imf_context_filter_event(Ecore_IMF_Context *ctx, Evas_Callback_Type type, void *event_info);
EAPI int ecore_imf_context_filter_event(Ecore_IMF_Context *ctx, Ecore_IMF_Event_Type type, Ecore_IMF_Event *event);
/* plugin specific functions */
EAPI Ecore_IMF_Context *ecore_imf_context_new(const Ecore_IMF_Context_Class *ctxc);

View File

@ -3,8 +3,7 @@ MAINTAINERCLEANFILES = Makefile.in
if BUILD_ECORE_IMF
AM_CPPFLAGS = \
-I$(top_srcdir)/src/lib/ecore \
-DPACKAGE_LIB_DIR=\"$(libdir)\" \
@EVAS_CFLAGS@
-DPACKAGE_LIB_DIR=\"$(libdir)\"
lib_LTLIBRARIES = libecore_imf.la
include_HEADERS = \
@ -17,8 +16,7 @@ ecore_imf_module.c \
ecore_imf_private.h
libecore_imf_la_LIBADD = \
$(top_builddir)/src/lib/ecore/libecore.la \
@EVAS_LIBS@
$(top_builddir)/src/lib/ecore/libecore.la
libecore_imf_la_LDFLAGS = -version-info @version_info@
endif

View File

@ -32,6 +32,12 @@ ecore_imf_context_available_ids_get(void)
return ecore_imf_module_context_ids_get();
}
EAPI Ecore_List *
ecore_imf_context_available_ids_by_canvas_type_get(const char *canvas_type)
{
return ecore_imf_module_context_ids_by_canvas_type_get(canvas_type);
}
/*
* Match @locale against @against.
*
@ -66,6 +72,11 @@ _ecore_imf_context_match_locale(const char *locale, const char *against, int aga
*/
EAPI const char *
ecore_imf_context_default_id_get(void)
{
return ecore_imf_context_default_id_by_canvas_type_get(NULL);
}
EAPI const char *ecore_imf_context_default_id_by_canvas_type_get(const char *canvas_type)
{
const char *id;
Ecore_List *modules;
@ -95,6 +106,10 @@ ecore_imf_context_default_id_get(void)
ecore_list_first_goto(modules);
while ((module = ecore_list_next(modules)))
{
if (canvas_type &&
strcmp(module->info->canvas_type, canvas_type) == 0)
continue;
const char *p = module->info->default_locales;
while (p)
{
@ -161,6 +176,26 @@ ecore_imf_context_add(const char *id)
return ctx;
}
/**
* Retrieve the info for the given Input Method Context.
*
* @param ctx An #Ecore_IMF_Context.
* @return Return a #Ecore_IMF_Context_Info for the given Input Method Context;
* on failure it returns NULL.
* @ingroup Ecore_IMF_Context_Group
*/
EAPI const Ecore_IMF_Context_Info *
ecore_imf_context_info_get(Ecore_IMF_Context *ctx)
{
if (!ECORE_MAGIC_CHECK(ctx, ECORE_MAGIC_CONTEXT))
{
ECORE_MAGIC_FAIL(ctx, ECORE_MAGIC_CONTEXT,
"ecore_imf_context_info_get");
return NULL;
}
return ctx->module->info;
}
/**
* Delete the given Input Method Context and free its memory.
*
@ -183,7 +218,7 @@ ecore_imf_context_del(Ecore_IMF_Context *ctx)
/**
* Set the client window for the Input Method Context; this is the
* Evas canvas in which the input appears.
* Ecore_X_Window when using X11, Ecore_Win32_Window when using Win32, etc.
* This window is used in order to correctly position status windows, and may
* also be used for purposes internal to the Input Method Context.
*
@ -193,7 +228,7 @@ ecore_imf_context_del(Ecore_IMF_Context *ctx)
* @ingroup Ecore_IMF_Context_Group
*/
EAPI void
ecore_imf_context_client_window_set(Ecore_IMF_Context *ctx, Evas *evas)
ecore_imf_context_client_window_set(Ecore_IMF_Context *ctx, void *window)
{
if (!ECORE_MAGIC_CHECK(ctx, ECORE_MAGIC_CONTEXT))
{
@ -201,7 +236,32 @@ ecore_imf_context_client_window_set(Ecore_IMF_Context *ctx, Evas *evas)
"ecore_imf_context_client_window_set");
return;
}
if (ctx->klass->client_window_set) ctx->klass->client_window_set(ctx, evas);
if (ctx->klass->client_window_set) ctx->klass->client_window_set(ctx, window);
}
/**
* Set the client canvas for the Input Method Context; this is the
* canvas in which the input appears.
* The canvas type can be determined by using the context canvas type.
* Actually only canvas with type "evas" (Evas *) is supported.
* This canvas may be used in order to correctly position status windows, and may
* also be used for purposes internal to the Input Method Context.
*
* @param ctx An #Ecore_IMF_Context.
* @param canas The client canvas. This may be NULL to indicate
* that the previous client canvas no longer exists.
* @ingroup Ecore_IMF_Context_Group
*/
EAPI void
ecore_imf_context_client_canvas_set(Ecore_IMF_Context *ctx, void *canvas)
{
if (!ECORE_MAGIC_CHECK(ctx, ECORE_MAGIC_CONTEXT))
{
ECORE_MAGIC_FAIL(ctx, ECORE_MAGIC_CONTEXT,
"ecore_imf_context_client_window_set");
return;
}
if (ctx->klass->client_canvas_set) ctx->klass->client_canvas_set(ctx, canvas);
}
/**
@ -449,15 +509,13 @@ ecore_imf_context_input_mode_get(Ecore_IMF_Context *ctx)
* obligation of any events to be submitted to this function.
*
* @param ctx An #Ecore_IMF_Context.
* @param type The type of event defined in #Evas_Callback_Type
* @param event_info The event itself; This should be one of
* Evas_Event_* types or NULL for some event types as
* EVAS_CALLBACK_SHOW/HIDE for example.
* @param type The type of event defined by #Ecore_IMF_Event_Type.
* @param event The event itself.
* @return 1 if the event was handled; otherwise 0.
* @ingroup Ecore_IMF_Context_Group
*/
EAPI int
ecore_imf_context_filter_event(Ecore_IMF_Context *ctx, Evas_Callback_Type type, void *event_info)
ecore_imf_context_filter_event(Ecore_IMF_Context *ctx, Ecore_IMF_Event_Type type, Ecore_IMF_Event *event)
{
if (!ECORE_MAGIC_CHECK(ctx, ECORE_MAGIC_CONTEXT))
{
@ -465,7 +523,7 @@ ecore_imf_context_filter_event(Ecore_IMF_Context *ctx, Evas_Callback_Type type,
"ecore_imf_context_filter_event");
return 0;
}
if (ctx->klass->filter_event) return ctx->klass->filter_event(ctx, type, event_info);
if (ctx->klass->filter_event) return ctx->klass->filter_event(ctx, type, event);
return 0;
}

View File

@ -91,11 +91,22 @@ Ecore_IMF_Context *
ecore_imf_module_context_create(const char *ctx_id)
{
Ecore_IMF_Module *module;
Ecore_IMF_Context *ctx = NULL;
if (!modules) return NULL;
module = ecore_hash_get(modules, ctx_id);
if (module) return module->create();
return NULL;
if (module)
{
ctx = module->create();
if (!ECORE_MAGIC_CHECK(ctx, ECORE_MAGIC_CONTEXT))
{
ECORE_MAGIC_FAIL(ctx, ECORE_MAGIC_CONTEXT,
"ecore_imf_module_context_create");
return NULL;
}
ctx->module = module;
}
return ctx;
}
Ecore_List *
@ -105,6 +116,38 @@ ecore_imf_module_context_ids_get(void)
return ecore_hash_keys(modules);
}
Ecore_List *
ecore_imf_module_context_ids_by_canvas_type_get(const char *canvas_type)
{
Ecore_List *values;
unsigned int i = 0;
if (!modules) return NULL;
if (!canvas_type)
return ecore_imf_module_context_ids_get();
values = ecore_list_new();
while (i < ecore_prime_table[modules->size])
{
if (modules->buckets[i])
{
Ecore_Hash_Node *node;
for (node = modules->buckets[i]; node; node = node->next)
{
Ecore_IMF_Module *module = node->value;
if (strcmp(module->info->canvas_type, canvas_type) == 0)
ecore_list_append(values, (void *) module->info->id);
}
}
i++;
}
ecore_list_first_goto(values);
return values;
}
static void
_ecore_imf_module_load_all(void)
{

View File

@ -12,6 +12,7 @@ typedef struct _Ecore_IMF_Module Ecore_IMF_Module;
struct _Ecore_IMF_Context
{
ECORE_MAGIC;
const Ecore_IMF_Module *module;
const Ecore_IMF_Context_Class *klass;
void *data;
int input_mode;
@ -32,5 +33,6 @@ Ecore_List *ecore_imf_module_available_get(void);
Ecore_IMF_Module *ecore_imf_module_get(const char *ctx_id);
Ecore_IMF_Context *ecore_imf_module_context_create(const char *ctx_id);
Ecore_List *ecore_imf_module_context_ids_get(void);
Ecore_List *ecore_imf_module_context_ids_by_canvas_type_get(const char *canvas_type);
#endif

View File

@ -0,0 +1,6 @@
.deps
.libs
Makefile
Makefile.in
*.lo
*.la

View File

@ -0,0 +1,48 @@
/*
* vim:ts=8:sw=3:sts=8:noexpandtab:cino=>5n-3f0^-2{2
*/
#ifndef _ECORE_IMF_EVAS_H
#define _ECORE_IMF_EVAS_H
#ifdef EAPI
#undef EAPI
#endif
#ifdef _MSC_VER
# ifdef BUILDING_DLL
# define EAPI __declspec(dllexport)
# else
# define EAPI __declspec(dllimport)
# endif
#else
# ifdef __GNUC__
# if __GNUC__ >= 4
# define EAPI __attribute__ ((visibility("default")))
# else
# define EAPI
# endif
# else
# define EAPI
# endif
#endif
#include <Ecore_IMF.h>
#include <Evas.h>
#ifdef __cplusplus
extern "C" {
#endif
EAPI void ecore_imf_evas_event_mouse_in_wrap(Evas_Event_Mouse_In *evas_event, Ecore_IMF_Event_Mouse_In *imf_event);
EAPI void ecore_imf_evas_event_mouse_out_wrap(Evas_Event_Mouse_Out *evas_event, Ecore_IMF_Event_Mouse_Out *imf_event);
EAPI void ecore_imf_evas_event_mouse_move_wrap(Evas_Event_Mouse_Move *evas_event, Ecore_IMF_Event_Mouse_Move *imf_event);
EAPI void ecore_imf_evas_event_mouse_down_wrap(Evas_Event_Mouse_Down *evas_event, Ecore_IMF_Event_Mouse_Down *imf_event);
EAPI void ecore_imf_evas_event_mouse_up_wrap(Evas_Event_Mouse_Up *evas_event, Ecore_IMF_Event_Mouse_Up *imf_event);
EAPI void ecore_imf_evas_event_mouse_wheel_wrap(Evas_Event_Mouse_Wheel *evas_event, Ecore_IMF_Event_Mouse_Wheel *imf_event);
EAPI void ecore_imf_evas_event_key_down_wrap(Evas_Event_Key_Down *evas_event, Ecore_IMF_Event_Key_Down *imf_event);
EAPI void ecore_imf_evas_event_key_up_wrap(Evas_Event_Key_Up *evas_event, Ecore_IMF_Event_Key_Up *imf_event);
#ifdef __cplusplus
}
#endif
#endif

View File

@ -0,0 +1,27 @@
MAINTAINERCLEANFILES = Makefile.in
if BUILD_ECORE_IMF_EVAS
AM_CPPFLAGS = \
-I$(top_srcdir)/src/lib/ecore_imf \
@EVAS_CFLAGS@
lib_LTLIBRARIES = libecore_imf_evas.la
include_HEADERS = \
Ecore_IMF_Evas.h
libecore_imf_evas_la_SOURCES = \
ecore_imf_evas.c
libecore_imf_evas_la_LIBADD = \
$(top_builddir)/src/lib/ecore_imf/libecore_imf.la \
@EVAS_LIBS@
libecore_imf_evas_la_DEPENDENCIES = \
$(top_builddir)/src/lib/ecore_imf/libecore_imf.la
libecore_imf_evas_la_LDFLAGS = -version-info @version_info@
endif
EXTRA_DIST = \
Ecore_IMF_Evas.h \
ecore_imf_evas.c

View File

@ -0,0 +1,261 @@
/*
* vim:ts=8:sw=3:sts=8:noexpandtab:cino=>5n-3f0^-2{2
*/
#include "config.h"
#include "Ecore_IMF_Evas.h"
/**
* @defgroup Ecore_IMF_Evas_Group Ecore Input Method Context Evas Helper Functions
*
* Helper functions to make it easy to use Evas with Ecore_IMF.
*/
static char *_ecore_imf_evas_event_empty = "";
/* Converts the Evas modifiers to Ecore_IMF keyboard modifiers */
static void
_ecore_imf_evas_event_modifiers_wrap(Evas_Modifier *evas_modifiers,
Ecore_IMF_Keyboard_Modifiers *imf_keyboard_modifiers)
{
if (!evas_modifiers || !imf_keyboard_modifiers)
return;
*imf_keyboard_modifiers = ECORE_IMF_KEYBOARD_MODIFIER_NONE;
if (evas_key_modifier_is_set(evas_modifiers, "Control"))
*imf_keyboard_modifiers |= ECORE_IMF_KEYBOARD_MODIFIER_CTRL;
if (evas_key_modifier_is_set(evas_modifiers, "Alt"))
*imf_keyboard_modifiers |= ECORE_IMF_KEYBOARD_MODIFIER_ALT;
if (evas_key_modifier_is_set(evas_modifiers, "Shift"))
*imf_keyboard_modifiers |= ECORE_IMF_KEYBOARD_MODIFIER_SHIFT;
if (evas_key_modifier_is_set(evas_modifiers, "Super") || evas_key_modifier_is_set(evas_modifiers, "Hyper"))
*imf_keyboard_modifiers |= ECORE_IMF_KEYBOARD_MODIFIER_WIN;
}
/* Converts the Evas locks to Ecore_IMF keyboard locks */
static void
_ecore_imf_evas_event_locks_wrap(Evas_Lock *evas_locks,
Ecore_IMF_Keyboard_Locks *imf_keyboard_locks)
{
if (!evas_locks || !imf_keyboard_locks)
return;
*imf_keyboard_locks = ECORE_IMF_KEYBOARD_LOCK_NONE;
if (evas_key_lock_is_set(evas_locks, "Num_Lock"))
*imf_keyboard_locks |= ECORE_IMF_KEYBOARD_LOCK_NUM;
if (evas_key_lock_is_set(evas_locks, "Caps_Lock"))
*imf_keyboard_locks |= ECORE_IMF_KEYBOARD_LOCK_CAPS;
if (evas_key_lock_is_set(evas_locks, "Scroll_Lock"))
*imf_keyboard_locks |= ECORE_IMF_KEYBOARD_LOCK_SCROLL;
}
/* Converts the Evas mouse flags to Ecore_IMF mouse flags */
static void
_ecore_imf_evas_event_mouse_flags_wrap(Evas_Button_Flags evas_flags,
Ecore_IMF_Mouse_Flags *imf_flags)
{
if (!imf_flags)
return;
*imf_flags = ECORE_IMF_MOUSE_NONE;
if (evas_flags & EVAS_BUTTON_DOUBLE_CLICK)
*imf_flags |= ECORE_IMF_MOUSE_DOUBLE_CLICK;
if (evas_flags & EVAS_BUTTON_TRIPLE_CLICK)
*imf_flags |= ECORE_IMF_MOUSE_TRIPLE_CLICK;
}
/**
* Converts a "mouse_in" event from Evas to the corresponding event of Ecore_IMF.
*
* @param evas_event The received Evas event.
* @param imf_event The location to store the converted Ecore_IMF event.
* @ingroup Ecore_IMF_Evas_Group
*/
EAPI void
ecore_imf_evas_event_mouse_in_wrap(Evas_Event_Mouse_In *evas_event,
Ecore_IMF_Event_Mouse_In *imf_event)
{
if (!evas_event || !imf_event)
return;
imf_event->buttons = evas_event->buttons;
imf_event->output.x = evas_event->output.x;
imf_event->output.y = evas_event->output.y;
imf_event->canvas.x = evas_event->canvas.x;
imf_event->canvas.y = evas_event->canvas.y;
imf_event->timestamp = evas_event->timestamp;
_ecore_imf_evas_event_modifiers_wrap(evas_event->modifiers, &imf_event->modifiers);
_ecore_imf_evas_event_locks_wrap(evas_event->locks, &imf_event->locks);
}
/**
* Converts a "mouse_out" event from Evas to the corresponding event of Ecore_IMF.
*
* @param evas_event The received Evas event.
* @param imf_event The location to store the converted Ecore_IMF event.
* @ingroup Ecore_IMF_Evas_Group
*/
EAPI void
ecore_imf_evas_event_mouse_out_wrap(Evas_Event_Mouse_Out *evas_event,
Ecore_IMF_Event_Mouse_Out *imf_event)
{
if (!evas_event || !imf_event)
return;
imf_event->buttons = evas_event->buttons;
imf_event->output.x = evas_event->output.x;
imf_event->output.y = evas_event->output.y;
imf_event->canvas.x = evas_event->canvas.x;
imf_event->canvas.y = evas_event->canvas.y;
imf_event->timestamp = evas_event->timestamp;
_ecore_imf_evas_event_modifiers_wrap(evas_event->modifiers, &imf_event->modifiers);
_ecore_imf_evas_event_locks_wrap(evas_event->locks, &imf_event->locks);
}
/**
* Converts a "mouse_move" event from Evas to the corresponding event of Ecore_IMF.
*
* @param evas_event The received Evas event.
* @param imf_event The location to store the converted Ecore_IMF event.
* @ingroup Ecore_IMF_Evas_Group
*/
EAPI void
ecore_imf_evas_event_mouse_move_wrap(Evas_Event_Mouse_Move *evas_event,
Ecore_IMF_Event_Mouse_Move *imf_event)
{
if (!evas_event || !imf_event)
return;
imf_event->buttons = evas_event->buttons;
imf_event->cur.output.x = evas_event->cur.output.x;
imf_event->cur.output.y = evas_event->cur.output.y;
imf_event->prev.output.x = evas_event->prev.output.x;
imf_event->prev.output.y = evas_event->prev.output.y;
imf_event->cur.canvas.x = evas_event->cur.canvas.x;
imf_event->cur.canvas.y = evas_event->cur.canvas.y;
imf_event->prev.canvas.x = evas_event->prev.canvas.x;
imf_event->prev.canvas.y = evas_event->prev.canvas.y;
imf_event->timestamp = evas_event->timestamp;
_ecore_imf_evas_event_modifiers_wrap(evas_event->modifiers, &imf_event->modifiers);
_ecore_imf_evas_event_locks_wrap(evas_event->locks, &imf_event->locks);
}
/**
* Converts a "mouse_down" event from Evas to the corresponding event of Ecore_IMF.
*
* @param evas_event The received Evas event.
* @param imf_event The location to store the converted Ecore_IMF event.
* @ingroup Ecore_IMF_Evas_Group
*/
EAPI void
ecore_imf_evas_event_mouse_down_wrap(Evas_Event_Mouse_Down *evas_event,
Ecore_IMF_Event_Mouse_Down *imf_event)
{
if (!evas_event || !imf_event)
return;
imf_event->button = evas_event->button;
imf_event->output.x = evas_event->output.x;
imf_event->output.y = evas_event->output.y;
imf_event->canvas.x = evas_event->canvas.x;
imf_event->canvas.y = evas_event->canvas.y;
imf_event->timestamp = evas_event->timestamp;
_ecore_imf_evas_event_modifiers_wrap(evas_event->modifiers, &imf_event->modifiers);
_ecore_imf_evas_event_locks_wrap(evas_event->locks, &imf_event->locks);
_ecore_imf_evas_event_mouse_flags_wrap(evas_event->flags, &imf_event->flags);
}
/**
* Converts a "mouse_up" event from Evas to the corresponding event of Ecore_IMF.
*
* @param evas_event The received Evas event.
* @param imf_event The location to store the converted Ecore_IMF event.
* @ingroup Ecore_IMF_Evas_Group
*/
EAPI void
ecore_imf_evas_event_mouse_up_wrap(Evas_Event_Mouse_Up *evas_event,
Ecore_IMF_Event_Mouse_Up *imf_event)
{
if (!evas_event || !imf_event)
return;
imf_event->button = evas_event->button;
imf_event->output.x = evas_event->output.x;
imf_event->output.y = evas_event->output.y;
imf_event->canvas.x = evas_event->canvas.x;
imf_event->canvas.y = evas_event->canvas.y;
imf_event->timestamp = evas_event->timestamp;
_ecore_imf_evas_event_modifiers_wrap(evas_event->modifiers, &imf_event->modifiers);
_ecore_imf_evas_event_locks_wrap(evas_event->locks, &imf_event->locks);
_ecore_imf_evas_event_mouse_flags_wrap(evas_event->flags, &imf_event->flags);
}
/**
* Converts a "mouse_wheel" event from Evas to the corresponding event of Ecore_IMF.
*
* @param evas_event The received Evas event.
* @param imf_event The location to store the converted Ecore_IMF event.
* @ingroup Ecore_IMF_Evas_Group
*/
EAPI void
ecore_imf_evas_event_mouse_wheel_wrap(Evas_Event_Mouse_Wheel *evas_event,
Ecore_IMF_Event_Mouse_Wheel *imf_event)
{
if (!evas_event || !imf_event)
return;
imf_event->direction = evas_event->direction;
imf_event->z = evas_event->z;
imf_event->output.x = evas_event->output.x;
imf_event->output.y = evas_event->output.y;
imf_event->canvas.x = evas_event->canvas.x;
imf_event->canvas.y = evas_event->canvas.y;
imf_event->timestamp = evas_event->timestamp;
_ecore_imf_evas_event_modifiers_wrap(evas_event->modifiers, &imf_event->modifiers);
_ecore_imf_evas_event_locks_wrap(evas_event->locks, &imf_event->locks);
imf_event->timestamp = evas_event->timestamp;
}
/**
* Converts a "key_down" event from Evas to the corresponding event of Ecore_IMF.
*
* @param evas_event The received Evas event.
* @param imf_event The location to store the converted Ecore_IMF event.
* @ingroup Ecore_IMF_Evas_Group
*/
EAPI void
ecore_imf_evas_event_key_down_wrap(Evas_Event_Key_Down *evas_event,
Ecore_IMF_Event_Key_Down *imf_event)
{
if (!evas_event || !imf_event)
return;
imf_event->keyname = evas_event->keyname ? evas_event->keyname : _ecore_imf_evas_event_empty;
imf_event->key = evas_event->key ? evas_event->key : _ecore_imf_evas_event_empty;
imf_event->string = evas_event->string ? evas_event->string : _ecore_imf_evas_event_empty;
imf_event->compose = evas_event->compose ? evas_event->compose : _ecore_imf_evas_event_empty;
imf_event->timestamp = evas_event->timestamp;
_ecore_imf_evas_event_modifiers_wrap(evas_event->modifiers, &imf_event->modifiers);
_ecore_imf_evas_event_locks_wrap(evas_event->locks, &imf_event->locks);
}
/**
* Converts a "key_up" event from Evas to the corresponding event of Ecore_IMF.
*
* @param evas_event The received Evas event.
* @param imf_event The location to store the converted Ecore_IMF event.
* @ingroup Ecore_IMF_Evas_Group
*/
EAPI void
ecore_imf_evas_event_key_up_wrap(Evas_Event_Key_Up *evas_event,
Ecore_IMF_Event_Key_Up *imf_event)
{
imf_event->keyname = evas_event->keyname ? evas_event->keyname : _ecore_imf_evas_event_empty;
imf_event->key = evas_event->key ? evas_event->key : _ecore_imf_evas_event_empty;
imf_event->string = evas_event->string ? evas_event->string : _ecore_imf_evas_event_empty;
imf_event->compose = evas_event->compose ? evas_event->compose : _ecore_imf_evas_event_empty;
imf_event->timestamp = evas_event->timestamp;
_ecore_imf_evas_event_modifiers_wrap(evas_event->modifiers, &imf_event->modifiers);
_ecore_imf_evas_event_locks_wrap(evas_event->locks, &imf_event->locks);
}

View File

@ -542,8 +542,8 @@ eet_data_chunk_get(Eet_Data_Chunk *chnk, const void *src, int size)
}
else
chnk->group_type = EET_G_UNKNOWN;
if ((chnk->type < EET_T_UNKNOW) || (chnk->type >= EET_T_LAST) ||
(chnk->group_type < EET_G_UNKNOWN) || (chnk->group_type >= EET_G_LAST))
if ((chnk->type >= EET_T_LAST) ||
(chnk->group_type >= EET_G_LAST))
{
chnk->type = 0;
chnk->group_type = 0;