2 * vim:ts=8:sw=3:sts=8:noexpandtab:cino=>5n-3f0^-2{2
14 #include <ecore_private.h>
16 #include "Ecore_IMF.h"
17 #include "ecore_imf_private.h"
20 * @defgroup Ecore_IMF_Context_Group Ecore Input Method Context Functions
22 * Functions that operate on Ecore Input Method Context objects.
26 * Get the list of the available Input Method Context ids.
28 * Note that the caller is responsible for freeing the Eina_List
29 * when finished with it. There is no need to finish the list strings.
31 * @return Return an EIna_List of strings;
32 * on failure it returns NULL.
33 * @ingroup Ecore_IMF_Context_Group
36 ecore_imf_context_available_ids_get(void)
38 return ecore_imf_module_context_ids_get();
42 ecore_imf_context_available_ids_by_canvas_type_get(const char *canvas_type)
44 return ecore_imf_module_context_ids_by_canvas_type_get(canvas_type);
48 * Match @locale against @against.
50 * 'en_US' against 'en_US' => 4
51 * 'en_US' against 'en' => 3
52 * 'en', 'en_UK' against 'en_US' => 2
53 * all locales, against '*' => 1
56 _ecore_imf_context_match_locale(const char *locale, const char *against, int against_len)
58 if (strcmp(against, "*") == 0)
61 if (strcasecmp(locale, against) == 0)
64 if (strncasecmp(locale, against, 2) == 0)
65 return (against_len == 2) ? 3 : 2;
71 * Get the id of the default Input Method Context.
72 * The id may to used to create a new instance of an Input Method
75 * @return Return a string containing the id of the default Input
76 * Method Context; on failure it returns NULL.
77 * @ingroup Ecore_IMF_Context_Group
80 ecore_imf_context_default_id_get(void)
82 return ecore_imf_context_default_id_by_canvas_type_get(NULL);
86 ecore_imf_context_default_id_by_canvas_type_get(const char *canvas_type)
90 Ecore_IMF_Module *module;
93 int best_goodness = 0;
95 id = getenv("ECORE_IMF_MODULE");
98 if (strcmp(id, "none") == 0) return NULL;
99 if (ecore_imf_module_get(id)) return id;
102 modules = ecore_imf_module_available_get();
103 if (!modules) return NULL;
105 locale = setlocale(LC_CTYPE, NULL);
106 if (!locale) return NULL;
108 locale = strdup(locale);
110 tmp = strchr(locale, '.');
111 if (tmp) *tmp = '\0';
112 tmp = strchr(locale, '@');
113 if (tmp) *tmp = '\0';
117 EINA_LIST_FREE(modules, module)
120 strcmp(module->info->canvas_type, canvas_type) == 0)
123 const char *p = module->info->default_locales;
126 const char *q = strchr(p, ':');
127 int goodness = _ecore_imf_context_match_locale(locale, p, q ? (size_t)(q - p) : strlen (p));
129 if (goodness > best_goodness)
131 id = module->info->id;
132 best_goodness = goodness;
135 p = q ? q + 1 : NULL;
144 * Retrieve the info for the Input Method Context with @p id.
146 * @param id The Input Method Context id to query for.
147 * @return Return a #Ecore_IMF_Context_Info for the Input Method Context with @p id;
148 * on failure it returns NULL.
149 * @ingroup Ecore_IMF_Context_Group
151 EAPI const Ecore_IMF_Context_Info *
152 ecore_imf_context_info_by_id_get(const char *id)
154 Ecore_IMF_Module *module;
156 if (!id) return NULL;
157 module = ecore_imf_module_get(id);
158 if (!module) return NULL;
163 * Create a new Input Method Context defined by the given id.
165 * @param id The Input Method Context id.
166 * @return A newly allocated Input Method Context;
167 * on failure it returns NULL.
168 * @ingroup Ecore_IMF_Context_Group
170 EAPI Ecore_IMF_Context *
171 ecore_imf_context_add(const char *id)
173 Ecore_IMF_Context *ctx;
175 if (!id) return NULL;
176 ctx = ecore_imf_module_context_create(id);
177 if (!ctx || !ctx->klass) return NULL;
178 if (ctx->klass->add) ctx->klass->add(ctx);
179 /* default use_preedit is 1, so let's make sure it's
180 * set on the immodule */
181 ecore_imf_context_use_preedit_set(ctx, 1);
182 /* default input_mode is ECORE_IMF_INPUT_MODE_FULL, so let's make sure it's
183 * set on the immodule */
184 ecore_imf_context_input_mode_set(ctx, ECORE_IMF_INPUT_MODE_FULL);
189 * Retrieve the info for the given Input Method Context.
191 * @param ctx An #Ecore_IMF_Context.
192 * @return Return a #Ecore_IMF_Context_Info for the given Input Method Context;
193 * on failure it returns NULL.
194 * @ingroup Ecore_IMF_Context_Group
196 EAPI const Ecore_IMF_Context_Info *
197 ecore_imf_context_info_get(Ecore_IMF_Context *ctx)
199 if (!ECORE_MAGIC_CHECK(ctx, ECORE_MAGIC_CONTEXT))
201 ECORE_MAGIC_FAIL(ctx, ECORE_MAGIC_CONTEXT,
202 "ecore_imf_context_info_get");
205 return ctx->module->info;
209 * Delete the given Input Method Context and free its memory.
211 * @param ctx An #Ecore_IMF_Context.
212 * @ingroup Ecore_IMF_Context_Group
215 ecore_imf_context_del(Ecore_IMF_Context *ctx)
217 if (!ECORE_MAGIC_CHECK(ctx, ECORE_MAGIC_CONTEXT))
219 ECORE_MAGIC_FAIL(ctx, ECORE_MAGIC_CONTEXT,
220 "ecore_imf_context_del");
223 if (ctx->klass->del) ctx->klass->del(ctx);
224 ECORE_MAGIC_SET(ctx, ECORE_MAGIC_NONE);
229 * Set the client window for the Input Method Context; this is the
230 * Ecore_X_Window when using X11, Ecore_Win32_Window when using Win32, etc.
231 * This window is used in order to correctly position status windows, and may
232 * also be used for purposes internal to the Input Method Context.
234 * @param ctx An #Ecore_IMF_Context.
235 * @param window The client window. This may be NULL to indicate
236 * that the previous client window no longer exists.
237 * @ingroup Ecore_IMF_Context_Group
240 ecore_imf_context_client_window_set(Ecore_IMF_Context *ctx, void *window)
242 if (!ECORE_MAGIC_CHECK(ctx, ECORE_MAGIC_CONTEXT))
244 ECORE_MAGIC_FAIL(ctx, ECORE_MAGIC_CONTEXT,
245 "ecore_imf_context_client_window_set");
248 if (ctx->klass->client_window_set) ctx->klass->client_window_set(ctx, window);
252 * Set the client canvas for the Input Method Context; this is the
253 * canvas in which the input appears.
254 * The canvas type can be determined by using the context canvas type.
255 * Actually only canvas with type "evas" (Evas *) is supported.
256 * This canvas may be used in order to correctly position status windows, and may
257 * also be used for purposes internal to the Input Method Context.
259 * @param ctx An #Ecore_IMF_Context.
260 * @param canas The client canvas. This may be NULL to indicate
261 * that the previous client canvas no longer exists.
262 * @ingroup Ecore_IMF_Context_Group
265 ecore_imf_context_client_canvas_set(Ecore_IMF_Context *ctx, void *canvas)
267 if (!ECORE_MAGIC_CHECK(ctx, ECORE_MAGIC_CONTEXT))
269 ECORE_MAGIC_FAIL(ctx, ECORE_MAGIC_CONTEXT,
270 "ecore_imf_context_client_window_set");
273 if (ctx->klass->client_canvas_set) ctx->klass->client_canvas_set(ctx, canvas);
277 * Ask the Input Method Context to show itself.
279 * @param ctx An #Ecore_IMF_Context.
280 * @ingroup Ecore_IMF_Context_Group
283 ecore_imf_context_show(Ecore_IMF_Context *ctx)
285 if (!ECORE_MAGIC_CHECK(ctx, ECORE_MAGIC_CONTEXT))
287 ECORE_MAGIC_FAIL(ctx, ECORE_MAGIC_CONTEXT,
288 "ecore_imf_context_show");
291 if (ctx->klass->show) ctx->klass->show(ctx);
295 * Ask the Input Method Context to hide itself.
297 * @param ctx An #Ecore_IMF_Context.
298 * @ingroup Ecore_IMF_Context_Group
301 ecore_imf_context_hide(Ecore_IMF_Context *ctx)
303 if (!ECORE_MAGIC_CHECK(ctx, ECORE_MAGIC_CONTEXT))
305 ECORE_MAGIC_FAIL(ctx, ECORE_MAGIC_CONTEXT,
306 "ecore_imf_context_hide");
309 if (ctx->klass->hide) ctx->klass->hide(ctx);
313 * Retrieve the current preedit string and cursor position
314 * for the Input Method Context.
316 * @param ctx An #Ecore_IMF_Context.
317 * @param str Location to store the retrieved string. The
318 * string retrieved must be freed with free().
319 * @param cursor_pos Location to store position of cursor (in characters)
320 * within the preedit string.
321 * @ingroup Ecore_IMF_Context_Group
324 ecore_imf_context_preedit_string_get(Ecore_IMF_Context *ctx, char **str, int *cursor_pos)
326 if (!ECORE_MAGIC_CHECK(ctx, ECORE_MAGIC_CONTEXT))
328 ECORE_MAGIC_FAIL(ctx, ECORE_MAGIC_CONTEXT,
329 "ecore_imf_context_preedit_string_get");
332 if (ctx->klass->preedit_string_get)
333 ctx->klass->preedit_string_get(ctx, str, cursor_pos);
336 if (str) *str = strdup("");
337 if (cursor_pos) *cursor_pos = 0;
342 * Notify the Input Method Context that the widget to which its
343 * correspond has gained focus.
345 * @param ctx An #Ecore_IMF_Context.
346 * @ingroup Ecore_IMF_Context_Group
349 ecore_imf_context_focus_in(Ecore_IMF_Context *ctx)
351 if (!ECORE_MAGIC_CHECK(ctx, ECORE_MAGIC_CONTEXT))
353 ECORE_MAGIC_FAIL(ctx, ECORE_MAGIC_CONTEXT,
354 "ecore_imf_context_focus_in");
357 if (ctx->klass->focus_in) ctx->klass->focus_in(ctx);
361 * Notify the Input Method Context that the widget to which its
362 * correspond has lost focus.
364 * @param ctx An #Ecore_IMF_Context.
365 * @ingroup Ecore_IMF_Context_Group
368 ecore_imf_context_focus_out(Ecore_IMF_Context *ctx)
370 if (!ECORE_MAGIC_CHECK(ctx, ECORE_MAGIC_CONTEXT))
372 ECORE_MAGIC_FAIL(ctx, ECORE_MAGIC_CONTEXT,
373 "ecore_imf_context_focus_out");
376 if (ctx->klass->focus_out) ctx->klass->focus_out(ctx);
380 * Notify the Input Method Context that a change such as a
381 * change in cursor position has been made. This will typically
382 * cause the Input Method Context to clear the preedit state.
384 * @param ctx An #Ecore_IMF_Context.
385 * @ingroup Ecore_IMF_Context_Group
388 ecore_imf_context_reset(Ecore_IMF_Context *ctx)
390 if (!ECORE_MAGIC_CHECK(ctx, ECORE_MAGIC_CONTEXT))
392 ECORE_MAGIC_FAIL(ctx, ECORE_MAGIC_CONTEXT,
393 "ecore_imf_context_reset");
396 if (ctx->klass->reset) ctx->klass->reset(ctx);
400 * Notify the Input Method Context that a change in the cursor
401 * position has been made.
403 * @param ctx An #Ecore_IMF_Context.
404 * @param cursor_pos New cursor position in characters.
405 * @ingroup Ecore_IMF_Context_Group
408 ecore_imf_context_cursor_position_set(Ecore_IMF_Context *ctx, int cursor_pos)
410 if (!ECORE_MAGIC_CHECK(ctx, ECORE_MAGIC_CONTEXT))
412 ECORE_MAGIC_FAIL(ctx, ECORE_MAGIC_CONTEXT,
413 "ecore_imf_context_cursor_position_set");
416 if (ctx->klass->cursor_position_set) ctx->klass->cursor_position_set(ctx, cursor_pos);
420 * Set whether the IM context should use the preedit string
421 * to display feedback. If @use_preedit is 0 (default
422 * is 1), then the IM context may use some other method to display
423 * feedback, such as displaying it in a child of the root window.
425 * @param ctx An #Ecore_IMF_Context.
426 * @param use_preedit Whether the IM context should use the preedit string.
427 * @ingroup Ecore_IMF_Context_Group
430 ecore_imf_context_use_preedit_set(Ecore_IMF_Context *ctx, int use_preedit)
432 if (!ECORE_MAGIC_CHECK(ctx, ECORE_MAGIC_CONTEXT))
434 ECORE_MAGIC_FAIL(ctx, ECORE_MAGIC_CONTEXT,
435 "ecore_imf_context_use_preedit_set");
438 if (ctx->klass->use_preedit_set) ctx->klass->use_preedit_set(ctx, use_preedit);
442 * Set the callback to be used on get_surrounding request.
444 * This callback will be called when the Input Method Context
445 * module requests the surrounding context.
447 * @param ctx An #Ecore_IMF_Context.
448 * @param func The callback to be called.
449 * @param data The data pointer to be passed to @p func
450 * @ingroup Ecore_IMF_Context_Group
453 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)
455 if (!ECORE_MAGIC_CHECK(ctx, ECORE_MAGIC_CONTEXT))
457 ECORE_MAGIC_FAIL(ctx, ECORE_MAGIC_CONTEXT,
458 "ecore_imf_context_retrieve_surrounding_callback_set");
462 ctx->retrieve_surrounding_func = func;
463 ctx->retrieve_surrounding_data = (void *) data;
467 * Set the input mode used by the Ecore Input Context.
469 * The input mode can be one of the input modes defined in
470 * #Ecore_IMF_Input_Mode. The default input mode is
471 * ECORE_IMF_INPUT_MODE_FULL.
473 * @param ctx An #Ecore_IMF_Context.
474 * @param input_mode The input mode to be used by @p ctx.
475 * @ingroup Ecore_IMF_Context_Group
478 ecore_imf_context_input_mode_set(Ecore_IMF_Context *ctx, Ecore_IMF_Input_Mode input_mode)
480 if (!ECORE_MAGIC_CHECK(ctx, ECORE_MAGIC_CONTEXT))
482 ECORE_MAGIC_FAIL(ctx, ECORE_MAGIC_CONTEXT,
483 "ecore_imf_context_input_mode_set");
486 if (ctx->klass->input_mode_set) ctx->klass->input_mode_set(ctx, input_mode);
487 ctx->input_mode = input_mode;
491 * Get the input mode being used by the Ecore Input Context.
493 * See @ref ecore_imf_context_input_mode_set for more details.
495 * @param ctx An #Ecore_IMF_Context.
496 * @return The input mode being used by @p ctx.
497 * @ingroup Ecore_IMF_Context_Group
499 EAPI Ecore_IMF_Input_Mode
500 ecore_imf_context_input_mode_get(Ecore_IMF_Context *ctx)
502 if (!ECORE_MAGIC_CHECK(ctx, ECORE_MAGIC_CONTEXT))
504 ECORE_MAGIC_FAIL(ctx, ECORE_MAGIC_CONTEXT,
505 "ecore_imf_context_input_mode_set");
508 return ctx->input_mode;
512 * Allow an Ecore Input Context to internally handle an event.
513 * If this function returns 1, then no further processing
514 * should be done for this event.
516 * Input methods must be able to accept all types of events (simply
517 * returning 0 if the event was not handled), but there is no
518 * obligation of any events to be submitted to this function.
520 * @param ctx An #Ecore_IMF_Context.
521 * @param type The type of event defined by #Ecore_IMF_Event_Type.
522 * @param event The event itself.
523 * @return 1 if the event was handled; otherwise 0.
524 * @ingroup Ecore_IMF_Context_Group
527 ecore_imf_context_filter_event(Ecore_IMF_Context *ctx, Ecore_IMF_Event_Type type, Ecore_IMF_Event *event)
529 if (!ECORE_MAGIC_CHECK(ctx, ECORE_MAGIC_CONTEXT))
531 ECORE_MAGIC_FAIL(ctx, ECORE_MAGIC_CONTEXT,
532 "ecore_imf_context_filter_event");
535 if (ctx->klass->filter_event) return ctx->klass->filter_event(ctx, type, event);
540 * @defgroup Ecore_IMF_Context_Module_Group Ecore Input Method Context Module Functions
542 * Functions that should be used by Ecore Input Method Context modules.
546 * Creates a new Input Method Context with klass specified by @p ctxc.
548 * This method should be used by modules implementing the Input
549 * Method Context interface.
551 * @param ctxc An #Ecore_IMF_Context_Class.
552 * @return A new #Ecore_IMF_Context; on failure it returns NULL.
553 * @ingroup Ecore_IMF_Context_Module_Group
555 EAPI Ecore_IMF_Context *
556 ecore_imf_context_new(const Ecore_IMF_Context_Class *ctxc)
558 Ecore_IMF_Context *ctx;
560 if (!ctxc) return NULL;
561 ctx = malloc(sizeof(Ecore_IMF_Context));
562 if (!ctx) return NULL;
563 ECORE_MAGIC_SET(ctx, ECORE_MAGIC_CONTEXT);
566 ctx->retrieve_surrounding_func = NULL;
567 ctx->retrieve_surrounding_data = NULL;
572 * Set the Input Method Context specific data.
574 * Note that this method should be used by modules to set
575 * the Input Method Context specific data and it's not meant to
576 * be used by applications to store application specific data.
578 * @param ctx An #Ecore_IMF_Context.
579 * @param data The Input Method Context specific data.
580 * @return A new #Ecore_IMF_Context; on failure it returns NULL.
581 * @ingroup Ecore_IMF_Context_Module_Group
584 ecore_imf_context_data_set(Ecore_IMF_Context *ctx, void *data)
586 if (!ECORE_MAGIC_CHECK(ctx, ECORE_MAGIC_CONTEXT))
588 ECORE_MAGIC_FAIL(ctx, ECORE_MAGIC_CONTEXT,
589 "ecore_imf_context_data_set");
596 * Get the Input Method Context specific data.
598 * See @ref ecore_imf_context_data_set for more details.
600 * @param ctx An #Ecore_IMF_Context.
601 * @return The Input Method Context specific data.
602 * @ingroup Ecore_IMF_Context_Module_Group
604 EAPI void *ecore_imf_context_data_get(Ecore_IMF_Context *ctx)
606 if (!ECORE_MAGIC_CHECK(ctx, ECORE_MAGIC_CONTEXT))
608 ECORE_MAGIC_FAIL(ctx, ECORE_MAGIC_CONTEXT,
609 "ecore_imf_context_data_get");
616 * Retrieve context around insertion point.
618 * This function is implemented by calling the
619 * Ecore_IMF_Context::retrieve_surrounding_func (
620 * set using #ecore_imf_context_retrieve_surrounding_callback_set).
622 * There is no obligation for a widget to respond to the
623 * ::retrieve_surrounding_func, so input methods must be prepared
624 * to function without context.
626 * @param ctx An #Ecore_IMF_Context.
627 * @param text Location to store a UTF-8 encoded string of text
628 * holding context around the insertion point.
629 * If the function returns 1, then you must free
630 * the result stored in this location with free().
631 * @param cursor_pos Location to store the position in characters of
632 * the insertion cursor within @text.
633 * @return 1 if surrounding text was provided; otherwise 0.
634 * @ingroup Ecore_IMF_Context_Module_Group
637 ecore_imf_context_surrounding_get(Ecore_IMF_Context *ctx, char **text, int *cursor_pos)
641 if (!ECORE_MAGIC_CHECK(ctx, ECORE_MAGIC_CONTEXT))
643 ECORE_MAGIC_FAIL(ctx, ECORE_MAGIC_CONTEXT,
644 "ecore_imf_context_surrounding_get");
648 if (ctx->retrieve_surrounding_func)
650 result = ctx->retrieve_surrounding_func(ctx->retrieve_surrounding_data, ctx, text, cursor_pos);
653 if (text) *text = NULL;
654 if (cursor_pos) *cursor_pos = 0;
661 _ecore_imf_event_free_preedit(void *data __UNUSED__, void *event)
667 * Adds ECORE_IMF_EVENT_PREEDIT_START to the event queue.
669 * @param ctx An #Ecore_IMF_Context.
670 * @ingroup Ecore_IMF_Context_Module_Group
673 ecore_imf_context_preedit_start_event_add(Ecore_IMF_Context *ctx)
675 Ecore_IMF_Event_Commit *ev;
677 if (!ECORE_MAGIC_CHECK(ctx, ECORE_MAGIC_CONTEXT))
679 ECORE_MAGIC_FAIL(ctx, ECORE_MAGIC_CONTEXT,
680 "ecore_imf_context_preedit_start_event_add");
684 ev = malloc(sizeof(Ecore_IMF_Event_Preedit_Start));
686 ecore_event_add(ECORE_IMF_EVENT_PREEDIT_START,
687 ev, _ecore_imf_event_free_preedit, NULL);
691 * Adds ECORE_IMF_EVENT_PREEDIT_END to the event queue.
693 * @param ctx An #Ecore_IMF_Context.
694 * @ingroup Ecore_IMF_Context_Module_Group
697 ecore_imf_context_preedit_end_event_add(Ecore_IMF_Context *ctx)
699 Ecore_IMF_Event_Commit *ev;
701 if (!ECORE_MAGIC_CHECK(ctx, ECORE_MAGIC_CONTEXT))
703 ECORE_MAGIC_FAIL(ctx, ECORE_MAGIC_CONTEXT,
704 "ecore_imf_context_preedit_end_event_add");
708 ev = malloc(sizeof(Ecore_IMF_Event_Preedit_End));
710 ecore_event_add(ECORE_IMF_EVENT_PREEDIT_END,
711 ev, _ecore_imf_event_free_preedit, NULL);
715 * Adds ECORE_IMF_EVENT_PREEDIT_CHANGED to the event queue.
717 * @param ctx An #Ecore_IMF_Context.
718 * @ingroup Ecore_IMF_Context_Module_Group
721 ecore_imf_context_preedit_changed_event_add(Ecore_IMF_Context *ctx)
723 Ecore_IMF_Event_Commit *ev;
725 if (!ECORE_MAGIC_CHECK(ctx, ECORE_MAGIC_CONTEXT))
727 ECORE_MAGIC_FAIL(ctx, ECORE_MAGIC_CONTEXT,
728 "ecore_imf_context_preedit_changed_event_add");
732 ev = malloc(sizeof(Ecore_IMF_Event_Preedit_Changed));
734 ecore_event_add(ECORE_IMF_EVENT_PREEDIT_CHANGED,
735 ev, _ecore_imf_event_free_preedit, NULL);
739 _ecore_imf_event_free_commit(void *data __UNUSED__, void *event)
741 Ecore_IMF_Event_Commit *ev;
744 if (ev->str) free(ev->str);
749 * Adds ECORE_IMF_EVENT_COMMIT to the event queue.
751 * @param ctx An #Ecore_IMF_Context.
752 * @param str The committed string.
753 * @ingroup Ecore_IMF_Context_Module_Group
756 ecore_imf_context_commit_event_add(Ecore_IMF_Context *ctx, const char *str)
758 Ecore_IMF_Event_Commit *ev;
760 if (!ECORE_MAGIC_CHECK(ctx, ECORE_MAGIC_CONTEXT))
762 ECORE_MAGIC_FAIL(ctx, ECORE_MAGIC_CONTEXT,
763 "ecore_imf_context_commit_event_add");
767 ev = malloc(sizeof(Ecore_IMF_Event_Commit));
769 ev->str = str ? strdup(str) : NULL;
770 ecore_event_add(ECORE_IMF_EVENT_COMMIT,
771 ev, _ecore_imf_event_free_commit, NULL);
776 _ecore_imf_event_free_delete_surrounding(void *data __UNUSED__, void *event)
782 * Adds ECORE_IMF_EVENT_DELETE_SURROUNDING to the event queue.
784 * @param ctx An #Ecore_IMF_Context.
785 * @param offset The start offset of surrounding to be deleted.
786 * @param n_chars The number of characters to be deleted.
787 * @ingroup Ecore_IMF_Context_Module_Group
790 ecore_imf_context_delete_surrounding_event_add(Ecore_IMF_Context *ctx, int offset, int n_chars)
792 Ecore_IMF_Event_Delete_Surrounding *ev;
794 if (!ECORE_MAGIC_CHECK(ctx, ECORE_MAGIC_CONTEXT))
796 ECORE_MAGIC_FAIL(ctx, ECORE_MAGIC_CONTEXT,
797 "ecore_imf_context_delete_surrounding_event_add");
801 ev = malloc(sizeof(Ecore_IMF_Event_Delete_Surrounding));
804 ev->n_chars = n_chars;
805 ecore_event_add(ECORE_IMF_EVENT_DELETE_SURROUNDING,
806 ev, _ecore_imf_event_free_delete_surrounding, NULL);