3 #include "e_mod_main.h"
4 #include <text-server-protocol.h>
5 #include <input-method-server-protocol.h>
7 #include <vconf-keys.h>
11 #include <system_info.h>
16 #define LOG_TAG "WL_TEXTINPUT"
18 #define WTI_WARNING(resource, code, msg) (_e_text_input_log_show((resource), (code), (msg), __func__))
20 tizen_profile_t _get_tizen_profile()
22 static tizen_profile_t profile = TIZEN_PROFILE_UNKNOWN;
23 if (__builtin_expect(profile != TIZEN_PROFILE_UNKNOWN, 1))
27 system_info_get_platform_string("http://tizen.org/feature/profile", &profileName);
32 profile = TIZEN_PROFILE_MOBILE;
36 profile = TIZEN_PROFILE_WEARABLE;
40 profile = TIZEN_PROFILE_TV;
44 profile = TIZEN_PROFILE_IVI;
46 default: // common or unknown ==> ALL ARE COMMON.
47 profile = TIZEN_PROFILE_COMMON;
54 static Eina_Bool _e_text_input_method_context_cb_client_resize(void *data EINA_UNUSED, int type, void *event);
55 static void set_soft_keyboard_mode();
57 typedef struct _E_Text_Input E_Text_Input;
58 typedef struct _E_Text_Input_Mgr E_Text_Input_Mgr;
59 typedef struct _E_Input_Method E_Input_Method;
60 typedef struct _E_Input_Method_Context E_Input_Method_Context;
61 typedef struct _E_Mod_Text_Input_Shutdown_Cb E_Mod_Text_Input_Shutdown_Cb;
65 struct wl_resource *resource;
67 Eina_List *input_methods;
68 Eina_Bool input_panel_visibile;
72 struct _E_Text_Input_Mgr
74 struct wl_global *global;
75 struct wl_resource *resource;
77 Eina_List *text_input_list;
80 struct _E_Input_Method
82 struct wl_global *global;
83 struct wl_resource *resource;
86 E_Input_Method_Context *context;
89 struct _E_Input_Method_Context
91 struct wl_resource *resource;
94 E_Input_Method *input_method;
96 #if ENABLE_GRAB_KEYBOARD
99 struct wl_resource *resource;
102 struct xkb_keymap *keymap;
103 struct xkb_state *state;
104 xkb_mod_mask_t mod_depressed, mod_latched, mod_locked;
105 xkb_layout_index_t mod_group;
111 struct _E_Mod_Text_Input_Shutdown_Cb
113 void (*func)(void *data);
117 /* This represents the overall input panel's state including the candidate area */
118 enum _E_Input_Panel_State
120 E_INPUT_PANEL_STATE_DID_HIDE,
121 E_INPUT_PANEL_STATE_WILL_HIDE,
122 E_INPUT_PANEL_STATE_DID_SHOW,
123 E_INPUT_PANEL_STATE_WILL_SHOW,
126 static E_Input_Method *g_input_method = NULL;
127 static E_Text_Input *g_text_input = NULL;
128 static struct wl_client *g_client = NULL;
129 static Eina_List *shutdown_list = NULL;
130 static Eina_Bool g_disable_show_panel = EINA_FALSE;
131 static Eeze_Udev_Watch *eeze_udev_watch_hander = NULL;
132 static Ecore_Event_Handler *ecore_key_down_handler = NULL;
133 static Eina_List *handlers = NULL;
134 static uint32_t g_text_input_count = 1;
135 static Ecore_Timer *g_timer_will_hide = NULL;
136 static enum _E_Input_Panel_State g_input_panel_state = E_INPUT_PANEL_STATE_DID_HIDE;
137 static E_Client *client_surface_ec = NULL;
138 static E_Text_Input *g_show_text_input = NULL;
139 static struct wl_client *g_show_client = NULL;
140 static Eina_Bool g_updated_geometry = EINA_FALSE;
142 /* The candidate's show state that was requested by the application or IME */
143 static Eina_Bool g_show_state_candidate = EINA_FALSE;
145 static Eina_List *hooks_ec = NULL;
147 const int WILL_HIDE_TIMER_INTERVAL = 1.0f;
149 #undef E_CLIENT_HOOK_APPEND
150 #define E_CLIENT_HOOK_APPEND(l, t, cb, d) \
154 _h = e_client_hook_add(t, cb, d); \
156 l = eina_list_append(l, _h); \
160 static void _e_text_input_cb_input_panel_show(struct wl_client *client, struct wl_resource *resource);
161 static void _e_text_input_deactivate(E_Text_Input *text_input, E_Input_Method *input_method, Eina_Bool need_focus_in);
162 static Eina_Bool _e_text_input_method_create_context(struct wl_client *client, E_Input_Method *input_method, E_Text_Input *text_input, Eina_Bool need_focus_out);
165 e_text_input_client_surface_get(void)
167 return client_surface_ec;
171 _e_text_input_log_show(struct wl_resource *resource, uint32_t code, const char *msg, const char *warning_msg)
173 LOGE("%s() is failed. msg : %s\n", warning_msg, msg);
177 _e_text_input_send_input_panel_geometry(struct wl_resource *resource, int x, int y, int w, int h)
182 if (client_surface_ec)
184 angle = client_surface_ec->e.state.rot.ang.next < 0 ?
185 client_surface_ec->e.state.rot.ang.curr :
186 client_surface_ec->e.state.rot.ang.next;
188 LOGD("curr : %d, next : %d, angle : %d\n", client_surface_ec->e.state.rot.ang.curr,
189 client_surface_ec->e.state.rot.ang.next, angle);
192 snprintf(geometry, sizeof(geometry), "%d,%d,%d,%d", x, y, w, h);
198 vconf_set_str(VCONFKEY_ISF_IME_RECENT_LAND_GEOMETRY, geometry);
201 vconf_set_str(VCONFKEY_ISF_IME_RECENT_PORT_GEOMETRY, geometry);
205 LOGD("angle : %d, x : %d, y : %d, w : %d, h : %d\n", angle, x, y, w, h);
207 wl_text_input_send_input_panel_geometry(resource, x, y, w, h);
211 _will_hide_timer_handler(void *data)
213 INF("TIMED OUT while waiting for WILL_HIDE_ACK : %d", g_input_panel_state);
214 if (g_input_panel_state == E_INPUT_PANEL_STATE_WILL_HIDE)
216 e_input_panel_visibility_change(EINA_FALSE);
217 e_input_panel_transient_for_set(NULL);
218 g_input_panel_state = E_INPUT_PANEL_STATE_DID_HIDE;
221 if (g_timer_will_hide)
223 ecore_timer_del(g_timer_will_hide);
224 g_timer_will_hide = NULL;
227 return ECORE_CALLBACK_CANCEL;
231 _input_panel_hide(struct wl_client *client, struct wl_resource *resource, Eina_Bool force_hide)
233 E_Text_Input *text_input = wl_resource_get_user_data(resource);
234 E_Input_Method *input_method = NULL;
235 Eina_Bool _context_created = EINA_FALSE;
241 WTI_WARNING(resource,
242 WL_DISPLAY_ERROR_INVALID_OBJECT,
243 "No Text Input For Resource");
247 text_input->input_panel_visibile = EINA_FALSE;
249 if (text_input->resource)
251 wl_text_input_send_input_panel_geometry(text_input->resource, 0, 0, 0, 0);
252 wl_text_input_send_input_panel_state(text_input->resource, WL_TEXT_INPUT_INPUT_PANEL_STATE_HIDE);
257 e_input_panel_visibility_change(EINA_FALSE);
258 e_input_panel_transient_for_set(NULL);
259 g_input_panel_state = E_INPUT_PANEL_STATE_DID_HIDE;
263 g_input_panel_state = E_INPUT_PANEL_STATE_WILL_HIDE;
264 /* Temporarily sending private command, will need for a new wayland protocol */
265 if (text_input->resource)
266 wl_text_input_send_private_command(text_input->resource, 0, "CONFORMANT_RESET");
268 if (g_timer_will_hide)
270 ecore_timer_del(g_timer_will_hide);
271 g_timer_will_hide = NULL;
274 zone = e_zone_current_get();
275 if (zone && (zone->display_state == E_ZONE_DISPLAY_STATE_OFF))
278 timeout = WILL_HIDE_TIMER_INTERVAL;
279 g_timer_will_hide = ecore_timer_add(timeout, _will_hide_timer_handler, NULL);
282 if (g_input_method && g_input_method->resource)
283 input_method = wl_resource_get_user_data(g_input_method->resource);
286 If input_method->context is already deleted, create context struct again to send input_panel_hide event to Input Method(IME) correctly.
287 Because input_panel_hide event can be called after focus_out(deactivate) by application.
288 And Input Method(IME) should know the state of their own input_panel to manage their resource when the input_panel is hidden.
291 ((!input_method->context) || (!input_method->context->resource)))
292 _context_created = _e_text_input_method_create_context(client, input_method, text_input, EINA_FALSE);
294 if (input_method && input_method->resource && input_method->context && input_method->context->resource)
295 wl_input_method_send_hide_input_panel(input_method->resource, input_method->context->resource);
297 if (_context_created)
298 _e_text_input_deactivate(text_input, input_method, EINA_FALSE);
300 e_input_panel_wait_update_set(EINA_FALSE);
302 /* When the input panel suface is hidden, the candidate will hide too */
303 g_show_state_candidate = EINA_FALSE;
307 _keyboard_mode_changed_cb(keynode_t *key, void* data)
309 bool val = vconf_keynode_get_bool(key);
310 LOGD("keyboard mode : %d\n", val);
314 #ifdef SUPPORT_CANDIDATE_ONEWINDOW
315 /* Switching to S/W keyboard mode, hide input panel since it could be displaying candidate only */
316 if (g_disable_show_panel && g_text_input && g_text_input->resource && g_client)
317 _input_panel_hide(g_client, g_text_input->resource, EINA_FALSE);
319 g_disable_show_panel = EINA_FALSE;
323 #ifdef SUPPORT_CANDIDATE_ONEWINDOW
324 /* Switching to H/W keyboard mode, hide input panel only if there is no candidate */
325 if (!g_show_state_candidate && g_text_input && g_text_input->resource && g_client)
327 if (g_text_input && g_text_input->resource && g_client)
329 _input_panel_hide(g_client, g_text_input->resource, EINA_FALSE);
331 g_disable_show_panel = EINA_TRUE;
336 #if ENABLE_GRAB_KEYBOARD
338 _e_text_input_method_context_keyboard_grab_keyboard_state_update(E_Input_Method_Context *context, uint32_t keycode, Eina_Bool pressed)
340 enum xkb_key_direction dir;
342 if (!context->kbd.state) return;
344 if (pressed) dir = XKB_KEY_DOWN;
345 else dir = XKB_KEY_UP;
347 context->kbd.mod_changed =
348 xkb_state_update_key(context->kbd.state, keycode + 8, dir);
352 _e_text_input_method_context_keyboard_grab_keyboard_modifiers_update(E_Input_Method_Context *context, struct wl_resource *keyboard)
356 if (!context->input) return;
357 if (!context->kbd.state) return;
359 context->kbd.mod_depressed =
360 xkb_state_serialize_mods(context->kbd.state, XKB_STATE_DEPRESSED);
361 context->kbd.mod_latched =
362 xkb_state_serialize_mods(context->kbd.state, XKB_STATE_MODS_LATCHED);
363 context->kbd.mod_locked =
364 xkb_state_serialize_mods(context->kbd.state, XKB_STATE_MODS_LOCKED);
365 context->kbd.mod_group =
366 xkb_state_serialize_layout(context->kbd.state, XKB_STATE_LAYOUT_EFFECTIVE);
368 serial = wl_display_next_serial(e_comp_wl->wl.disp);
369 wl_keyboard_send_modifiers(keyboard, serial,
370 context->kbd.mod_depressed,
371 context->kbd.mod_latched,
372 context->kbd.mod_locked,
373 context->kbd.mod_group);
377 _e_text_input_method_context_key_send(E_Input_Method_Context *context, unsigned int keycode, unsigned int timestamp, enum wl_keyboard_key_state state)
381 if (!context->input) return;
384 /* update modifier state */
385 _e_text_input_method_context_keyboard_grab_keyboard_state_update(context, nk, state == WL_KEYBOARD_KEY_STATE_PRESSED);
387 serial = wl_display_next_serial(e_comp_wl->wl.disp);
389 wl_keyboard_send_key(context->kbd.resource, serial, timestamp, nk, state);
390 if (context->kbd.mod_changed)
392 _e_text_input_method_context_keyboard_grab_keyboard_modifiers_update(context, context->kbd.resource);
393 context->kbd.mod_changed = 0;
398 _e_text_input_method_context_ecore_cb_key_down(void *data, int ev_type EINA_UNUSED, Ecore_Event_Key *ev)
400 E_Input_Method_Context *context = data;
402 _e_text_input_method_context_key_send(context, ev->keycode, ev->timestamp,
403 WL_KEYBOARD_KEY_STATE_PRESSED);
405 return ECORE_CALLBACK_RENEW;
409 _e_text_input_method_context_ecore_cb_key_up(void *data, int ev_type EINA_UNUSED, Ecore_Event_Key *ev)
411 E_Input_Method_Context *context = data;
413 _e_text_input_method_context_key_send(context, ev->keycode, ev->timestamp,
414 WL_KEYBOARD_KEY_STATE_RELEASED);
416 return ECORE_CALLBACK_RENEW;
420 _e_text_input_method_context_grab_set(E_Input_Method_Context *context, Eina_Bool set)
422 if (set == context->kbd.grabbed)
428 context->kbd.grabbed = set;
432 if (context->kbd.keymap) xkb_map_unref(context->kbd.keymap);
433 if (context->kbd.state) xkb_state_unref(context->kbd.state);
434 context->kbd.keymap = xkb_map_ref(e_comp_wl->xkb.keymap);
435 context->kbd.state = xkb_state_new(e_comp_wl->xkb.keymap);
436 E_LIST_HANDLER_APPEND(context->kbd.handlers, ECORE_EVENT_KEY_DOWN,
437 _e_text_input_method_context_ecore_cb_key_down,
439 E_LIST_HANDLER_APPEND(context->kbd.handlers, ECORE_EVENT_KEY_UP,
440 _e_text_input_method_context_ecore_cb_key_up,
443 e_comp_grab_input(0, 1);
447 E_FREE_LIST(context->kbd.handlers, ecore_event_handler_del);
449 e_comp_ungrab_input(0, 1);
451 if (context->kbd.keymap)
453 xkb_map_unref(context->kbd.keymap);
454 context->kbd.keymap = NULL;
457 if (context->kbd.state)
459 xkb_state_unref(context->kbd.state);
460 context->kbd.state = NULL;
467 _e_mod_text_input_shutdown_cb_add(void (*func)(void *data), void *data)
469 E_Mod_Text_Input_Shutdown_Cb *cb;
471 if (!(cb = E_NEW(E_Mod_Text_Input_Shutdown_Cb, 1)))
473 ERR("Could not allocate space for Text Input Shutdown Callback");
480 shutdown_list = eina_list_append(shutdown_list, cb);
484 _e_text_input_method_context_cb_destroy(struct wl_client *client EINA_UNUSED, struct wl_resource *resource)
486 wl_resource_destroy(resource);
490 _e_text_input_method_context_cb_string_commit(struct wl_client *client EINA_UNUSED, struct wl_resource *resource, uint32_t serial, const char *text)
492 E_Input_Method_Context *context = wl_resource_get_user_data(resource);
496 WTI_WARNING(resource,
497 WL_DISPLAY_ERROR_INVALID_OBJECT,
498 "No Input Method Context For Resource");
502 if ((context->input) && (context->input->resource))
503 wl_text_input_send_commit_string(context->input->resource,
508 _e_text_input_method_context_cb_preedit_string(struct wl_client *client EINA_UNUSED, struct wl_resource *resource, uint32_t serial, const char *text, const char *commit)
510 E_Input_Method_Context *context = wl_resource_get_user_data(resource);
514 WTI_WARNING(resource,
515 WL_DISPLAY_ERROR_INVALID_OBJECT,
516 "No Input Method Context For Resource");
520 if ((context->input) && (context->input->resource))
521 wl_text_input_send_preedit_string(context->input->resource,
522 serial, text, commit);
526 _e_text_input_method_context_cb_recapture_string(struct wl_client *client EINA_UNUSED, struct wl_resource *resource, uint32_t serial, int32_t index, uint32_t length, const char *preedit, const char *preedit_commit, const char *commit)
528 E_Input_Method_Context *context = wl_resource_get_user_data(resource);
532 WTI_WARNING(resource,
533 WL_DISPLAY_ERROR_INVALID_OBJECT,
534 "No Input Method Context For Resource");
538 if ((context->input) && (context->input->resource))
539 wl_text_input_send_recapture_string(context->input->resource,
540 serial, index, length, preedit, preedit_commit, commit);
544 _e_text_input_method_context_cb_preedit_styling(struct wl_client *client EINA_UNUSED, struct wl_resource *resource, uint32_t index, uint32_t length, uint32_t style)
546 E_Input_Method_Context *context = wl_resource_get_user_data(resource);
550 WTI_WARNING(resource,
551 WL_DISPLAY_ERROR_INVALID_OBJECT,
552 "No Input Method Context For Resource");
556 if ((context->input) && (context->input->resource))
557 wl_text_input_send_preedit_styling(context->input->resource,
558 index, length, style);
562 _e_text_input_method_context_cb_preedit_cursor(struct wl_client *client EINA_UNUSED, struct wl_resource *resource, int32_t cursor)
564 E_Input_Method_Context *context = wl_resource_get_user_data(resource);
568 WTI_WARNING(resource,
569 WL_DISPLAY_ERROR_INVALID_OBJECT,
570 "No Input Method Context For Resource");
574 if ((context->input) && (context->input->resource))
575 wl_text_input_send_preedit_cursor(context->input->resource,
580 _e_text_input_method_context_cb_surrounding_text_delete(struct wl_client *client EINA_UNUSED, struct wl_resource *resource, int32_t index, uint32_t length)
582 E_Input_Method_Context *context = wl_resource_get_user_data(resource);
586 WTI_WARNING(resource,
587 WL_DISPLAY_ERROR_INVALID_OBJECT,
588 "No Input Method Context For Resource");
592 if ((context->input) && (context->input->resource))
593 wl_text_input_send_delete_surrounding_text(context->input->resource,
598 _e_text_input_method_context_cb_cursor_position(struct wl_client *client EINA_UNUSED, struct wl_resource *resource, int32_t index, int32_t anchor)
600 E_Input_Method_Context *context = wl_resource_get_user_data(resource);
604 WTI_WARNING(resource,
605 WL_DISPLAY_ERROR_INVALID_OBJECT,
606 "No Input Method Context For Resource");
610 if ((context->input) && (context->input->resource))
611 wl_text_input_send_cursor_position(context->input->resource,
616 _e_text_input_method_context_cb_modifiers_map(struct wl_client *client EINA_UNUSED, struct wl_resource *resource, struct wl_array *map)
618 E_Input_Method_Context *context = wl_resource_get_user_data(resource);
622 WTI_WARNING(resource,
623 WL_DISPLAY_ERROR_INVALID_OBJECT,
624 "No Input Method Context For Resource");
628 if ((context->input) && (context->input->resource))
629 wl_text_input_send_modifiers_map(context->input->resource, map);
633 _e_keyevent_free(void *data EINA_UNUSED, void *ev)
635 Ecore_Event_Key *e = ev;
638 eina_stringshare_del(e->keyname);
641 eina_stringshare_del(e->key);
644 eina_stringshare_del(e->compose);
647 eina_stringshare_del(e->string);
653 feed_key_event(const char *keyname, const char *key, const char *string, int keycode, int state)
655 Ecore_Event_Key *e = E_NEW(Ecore_Event_Key, 1);
658 e->keyname = (char *)eina_stringshare_add(keyname);
659 e->key = (char *)eina_stringshare_add(key);
660 e->string = (char *)eina_stringshare_add(string);
661 e->compose = (char *)eina_stringshare_add(e->string);
663 e->timestamp = 0; /* For distinguishing S/W keyboard event */
665 e->keycode = keycode;
667 ecore_event_add(state ? ECORE_EVENT_KEY_DOWN : ECORE_EVENT_KEY_UP, e, _e_keyevent_free, NULL);
671 _e_text_input_method_context_cb_keysym(struct wl_client *client EINA_UNUSED, struct wl_resource *resource, uint32_t serial, uint32_t time, uint32_t sym, uint32_t state, uint32_t modifiers)
673 E_Input_Method_Context *context = wl_resource_get_user_data(resource);
677 WTI_WARNING(resource,
678 WL_DISPLAY_ERROR_INVALID_OBJECT,
679 "No Input Method Context For Resource");
683 if ((context->input) && (context->input->resource))
685 wl_text_input_send_keysym(context->input->resource,
686 serial, time, sym, state, modifiers);
690 char string[32], key[32], keyname[32];
692 memset(keyname, 0, sizeof(keyname));
693 xkb_keysym_get_name(sym, keyname, sizeof(keyname));
694 if (keyname[0] == '\0')
695 snprintf(keyname, sizeof(keyname), "Keysym-%u", sym);
697 if (strcmp(keyname, "BackSpace") == 0)
699 /* backspace key should be supported in the multibutton entry of elementary
700 even though it losts focus */
701 memset(key, 0, sizeof(key));
702 xkb_keysym_get_name(sym, key, sizeof(key));
704 memset(string, 0, sizeof(string));
705 xkb_keysym_to_utf8(sym, string, 32);
709 /* Backspace keycode (22) */
710 feed_key_event(keyname, key, string, 22, 1); /* key down */
711 feed_key_event(keyname, key, string, 22, 0); /* key up */
717 #if ENABLE_GRAB_KEYBOARD
719 _e_text_input_method_context_keyboard_grab_cb_resource_destroy(struct wl_client *client EINA_UNUSED, struct wl_resource *resource)
721 wl_resource_destroy(resource);
724 static const struct wl_keyboard_interface _e_keyboard_grab_interface =
726 _e_text_input_method_context_keyboard_grab_cb_resource_destroy
730 _e_text_input_method_context_keyboard_grab_cb_keyboard_unbind(struct wl_resource *resource)
732 E_Input_Method_Context *context = wl_resource_get_user_data(resource);
736 WTI_WARNING(resource,
737 WL_DISPLAY_ERROR_INVALID_OBJECT,
738 "No Input Method Context For Resource");
742 _e_text_input_method_context_grab_set(context, EINA_FALSE);
744 context->kbd.resource = NULL;
749 _e_text_input_method_context_cb_keyboard_grab(struct wl_client *client, struct wl_resource *resource, uint32_t id)
751 DBG("Input Method Context - grab keyboard %d", wl_resource_get_id(resource));
752 #if ENABLE_GRAB_KEYBOARD
753 E_Input_Method_Context *context = wl_resource_get_user_data(resource);
754 struct wl_resource *keyboard = NULL;
758 WTI_WARNING(resource,
759 WL_DISPLAY_ERROR_INVALID_OBJECT,
760 "No Input Method Context For Resource");
764 keyboard = wl_resource_create(client, &wl_keyboard_interface, 1, id);
767 wl_client_post_no_memory(client);
771 wl_resource_set_implementation(keyboard, &_e_keyboard_grab_interface, context, _e_text_input_method_context_keyboard_grab_cb_keyboard_unbind);
773 /* send current keymap */
774 wl_keyboard_send_keymap(keyboard, WL_KEYBOARD_KEYMAP_FORMAT_XKB_V1,
775 e_comp_wl->xkb.fd, e_comp_wl->xkb.size);
777 context->kbd.resource = keyboard;
779 _e_text_input_method_context_grab_set(context, EINA_TRUE);
784 _e_text_input_method_context_cb_key(struct wl_client *client, struct wl_resource *resource, uint32_t serial, uint32_t time, uint32_t key, uint32_t state_w)
786 DBG("Input Method Context - key %d", wl_resource_get_id(resource));
797 _e_text_input_method_context_cb_modifiers(struct wl_client *client, struct wl_resource *resource, uint32_t serial, uint32_t mods_depressed, uint32_t mods_latched, uint32_t mods_locked, uint32_t group)
799 DBG("Input Method Context - modifiers %d", wl_resource_get_id(resource));
804 (void)mods_depressed;
811 _e_text_input_method_context_cb_language(struct wl_client *client EINA_UNUSED, struct wl_resource *resource, uint32_t serial, const char *language)
813 E_Input_Method_Context *context = wl_resource_get_user_data(resource);
817 WTI_WARNING(resource,
818 WL_DISPLAY_ERROR_INVALID_OBJECT,
819 "No Input Method Context For Resource");
823 if ((context->input) && (context->input->resource))
824 wl_text_input_send_language(context->input->resource,
829 _e_text_input_method_context_cb_text_direction(struct wl_client *client EINA_UNUSED, struct wl_resource *resource, uint32_t serial, uint32_t direction)
831 E_Input_Method_Context *context = wl_resource_get_user_data(resource);
835 WTI_WARNING(resource,
836 WL_DISPLAY_ERROR_INVALID_OBJECT,
837 "No Input Method Context For Resource");
841 if ((context->input) && (context->input->resource))
842 wl_text_input_send_text_direction(context->input->resource,
847 _e_text_input_method_context_cb_selection_region(struct wl_client *client EINA_UNUSED, struct wl_resource *resource, uint32_t serial, int32_t start, int32_t end)
849 E_Input_Method_Context *context = wl_resource_get_user_data(resource);
853 WTI_WARNING(resource,
854 WL_DISPLAY_ERROR_INVALID_OBJECT,
855 "No Input Method Context For Resource");
859 if ((context->input) && (context->input->resource))
860 wl_text_input_send_selection_region(context->input->resource,
865 _e_text_input_method_context_cb_private_command(struct wl_client *client EINA_UNUSED, struct wl_resource *resource, uint32_t serial, const char *command)
867 E_Input_Method_Context *context = wl_resource_get_user_data(resource);
871 WTI_WARNING(resource,
872 WL_DISPLAY_ERROR_INVALID_OBJECT,
873 "No Input Method Context For Resource");
877 if ((context->input) && (context->input->resource))
878 wl_text_input_send_private_command(context->input->resource,
883 _e_text_input_method_context_cb_commit_content(struct wl_client *client EINA_UNUSED, struct wl_resource *resource, uint32_t serial, const char *content, const char *description, const char *mime_types)
885 E_Input_Method_Context *context = wl_resource_get_user_data(resource);
889 WTI_WARNING(resource,
890 WL_DISPLAY_ERROR_INVALID_OBJECT,
891 "No Input Method Context For Resource");
895 if ((context->input) && (context->input->resource))
896 wl_text_input_send_commit_content(context->input->resource,
897 serial, content, description, mime_types);
901 _e_text_input_method_context_cb_input_panel_event(struct wl_client *client EINA_UNUSED, struct wl_resource *resource, uint32_t serial, uint32_t event_type, uint32_t value)
903 E_Input_Method_Context *context = wl_resource_get_user_data(resource);
907 WTI_WARNING(resource,
908 WL_DISPLAY_ERROR_INVALID_OBJECT,
909 "No Input Method Context For Resource");
913 if ((context->input) && (context->input->resource))
914 wl_text_input_send_input_panel_event(context->input->resource,
915 serial, event_type, value);
919 _e_text_input_method_context_cb_update_candidate_state(struct wl_client *client EINA_UNUSED, struct wl_resource *resource, uint32_t state)
921 E_Input_Method_Context *context = wl_resource_get_user_data(resource);
925 WTI_WARNING(resource,
926 WL_DISPLAY_ERROR_INVALID_OBJECT,
927 "No Input Method Context For Resource");
931 LOGD("Candidate State : %d", state);
932 Eina_Bool prev_show_state = g_show_state_candidate;
933 g_show_state_candidate = state;
934 if (g_input_panel_state == E_INPUT_PANEL_STATE_DID_HIDE)
935 prev_show_state = EINA_FALSE;
939 /* If the candidate state has been changed to OFF when panel is not in show state, */
940 if (!g_show_state_candidate && prev_show_state && g_disable_show_panel && g_client && g_text_input)
941 _input_panel_hide(g_client, g_text_input->resource, EINA_FALSE);
945 /* If the candidate state has been changed to ON when panel is not in show state */
946 if (g_show_state_candidate && !prev_show_state && g_disable_show_panel && g_client && g_text_input)
948 _e_text_input_cb_input_panel_show(g_client, g_text_input->resource);
949 int x = 0, y = 0, w = 0, h = 0;
950 if (e_input_panel_client_geometry_get(NULL, &x, &y, &w, &h) && !(w <= 1 || h <= 1))
951 _e_text_input_send_input_panel_geometry(g_text_input->resource, x, y, w, h);
957 _e_text_input_method_context_cb_input_panel_data_update(struct wl_client *client EINA_UNUSED, struct wl_resource *resource, uint32_t serial, const char *data, uint32_t length)
959 E_Input_Method_Context *context = wl_resource_get_user_data(resource);
963 WTI_WARNING(resource,
964 WL_DISPLAY_ERROR_INVALID_OBJECT,
965 "No Input Method Context For Resource");
969 if ((context->input) && (context->input->resource))
970 wl_text_input_send_input_panel_data(context->input->resource,
971 serial, data, length);
975 _e_text_input_method_context_cb_hide_input_panel(struct wl_client *client EINA_UNUSED, struct wl_resource *resource, uint32_t serial)
977 E_Text_Input *text_input = g_text_input;
978 E_Input_Method *input_method = NULL;
982 WTI_WARNING(resource,
983 WL_DISPLAY_ERROR_INVALID_OBJECT,
984 "No Text Input For Resource");
988 text_input->input_panel_visibile = EINA_FALSE;
990 if (g_text_input && g_text_input->resource && g_client)
991 _input_panel_hide(g_client, g_text_input->resource, EINA_FALSE);
993 if (g_input_method && g_input_method->resource)
994 input_method = wl_resource_get_user_data(g_input_method->resource);
996 if (input_method && input_method->resource && input_method->context && input_method->context->resource)
997 wl_input_method_send_hide_input_panel(input_method->resource, input_method->context->resource);
1001 _e_text_input_method_context_cb_get_selection_text(struct wl_client *client EINA_UNUSED, struct wl_resource *resource, int32_t fd)
1003 E_Input_Method_Context *context = wl_resource_get_user_data(resource);
1007 WTI_WARNING(resource,
1008 WL_DISPLAY_ERROR_INVALID_OBJECT,
1009 "No Input Method Context For Resource");
1014 if ((context->input) && (context->input->resource))
1015 wl_text_input_send_get_selection_text(context->input->resource, fd);
1021 _e_text_input_method_context_cb_get_surrounding_text(struct wl_client *client EINA_UNUSED, struct wl_resource *resource,
1022 uint32_t maxlen_before, uint32_t maxlen_after, int32_t fd)
1024 E_Input_Method_Context *context = wl_resource_get_user_data(resource);
1028 WTI_WARNING(resource,
1029 WL_DISPLAY_ERROR_INVALID_OBJECT,
1030 "No Input Method Context For Resource");
1035 if ((context->input) && (context->input->resource))
1036 wl_text_input_send_get_surrounding_text(context->input->resource, maxlen_before, maxlen_after, fd);
1042 _e_text_input_method_context_cb_filter_key_event_done(struct wl_client *client EINA_UNUSED, struct wl_resource *resource,
1043 uint32_t serial, uint32_t state)
1045 E_Input_Method_Context *context = wl_resource_get_user_data(resource);
1049 WTI_WARNING(resource,
1050 WL_DISPLAY_ERROR_INVALID_OBJECT,
1051 "No Input Method Context For Resource");
1055 if ((context->input) && (context->input->resource))
1056 wl_text_input_send_filter_key_event_done(context->input->resource,
1061 _e_text_input_method_context_cb_update_ise_geometry(struct wl_client *client EINA_UNUSED, struct wl_resource *resource,
1062 uint32_t serial, uint32_t x, uint32_t y, uint32_t width, uint32_t height)
1064 E_Input_Method_Context *context = wl_resource_get_user_data(resource);
1068 WTI_WARNING(resource,
1069 WL_DISPLAY_ERROR_INVALID_OBJECT,
1070 "No Input Method Context For Resource");
1074 if ((context->input) && (context->input->resource))
1076 _e_text_input_send_input_panel_geometry(context->input->resource, x, y, width, height);
1077 g_updated_geometry = EINA_TRUE;
1083 _e_text_input_method_context_cb_reshow_input_panel(struct wl_client *client EINA_UNUSED, struct wl_resource *resource)
1085 e_input_panel_transient_for_set(client_surface_ec);
1086 e_input_panel_wait_update_set(EINA_TRUE);
1088 static const struct wl_input_method_context_interface _e_text_input_method_context_implementation = {
1089 _e_text_input_method_context_cb_destroy,
1090 _e_text_input_method_context_cb_string_commit,
1091 _e_text_input_method_context_cb_preedit_string,
1092 _e_text_input_method_context_cb_preedit_styling,
1093 _e_text_input_method_context_cb_preedit_cursor,
1094 _e_text_input_method_context_cb_surrounding_text_delete,
1095 _e_text_input_method_context_cb_cursor_position,
1096 _e_text_input_method_context_cb_modifiers_map,
1097 _e_text_input_method_context_cb_keysym,
1098 _e_text_input_method_context_cb_keyboard_grab,
1099 _e_text_input_method_context_cb_key,
1100 _e_text_input_method_context_cb_modifiers,
1101 _e_text_input_method_context_cb_language,
1102 _e_text_input_method_context_cb_text_direction,
1103 _e_text_input_method_context_cb_selection_region,
1104 _e_text_input_method_context_cb_private_command,
1105 _e_text_input_method_context_cb_input_panel_data_update,
1106 _e_text_input_method_context_cb_hide_input_panel,
1107 _e_text_input_method_context_cb_get_selection_text,
1108 _e_text_input_method_context_cb_get_surrounding_text,
1109 _e_text_input_method_context_cb_filter_key_event_done,
1110 _e_text_input_method_context_cb_update_ise_geometry,
1111 _e_text_input_method_context_cb_recapture_string,
1112 _e_text_input_method_context_cb_input_panel_event,
1113 _e_text_input_method_context_cb_commit_content,
1114 _e_text_input_method_context_cb_update_candidate_state,
1115 _e_text_input_method_context_cb_reshow_input_panel,
1119 _e_text_input_method_context_cb_resource_destroy(struct wl_resource *resource)
1121 E_Input_Method_Context *context = wl_resource_get_user_data(resource);
1125 WTI_WARNING(resource,
1126 WL_DISPLAY_ERROR_INVALID_OBJECT,
1127 "No Input Method Context For Resource");
1131 #if ENABLE_GRAB_KEYBOARD
1132 if (context->kbd.resource)
1133 wl_resource_destroy(context->kbd.resource);
1136 if ((context->input_method) &&
1137 (context->input_method->context == context))
1138 context->input_method->context = NULL;
1143 static Eina_Bool is_number_key(const char *str)
1145 if (!str) return EINA_FALSE;
1147 int result = atoi(str);
1151 if (!strcmp(str, "0"))
1161 _e_mod_ecore_key_down_cb(void *data, int type, void *event)
1163 Ecore_Event_Key *ev = (Ecore_Event_Key *)event;
1165 if (g_disable_show_panel == EINA_TRUE)
1166 return ECORE_CALLBACK_PASS_ON;
1168 /* process remote controller key exceptionally */
1169 if (((!strcmp(ev->key, "Down") ||
1170 !strcmp(ev->key, "KP_Down") ||
1171 !strcmp(ev->key, "Up") ||
1172 !strcmp(ev->key, "KP_Up") ||
1173 !strcmp(ev->key, "Right") ||
1174 !strcmp(ev->key, "KP_Right") ||
1175 !strcmp(ev->key, "Left") ||
1176 !strcmp(ev->key, "KP_Left")) && !ev->string) ||
1177 !strcmp(ev->key, "Return") ||
1178 !strcmp(ev->key, "Pause") ||
1179 !strcmp(ev->key, "NoSymbol") ||
1180 !strncmp(ev->key, "XF86", 4) ||
1181 is_number_key(ev->string))
1182 return ECORE_CALLBACK_PASS_ON;
1184 if (g_text_input && g_text_input->resource && g_client)
1185 _input_panel_hide(g_client, g_text_input->resource, EINA_FALSE);
1187 g_disable_show_panel = EINA_TRUE;
1189 return ECORE_CALLBACK_PASS_ON;
1193 _e_text_input_deactivate(E_Text_Input *text_input, E_Input_Method *input_method, Eina_Bool need_focus_in)
1195 LOGD("text_input : %p\n", text_input);
1197 if (text_input == g_text_input)
1199 g_text_input = NULL;
1203 if (input_method->input == text_input)
1205 if ((input_method->context) && (input_method->resource))
1207 #if ENABLE_GRAB_KEYBOARD
1208 _e_text_input_method_context_grab_set(input_method->context,
1211 /* TODO: finish the grab of keyboard. */
1212 wl_input_method_send_deactivate(input_method->resource,
1213 input_method->context->resource,
1217 if (ecore_key_down_handler)
1219 ecore_event_handler_del(ecore_key_down_handler);
1220 ecore_key_down_handler = NULL;
1223 LOGD("Resetting input_method->input : %p", input_method->input);
1224 input_method->input = NULL;
1225 if (input_method->context) input_method->context->input = NULL;
1226 input_method->context = NULL;
1228 text_input->input_methods = eina_list_remove(text_input->input_methods, input_method);
1230 if (text_input->resource)
1231 wl_text_input_send_leave(text_input->resource);
1234 g_disable_show_panel = EINA_FALSE;
1239 _e_text_input_cb_activate(struct wl_client *client, struct wl_resource *resource, struct wl_resource *seat, struct wl_resource *surface)
1241 E_Text_Input *text_input = NULL;
1242 E_Input_Method *input_method = NULL;
1243 E_Text_Input *old = NULL;
1244 E_Input_Method_Context *context = NULL;
1245 E_Client *ec = NULL;
1247 EINA_SAFETY_ON_NULL_GOTO(resource, err);
1248 EINA_SAFETY_ON_NULL_GOTO(seat, err);
1249 EINA_SAFETY_ON_NULL_GOTO(g_input_method, err);
1250 EINA_SAFETY_ON_NULL_GOTO(g_input_method->resource, err);
1252 /* Store application window's E_Client* value for setting transient_for information later */
1253 ec = wl_resource_get_user_data(surface);
1254 EINA_SAFETY_ON_NULL_GOTO(ec, err);
1255 EINA_SAFETY_ON_TRUE_GOTO(e_object_is_del(E_OBJECT(ec)), err);
1256 client_surface_ec = ec;
1258 text_input = wl_resource_get_user_data(resource);
1259 g_text_input = text_input;
1262 /* FIXME: should get input_method object from seat. */
1263 input_method = wl_resource_get_user_data(g_input_method->resource);
1264 EINA_SAFETY_ON_NULL_GOTO(input_method, err);
1266 old = input_method->input;
1268 LOGD("old : %p, text_input : %p, %d", old, text_input, g_input_panel_state);
1269 if (old == text_input)
1273 _e_text_input_deactivate(old, input_method, EINA_TRUE);
1275 input_method->input = text_input;
1276 text_input->input_methods = eina_list_append(text_input->input_methods, input_method);
1278 if (input_method->resource)
1280 if (!(context = E_NEW(E_Input_Method_Context, 1)))
1282 wl_client_post_no_memory(client);
1283 ERR("Could not allocate space for Input_Method_Context");
1287 if (!ecore_key_down_handler)
1288 ecore_key_down_handler = ecore_event_handler_add(ECORE_EVENT_KEY_DOWN,
1289 _e_mod_ecore_key_down_cb,
1293 wl_resource_create(wl_resource_get_client(input_method->resource),
1294 &wl_input_method_context_interface, 1, 0);
1296 if (context->resource)
1297 wl_resource_set_implementation(context->resource,
1298 &_e_text_input_method_context_implementation,
1299 context, _e_text_input_method_context_cb_resource_destroy);
1301 context->input = text_input;
1302 context->input_method = input_method;
1303 input_method->context = context;
1305 if (context->resource)
1306 wl_input_method_send_activate(input_method->resource, context->resource, text_input->id, EINA_TRUE);
1310 set_soft_keyboard_mode();
1312 if (text_input->resource)
1313 wl_text_input_send_enter(text_input->resource, surface);
1319 WTI_WARNING(resource,
1320 WL_DISPLAY_ERROR_INVALID_OBJECT,
1321 "No Text Input For Resource");
1325 WL_DISPLAY_ERROR_INVALID_OBJECT,
1326 "No Comp Data For Seat");
1330 _e_text_input_cb_deactivate(struct wl_client *client EINA_UNUSED, struct wl_resource *resource, struct wl_resource *seat)
1333 E_Text_Input *text_input = wl_resource_get_user_data(resource);
1334 E_Input_Method *input_method = NULL;
1338 WTI_WARNING(resource,
1339 WL_DISPLAY_ERROR_INVALID_OBJECT,
1340 "No Text Input For Resource");
1344 if (text_input == g_text_input)
1346 g_text_input = NULL;
1350 /* FIXME: should get input_method object from seat. */
1351 if (g_input_method && g_input_method->resource)
1352 input_method = wl_resource_get_user_data(g_input_method->resource);
1357 WL_DISPLAY_ERROR_INVALID_OBJECT,
1358 "No Input Method For Seat");
1362 _e_text_input_deactivate(text_input, input_method, EINA_TRUE);
1366 _e_text_input_method_create_context(struct wl_client *client, E_Input_Method *input_method, E_Text_Input *text_input, Eina_Bool need_focus_out)
1368 E_Input_Method_Context *context = NULL;
1370 EINA_SAFETY_ON_NULL_RETURN_VAL(input_method, EINA_FALSE);
1371 EINA_SAFETY_ON_NULL_RETURN_VAL(input_method->resource, EINA_FALSE);
1372 EINA_SAFETY_ON_NULL_RETURN_VAL(text_input, EINA_FALSE);
1374 g_text_input = text_input;
1376 input_method->input = text_input;
1377 text_input->input_methods = eina_list_append(text_input->input_methods, input_method);
1379 if (!(context = E_NEW(E_Input_Method_Context, 1)))
1381 wl_client_post_no_memory(client);
1382 ERR("Could not allocate space for Input_Method_Context");
1387 wl_resource_create(wl_resource_get_client(input_method->resource),
1388 &wl_input_method_context_interface, 1, 0);
1390 if (context->resource)
1391 wl_resource_set_implementation(context->resource,
1392 &_e_text_input_method_context_implementation,
1393 context, _e_text_input_method_context_cb_resource_destroy);
1395 context->input = text_input;
1396 context->input_method = input_method;
1397 input_method->context = context;
1399 wl_input_method_send_activate(input_method->resource, context->resource, text_input->id, need_focus_out);
1405 _e_text_input_cb_input_panel_show(struct wl_client *client, struct wl_resource *resource)
1407 E_Text_Input *text_input = wl_resource_get_user_data(resource);
1408 E_Input_Method *input_method = NULL;
1410 LOGD("text_input : %p\n", text_input);
1414 WTI_WARNING(resource,
1415 WL_DISPLAY_ERROR_INVALID_OBJECT,
1416 "No Text Input For Resource");
1420 #ifndef SUPPORT_CANDIDATE_ONEWINDOW
1421 if (g_disable_show_panel == EINA_TRUE)
1425 if (g_input_method && g_input_method->resource)
1426 input_method = wl_resource_get_user_data(g_input_method->resource);
1428 /* If input_method->context doesn't exist, create context struct to send input_panel_show event to Input Method(IME) correctly.
1429 * Because input_panel_show event can be called before focus_in(activate) by application.
1430 * And Input Method(IME) should know the state of their own input_panel to manage their resource when the input_panel is shown. */
1431 if (input_method && (!input_method->context || !input_method->context->resource))
1432 _e_text_input_method_create_context(client, input_method, text_input, EINA_TRUE);
1434 #ifdef SUPPORT_CANDIDATE_ONEWINDOW
1435 if (g_disable_show_panel == EINA_TRUE)
1437 if (g_show_state_candidate == EINA_TRUE)
1439 g_input_panel_state = E_INPUT_PANEL_STATE_DID_SHOW;
1440 g_show_client = client;
1441 e_input_panel_visibility_change(EINA_TRUE);
1442 e_input_panel_transient_for_set(client_surface_ec);
1448 if (input_method && input_method->resource && input_method->context && input_method->context->resource)
1450 /* DO NOT show input panel surface until we get message "show complete" from input method,
1451 * in order to give a change to update UI */
1452 LOGD("IM::SHOW::WAIT_FOR_READY\n");
1454 g_show_client = client;
1455 wl_input_method_send_show_input_panel(input_method->resource, input_method->context->resource);
1457 /* we need to force update in order to release buffer
1458 * if we do not, client can't update
1459 * because they may in manual render state by frame callback mechanism,
1460 * and also don't have released buffer */
1461 e_input_panel_wait_update_set(EINA_TRUE);
1464 /* If the input panel state was WILL_HIDE, it means that the conformant area information needs to be restored */
1465 if (g_input_panel_state == E_INPUT_PANEL_STATE_WILL_HIDE)
1467 if (text_input->resource)
1468 wl_text_input_send_private_command(text_input->resource, 0, "CONFORMANT_RESTORE");
1471 text_input->input_panel_visibile = EINA_TRUE;
1472 g_input_panel_state = E_INPUT_PANEL_STATE_WILL_SHOW;
1473 g_show_text_input = text_input;
1475 g_updated_geometry = EINA_FALSE;
1477 e_input_panel_transient_for_set(client_surface_ec);
1481 _e_text_input_cb_input_panel_hide(struct wl_client *client, struct wl_resource *resource)
1483 if (g_show_client == client) {
1484 _input_panel_hide(client, resource, EINA_FALSE);
1485 g_show_text_input = NULL;
1486 g_show_client = NULL;
1491 _e_text_input_cb_reset(struct wl_client *client EINA_UNUSED, struct wl_resource *resource)
1493 E_Text_Input *text_input = wl_resource_get_user_data(resource);
1494 E_Input_Method *input_method = NULL;
1495 Eina_List *l = NULL;
1499 WTI_WARNING(resource,
1500 WL_DISPLAY_ERROR_INVALID_OBJECT,
1501 "No Text Input For Resource");
1505 EINA_LIST_FOREACH(text_input->input_methods, l, input_method)
1507 if (!input_method || !input_method->context) continue;
1508 if (input_method->context->resource)
1509 wl_input_method_context_send_reset(input_method->context->resource);
1514 _e_text_input_cb_content_type_set(struct wl_client *client EINA_UNUSED, struct wl_resource *resource, uint32_t hint, uint32_t purpose)
1516 E_Text_Input *text_input = wl_resource_get_user_data(resource);
1517 E_Input_Method *input_method = NULL;
1518 Eina_List *l = NULL;
1522 WTI_WARNING(resource,
1523 WL_DISPLAY_ERROR_INVALID_OBJECT,
1524 "No Text Input For Resource");
1528 EINA_LIST_FOREACH(text_input->input_methods, l, input_method)
1530 if (!input_method || !input_method->context) continue;
1532 if (input_method->context->resource)
1533 wl_input_method_context_send_content_type(input_method->context->resource,
1539 _e_text_input_cb_cursor_rectangle_set(struct wl_client *client EINA_UNUSED, struct wl_resource *resource, int32_t x, int32_t y, int32_t width, int32_t height)
1541 E_Text_Input *text_input = wl_resource_get_user_data(resource);
1545 WTI_WARNING(resource,
1546 WL_DISPLAY_ERROR_INVALID_OBJECT,
1547 "No Text Input For Resource");
1551 /* TODO: issue event update input_panel */
1555 _e_text_input_cb_preferred_language_set(struct wl_client *client EINA_UNUSED, struct wl_resource *resource, const char *language)
1557 E_Text_Input *text_input = wl_resource_get_user_data(resource);
1558 E_Input_Method *input_method = NULL;
1559 Eina_List *l = NULL;
1563 WTI_WARNING(resource,
1564 WL_DISPLAY_ERROR_INVALID_OBJECT,
1565 "No Text Input For Resource");
1569 EINA_LIST_FOREACH(text_input->input_methods, l, input_method)
1571 if (!input_method || !input_method->context) continue;
1573 if (input_method->context->resource)
1574 wl_input_method_context_send_preferred_language(input_method->context->resource,
1580 _e_text_input_cb_state_commit(struct wl_client *client EINA_UNUSED, struct wl_resource *resource, uint32_t serial)
1582 E_Text_Input *text_input = wl_resource_get_user_data(resource);
1583 E_Input_Method *input_method = NULL;
1584 Eina_List *l = NULL;
1588 WTI_WARNING(resource,
1589 WL_DISPLAY_ERROR_INVALID_OBJECT,
1590 "No Text Input For Resource");
1594 EINA_LIST_FOREACH(text_input->input_methods, l, input_method)
1596 if (!input_method || !input_method->context) continue;
1598 if (input_method->context->resource)
1599 wl_input_method_context_send_commit_state(input_method->context->resource, serial);
1604 _e_text_input_cb_action_invoke(struct wl_client *client EINA_UNUSED, struct wl_resource *resource, uint32_t button, uint32_t index)
1606 E_Text_Input *text_input = wl_resource_get_user_data(resource);
1607 E_Input_Method *input_method = NULL;
1608 Eina_List *l = NULL;
1612 WTI_WARNING(resource,
1613 WL_DISPLAY_ERROR_INVALID_OBJECT,
1614 "No Text Input For Resource");
1618 EINA_LIST_FOREACH(text_input->input_methods, l, input_method)
1620 if (!input_method || !input_method->context) continue;
1622 if (input_method->context->resource)
1623 wl_input_method_context_send_invoke_action(input_method->context->resource,
1629 _e_text_input_cb_return_key_type_set(struct wl_client *client EINA_UNUSED, struct wl_resource *resource, uint32_t return_key_type)
1631 E_Text_Input *text_input = wl_resource_get_user_data(resource);
1632 E_Input_Method *input_method = NULL;
1633 Eina_List *l = NULL;
1637 WTI_WARNING(resource,
1638 WL_DISPLAY_ERROR_INVALID_OBJECT,
1639 "No Text Input For Resource");
1643 EINA_LIST_FOREACH(text_input->input_methods, l, input_method)
1645 if (!input_method || !input_method->context) continue;
1647 if (input_method->context->resource)
1648 wl_input_method_context_send_return_key_type(input_method->context->resource,
1654 _e_text_input_cb_return_key_disabled_set(struct wl_client *client EINA_UNUSED, struct wl_resource *resource, uint32_t disabled)
1656 E_Text_Input *text_input = wl_resource_get_user_data(resource);
1657 E_Input_Method *input_method = NULL;
1658 Eina_List *l = NULL;
1662 WTI_WARNING(resource,
1663 WL_DISPLAY_ERROR_INVALID_OBJECT,
1664 "No Text Input For Resource");
1668 EINA_LIST_FOREACH(text_input->input_methods, l, input_method)
1670 if (!input_method || !input_method->context) continue;
1672 if (input_method->context->resource)
1673 wl_input_method_context_send_return_key_disabled(input_method->context->resource,
1679 _e_text_input_cb_input_panel_data_set(struct wl_client *client EINA_UNUSED, struct wl_resource *resource, const char *data, uint32_t length)
1681 E_Text_Input *text_input = wl_resource_get_user_data(resource);
1682 E_Input_Method *input_method = NULL;
1683 Eina_List *l = NULL;
1687 WTI_WARNING(resource,
1688 WL_DISPLAY_ERROR_INVALID_OBJECT,
1689 "No Text Input For Resource");
1693 EINA_LIST_FOREACH(text_input->input_methods, l, input_method)
1695 if (!input_method || !input_method->context) continue;
1697 if (input_method->context->resource)
1698 wl_input_method_context_send_input_panel_data(input_method->context->resource,
1702 /* Temporarily receiving WILL_HIDE_ACK via input_panel_data, will need for a new wayland protocol */
1703 const char *szWillHideAck = "WILL_HIDE_ACK";
1704 if (strncmp(data, szWillHideAck, strlen(szWillHideAck)) == 0)
1706 if (g_timer_will_hide)
1708 ecore_timer_del(g_timer_will_hide);
1709 g_timer_will_hide = NULL;
1711 INF("WILL_HIDE_ACK_RECVED, %d", g_input_panel_state);
1712 if (g_input_panel_state == E_INPUT_PANEL_STATE_WILL_HIDE)
1714 e_input_panel_visibility_change(EINA_FALSE);
1715 e_input_panel_transient_for_set(NULL);
1716 g_input_panel_state = E_INPUT_PANEL_STATE_DID_HIDE;
1722 _e_text_input_cb_bidi_direction_set(struct wl_client *client EINA_UNUSED, struct wl_resource *resource, uint32_t bidi_direction)
1724 E_Text_Input *text_input = wl_resource_get_user_data(resource);
1725 E_Input_Method *input_method = NULL;
1726 Eina_List *l = NULL;
1730 WTI_WARNING(resource,
1731 WL_DISPLAY_ERROR_INVALID_OBJECT,
1732 "No Text Input For Resource");
1736 EINA_LIST_FOREACH(text_input->input_methods, l, input_method)
1738 if (!input_method || !input_method->context) continue;
1740 if (input_method->context->resource)
1741 wl_input_method_context_send_bidi_direction(input_method->context->resource,
1747 _e_text_input_cb_cursor_position_set(struct wl_client *client EINA_UNUSED, struct wl_resource *resource, uint32_t cursor_position)
1749 E_Text_Input *text_input = wl_resource_get_user_data(resource);
1750 E_Input_Method *input_method = NULL;
1751 Eina_List *l = NULL;
1755 WTI_WARNING(resource,
1756 WL_DISPLAY_ERROR_INVALID_OBJECT,
1757 "No Text Input For Resource");
1761 EINA_LIST_FOREACH(text_input->input_methods, l, input_method)
1763 if (!input_method || !input_method->context) continue;
1765 if (input_method->context->resource)
1766 wl_input_method_context_send_cursor_position(input_method->context->resource, cursor_position);
1771 _e_text_input_cb_process_input_device_event(struct wl_client *client EINA_UNUSED, struct wl_resource *resource, uint32_t type, const char *data, uint32_t length)
1773 E_Text_Input *text_input = wl_resource_get_user_data(resource);
1774 E_Input_Method *input_method = NULL;
1775 Eina_List *l = NULL;
1779 WTI_WARNING(resource,
1780 WL_DISPLAY_ERROR_INVALID_OBJECT,
1781 "No Text Input For Resource");
1785 EINA_LIST_FOREACH(text_input->input_methods, l, input_method)
1787 if (!input_method || !input_method->context) continue;
1789 if (input_method->context->resource)
1790 wl_input_method_context_send_process_input_device_event(input_method->context->resource,
1791 type, data, length);
1796 _e_text_input_cb_filter_key_event(struct wl_client *client EINA_UNUSED, struct wl_resource *resource,
1797 uint32_t serial, uint32_t time, const char *keyname, uint32_t state,
1798 uint32_t modifiers, const char *dev_name, uint32_t dev_class,
1799 uint32_t dev_subclass, uint32_t keycode)
1802 E_Text_Input *text_input = wl_resource_get_user_data(resource);
1803 E_Input_Method *input_method = NULL;
1807 WTI_WARNING(resource,
1808 WL_DISPLAY_ERROR_INVALID_OBJECT,
1809 "No Text Input For Resource");
1813 /* FIXME: should get input_method object from seat. */
1814 if (g_input_method && g_input_method->resource)
1815 input_method = wl_resource_get_user_data(g_input_method->resource);
1817 if (input_method && input_method->context && input_method->context->resource)
1819 wl_input_method_context_send_filter_key_event(input_method->context->resource,
1820 serial, time, keyname, state, modifiers,
1821 dev_name, dev_class, dev_subclass, keycode);
1825 if (text_input->resource)
1826 wl_text_input_send_filter_key_event_done(text_input->resource, serial, false);
1828 WTI_WARNING(resource,
1829 WL_DISPLAY_ERROR_INVALID_OBJECT,
1836 _e_text_input_cb_get_hide_permission(struct wl_client *client EINA_UNUSED, struct wl_resource *resource)
1838 E_Text_Input *text_input = wl_resource_get_user_data(resource);
1839 uint32_t permission = 1;
1840 E_Client *focused_ec = NULL;
1844 WTI_WARNING(resource,
1845 WL_DISPLAY_ERROR_INVALID_OBJECT,
1846 "No Text Input For Resource");
1850 focused_ec = e_client_focused_get();
1853 if (focused_ec != client_surface_ec)
1855 E_Window_Type focus_win_type = focused_ec->netwm.type;
1856 LOGD("Window ID : 0x%08x, Name : %s, type : %d\n", (unsigned int)e_client_util_win_get(focused_ec), (char *)e_client_util_name_get(focused_ec), focus_win_type);
1858 if (focus_win_type == E_WINDOW_TYPE_NOTIFICATION ||
1859 focus_win_type == E_WINDOW_TYPE_POPUP_MENU)
1865 LOGD("Can't get focus window\n");
1868 if (text_input->resource)
1869 wl_text_input_send_hide_permission(text_input->resource, permission);
1873 _e_text_input_cb_set_capital_mode(struct wl_client *client EINA_UNUSED, struct wl_resource *resource, uint32_t mode)
1875 E_Text_Input *text_input = wl_resource_get_user_data(resource);
1876 E_Input_Method *input_method = NULL;
1877 Eina_List *l = NULL;
1881 WTI_WARNING(resource,
1882 WL_DISPLAY_ERROR_INVALID_OBJECT,
1883 "No Text Input For Resource");
1887 EINA_LIST_FOREACH(text_input->input_methods, l, input_method)
1889 if (!input_method || !input_method->context) continue;
1890 if (input_method->context->resource)
1891 wl_input_method_context_send_capital_mode(input_method->context->resource, mode);
1896 _e_text_input_cb_prediction_hint_set(struct wl_client *client EINA_UNUSED, struct wl_resource *resource, const char *prediction_hint)
1898 E_Text_Input *text_input = wl_resource_get_user_data(resource);
1899 E_Input_Method *input_method = NULL;
1900 Eina_List *l = NULL;
1904 WTI_WARNING(resource,
1905 WL_DISPLAY_ERROR_INVALID_OBJECT,
1906 "No Text Input For Resource");
1910 EINA_LIST_FOREACH(text_input->input_methods, l, input_method)
1912 if (!input_method || !input_method->context) continue;
1914 if (input_method->context->resource)
1915 wl_input_method_context_send_prediction_hint(input_method->context->resource, prediction_hint);
1920 _e_text_input_cb_prediction_hint_data_set(struct wl_client *client EINA_UNUSED, struct wl_resource *resource, const char *key, const char *value)
1922 E_Text_Input *text_input = wl_resource_get_user_data(resource);
1923 E_Input_Method *input_method = NULL;
1924 Eina_List *l = NULL;
1928 WTI_WARNING(resource,
1929 WL_DISPLAY_ERROR_INVALID_OBJECT,
1930 "No Text Input For Resource");
1934 EINA_LIST_FOREACH(text_input->input_methods, l, input_method)
1936 if (!input_method || !input_method->context) continue;
1938 if (input_method->context->resource)
1939 wl_input_method_context_send_prediction_hint_data(input_method->context->resource, key, value);
1944 _e_text_input_cb_mime_type_accept_set(struct wl_client *client EINA_UNUSED, struct wl_resource *resource, const char *mime_type)
1946 E_Text_Input *text_input = wl_resource_get_user_data(resource);
1947 E_Input_Method *input_method = NULL;
1948 Eina_List *l = NULL;
1952 WTI_WARNING(resource,
1953 WL_DISPLAY_ERROR_INVALID_OBJECT,
1954 "No Text Input For Resource");
1958 EINA_LIST_FOREACH(text_input->input_methods, l, input_method)
1960 if (!input_method || !input_method->context) continue;
1962 if (input_method->context->resource)
1963 wl_input_method_context_send_mime_type(input_method->context->resource, mime_type);
1968 _e_text_input_cb_input_panel_position_set(struct wl_client *client EINA_UNUSED, struct wl_resource *resource, uint32_t x, uint32_t y)
1970 E_Text_Input *text_input = wl_resource_get_user_data(resource);
1974 WTI_WARNING(resource,
1975 WL_DISPLAY_ERROR_INVALID_OBJECT,
1976 "No Text Input For Resource");
1979 e_input_panel_floating_position_set(x, y);
1983 _e_text_input_cb_finalize_content(struct wl_client *client EINA_UNUSED, struct wl_resource *resource, const char *text, uint32_t cursor_position)
1985 E_Text_Input *text_input = wl_resource_get_user_data(resource);
1986 E_Input_Method *input_method = NULL;
1987 Eina_List *l = NULL;
1991 WTI_WARNING(resource,
1992 WL_DISPLAY_ERROR_INVALID_OBJECT,
1993 "No Text Input For Resource");
1997 EINA_LIST_FOREACH(text_input->input_methods, l, input_method)
1999 if (!input_method || !input_method->context) continue;
2001 if (input_method->context->resource)
2002 wl_input_method_context_send_finalized_content(input_method->context->resource, text, cursor_position);
2007 _e_text_input_cb_resource_destroy(struct wl_resource *resource)
2009 E_Text_Input *text_input = wl_resource_get_user_data(resource);
2010 E_Input_Method *input_method = NULL;
2014 WTI_WARNING(resource,
2015 WL_DISPLAY_ERROR_INVALID_OBJECT,
2016 "No Text Input For Resource");
2020 if (g_show_text_input == text_input)
2022 if (text_input->input_panel_visibile)
2024 _input_panel_hide(g_client, resource, EINA_TRUE);
2027 g_show_text_input = NULL;
2030 if (g_text_input == text_input)
2032 g_text_input = NULL;
2036 EINA_LIST_FREE(text_input->input_methods, input_method)
2039 _e_text_input_deactivate(text_input, input_method, EINA_TRUE);
2046 _e_text_input_cb_destroy(struct wl_client *client, struct wl_resource *resource)
2049 E_Text_Input *text_input = wl_resource_get_user_data(resource);
2050 E_Input_Method *input_method = NULL;
2051 Eina_Bool _context_created = EINA_FALSE;
2055 WTI_WARNING(resource,
2056 WL_DISPLAY_ERROR_INVALID_OBJECT,
2057 "No Text Input For Resource");
2061 if (g_input_method && g_input_method->resource)
2062 input_method = wl_resource_get_user_data(g_input_method->resource);
2066 WTI_WARNING(resource,
2067 WL_DISPLAY_ERROR_INVALID_OBJECT,
2068 "No Input Method For Seat");
2072 if ((!input_method->context) || (!input_method->context->resource))
2073 _context_created = _e_text_input_method_create_context(client, input_method, text_input, EINA_FALSE);
2075 if (input_method->resource && input_method->context && input_method->context->resource)
2076 wl_input_method_send_destroy(input_method->resource, input_method->context->resource);
2078 if (_context_created)
2079 _e_text_input_deactivate(text_input, input_method, EINA_FALSE);
2081 wl_resource_destroy(resource);
2084 static const struct wl_text_input_interface _e_text_input_implementation = {
2085 _e_text_input_cb_destroy,
2086 _e_text_input_cb_activate,
2087 _e_text_input_cb_deactivate,
2088 _e_text_input_cb_input_panel_show,
2089 _e_text_input_cb_input_panel_hide,
2090 _e_text_input_cb_reset,
2091 _e_text_input_cb_content_type_set,
2092 _e_text_input_cb_cursor_rectangle_set,
2093 _e_text_input_cb_preferred_language_set,
2094 _e_text_input_cb_state_commit,
2095 _e_text_input_cb_action_invoke,
2096 _e_text_input_cb_return_key_type_set,
2097 _e_text_input_cb_return_key_disabled_set,
2098 _e_text_input_cb_input_panel_data_set,
2099 _e_text_input_cb_bidi_direction_set,
2100 _e_text_input_cb_cursor_position_set,
2101 _e_text_input_cb_process_input_device_event,
2102 _e_text_input_cb_filter_key_event,
2103 _e_text_input_cb_get_hide_permission,
2104 _e_text_input_cb_set_capital_mode,
2105 _e_text_input_cb_prediction_hint_set,
2106 _e_text_input_cb_mime_type_accept_set,
2107 _e_text_input_cb_input_panel_position_set,
2108 _e_text_input_cb_finalize_content,
2109 _e_text_input_cb_prediction_hint_data_set
2113 _e_text_input_manager_cb_text_input_create(struct wl_client *client, struct wl_resource *resource, uint32_t id)
2115 E_Text_Input_Mgr *text_input_mgr = wl_resource_get_user_data(resource);
2116 E_Text_Input *text_input = NULL;
2118 if (!text_input_mgr)
2120 WTI_WARNING(resource,
2121 WL_DISPLAY_ERROR_INVALID_OBJECT,
2122 "No Text Input Manager For Resource");
2126 if (!(text_input = E_NEW(E_Text_Input, 1)))
2128 wl_client_post_no_memory(client);
2129 ERR("Could not allocate space for Text_Input");
2133 text_input->resource =
2134 wl_resource_create(client, &wl_text_input_interface, 1, id);
2136 if (!text_input->resource)
2138 wl_client_post_no_memory(client);
2139 ERR("Could not create the resource for text_input");
2143 text_input->id = g_text_input_count++;
2145 wl_resource_set_implementation(text_input->resource,
2146 &_e_text_input_implementation,
2147 text_input, _e_text_input_cb_resource_destroy);
2150 static const struct wl_text_input_manager_interface _e_text_input_manager_implementation = {
2151 _e_text_input_manager_cb_text_input_create
2155 _e_text_cb_bind_text_input_manager(struct wl_client *client, void *data, uint32_t version EINA_UNUSED, uint32_t id)
2157 E_Text_Input_Mgr *text_input_mgr = data;
2159 text_input_mgr->resource =
2160 wl_resource_create(client,
2161 &wl_text_input_manager_interface, 1, id);
2163 if (text_input_mgr->resource)
2164 wl_resource_set_implementation(text_input_mgr->resource,
2165 &_e_text_input_manager_implementation,
2166 text_input_mgr, NULL);
2170 _e_text_input_method_cb_unbind(struct wl_resource *resource)
2173 E_Input_Method *input_method = wl_resource_get_user_data(resource);
2177 WTI_WARNING(resource,
2178 WL_DISPLAY_ERROR_INVALID_OBJECT,
2179 "No Input Method For Resource");
2183 if (input_method->resource != resource) return;
2185 if (input_method->input)
2186 _e_text_input_deactivate(input_method->input, input_method, EINA_TRUE);
2188 input_method->resource = NULL;
2189 input_method->context = NULL;
2191 if (vconf_set_bool(VCONFKEY_ISF_BIND, 0) != 0)
2192 LOGW("failed to set isf bind\n");
2196 _e_text_input_method_cb_bind(struct wl_client *client, void *data, uint32_t version EINA_UNUSED, uint32_t id)
2199 E_Input_Method *input_method = data;
2200 struct wl_resource *resource = NULL;
2202 if (!input_method) return;
2204 if (input_method->resource)
2205 _e_text_input_method_cb_unbind(input_method->resource);
2207 if (input_method->resource)
2209 WTI_WARNING(input_method->resource, WL_DISPLAY_ERROR_INVALID_OBJECT,
2210 "input_method object already bound");
2214 resource = wl_resource_create(client, &wl_input_method_interface, 1, id);
2215 if (EINA_UNLIKELY(!resource))
2218 input_method->resource = resource;
2220 wl_resource_set_implementation(resource, NULL, input_method,
2221 _e_text_input_method_cb_unbind);
2223 if (vconf_set_bool(VCONFKEY_ISF_BIND, 1) != 0)
2224 LOGW("failed to set isf bind\n");
2228 _e_text_input_method_destroy(void *data)
2230 E_Input_Method *input_method = data;
2235 if (input_method->global)
2236 wl_global_destroy(input_method->global);
2242 _e_text_input_method_create(void)
2244 if (!(g_input_method = E_NEW(E_Input_Method, 1)))
2246 ERR("Could not allocate space for Input_Method");
2250 g_input_method->global =
2251 wl_global_create(e_comp_wl->wl.disp, &wl_input_method_interface, 1,
2252 g_input_method, _e_text_input_method_cb_bind);
2254 if (!g_input_method->global)
2256 free(g_input_method);
2257 g_input_method = NULL;
2261 _e_mod_text_input_shutdown_cb_add(_e_text_input_method_destroy, g_input_method);
2267 _e_text_input_manager_destroy(void *data)
2269 E_Text_Input_Mgr *text_input_mgr = data;
2270 if (!text_input_mgr) return;
2272 wl_global_destroy(text_input_mgr->global);
2273 free(text_input_mgr);
2277 _e_text_input_manager_create(void)
2279 E_Text_Input_Mgr *text_input_mgr;
2281 if (!(text_input_mgr = E_NEW(E_Text_Input_Mgr, 1)))
2283 ERR("Could not allocate space for Text_Input_Manager");
2287 text_input_mgr->global =
2288 wl_global_create(e_comp_wl->wl.disp,
2289 &wl_text_input_manager_interface, 1,
2290 text_input_mgr, _e_text_cb_bind_text_input_manager);
2292 if (!text_input_mgr->global)
2294 free(text_input_mgr);
2298 _e_mod_text_input_shutdown_cb_add(_e_text_input_manager_destroy, text_input_mgr);
2304 _e_mod_text_input_shutdown(void)
2306 E_Mod_Text_Input_Shutdown_Cb *cb;
2308 EINA_LIST_FREE(shutdown_list, cb)
2318 E_API E_Module_Api e_modapi = { E_MODULE_API_VERSION, "Wl_Text_Input" };
2321 set_soft_keyboard_mode()
2323 g_disable_show_panel = EINA_FALSE;
2325 /* switch to S/W keyboard mode */
2327 if (vconf_get_bool(VCONFKEY_ISF_HW_KEYBOARD_INPUT_DETECTED, &val) == 0 && val != 0)
2328 vconf_set_bool(VCONFKEY_ISF_HW_KEYBOARD_INPUT_DETECTED, 0);
2332 _e_mod_eeze_udev_watch_cb(const char *text, Eeze_Udev_Event event, void *data, Eeze_Udev_Watch *watch)
2334 if (event == EEZE_UDEV_EVENT_REMOVE)
2335 set_soft_keyboard_mode();
2339 _e_text_input_method_context_cb_client_resize(void *data EINA_UNUSED, int type EINA_UNUSED, void *event)
2344 int x = 0, y = 0, w = 0, h = 0;
2346 ev = (E_Event_Client *)event;
2347 EINA_SAFETY_ON_NULL_RETURN_VAL(ev, ECORE_CALLBACK_PASS_ON);
2350 EINA_SAFETY_ON_NULL_RETURN_VAL(ec, ECORE_CALLBACK_PASS_ON);
2352 found = e_input_panel_client_find(ec);
2353 if (!found) return ECORE_CALLBACK_PASS_ON;
2354 if ((ec->w < 1) && (ec->h < 1)) return ECORE_CALLBACK_PASS_ON;
2356 if (g_text_input && g_text_input->resource && g_input_panel_state != E_INPUT_PANEL_STATE_WILL_HIDE && g_input_panel_state != E_INPUT_PANEL_STATE_DID_HIDE)
2358 if (e_input_panel_client_geometry_get(NULL, &x, &y, &w, &h) && !(w <= 1 || h <= 1))
2359 _e_text_input_send_input_panel_geometry(g_text_input->resource, x, y, w, h);
2362 return ECORE_CALLBACK_PASS_ON;
2366 _pol_cb_hook_client_del(void *d EINA_UNUSED, E_Client *ec)
2368 if (EINA_UNLIKELY(!ec))
2371 if (ec == client_surface_ec)
2373 LOGD("transient_for_ec deleted, hiding input panel\n");
2374 e_input_panel_visibility_change(EINA_FALSE);
2375 e_input_panel_transient_for_set(NULL);
2377 if(!e_input_panel_surface_destroy(ec))
2378 LOGE("fail to remove surface\n");
2380 g_input_panel_state = E_INPUT_PANEL_STATE_DID_HIDE;
2381 if (g_timer_will_hide)
2383 ecore_timer_del(g_timer_will_hide);
2384 g_timer_will_hide = NULL;
2386 client_surface_ec = NULL;
2387 LOGD("TRANSIENT_FOR::Reset transient_for_ec to NULL\n");
2392 e_text_input_update_input_panel_state(Eina_Bool state)
2394 if (!g_text_input || !g_text_input->resource) return;
2396 E_Text_Input *text_input = wl_resource_get_user_data(g_text_input->resource);
2400 WTI_WARNING(g_text_input->resource,
2401 WL_DISPLAY_ERROR_INVALID_OBJECT,
2402 "No Text Input For Resource");
2406 if (text_input->resource)
2408 if (!g_updated_geometry)
2410 int x = 0, y = 0, w = 0, h = 0;
2411 if (e_input_panel_client_geometry_get(NULL, &x, &y, &w, &h) && !(w <= 1 || h <= 1))
2412 _e_text_input_send_input_panel_geometry(text_input->resource, x, y, w, h);
2413 g_updated_geometry = EINA_TRUE;
2415 uint32_t input_panel_state = WL_TEXT_INPUT_INPUT_PANEL_STATE_HIDE;
2416 if (state) input_panel_state = WL_TEXT_INPUT_INPUT_PANEL_STATE_SHOW;
2417 wl_text_input_send_input_panel_state(text_input->resource, input_panel_state);
2422 e_modapi_init(E_Module *m)
2424 if (!e_comp_wl) return NULL;
2426 if (!wti_log_init())
2429 /* FIXME: create only one input method object per seat. */
2430 if (!_e_text_input_method_create())
2433 if (!e_input_panel_init())
2436 if (!_e_text_input_manager_create())
2439 E_LIST_HANDLER_APPEND(handlers, E_EVENT_CLIENT_RESIZE, _e_text_input_method_context_cb_client_resize, NULL);
2441 vconf_notify_key_changed(VCONFKEY_ISF_HW_KEYBOARD_INPUT_DETECTED, _keyboard_mode_changed_cb, NULL);
2443 eeze_udev_watch_hander = eeze_udev_watch_add(EEZE_UDEV_TYPE_KEYBOARD,
2444 EEZE_UDEV_EVENT_REMOVE,
2445 _e_mod_eeze_udev_watch_cb,
2447 if (!eeze_udev_watch_hander)
2450 E_CLIENT_HOOK_APPEND(hooks_ec, E_CLIENT_HOOK_DEL, _pol_cb_hook_client_del, NULL);
2454 _e_mod_text_input_shutdown();
2459 e_modapi_shutdown(E_Module *m EINA_UNUSED)
2461 E_FREE_LIST(handlers, ecore_event_handler_del);
2462 E_FREE_LIST(hooks_ec, e_client_hook_del);
2464 if (g_timer_will_hide)
2466 ecore_timer_del(g_timer_will_hide);
2467 g_timer_will_hide = NULL;
2470 vconf_ignore_key_changed(VCONFKEY_ISF_HW_KEYBOARD_INPUT_DETECTED, _keyboard_mode_changed_cb);
2472 if (eeze_udev_watch_hander)
2474 eeze_udev_watch_del(eeze_udev_watch_hander);
2475 eeze_udev_watch_hander = NULL;
2477 _e_mod_text_input_shutdown();
2479 e_input_panel_shutdown();
2487 e_modapi_save(E_Module *m EINA_UNUSED)