if (input_method->resource)
{
- if (!(context = E_NEW(E_Input_Method_Context, 1)))
- {
- wl_client_post_no_memory(client);
- ERR("Could not allocate space for Input_Method_Context");
- return;
- }
-
if (!ecore_key_down_handler)
ecore_key_down_handler = ecore_event_handler_prepend(ECORE_EVENT_KEY_DOWN,
- _e_mod_ecore_key_down_cb,
- NULL);
+ _e_mod_ecore_key_down_cb,
+ NULL);
- context->resource =
- wl_resource_create(wl_resource_get_client(input_method->resource),
- &zwp_input_method_context_v1_interface, 1, 0);
-
- if (context->resource)
- wl_resource_set_implementation(context->resource,
- &_e_text_input_method_context_implementation,
- context, _e_text_input_method_context_cb_resource_destroy);
+ context = create_input_method_context(client, input_method);
+ EINA_SAFETY_ON_NULL_GOTO(context, err);
context->input = text_input;
- context->input_method = input_method;
- input_method->context = context;
if (context->resource)
{