ecore_imf - How to handle preedit and commit string from Input Method Framework

This example demonstrates how to connect input method framework and handle preedit and commit string from input method framework.

To input Chinese, Japanese, Korean and other complex languages, the editor should be connected with input method framework.

How to initialize and shutdown ecore imf module

- ecore_imf_init() should be called to initialize and load immodule.
- ecore_imf_shutdown() is used for shutdowning and unloading immodule.

How to create input context and register pre-edit and commit event handler

Each entry should have each input context to connect with input service framework. Key event is processed by input method engine. The result is notified to application through ECORE_IMF_CALLBACK_PREEDIT_CHANGED and ECORE_IMF_CALLBACK_COMMIT event.

The full example follows.

#include <Ecore.h>
#include <Ecore_Evas.h>
#include <Ecore_IMF.h>
#include <Ecore_IMF_Evas.h>
#include <Evas.h>
#include <stdio.h>
#define WIDTH 480
#define HEIGHT 800
typedef struct _Entry Entry;
struct _Entry
{
Evas_Object *rect;
Evas_Object *txt_obj;
Evas_Textblock_Style *txt_style;
Evas_Textblock_Cursor *cursor;
Evas_Textblock_Cursor *preedit_start;
Evas_Textblock_Cursor *preedit_end;
Ecore_IMF_Context *imf_context;
Eina_Bool have_preedit : 1;
};
static void _imf_cursor_info_set(Entry *en);
static void
_mouse_down_cb(void *data, Evas *e EINA_UNUSED, Evas_Object *o EINA_UNUSED, void *event_info)
{
Entry *en = data;
Evas_Event_Mouse_Down *ev = event_info;
if (!en) return;
if (en->imf_context)
{
Ecore_IMF_Event_Mouse_Down ecore_ev;
ecore_imf_evas_event_mouse_down_wrap(ev, &ecore_ev);
if (ecore_imf_context_filter_event(en->imf_context,
ECORE_IMF_EVENT_MOUSE_DOWN,
(Ecore_IMF_Event *)&ecore_ev))
return;
// ecore_imf_context_reset should be called before calculating new cursor position
ecore_imf_context_reset(en->imf_context);
}
// calculate new cursor position
}
static void
_mouse_up_cb(void *data, Evas *e EINA_UNUSED, Evas_Object *o EINA_UNUSED, void *event_info)
{
Entry *en = data;
Evas_Event_Mouse_Up *ev = event_info;
if (!en) return;
if (ev->event_flags & EVAS_EVENT_FLAG_ON_HOLD)
{
_imf_cursor_info_set(en);
return;
}
if (en->imf_context)
{
Ecore_IMF_Event_Mouse_Up ecore_ev;
ecore_imf_evas_event_mouse_up_wrap(ev, &ecore_ev);
if (ecore_imf_context_filter_event(en->imf_context,
ECORE_IMF_EVENT_MOUSE_UP,
(Ecore_IMF_Event *)&ecore_ev))
return;
}
if (en->rect)
{
if (evas_object_focus_get(en->rect))
{
// notify cursor information
_imf_cursor_info_set(en);
}
else
evas_object_focus_set(en->rect, EINA_TRUE);
}
}
static void
_entry_focus_in_cb(void *data, Evas *e EINA_UNUSED, Evas_Object *o EINA_UNUSED, void *event_info EINA_UNUSED)
{
Entry *en = data;
if (!en) return;
if (en->imf_context)
ecore_imf_context_focus_in(en->imf_context);
// notify the cursor information
_imf_cursor_info_set(en);
}
static void
_entry_focus_out_cb(void *data, Evas *e EINA_UNUSED, Evas_Object *o EINA_UNUSED, void *event_info EINA_UNUSED)
{
Entry *en = data;
if (!en) return;
if (en->imf_context)
{
// ecore_imf_context_reset should be called for flushing the preedit string in focus-out event handler
ecore_imf_context_reset(en->imf_context);
ecore_imf_context_focus_out(en->imf_context);
}
}
static void
_canvas_focus_in_cb(void *data EINA_UNUSED, Evas *e, void *event_info EINA_UNUSED)
{
Entry *en;
Evas_Object *obj = evas_focus_get(e);
if (!obj) return;
en = evas_object_data_get(obj, "Entry");
if (en)
_entry_focus_in_cb(en, NULL, NULL, NULL);
}
static void
_canvas_focus_out_cb(void *data EINA_UNUSED, Evas *e, void *event_info EINA_UNUSED)
{
Entry *en;
Evas_Object *obj = evas_focus_get(e);
if (!obj) return;
en = evas_object_data_get(obj, "Entry");
if (en)
_entry_focus_out_cb(en, NULL, NULL, NULL);
}
static void
_imf_cursor_info_set(Entry *en)
{
Evas_Coord x, y, w, h;
Evas_Coord cx, cy, cw, ch; // cursor geometry
int cursor_pos; // cursor position in chars (Not bytes)
Evas_BiDi_Direction dir;
if (!en) return;
// get cursor geometry
if (en->txt_obj)
evas_object_geometry_get(en->txt_obj, &x, &y, &w, &h);
if (en->cursor && en->imf_context)
{
evas_textblock_cursor_geometry_get(en->cursor, &cx, &cy, &cw, &ch, &dir, EVAS_TEXTBLOCK_CURSOR_BEFORE);
// get cursor position
cursor_pos = evas_textblock_cursor_pos_get(en->cursor);
ecore_imf_context_cursor_position_set(en->imf_context, cursor_pos);
ecore_imf_context_cursor_location_set(en->imf_context, x + cx, y + cy, cw, ch);
ecore_imf_context_bidi_direction_set(en->imf_context, (Ecore_IMF_BiDi_Direction)dir);
}
}
static void
_preedit_del(Entry *en)
{
if (!en || !en->have_preedit) return;
if (!en->preedit_start || !en->preedit_end) return;
if (!evas_textblock_cursor_compare(en->preedit_start, en->preedit_end)) return;
// delete the preedit characters
evas_textblock_cursor_range_delete(en->preedit_start, en->preedit_end);
}
static void
_preedit_clear(Entry *en)
{
if (en->preedit_start)
{
evas_textblock_cursor_free(en->preedit_start);
en->preedit_start = NULL;
}
if (en->preedit_end)
{
evas_textblock_cursor_free(en->preedit_end);
en->preedit_end = NULL;
}
en->have_preedit = EINA_FALSE;
}
static Eina_Bool
_ecore_imf_retrieve_surrounding_cb(void *data, Ecore_IMF_Context *ctx EINA_UNUSED, char **text, int *cursor_pos)
{
// This callback will be called when the Input Method Context module requests the surrounding context.
Entry *en = data;
const char *str;
if (!en) return EINA_FALSE;
str = evas_object_textblock_text_markup_get(en->txt_obj);
if (text)
*text = str ? strdup(str) : strdup("");
// get the current position of cursor
if (cursor_pos && en->cursor)
*cursor_pos = evas_textblock_cursor_pos_get(en->cursor);
return EINA_TRUE;
}
static void
_ecore_imf_event_delete_surrounding_cb(void *data, Ecore_IMF_Context *ctx EINA_UNUSED, void *event_info)
{
// called when the input method needs to delete all or part of the context surrounding the cursor
Entry *en = data;
Ecore_IMF_Event_Delete_Surrounding *ev = event_info;
Evas_Textblock_Cursor *del_start, *del_end;
int cursor_pos;
if ((!en) || (!ev) || (!en->cursor)) return;
// get the current cursor position
cursor_pos = evas_textblock_cursor_pos_get(en->cursor);
// start cursor position to be deleted
del_start = evas_object_textblock_cursor_new(en->txt_obj);
evas_textblock_cursor_pos_set(del_start, cursor_pos + ev->offset);
// end cursor position to be deleted
del_end = evas_object_textblock_cursor_new(en->txt_obj);
evas_textblock_cursor_pos_set(del_end, cursor_pos + ev->offset + ev->n_chars);
// implement function to delete character(s) from 'cursor_pos+ev->offset' cursor position to 'cursor_pos + ev->offset + ev->n_chars'
evas_textblock_cursor_range_delete(del_start, del_end);
evas_textblock_cursor_free(del_start);
evas_textblock_cursor_free(del_end);
}
static void
_ecore_imf_event_commit_cb(void *data, Ecore_IMF_Context *ctx EINA_UNUSED, void *event_info)
{
Entry *en = data;
char *commit_str = (char *)event_info;
if (!en) return;
// delete preedit string
_preedit_del(en);
_preedit_clear(en);
printf("commit string : %s\n", commit_str);
// insert the commit string in the editor
if (en->cursor && commit_str)
evas_object_textblock_text_markup_prepend(en->cursor, commit_str);
// notify the cursor information
_imf_cursor_info_set(en);
return;
}
static void
_ecore_imf_event_preedit_changed_cb(void *data, Ecore_IMF_Context *ctx, void *event_info EINA_UNUSED)
{
// example how to get preedit string
Entry *en = data;
char *preedit_string;
int cursor_pos;
Eina_List *attrs = NULL;
Eina_List *l;
Ecore_IMF_Preedit_Attr *attr;
Ecore_IMF_Context *imf_context = ctx;
int preedit_start_pos, preedit_end_pos;
int i;
Eina_Bool preedit_end_state = EINA_FALSE;
if (!en || !en->cursor) return;
// get preedit string and attributes
ecore_imf_context_preedit_string_with_attributes_get(imf_context, &preedit_string, &attrs, &cursor_pos);
printf("preedit string : %s\n", preedit_string);
if (!strcmp(preedit_string, ""))
preedit_end_state = EINA_TRUE;
// delete preedit
_preedit_del(en);
preedit_start_pos = evas_textblock_cursor_pos_get(en->cursor);
// insert preedit character(s)
if (strlen(preedit_string) > 0)
{
if (attrs)
{
EINA_LIST_FOREACH(attrs, l, attr)
{
if (attr->preedit_type == ECORE_IMF_PREEDIT_TYPE_SUB1) // style type
{
// apply appropriate style such as underline
}
else if (attr->preedit_type == ECORE_IMF_PREEDIT_TYPE_SUB2 || attr->preedit_type == ECORE_IMF_PREEDIT_TYPE_SUB3)
{
// apply appropriate style such as underline
}
}
// insert code to display preedit string in your editor
evas_object_textblock_text_markup_prepend(en->cursor, preedit_string);
}
}
if (!preedit_end_state)
{
// set preedit start cursor
if (!en->preedit_start)
en->preedit_start = evas_object_textblock_cursor_new(en->txt_obj);
evas_textblock_cursor_copy(en->cursor, en->preedit_start);
// set preedit end cursor
if (!en->preedit_end)
en->preedit_end = evas_object_textblock_cursor_new(en->txt_obj);
evas_textblock_cursor_copy(en->cursor, en->preedit_end);
preedit_end_pos = evas_textblock_cursor_pos_get(en->cursor);
for (i = 0; i < (preedit_end_pos - preedit_start_pos); i++)
{
evas_textblock_cursor_char_prev(en->preedit_start);
}
en->have_preedit = EINA_TRUE;
// set cursor position
evas_textblock_cursor_pos_set(en->cursor, preedit_start_pos + cursor_pos);
}
// notify the cursor information
_imf_cursor_info_set(en);
EINA_LIST_FREE(attrs, attr)
free(attr);
free(preedit_string);
}
static void
_key_down_cb(void *data, Evas *e EINA_UNUSED, Evas_Object *o EINA_UNUSED, void *event_info)
{
Entry *en = data;
Evas_Event_Key_Down *ev = event_info;
Eina_Bool control, alt, shift;
if ((!en) || (!ev->key) || (!en->cursor)) return;
if (en->imf_context)
{
Ecore_IMF_Event_Key_Down ecore_ev;
ecore_imf_evas_event_key_down_wrap(ev, &ecore_ev);
if (ecore_imf_context_filter_event(en->imf_context,
ECORE_IMF_EVENT_KEY_DOWN,
(Ecore_IMF_Event *)&ecore_ev))
return;
}
control = evas_key_modifier_is_set(ev->modifiers, "Control");
alt = evas_key_modifier_is_set(ev->modifiers, "Alt");
shift = evas_key_modifier_is_set(ev->modifiers, "Shift");
(void)alt;
(void)shift;
if (!strcmp(ev->key, "BackSpace"))
{
if (evas_textblock_cursor_char_prev(en->cursor))
{
evas_textblock_cursor_char_delete(en->cursor);
// notify the cursor information
_imf_cursor_info_set(en);
}
return;
}
else if (!strcmp(ev->key, "Delete") ||
(!strcmp(ev->key, "KP_Delete") && !ev->string))
{
// FILLME
}
else if ((control) && (!strcmp(ev->key, "v")))
{
// ctrl + v
// FILLME
}
else if ((control) && (!strcmp(ev->key, "a")))
{
// ctrl + a
// FILLME
}
else if ((control) && (!strcmp(ev->key, "A")))
{
// ctrl + A
// FILLME
}
else if ((control) && ((!strcmp(ev->key, "c") || (!strcmp(ev->key, "Insert")))))
{
// ctrl + c
// FILLME
}
else if ((control) && ((!strcmp(ev->key, "x") || (!strcmp(ev->key, "m")))))
{
// ctrl + x
// FILLME
}
else if ((control) && (!strcmp(ev->key, "z")))
{
// ctrl + z (undo)
// FILLME
}
else if ((control) && (!strcmp(ev->key, "y")))
{
// ctrl + y (redo)
// FILLME
}
else if ((!strcmp(ev->key, "Return")) || (!strcmp(ev->key, "KP_Enter")))
{
// FILLME
}
else
{
if (ev->string)
{
printf("key down string : %s\n", ev->string);
evas_object_textblock_text_markup_prepend(en->cursor, ev->string);
}
}
// notify the cursor information
_imf_cursor_info_set(en);
}
static void
_key_up_cb(void *data, Evas *e EINA_UNUSED, Evas_Object *o EINA_UNUSED, void *event_info)
{
Entry *en = data;
Evas_Event_Key_Up *ev = event_info;
if (!en) return;
if (en->imf_context)
{
Ecore_IMF_Event_Key_Up ecore_ev;
ecore_imf_evas_event_key_up_wrap(ev, &ecore_ev);
if (ecore_imf_context_filter_event(en->imf_context,
ECORE_IMF_EVENT_KEY_UP,
(Ecore_IMF_Event *)&ecore_ev))
return;
}
}
static void
create_input_field(Evas *evas, Entry *en, Evas_Coord x, Evas_Coord y, Evas_Coord w, Evas_Coord h)
{
if (!en) return;
en->have_preedit = EINA_FALSE;
en->preedit_start = NULL;
en->preedit_end = NULL;
// create the background for text input field
en->rect = evas_object_rectangle_add(evas);
evas_object_color_set(en->rect, 150, 150, 150, 255); // gray color
evas_object_move(en->rect, x, y);
evas_object_resize(en->rect, w, h);
evas_object_show(en->rect);
evas_object_data_set(en->rect, "Entry", en);
// create text object for displaying text
en->txt_obj = evas_object_textblock_add(evas);
evas_object_color_set(en->txt_obj, 0, 0, 0, 255);
evas_object_pass_events_set(en->txt_obj, EINA_TRUE);
evas_object_move(en->txt_obj, x, y);
evas_object_resize(en->txt_obj, w, h);
evas_object_show(en->txt_obj);
// set style on textblock
static const char *style_buf =
"DEFAULT='font=Sans font_size=30 color=#000 text_class=entry'"
"newline='br'"
"b='+ font=Sans:style=bold'";
en->txt_style = evas_textblock_style_new();
evas_textblock_style_set(en->txt_style, style_buf);
evas_object_textblock_style_set(en->txt_obj, en->txt_style);
// create cursor
en->cursor = evas_object_textblock_cursor_new(en->txt_obj);
// create input context
const char *default_id = ecore_imf_context_default_id_get();
if (!default_id)
{
fprintf(stderr, "Can't create ecore_imf_context\n");
return;
}
en->imf_context = ecore_imf_context_add(default_id);
ecore_imf_context_client_canvas_set(en->imf_context, evas);
// register key event handler
evas_object_event_callback_add(en->rect, EVAS_CALLBACK_KEY_DOWN, _key_down_cb, en);
evas_object_event_callback_add(en->rect, EVAS_CALLBACK_KEY_UP, _key_up_cb, en);
// register mouse event handler
evas_object_event_callback_add(en->rect, EVAS_CALLBACK_MOUSE_DOWN, _mouse_down_cb, en);
evas_object_event_callback_add(en->rect, EVAS_CALLBACK_MOUSE_UP, _mouse_up_cb, en);
// register focus event handler
evas_object_event_callback_add(en->rect, EVAS_CALLBACK_FOCUS_IN, _entry_focus_in_cb, en);
evas_object_event_callback_add(en->rect, EVAS_CALLBACK_FOCUS_OUT, _entry_focus_out_cb, en);
// register retrieve surrounding callback
ecore_imf_context_retrieve_surrounding_callback_set(en->imf_context, _ecore_imf_retrieve_surrounding_cb, en);
// register commit event callback
ecore_imf_context_event_callback_add(en->imf_context, ECORE_IMF_CALLBACK_COMMIT, _ecore_imf_event_commit_cb, en);
// register preedit changed event handler
ecore_imf_context_event_callback_add(en->imf_context, ECORE_IMF_CALLBACK_PREEDIT_CHANGED, _ecore_imf_event_preedit_changed_cb, en);
// register surrounding delete event callback
ecore_imf_context_event_callback_add(en->imf_context, ECORE_IMF_CALLBACK_DELETE_SURROUNDING, _ecore_imf_event_delete_surrounding_cb, en);
}
static void
delete_input_field(Entry *en)
{
if (!en) return;
if (en->rect)
{
evas_object_del(en->rect);
en->rect = NULL;
}
if (en->cursor)
{
evas_textblock_cursor_free(en->cursor);
en->cursor = NULL;
}
if (en->preedit_start)
{
evas_textblock_cursor_free(en->preedit_start);
en->preedit_start = NULL;
}
if (en->preedit_end)
{
evas_textblock_cursor_free(en->preedit_end);
en->preedit_end = NULL;
}
if (en->txt_obj)
{
evas_object_del(en->txt_obj);
en->txt_obj = NULL;
}
if (en->txt_style)
{
evas_textblock_style_free(en->txt_style);
en->txt_style = NULL;
}
if (en->imf_context)
{
ecore_imf_context_del(en->imf_context);
en->imf_context = NULL;
}
}
int
main(void)
{
Ecore_Evas *ee;
Evas *evas;
Entry en1, en2;
if (!ecore_evas_init())
{
fprintf(stderr, "failed to call ecore_evas_init()\n");
return EXIT_FAILURE;
}
ecore_imf_init();
// create a new window, with size=WIDTHxHEIGHT and default engine
ee = ecore_evas_new(NULL, 0, 0, WIDTH, HEIGHT, NULL);
if (!ee)
{
fprintf(stderr, "failed to call ecore_evas_new\n");
return EXIT_FAILURE;
}
ecore_evas_show(ee);
// get the canvas off just-created window
evas = ecore_evas_get(ee);
if (!evas)
{
fprintf(stderr, "failed to call ecore_evas_get\n");
return EXIT_FAILURE;
}
// create input field rectangle
Evas_Object *bg = evas_object_rectangle_add(evas);
evas_object_move(bg, 0, 0);
evas_object_resize(bg, WIDTH, HEIGHT);
evas_object_color_set(bg, 255, 255, 255, 255);
evas_object_show(bg);
// register canvas focus in/out event handler
evas_event_callback_add(evas, EVAS_CALLBACK_CANVAS_FOCUS_IN, _canvas_focus_in_cb, NULL);
evas_event_callback_add(evas, EVAS_CALLBACK_CANVAS_FOCUS_OUT, _canvas_focus_out_cb, NULL);
memset(&en1, 0, sizeof(en1));
memset(&en2, 0, sizeof(en2));
// create input field 1
create_input_field(evas, &en1, 40, 60, 400, 80);
// create input field 2
create_input_field(evas, &en2, 40, 180, 400, 80);
// give focus to input field 1
evas_object_focus_set(en1.rect, EINA_TRUE);
ecore_main_loop_begin(); // begin mainloop
delete_input_field(&en1); // delete input field 1
delete_input_field(&en2); // delete input field 2
evas_event_callback_del_full(evas, EVAS_CALLBACK_CANVAS_FOCUS_IN, _canvas_focus_in_cb, NULL);
evas_event_callback_del_full(evas, EVAS_CALLBACK_CANVAS_FOCUS_OUT, _canvas_focus_out_cb, NULL);
ecore_evas_free(ee);
ecore_imf_shutdown();
ecore_evas_shutdown();
return 0;
}
Ecore_Evas.h
Evas wrapper functions.
Evas_Coord
int Evas_Coord
Type used for coordinates (in pixels, int).
Definition: Evas_Common.h:116
EVAS_EVENT_FLAG_ON_HOLD
@ EVAS_EVENT_FLAG_ON_HOLD
This event is being delivered but should be put "on hold" until the on hold flag is unset.
Definition: Evas_Common.h:368
EVAS_CALLBACK_KEY_DOWN
@ EVAS_CALLBACK_KEY_DOWN
Key Press Event.
Definition: Evas_Common.h:430
EVAS_CALLBACK_CANVAS_FOCUS_OUT
@ EVAS_CALLBACK_CANVAS_FOCUS_OUT
Canvas lost focus as a whole.
Definition: Evas_Common.h:444
EVAS_CALLBACK_FOCUS_IN
@ EVAS_CALLBACK_FOCUS_IN
Focus In Event.
Definition: Evas_Common.h:432
EVAS_CALLBACK_MOUSE_UP
@ EVAS_CALLBACK_MOUSE_UP
Mouse Button Up Event.
Definition: Evas_Common.h:423
EVAS_CALLBACK_MOUSE_DOWN
@ EVAS_CALLBACK_MOUSE_DOWN
Mouse Button Down Event.
Definition: Evas_Common.h:422
EVAS_CALLBACK_FOCUS_OUT
@ EVAS_CALLBACK_FOCUS_OUT
Focus Out Event.
Definition: Evas_Common.h:433
EVAS_CALLBACK_CANVAS_FOCUS_IN
@ EVAS_CALLBACK_CANVAS_FOCUS_IN
Canvas got focus as a whole.
Definition: Evas_Common.h:443
EVAS_CALLBACK_KEY_UP
@ EVAS_CALLBACK_KEY_UP
Key Release Event.
Definition: Evas_Common.h:431
ecore_evas_init
EAPI int ecore_evas_init(void)
Inits the Ecore_Evas system.
Definition: ecore_evas.c:602
ecore_evas_show
EAPI void ecore_evas_show(Ecore_Evas *ee)
Shows an Ecore_Evas' window.
Definition: ecore_evas.c:1480
ecore_evas_get
EAPI Evas * ecore_evas_get(const Ecore_Evas *ee)
Gets an Ecore_Evas's Evas.
Definition: ecore_evas.c:1300
ecore_evas_shutdown
EAPI int ecore_evas_shutdown(void)
Shuts down the Ecore_Evas system.
Definition: ecore_evas.c:666
ecore_evas_new
EAPI Ecore_Evas * ecore_evas_new(const char *engine_name, int x, int y, int w, int h, const char *extra_options)
Creates a new Ecore_Evas based on engine name and common parameters.
Definition: ecore_evas.c:1039
ecore_evas_free
EAPI void ecore_evas_free(Ecore_Evas *ee)
Frees an Ecore_Evas.
Definition: ecore_evas.c:1083
ecore_imf_context_default_id_get
EAPI const char * ecore_imf_context_default_id_get(void)
Gets the id of the default Input Method Context.
Definition: ecore_imf_context.c:56
ecore_imf_context_focus_in
EAPI void ecore_imf_context_focus_in(Ecore_IMF_Context *ctx)
Notifies the Input Method Context that the widget to which its correspond has gained focus.
Definition: ecore_imf_context.c:352
ecore_imf_context_preedit_string_with_attributes_get
EAPI void ecore_imf_context_preedit_string_with_attributes_get(Ecore_IMF_Context *ctx, char **str, Eina_List **attrs, int *cursor_pos)
Retrieves the current preedit string, attributes and cursor position for the Input Method Context.
Definition: ecore_imf_context.c:333
ecore_imf_context_event_callback_add
EAPI void ecore_imf_context_event_callback_add(Ecore_IMF_Context *ctx, Ecore_IMF_Callback_Type type, Ecore_IMF_Event_Cb func, const void *data)
Adds (registers) a callback function to a given context event.
Definition: ecore_imf_context.c:767
ecore_imf_context_cursor_location_set
EAPI void ecore_imf_context_cursor_location_set(Ecore_IMF_Context *ctx, int x, int y, int w, int h)
Notifies the Input Method Context that a change in the cursor location has been made.
Definition: ecore_imf_context.c:404
ecore_imf_context_reset
EAPI void ecore_imf_context_reset(Ecore_IMF_Context *ctx)
Notifies the Input Method Context that a change such as a change in cursor position has been made.
Definition: ecore_imf_context.c:378
ecore_imf_context_client_canvas_set
EAPI void ecore_imf_context_client_canvas_set(Ecore_IMF_Context *ctx, void *canvas)
Sets the client canvas for the Input Method Context; this is the canvas in which the input appears.
Definition: ecore_imf_context.c:261
ecore_imf_context_del
EAPI void ecore_imf_context_del(Ecore_IMF_Context *ctx)
Deletes the given Input Method Context and free its memory.
Definition: ecore_imf_context.c:199
Ecore_IMF_BiDi_Direction
Ecore_IMF_BiDi_Direction
Enumeration for defining the types of Ecore_IMF bidirectionality.
Definition: Ecore_IMF.h:471
Ecore_IMF_Context
struct _Ecore_IMF_Context Ecore_IMF_Context
An Input Method Context.
Definition: Ecore_IMF.h:198
ecore_imf_context_filter_event
EAPI Eina_Bool ecore_imf_context_filter_event(Ecore_IMF_Context *ctx, Ecore_IMF_Event_Type type, Ecore_IMF_Event *event)
Allows an Ecore Input Context to internally handle an event.
Definition: ecore_imf_context.c:544
ecore_imf_context_add
EAPI Ecore_IMF_Context * ecore_imf_context_add(const char *id)
Creates a new Input Method Context defined by the given id.
Definition: ecore_imf_context.c:146
ecore_imf_context_bidi_direction_set
EAPI void ecore_imf_context_bidi_direction_set(Ecore_IMF_Context *ctx, Ecore_IMF_BiDi_Direction direction)
Sets the bidirectionality at the current cursor position.
Definition: ecore_imf_context.c:1384
ecore_imf_context_retrieve_surrounding_callback_set
EAPI void ecore_imf_context_retrieve_surrounding_callback_set(Ecore_IMF_Context *ctx, Eina_Bool(*func)(void *data, Ecore_IMF_Context *ctx, char **text, int *cursor_pos), const void *data)
Sets the callback to be used on surrounding_get request.
Definition: ecore_imf_context.c:491
ecore_imf_context_cursor_position_set
EAPI void ecore_imf_context_cursor_position_set(Ecore_IMF_Context *ctx, int cursor_pos)
Notifies the Input Method Context that a change in the cursor position has been made.
Definition: ecore_imf_context.c:391
ecore_imf_context_focus_out
EAPI void ecore_imf_context_focus_out(Ecore_IMF_Context *ctx)
Notifies the Input Method Context that the widget to which its correspond has lost focus.
Definition: ecore_imf_context.c:365
ECORE_IMF_CALLBACK_DELETE_SURROUNDING
@ ECORE_IMF_CALLBACK_DELETE_SURROUNDING
"DELETE_SURROUNDING" is called when the input method needs to delete all or part of the context surro...
Definition: Ecore_IMF.h:233
ECORE_IMF_CALLBACK_COMMIT
@ ECORE_IMF_CALLBACK_COMMIT
"COMMIT" is called when a complete input sequence has been entered by the user
Definition: Ecore_IMF.h:232
ECORE_IMF_CALLBACK_PREEDIT_CHANGED
@ ECORE_IMF_CALLBACK_PREEDIT_CHANGED
"PREEDIT_CHANGED" is called whenever the preedit sequence currently being entered has changed.
Definition: Ecore_IMF.h:231
ECORE_IMF_EVENT_KEY_UP
@ ECORE_IMF_EVENT_KEY_UP
Key Up event.
Definition: Ecore_IMF.h:257
ECORE_IMF_EVENT_MOUSE_UP
@ ECORE_IMF_EVENT_MOUSE_UP
Mouse Up event.
Definition: Ecore_IMF.h:251
ECORE_IMF_EVENT_MOUSE_DOWN
@ ECORE_IMF_EVENT_MOUSE_DOWN
Mouse Down event.
Definition: Ecore_IMF.h:250
ECORE_IMF_EVENT_KEY_DOWN
@ ECORE_IMF_EVENT_KEY_DOWN
Key Down event.
Definition: Ecore_IMF.h:256
ECORE_IMF_PREEDIT_TYPE_SUB1
@ ECORE_IMF_PREEDIT_TYPE_SUB1
Substring style 1.
Definition: Ecore_IMF.h:322
ECORE_IMF_PREEDIT_TYPE_SUB2
@ ECORE_IMF_PREEDIT_TYPE_SUB2
Substring style 2.
Definition: Ecore_IMF.h:323
ECORE_IMF_PREEDIT_TYPE_SUB3
@ ECORE_IMF_PREEDIT_TYPE_SUB3
Substring style 3.
Definition: Ecore_IMF.h:324
ecore_imf_evas_event_key_up_wrap
EAPI void ecore_imf_evas_event_key_up_wrap(Evas_Event_Key_Up *evas_event, Ecore_IMF_Event_Key_Up *imf_event)
Converts a "key_up" event from Evas to the corresponding event of Ecore_IMF.
Definition: ecore_imf_evas.c:207
ecore_imf_evas_event_key_down_wrap
EAPI void ecore_imf_evas_event_key_down_wrap(Evas_Event_Key_Down *evas_event, Ecore_IMF_Event_Key_Down *imf_event)
Converts a "key_down" event from Evas to the corresponding event of Ecore_IMF.
Definition: ecore_imf_evas.c:176
ecore_imf_evas_event_mouse_down_wrap
EAPI void ecore_imf_evas_event_mouse_down_wrap(Evas_Event_Mouse_Down *evas_event, Ecore_IMF_Event_Mouse_Down *imf_event)
Converts a "mouse_down" event from Evas to the corresponding event of Ecore_IMF.
Definition: ecore_imf_evas.c:121
ecore_imf_evas_event_mouse_up_wrap
EAPI void ecore_imf_evas_event_mouse_up_wrap(Evas_Event_Mouse_Up *evas_event, Ecore_IMF_Event_Mouse_Up *imf_event)
Converts a "mouse_up" event from Evas to the corresponding event of Ecore_IMF.
Definition: ecore_imf_evas.c:139
ecore_imf_shutdown
EAPI int ecore_imf_shutdown(void)
Shuts down the Ecore_IMF library.
Definition: ecore_imf.c:47
ecore_imf_init
EAPI int ecore_imf_init(void)
Initialises the Ecore_IMF library.
Definition: ecore_imf.c:22
ecore_main_loop_begin
void ecore_main_loop_begin(void)
Runs the application main loop.
Definition: ecore_main.c:1311
EINA_LIST_FOREACH
#define EINA_LIST_FOREACH(list, l, _data)
Definition for the macro to iterate over a list.
Definition: eina_list.h:1415
EINA_LIST_FREE
#define EINA_LIST_FREE(list, data)
Definition for the macro to remove each list node while having access to each node's data.
Definition: eina_list.h:1629
EINA_TRUE
#define EINA_TRUE
boolean value TRUE (numerical value 1)
Definition: eina_types.h:539
EINA_FALSE
#define EINA_FALSE
boolean value FALSE (numerical value 0)
Definition: eina_types.h:533
Eina_Bool
unsigned char Eina_Bool
Type to mimic a boolean.
Definition: eina_types.h:527
EINA_UNUSED
#define EINA_UNUSED
Used to indicate that a function parameter is purposely unused.
Definition: eina_types.h:339
_mouse_down_cb
static void _mouse_down_cb(void *data, Evas *e, Evas_Object *obj, void *event_info)
For all mouse* / multi_* functions wethen send this event to _event_process function.
Definition: elm_gesture_layer.c:865
evas_event_callback_add
EVAS_API void evas_event_callback_add(Evas *eo_e, Evas_Callback_Type type, Evas_Event_Cb func, const void *data)
Add (register) a callback function to a given canvas event.
Definition: evas_callbacks.c:573
evas_event_callback_del_full
EVAS_API void * evas_event_callback_del_full(Evas *eo_e, Evas_Callback_Type type, Evas_Event_Cb func, const void *data)
Delete (unregister) a callback function registered to a given canvas event.
Definition: evas_callbacks.c:678
Evas
Eo Evas
An opaque handle to an Evas canvas.
Definition: Evas_Common.h:163
evas_focus_get
EVAS_API Efl_Canvas_Object * evas_focus_get(const Evas_Canvas *obj)
Retrieve the object focused by the default seat.
Definition: evas_canvas_eo.legacy.c:51
evas_key_modifier_is_set
EVAS_API Eina_Bool evas_key_modifier_is_set(const Evas_Modifier *m, const char *keyname)
Checks the state of a given modifier of the default seat, at the time of the call.
Definition: evas_key.c:76
evas_object_show
EVAS_API void evas_object_show(Evas_Object *eo_obj)
Makes the given Evas object visible.
Definition: evas_object_main.c:1814
evas_object_geometry_get
EVAS_API void evas_object_geometry_get(const Evas_Object *eo_obj, Evas_Coord *x, Evas_Coord *y, Evas_Coord *w, Evas_Coord *h)
Retrieves the position and (rectangular) size of the given Evas object.
Definition: evas_object_main.c:1335
evas_object_del
EVAS_API void evas_object_del(Evas_Object *obj)
Marks the given Evas object for deletion (when Evas will free its memory).
Definition: evas_object_main.c:928
evas_object_color_set
EVAS_API void evas_object_color_set(Evas_Object *obj, int r, int g, int b, int a)
Sets the general/main color of the given Evas object to the given one.
Definition: evas_object_main.c:2024
evas_object_event_callback_add
EVAS_API void evas_object_event_callback_add(Evas_Object *eo_obj, Evas_Callback_Type type, Evas_Object_Event_Cb func, const void *data)
Add (register) a callback function to a given Evas object event.
Definition: evas_callbacks.c:478
evas_object_data_get
EVAS_API void * evas_object_data_get(const Evas_Object *obj, const char *key)
Return an attached data pointer on an Evas object by its given string key.
Definition: evas_data.c:12
evas_object_data_set
EVAS_API void evas_object_data_set(Evas_Object *eo_obj, const char *key, const void *data)
Set an attached data pointer to an object with a given string key.
Definition: evas_data.c:5
evas_object_move
EVAS_API void evas_object_move(Evas_Object *obj, Evas_Coord x, Evas_Coord y)
Move the given Evas object to the given location inside its canvas' viewport.
Definition: evas_object_main.c:1171
evas_object_focus_get
EVAS_API Eina_Bool evas_object_focus_get(const Efl_Canvas_Object *obj)
Indicates that this object is the keyboard event receiver on its canvas.
Definition: efl_canvas_object_eo.legacy.c:45
evas_object_pass_events_set
EVAS_API void evas_object_pass_events_set(Efl_Canvas_Object *obj, Eina_Bool pass)
Set whether an Evas object is to pass (ignore) events.
Definition: efl_canvas_object_eo.legacy.c:76
Evas_Object
Efl_Canvas_Object Evas_Object
An Evas Object handle.
Definition: Evas_Common.h:185
evas_object_focus_set
EVAS_API void evas_object_focus_set(Efl_Canvas_Object *obj, Eina_Bool focus)
Indicates that this object is the keyboard event receiver on its canvas.
Definition: efl_canvas_object_eo.legacy.c:39
evas_object_resize
EVAS_API void evas_object_resize(Evas_Object *obj, Evas_Coord w, Evas_Coord h)
Changes the size of the given Evas object.
Definition: evas_object_main.c:1236
evas_object_rectangle_add
EVAS_API Evas_Object * evas_object_rectangle_add(Evas *e)
Adds a rectangle to the given evas.
Definition: evas_object_rectangle.c:78
evas_object_textblock_style_set
EVAS_API void evas_object_textblock_style_set(Eo *eo_obj, const Evas_Textblock_Style *ts)
Sets object's style to given style.
Definition: evas_object_textblock.c:8304
Evas_Textblock_Style
struct _Efl_Canvas_Textblock_Style Evas_Textblock_Style
A textblock style object.
Definition: evas_textblock_legacy.h:140
evas_textblock_cursor_compare
EVAS_API int evas_textblock_cursor_compare(const Efl_Text_Cursor_Handle *cur1, const Efl_Text_Cursor_Handle *cur2)
Compare two cursors.
Definition: evas_object_textblock.c:11375
evas_textblock_style_free
EVAS_API void evas_textblock_style_free(Evas_Textblock_Style *ts)
Destroys a textblock style.
Definition: evas_object_textblock.c:7981
evas_textblock_cursor_pos_set
EVAS_API void evas_textblock_cursor_pos_set(Efl_Text_Cursor_Handle *cur, int _pos)
Set the cursor pos.
Definition: evas_object_textblock.c:11244
evas_textblock_cursor_geometry_get
EVAS_API int evas_textblock_cursor_geometry_get(const Efl_Text_Cursor_Handle *cur, Evas_Coord *cx, Evas_Coord *cy, Evas_Coord *cw, Evas_Coord *ch, Evas_BiDi_Direction *dir, Evas_Textblock_Cursor_Type ctype)
Returns the geometry of the cursor.
Definition: evas_object_textblock.c:12981
evas_object_textblock_add
EVAS_API Evas_Object * evas_object_textblock_add(Evas *e)
Adds a textblock to the given evas.
Definition: evas_object_textblock.c:7907
evas_textblock_cursor_free
EVAS_API void evas_textblock_cursor_free(Evas_Textblock_Cursor *cur)
Free the cursor and unassociate it from the object.
Definition: evas_object_textblock.c:9815
evas_object_textblock_text_markup_get
EVAS_API const char * evas_object_textblock_text_markup_get(Eo *eo_obj)
Gets the current markup text of the textblock object.
Definition: evas_object_textblock.c:9113
evas_textblock_style_new
EVAS_API Evas_Textblock_Style * evas_textblock_style_new(void)
Creates a new textblock style.
Definition: evas_object_textblock.c:7971
evas_textblock_cursor_char_prev
EVAS_API Eina_Bool evas_textblock_cursor_char_prev(Efl_Text_Cursor_Handle *cur)
Advances the cursor one char backwards.
Definition: evas_object_textblock.c:10617
evas_textblock_cursor_range_delete
EVAS_API void evas_textblock_cursor_range_delete(Efl_Text_Cursor_Handle *cur1, Efl_Text_Cursor_Handle *cur2)
Delete the range between cur1 and cur2.
Definition: evas_object_textblock.c:12247
evas_object_textblock_text_markup_prepend
EVAS_API void evas_object_textblock_text_markup_prepend(Efl_Text_Cursor_Handle *cur, const char *text)
Prepends markup to the cursor cur.
Definition: evas_object_textblock.c:8956
evas_textblock_style_set
EVAS_API void evas_textblock_style_set(Evas_Textblock_Style *ts, const char *text)
Sets the style ts to the style passed as text by text.
Definition: evas_object_textblock.c:8048
evas_object_textblock_cursor_new
EVAS_API Efl_Text_Cursor_Handle * evas_object_textblock_cursor_new(const Evas_Object *eo_obj)
Create a new cursor, associate it to the obj and init it to point to the start of the textblock.
Definition: evas_object_textblock.c:9795
evas_textblock_cursor_copy
EVAS_API void evas_textblock_cursor_copy(const Evas_Textblock_Cursor *cur_src, Efl_Text_Cursor_Handle *cur_dest)
Make cur_dest point to the same place as cur.
Definition: evas_object_textblock.c:11411
evas_textblock_cursor_pos_get
EVAS_API int evas_textblock_cursor_pos_get(const Efl_Text_Cursor_Handle *cur)
Return the current cursor pos.
Definition: evas_object_textblock.c:11224
evas_textblock_cursor_char_delete
EVAS_API void evas_textblock_cursor_char_delete(Efl_Text_Cursor_Handle *cur)
Deletes a single character from position pointed by given cursor.
Definition: evas_object_textblock.c:12168
EVAS_TEXTBLOCK_CURSOR_BEFORE
@ EVAS_TEXTBLOCK_CURSOR_BEFORE
cursor type is before
Definition: evas_textblock_legacy.h:190
_Ecore_IMF_Event_Delete_Surrounding
The structure type used with the Delete_Surrounding Input Method event.
Definition: Ecore_IMF.h:556
_Ecore_IMF_Event_Key_Down
The structure type used with the Key_Down event.
Definition: Ecore_IMF.h:704
_Ecore_IMF_Event_Key_Up
The structure type used with the Key_Up event.
Definition: Ecore_IMF.h:723
_Ecore_IMF_Event_Mouse_Down
The structure type used with the Mouse_Down event.
Definition: Ecore_IMF.h:591
_Ecore_IMF_Event_Mouse_Up
The structure type used with the Mouse_Up event.
Definition: Ecore_IMF.h:610
_Ecore_IMF_Preedit_Attr
Structure that contains preedit attribute information.
Definition: Ecore_IMF.h:757
_Ecore_IMF_Preedit_Attr::preedit_type
Ecore_IMF_Preedit_Type preedit_type
preedit style type
Definition: Ecore_IMF.h:758
_Efl_Text_Cursor_Handle
Definition: efl_canvas_textblock_internal.h:160
_Eina_List
Type for a generic double linked list.
Definition: eina_list.h:318
_Evas_Event_Key_Down
Key press event.
Definition: Evas_Legacy.h:314
_Evas_Event_Key_Down::modifiers
Evas_Modifier * modifiers
modifier keys pressed during the event
Definition: Evas_Legacy.h:317
_Evas_Event_Key_Down::string
const char * string
A UTF8 string if this keystroke has produced a visible string to be ADDED.
Definition: Evas_Legacy.h:321
_Evas_Event_Key_Down::key
const char * key
The logical key : (eg shift+1 == exclamation)
Definition: Evas_Legacy.h:320
_Evas_Event_Key_Up
Key release event.
Definition: Evas_Legacy.h:331
_Evas_Event_Mouse_Down
Mouse button press event.
Definition: Evas_Legacy.h:160
_Evas_Event_Mouse_Up
Mouse button release event.
Definition: Evas_Legacy.h:178
_Ecore_IMF_Event
A union of IMF events.
Definition: Ecore_IMF.h:741