2 * vim:ts=8:sw=3:sts=8:noexpandtab:cino=>5n-3f0^-2{2
10 #include "Ecore_IMF.h"
11 #include "ecore_imf_private.h"
16 * @defgroup Ecore_IMF_Context_Group Ecore Input Method Context Functions
18 * Functions that operate on Ecore Input Method Context objects.
22 * Get the list of the available Input Method Context ids.
24 * Note that the caller is responsible for freeing the Ecore_List
25 * when finished with it. There is no need to finish the list strings.
27 * @return Return an Ecore_List of strings;
28 * on failure it returns NULL.
29 * @ingroup Ecore_IMF_Context_Group
32 ecore_imf_context_available_ids_get(void)
34 return ecore_imf_module_context_ids_get();
38 ecore_imf_context_available_ids_by_canvas_type_get(const char *canvas_type)
40 return ecore_imf_module_context_ids_by_canvas_type_get(canvas_type);
44 * Match @locale against @against.
46 * 'en_US' against 'en_US' => 4
47 * 'en_US' against 'en' => 3
48 * 'en', 'en_UK' against 'en_US' => 2
49 * all locales, against '*' => 1
52 _ecore_imf_context_match_locale(const char *locale, const char *against, int against_len)
54 if (strcmp(against, "*") == 0)
57 if (strcasecmp(locale, against) == 0)
60 if (strncasecmp(locale, against, 2) == 0)
61 return (against_len == 2) ? 3 : 2;
67 * Get the id of the default Input Method Context.
68 * The id may to used to create a new instance of an Input Method
71 * @return Return a string containing the id of the default Input
72 * Method Context; on failure it returns NULL.
73 * @ingroup Ecore_IMF_Context_Group
76 ecore_imf_context_default_id_get(void)
78 return ecore_imf_context_default_id_by_canvas_type_get(NULL);
82 ecore_imf_context_default_id_by_canvas_type_get(const char *canvas_type)
86 Ecore_IMF_Module *module;
89 int best_goodness = 0;
91 id = getenv("ECORE_IMF_MODULE");
94 if (strcmp(id, "none") == 0) return NULL;
95 if (ecore_imf_module_get(id)) return id;
98 modules = ecore_imf_module_available_get();
99 if (!modules) return NULL;
101 locale = setlocale(LC_CTYPE, NULL);
102 if (!locale) return NULL;
104 locale = strdup(locale);
106 tmp = strchr(locale, '.');
107 if (tmp) *tmp = '\0';
108 tmp = strchr(locale, '@');
109 if (tmp) *tmp = '\0';
113 ecore_list_first_goto(modules);
114 while ((module = ecore_list_next(modules)))
117 strcmp(module->info->canvas_type, canvas_type) == 0)
120 const char *p = module->info->default_locales;
123 const char *q = strchr(p, ':');
124 int goodness = _ecore_imf_context_match_locale(locale, p, q ? q - p : strlen (p));
126 if (goodness > best_goodness)
128 id = module->info->id;
129 best_goodness = goodness;
132 p = q ? q + 1 : NULL;
135 ecore_list_destroy(modules);
142 * Retrieve the info for the Input Method Context with @p id.
144 * @param id The Input Method Context id to query for.
145 * @return Return a #Ecore_IMF_Context_Info for the Input Method Context with @p id;
146 * on failure it returns NULL.
147 * @ingroup Ecore_IMF_Context_Group
149 EAPI const Ecore_IMF_Context_Info *
150 ecore_imf_context_info_by_id_get(const char *id)
152 Ecore_IMF_Module *module;
154 if (!id) return NULL;
155 module = ecore_imf_module_get(id);
156 if (!module) return NULL;
161 * Create a new Input Method Context defined by the given id.
163 * @param id The Input Method Context id.
164 * @return A newly allocated Input Method Context;
165 * on failure it returns NULL.
166 * @ingroup Ecore_IMF_Context_Group
168 EAPI Ecore_IMF_Context *
169 ecore_imf_context_add(const char *id)
171 Ecore_IMF_Context *ctx;
173 if (!id) return NULL;
174 ctx = ecore_imf_module_context_create(id);
175 if (!ctx || !ctx->klass) return NULL;
176 if (ctx->klass->add) ctx->klass->add(ctx);
177 /* default use_preedit is 1, so let's make sure it's
178 * set on the immodule */
179 ecore_imf_context_use_preedit_set(ctx, 1);
180 /* default input_mode is ECORE_IMF_INPUT_MODE_FULL, so let's make sure it's
181 * set on the immodule */
182 ecore_imf_context_input_mode_set(ctx, ECORE_IMF_INPUT_MODE_FULL);
187 * Retrieve the info for the given Input Method Context.
189 * @param ctx An #Ecore_IMF_Context.
190 * @return Return a #Ecore_IMF_Context_Info for the given Input Method Context;
191 * on failure it returns NULL.
192 * @ingroup Ecore_IMF_Context_Group
194 EAPI const Ecore_IMF_Context_Info *
195 ecore_imf_context_info_get(Ecore_IMF_Context *ctx)
197 if (!ECORE_MAGIC_CHECK(ctx, ECORE_MAGIC_CONTEXT))
199 ECORE_MAGIC_FAIL(ctx, ECORE_MAGIC_CONTEXT,
200 "ecore_imf_context_info_get");
203 return ctx->module->info;
207 * Delete the given Input Method Context and free its memory.
209 * @param ctx An #Ecore_IMF_Context.
210 * @ingroup Ecore_IMF_Context_Group
213 ecore_imf_context_del(Ecore_IMF_Context *ctx)
215 if (!ECORE_MAGIC_CHECK(ctx, ECORE_MAGIC_CONTEXT))
217 ECORE_MAGIC_FAIL(ctx, ECORE_MAGIC_CONTEXT,
218 "ecore_imf_context_del");
221 if (ctx->klass->del) ctx->klass->del(ctx);
222 ECORE_MAGIC_SET(ctx, ECORE_MAGIC_NONE);
227 * Set the client window for the Input Method Context; this is the
228 * Ecore_X_Window when using X11, Ecore_Win32_Window when using Win32, etc.
229 * This window is used in order to correctly position status windows, and may
230 * also be used for purposes internal to the Input Method Context.
232 * @param ctx An #Ecore_IMF_Context.
233 * @param window The client window. This may be NULL to indicate
234 * that the previous client window no longer exists.
235 * @ingroup Ecore_IMF_Context_Group
238 ecore_imf_context_client_window_set(Ecore_IMF_Context *ctx, void *window)
240 if (!ECORE_MAGIC_CHECK(ctx, ECORE_MAGIC_CONTEXT))
242 ECORE_MAGIC_FAIL(ctx, ECORE_MAGIC_CONTEXT,
243 "ecore_imf_context_client_window_set");
246 if (ctx->klass->client_window_set) ctx->klass->client_window_set(ctx, window);
250 * Set the client canvas for the Input Method Context; this is the
251 * canvas in which the input appears.
252 * The canvas type can be determined by using the context canvas type.
253 * Actually only canvas with type "evas" (Evas *) is supported.
254 * This canvas may be used in order to correctly position status windows, and may
255 * also be used for purposes internal to the Input Method Context.
257 * @param ctx An #Ecore_IMF_Context.
258 * @param canas The client canvas. This may be NULL to indicate
259 * that the previous client canvas no longer exists.
260 * @ingroup Ecore_IMF_Context_Group
263 ecore_imf_context_client_canvas_set(Ecore_IMF_Context *ctx, void *canvas)
265 if (!ECORE_MAGIC_CHECK(ctx, ECORE_MAGIC_CONTEXT))
267 ECORE_MAGIC_FAIL(ctx, ECORE_MAGIC_CONTEXT,
268 "ecore_imf_context_client_window_set");
271 if (ctx->klass->client_canvas_set) ctx->klass->client_canvas_set(ctx, canvas);
275 * Ask the Input Method Context to show itself.
277 * @param ctx An #Ecore_IMF_Context.
278 * @ingroup Ecore_IMF_Context_Group
281 ecore_imf_context_show(Ecore_IMF_Context *ctx)
283 if (!ECORE_MAGIC_CHECK(ctx, ECORE_MAGIC_CONTEXT))
285 ECORE_MAGIC_FAIL(ctx, ECORE_MAGIC_CONTEXT,
286 "ecore_imf_context_show");
289 if (ctx->klass->show) ctx->klass->show(ctx);
293 * Ask the Input Method Context to hide itself.
295 * @param ctx An #Ecore_IMF_Context.
296 * @ingroup Ecore_IMF_Context_Group
299 ecore_imf_context_hide(Ecore_IMF_Context *ctx)
301 if (!ECORE_MAGIC_CHECK(ctx, ECORE_MAGIC_CONTEXT))
303 ECORE_MAGIC_FAIL(ctx, ECORE_MAGIC_CONTEXT,
304 "ecore_imf_context_hide");
307 if (ctx->klass->hide) ctx->klass->hide(ctx);
311 * Retrieve the current preedit string and cursor position
312 * for the Input Method Context.
314 * @param ctx An #Ecore_IMF_Context.
315 * @param str Location to store the retrieved string. The
316 * string retrieved must be freed with free().
317 * @param cursor_pos Location to store position of cursor (in characters)
318 * within the preedit string.
319 * @ingroup Ecore_IMF_Context_Group
322 ecore_imf_context_preedit_string_get(Ecore_IMF_Context *ctx, char **str, int *cursor_pos)
324 if (!ECORE_MAGIC_CHECK(ctx, ECORE_MAGIC_CONTEXT))
326 ECORE_MAGIC_FAIL(ctx, ECORE_MAGIC_CONTEXT,
327 "ecore_imf_context_preedit_string_get");
330 if (ctx->klass->preedit_string_get)
331 ctx->klass->preedit_string_get(ctx, str, cursor_pos);
334 if (str) *str = strdup("");
335 if (cursor_pos) *cursor_pos = 0;
340 * Notify the Input Method Context that the widget to which its
341 * correspond has gained focus.
343 * @param ctx An #Ecore_IMF_Context.
344 * @ingroup Ecore_IMF_Context_Group
347 ecore_imf_context_focus_in(Ecore_IMF_Context *ctx)
349 if (!ECORE_MAGIC_CHECK(ctx, ECORE_MAGIC_CONTEXT))
351 ECORE_MAGIC_FAIL(ctx, ECORE_MAGIC_CONTEXT,
352 "ecore_imf_context_focus_in");
355 if (ctx->klass->focus_in) ctx->klass->focus_in(ctx);
359 * Notify the Input Method Context that the widget to which its
360 * correspond has lost focus.
362 * @param ctx An #Ecore_IMF_Context.
363 * @ingroup Ecore_IMF_Context_Group
366 ecore_imf_context_focus_out(Ecore_IMF_Context *ctx)
368 if (!ECORE_MAGIC_CHECK(ctx, ECORE_MAGIC_CONTEXT))
370 ECORE_MAGIC_FAIL(ctx, ECORE_MAGIC_CONTEXT,
371 "ecore_imf_context_focus_out");
374 if (ctx->klass->focus_out) ctx->klass->focus_out(ctx);
378 * Notify the Input Method Context that a change such as a
379 * change in cursor position has been made. This will typically
380 * cause the Input Method Context to clear the preedit state.
382 * @param ctx An #Ecore_IMF_Context.
383 * @ingroup Ecore_IMF_Context_Group
386 ecore_imf_context_reset(Ecore_IMF_Context *ctx)
388 if (!ECORE_MAGIC_CHECK(ctx, ECORE_MAGIC_CONTEXT))
390 ECORE_MAGIC_FAIL(ctx, ECORE_MAGIC_CONTEXT,
391 "ecore_imf_context_reset");
394 if (ctx->klass->reset) ctx->klass->reset(ctx);
398 * Notify the Input Method Context that a change in the cursor
399 * position has been made.
401 * @param ctx An #Ecore_IMF_Context.
402 * @param cursor_pos New cursor position in characters.
403 * @ingroup Ecore_IMF_Context_Group
406 ecore_imf_context_cursor_position_set(Ecore_IMF_Context *ctx, int cursor_pos)
408 if (!ECORE_MAGIC_CHECK(ctx, ECORE_MAGIC_CONTEXT))
410 ECORE_MAGIC_FAIL(ctx, ECORE_MAGIC_CONTEXT,
411 "ecore_imf_context_cursor_position_set");
414 if (ctx->klass->cursor_position_set) ctx->klass->cursor_position_set(ctx, cursor_pos);
418 * Set whether the IM context should use the preedit string
419 * to display feedback. If @use_preedit is 0 (default
420 * is 1), then the IM context may use some other method to display
421 * feedback, such as displaying it in a child of the root window.
423 * @param ctx An #Ecore_IMF_Context.
424 * @param use_preedit Whether the IM context should use the preedit string.
425 * @ingroup Ecore_IMF_Context_Group
428 ecore_imf_context_use_preedit_set(Ecore_IMF_Context *ctx, int use_preedit)
430 if (!ECORE_MAGIC_CHECK(ctx, ECORE_MAGIC_CONTEXT))
432 ECORE_MAGIC_FAIL(ctx, ECORE_MAGIC_CONTEXT,
433 "ecore_imf_context_use_preedit_set");
436 if (ctx->klass->use_preedit_set) ctx->klass->use_preedit_set(ctx, use_preedit);
440 * Set the callback to be used on get_surrounding request.
442 * This callback will be called when the Input Method Context
443 * module requests the surrounding context.
445 * @param ctx An #Ecore_IMF_Context.
446 * @param func The callback to be called.
447 * @param data The data pointer to be passed to @p func
448 * @ingroup Ecore_IMF_Context_Group
451 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)
453 if (!ECORE_MAGIC_CHECK(ctx, ECORE_MAGIC_CONTEXT))
455 ECORE_MAGIC_FAIL(ctx, ECORE_MAGIC_CONTEXT,
456 "ecore_imf_context_retrieve_surrounding_callback_set");
460 ctx->retrieve_surrounding_func = func;
461 ctx->retrieve_surrounding_data = (void *) data;
465 * Set the input mode used by the Ecore Input Context.
467 * The input mode can be one of the input modes defined in
468 * #Ecore_IMF_Input_Mode. The default input mode is
469 * ECORE_IMF_INPUT_MODE_FULL.
471 * @param ctx An #Ecore_IMF_Context.
472 * @param input_mode The input mode to be used by @p ctx.
473 * @ingroup Ecore_IMF_Context_Group
476 ecore_imf_context_input_mode_set(Ecore_IMF_Context *ctx, Ecore_IMF_Input_Mode input_mode)
478 if (!ECORE_MAGIC_CHECK(ctx, ECORE_MAGIC_CONTEXT))
480 ECORE_MAGIC_FAIL(ctx, ECORE_MAGIC_CONTEXT,
481 "ecore_imf_context_input_mode_set");
484 if (ctx->klass->input_mode_set) ctx->klass->input_mode_set(ctx, input_mode);
485 ctx->input_mode = input_mode;
489 * Get the input mode being used by the Ecore Input Context.
491 * See @ref ecore_imf_context_input_mode_set for more details.
493 * @param ctx An #Ecore_IMF_Context.
494 * @return The input mode being used by @p ctx.
495 * @ingroup Ecore_IMF_Context_Group
497 EAPI Ecore_IMF_Input_Mode
498 ecore_imf_context_input_mode_get(Ecore_IMF_Context *ctx)
500 if (!ECORE_MAGIC_CHECK(ctx, ECORE_MAGIC_CONTEXT))
502 ECORE_MAGIC_FAIL(ctx, ECORE_MAGIC_CONTEXT,
503 "ecore_imf_context_input_mode_set");
506 return ctx->input_mode;
510 * Allow an Ecore Input Context to internally handle an event.
511 * If this function returns 1, then no further processing
512 * should be done for this event.
514 * Input methods must be able to accept all types of events (simply
515 * returning 0 if the event was not handled), but there is no
516 * obligation of any events to be submitted to this function.
518 * @param ctx An #Ecore_IMF_Context.
519 * @param type The type of event defined by #Ecore_IMF_Event_Type.
520 * @param event The event itself.
521 * @return 1 if the event was handled; otherwise 0.
522 * @ingroup Ecore_IMF_Context_Group
525 ecore_imf_context_filter_event(Ecore_IMF_Context *ctx, Ecore_IMF_Event_Type type, Ecore_IMF_Event *event)
527 if (!ECORE_MAGIC_CHECK(ctx, ECORE_MAGIC_CONTEXT))
529 ECORE_MAGIC_FAIL(ctx, ECORE_MAGIC_CONTEXT,
530 "ecore_imf_context_filter_event");
533 if (ctx->klass->filter_event) return ctx->klass->filter_event(ctx, type, event);
538 * @defgroup Ecore_IMF_Context_Module_Group Ecore Input Method Context Module Functions
540 * Functions that should be used by Ecore Input Method Context modules.
544 * Creates a new Input Method Context with klass specified by @p ctxc.
546 * This method should be used by modules implementing the Input
547 * Method Context interface.
549 * @param ctxc An #Ecore_IMF_Context_Class.
550 * @return A new #Ecore_IMF_Context; on failure it returns NULL.
551 * @ingroup Ecore_IMF_Context_Module_Group
553 EAPI Ecore_IMF_Context *
554 ecore_imf_context_new(const Ecore_IMF_Context_Class *ctxc)
556 Ecore_IMF_Context *ctx;
558 if (!ctxc) return NULL;
559 ctx = malloc(sizeof(Ecore_IMF_Context));
560 if (!ctx) return NULL;
561 ECORE_MAGIC_SET(ctx, ECORE_MAGIC_CONTEXT);
564 ctx->retrieve_surrounding_func = NULL;
565 ctx->retrieve_surrounding_data = NULL;
570 * Set the Input Method Context specific data.
572 * Note that this method should be used by modules to set
573 * the Input Method Context specific data and it's not meant to
574 * be used by applications to store application specific data.
576 * @param ctx An #Ecore_IMF_Context.
577 * @param data The Input Method Context specific data.
578 * @return A new #Ecore_IMF_Context; on failure it returns NULL.
579 * @ingroup Ecore_IMF_Context_Module_Group
582 ecore_imf_context_data_set(Ecore_IMF_Context *ctx, void *data)
584 if (!ECORE_MAGIC_CHECK(ctx, ECORE_MAGIC_CONTEXT))
586 ECORE_MAGIC_FAIL(ctx, ECORE_MAGIC_CONTEXT,
587 "ecore_imf_context_data_set");
594 * Get the Input Method Context specific data.
596 * See @ref ecore_imf_context_data_set for more details.
598 * @param ctx An #Ecore_IMF_Context.
599 * @return The Input Method Context specific data.
600 * @ingroup Ecore_IMF_Context_Module_Group
602 EAPI void *ecore_imf_context_data_get(Ecore_IMF_Context *ctx)
604 if (!ECORE_MAGIC_CHECK(ctx, ECORE_MAGIC_CONTEXT))
606 ECORE_MAGIC_FAIL(ctx, ECORE_MAGIC_CONTEXT,
607 "ecore_imf_context_data_get");
614 * Retrieve context around insertion point.
616 * This function is implemented by calling the
617 * Ecore_IMF_Context::retrieve_surrounding_func (
618 * set using #ecore_imf_context_retrieve_surrounding_callback_set).
620 * There is no obligation for a widget to respond to the
621 * ::retrieve_surrounding_func, so input methods must be prepared
622 * to function without context.
624 * @param ctx An #Ecore_IMF_Context.
625 * @param text Location to store a UTF-8 encoded string of text
626 * holding context around the insertion point.
627 * If the function returns 1, then you must free
628 * the result stored in this location with free().
629 * @param cursor_pos Location to store the position in characters of
630 * the insertion cursor within @text.
631 * @return 1 if surrounding text was provided; otherwise 0.
632 * @ingroup Ecore_IMF_Context_Module_Group
635 ecore_imf_context_surrounding_get(Ecore_IMF_Context *ctx, char **text, int *cursor_pos)
639 if (!ECORE_MAGIC_CHECK(ctx, ECORE_MAGIC_CONTEXT))
641 ECORE_MAGIC_FAIL(ctx, ECORE_MAGIC_CONTEXT,
642 "ecore_imf_context_surrounding_get");
646 if (ctx->retrieve_surrounding_func)
648 result = ctx->retrieve_surrounding_func(ctx->retrieve_surrounding_data, ctx, text, cursor_pos);
651 if (text) *text = NULL;
652 if (cursor_pos) *cursor_pos = 0;
659 _ecore_imf_event_free_preedit(void *data __UNUSED__, void *event)
665 * Adds ECORE_IMF_EVENT_PREEDIT_START to the event queue.
667 * @param ctx An #Ecore_IMF_Context.
668 * @ingroup Ecore_IMF_Context_Module_Group
671 ecore_imf_context_preedit_start_event_add(Ecore_IMF_Context *ctx)
673 Ecore_IMF_Event_Commit *ev;
675 if (!ECORE_MAGIC_CHECK(ctx, ECORE_MAGIC_CONTEXT))
677 ECORE_MAGIC_FAIL(ctx, ECORE_MAGIC_CONTEXT,
678 "ecore_imf_context_preedit_start_event_add");
682 ev = malloc(sizeof(Ecore_IMF_Event_Preedit_Start));
684 ecore_event_add(ECORE_IMF_EVENT_PREEDIT_START,
685 ev, _ecore_imf_event_free_preedit, NULL);
689 * Adds ECORE_IMF_EVENT_PREEDIT_END to the event queue.
691 * @param ctx An #Ecore_IMF_Context.
692 * @ingroup Ecore_IMF_Context_Module_Group
695 ecore_imf_context_preedit_end_event_add(Ecore_IMF_Context *ctx)
697 Ecore_IMF_Event_Commit *ev;
699 if (!ECORE_MAGIC_CHECK(ctx, ECORE_MAGIC_CONTEXT))
701 ECORE_MAGIC_FAIL(ctx, ECORE_MAGIC_CONTEXT,
702 "ecore_imf_context_preedit_end_event_add");
706 ev = malloc(sizeof(Ecore_IMF_Event_Preedit_End));
708 ecore_event_add(ECORE_IMF_EVENT_PREEDIT_END,
709 ev, _ecore_imf_event_free_preedit, NULL);
713 * Adds ECORE_IMF_EVENT_PREEDIT_CHANGED to the event queue.
715 * @param ctx An #Ecore_IMF_Context.
716 * @ingroup Ecore_IMF_Context_Module_Group
719 ecore_imf_context_preedit_changed_event_add(Ecore_IMF_Context *ctx)
721 Ecore_IMF_Event_Commit *ev;
723 if (!ECORE_MAGIC_CHECK(ctx, ECORE_MAGIC_CONTEXT))
725 ECORE_MAGIC_FAIL(ctx, ECORE_MAGIC_CONTEXT,
726 "ecore_imf_context_preedit_changed_event_add");
730 ev = malloc(sizeof(Ecore_IMF_Event_Preedit_Changed));
732 ecore_event_add(ECORE_IMF_EVENT_PREEDIT_CHANGED,
733 ev, _ecore_imf_event_free_preedit, NULL);
737 _ecore_imf_event_free_commit(void *data __UNUSED__, void *event)
739 Ecore_IMF_Event_Commit *ev;
742 if (ev->str) free(ev->str);
747 * Adds ECORE_IMF_EVENT_COMMIT to the event queue.
749 * @param ctx An #Ecore_IMF_Context.
750 * @param str The committed string.
751 * @ingroup Ecore_IMF_Context_Module_Group
754 ecore_imf_context_commit_event_add(Ecore_IMF_Context *ctx, const char *str)
756 Ecore_IMF_Event_Commit *ev;
758 if (!ECORE_MAGIC_CHECK(ctx, ECORE_MAGIC_CONTEXT))
760 ECORE_MAGIC_FAIL(ctx, ECORE_MAGIC_CONTEXT,
761 "ecore_imf_context_commit_event_add");
765 ev = malloc(sizeof(Ecore_IMF_Event_Commit));
767 ev->str = str ? strdup(str) : NULL;
768 ecore_event_add(ECORE_IMF_EVENT_COMMIT,
769 ev, _ecore_imf_event_free_commit, NULL);
774 _ecore_imf_event_free_delete_surrounding(void *data __UNUSED__, void *event)
780 * Adds ECORE_IMF_EVENT_DELETE_SURROUNDING to the event queue.
782 * @param ctx An #Ecore_IMF_Context.
783 * @param offset The start offset of surrounding to be deleted.
784 * @param n_chars The number of characters to be deleted.
785 * @ingroup Ecore_IMF_Context_Module_Group
788 ecore_imf_context_delete_surrounding_event_add(Ecore_IMF_Context *ctx, int offset, int n_chars)
790 Ecore_IMF_Event_Delete_Surrounding *ev;
792 if (!ECORE_MAGIC_CHECK(ctx, ECORE_MAGIC_CONTEXT))
794 ECORE_MAGIC_FAIL(ctx, ECORE_MAGIC_CONTEXT,
795 "ecore_imf_context_delete_surrounding_event_add");
799 ev = malloc(sizeof(Ecore_IMF_Event_Delete_Surrounding));
802 ev->n_chars = n_chars;
803 ecore_event_add(ECORE_IMF_EVENT_DELETE_SURROUNDING,
804 ev, _ecore_imf_event_free_delete_surrounding, NULL);