diff --git a/src/modules/vkbd/e_kbd_send.c b/src/modules/vkbd/e_kbd_send.c index 22ec8c34e..9b8dafe71 100644 --- a/src/modules/vkbd/e_kbd_send.c +++ b/src/modules/vkbd/e_kbd_send.c @@ -1,6 +1,13 @@ #include "e.h" #include "e_kbd_send.h" +#ifdef HAVE_WAYLAND +#include "input-method-unstable-v1-client-protocol.h" +#include "text-input-unstable-v1-client-protocol.h" + + +#endif + #ifndef HAVE_WAYLAND_ONLY static const char * _string_to_keysym(const char *str) @@ -53,5 +60,71 @@ e_kbd_send_keysym_press(const char *key EINA_UNUSED, Kbd_Mod mod EINA_UNUSED) if (mod & KBD_MOD_ALT) ecore_x_test_fake_key_up("Alt_L"); if (mod & KBD_MOD_CTRL) ecore_x_test_fake_key_up("Control_L"); } + else + { +/* + struct wl_resource *res; + uint32_t serial, *end, *k, keycode, timestamp; + xkb_keysym_t keysym; + Eina_List *l; + + timestamp = ecore_loop_time_get() * 1000.0; + keysym = xkb_keysym_from_name(key, XKB_KEYSYM_NO_FLAGS); + keycode = xkb_keymap_key_by_name(keymap, key); + serial = wl_display_next_serial(e_comp_wl->wl.disp); + EINA_LIST_FOREACH(e_comp_wl->kbd.focused, l, res) + { + //keycode = KEYCOADE_ctrl + //e_comp_wl_input_keyboard_state_update(keycode, EINA_TRUE); + //if (mod & KBD_MOD_CTRL) ecore_x_test_fake_key_down("Control_L"); + //if (mod & KBD_MOD_ALT) ecore_x_test_fake_key_down("Alt_L"); + //if (mod & KBD_MOD_WIN) ecore_x_test_fake_key_down("Super_L"); + wl_keyboard_send_key(res, serial, timestamp, + keycode, WL_KEYBOARD_KEY_STATE_PRESSED); + } + serial = wl_display_next_serial(e_comp_wl->wl.disp); + EINA_LIST_FOREACH(e_comp_wl->kbd.focused, l, res) + { + wl_keyboard_send_key(res, serial, timestamp, + keycode, WL_KEYBOARD_KEY_STATE_RELEASED); + //if (mod & KBD_MOD_WIN) ecore_x_test_fake_key_up("Super_L"); + //if (mod & KBD_MOD_ALT) ecore_x_test_fake_key_up("Alt_L"); + //if (mod & KBD_MOD_CTRL) ecore_x_test_fake_key_up("Control_L"); + } + */ + } +#endif +} + +EAPI void +e_kbd_send_init(void) +{ +#ifndef HAVE_WAYLAND_ONLY + if (e_comp_util_has_x()) + { + return; + } +#endif +#ifdef HAVE_WAYLAND + if (!e_comp_util_has_x()) + { + } +#endif +} + + +EAPI void +e_kbd_send_shutdown(void) +{ +#ifndef HAVE_WAYLAND_ONLY + if (e_comp_util_has_x()) + { + return; + } +#endif +#ifdef HAVE_WAYLAND + if (!e_comp_util_has_x()) + { + } #endif } diff --git a/src/modules/vkbd/e_kbd_send.h b/src/modules/vkbd/e_kbd_send.h index 6a8815939..106e91674 100644 --- a/src/modules/vkbd/e_kbd_send.h +++ b/src/modules/vkbd/e_kbd_send.h @@ -11,5 +11,7 @@ typedef enum _Kbd_Mod EAPI void e_kbd_send_string_press(const char *str, Kbd_Mod mod); EAPI void e_kbd_send_keysym_press(const char *key, Kbd_Mod mod); +EAPI void e_kbd_send_init(void); +EAPI void e_kbd_send_shutdown(void); #endif diff --git a/src/modules/vkbd/e_mod_main.c b/src/modules/vkbd/e_mod_main.c index a25b91c0d..90c859a16 100644 --- a/src/modules/vkbd/e_mod_main.c +++ b/src/modules/vkbd/e_mod_main.c @@ -1,6 +1,7 @@ #include "e.h" #include "e_mod_main.h" #include "e_kbd_int.h" +#include "e_kbd_send.h" /* local function prototypes */ static void _il_kbd_stop(void); @@ -86,12 +87,14 @@ e_modapi_init(E_Module *m) e_module_delayed_set(m, 1); ki_delay_timer = ecore_timer_add(1.0, _il_ki_delay_cb, NULL); + e_kbd_send_init(); return m; } E_API int e_modapi_shutdown(E_Module *m EINA_UNUSED) { + e_kbd_send_shutdown(); e_config_domain_save("module.vkbd", cd, il_kbd_cfg); if (ki_delay_timer) { diff --git a/src/modules/vkbd/meson.build b/src/modules/vkbd/meson.build index e385606d5..fff164d87 100644 --- a/src/modules/vkbd/meson.build +++ b/src/modules/vkbd/meson.build @@ -14,6 +14,17 @@ src = files( ) if get_option(m) == true + if get_option('wayland') == true + foreach p: [ + '@0@/unstable/input-method/input-method-unstable-v1.xml'.format(dir_wayland_protocols), + '@0@/unstable/text-input/text-input-unstable-v1.xml'.format(dir_wayland_protocols), + ] + src += gen_scanner_server.process(p) + src += gen_scanner_client.process(p) + src += gen_scanner_impl.process(p) + endforeach + endif + cmd = [ edje_cmd, '-id', join_paths(meson.source_root(), 'src' , 'modules', m, 'images'),