From: Li Zhang Date: Thu, 16 Jul 2015 14:47:02 +0000 (+0800) Subject: Hide IME panel when H/W keyboard is connecting X-Git-Tag: submit/tizen/20150717.081545~1 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=22ea94b5d4b8d504ee55b64ba14d53e91f6a073a;p=platform%2Fcore%2Fuifw%2Fe-mod-tizen-wl-textinput.git Hide IME panel when H/W keyboard is connecting Change-Id: I155565500469b2ea35212482e146c377e993691e --- diff --git a/configure.ac b/configure.ac index 7894c3b..67883e2 100644 --- a/configure.ac +++ b/configure.ac @@ -36,10 +36,14 @@ fi PKG_CHECK_MODULES(WAYLAND_SCANNER, wayland-scanner) PKG_CHECK_MODULES(WAYLAND, [wayland-server]) PKG_CHECK_MODULES(ENLIGHTENMENT, [enlightenment]) +PKG_CHECK_MODULES(EEZE, [eeze]) AC_SUBST(ENLIGHTENMENT_CFLAGS) AC_SUBST(ENLIGHTENMENT_LIBS) +AC_SUBST(EEZE_CFLAGS) +AC_SUBST(EEZE_LIBS) + AC_CHECK_LIB(dl, dlopen, dlopen_libs=-ldl) AC_SUBST(dlopen_libs) diff --git a/packaging/e-mod-tizen-wl-textinput.spec b/packaging/e-mod-tizen-wl-textinput.spec index e659b77..ce0518d 100644 --- a/packaging/e-mod-tizen-wl-textinput.spec +++ b/packaging/e-mod-tizen-wl-textinput.spec @@ -8,6 +8,7 @@ License: BSD-2-Clause and MIT Source0: %{name}-%{version}.tar.bz2 BuildRequires: pkgconfig(wayland-server) BuildRequires: pkgconfig(enlightenment) +BuildRequires: pkgconfig(eeze) %if !%{with wayland} ExclusiveArch: %endif diff --git a/src/Makefile.am b/src/Makefile.am index 516e8fe..0a47d34 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -11,8 +11,8 @@ module_la_SOURCES = e_mod_main.c \ input-method-protocol.c \ text-protocol.c module_la_LIBADD = -module_la_CFLAGS = @WAYLAND_CFLAGS@ @ENLIGHTENMENT_CFLAGS@ -DHAVE_WAYLAND_ONLY -module_la_LDFLAGS = -module -avoid-version @WAYLAND_LIBS@ @ENLIGHTENMENT_LIBS@ +module_la_CFLAGS = @WAYLAND_CFLAGS@ @ENLIGHTENMENT_CFLAGS@ @EEZE_CFLAGS@ -DHAVE_WAYLAND_ONLY +module_la_LDFLAGS = -module -avoid-version @WAYLAND_LIBS@ @ENLIGHTENMENT_LIBS@ @EEZE_LIBS@ module_la_DEPENDENCIES = $(top_builddir)/config.h BUILT_SOURCES = input-method-protocol.c \ diff --git a/src/e_mod_main.c b/src/e_mod_main.c index 4600b06..b33f0d5 100644 --- a/src/e_mod_main.c +++ b/src/e_mod_main.c @@ -3,6 +3,7 @@ #include "e_mod_main.h" #include "text-protocol.h" #include "input-method-protocol.h" +#include "Eeze.h" typedef struct _E_Text_Input E_Text_Input; typedef struct _E_Text_Input_Mgr E_Text_Input_Mgr; @@ -56,6 +57,8 @@ struct _E_Mod_Text_Input_Shutdown_Cb E_Input_Method *g_input_method; Eina_List *shutdown_list; +Eina_Bool g_keyboard_connecting = EINA_FALSE; +Eeze_Udev_Watch * eeze_udev_watch_hander = NULL; static void _e_mod_text_input_shutdown_cb_add(void (*func)(void *data), void *data) @@ -475,7 +478,8 @@ _e_text_input_cb_input_panel_show(struct wl_client *client EINA_UNUSED, struct w "No Text Input For Resource"); return; } - + if (g_keyboard_connecting == EINA_TRUE) + return; text_input->input_panel_visibile = EINA_TRUE; e_input_panel_visibility_change(EINA_TRUE); @@ -522,6 +526,9 @@ _e_text_input_cb_reset(struct wl_client *client EINA_UNUSED, struct wl_resource return; } + if (g_keyboard_connecting == EINA_FALSE) + e_input_panel_visibility_change(EINA_TRUE); + EINA_LIST_FOREACH(text_input->input_methods, l, input_method) { if (!input_method || !input_method->context) continue; @@ -931,6 +938,18 @@ _e_mod_text_input_shutdown(void) EAPI E_Module_Api e_modapi = { E_MODULE_API_VERSION, "Wl_Text_Input" }; +static void +_e_mod_eeze_udev_watch_cb(const char *text, Eeze_Udev_Event event, void *data, Eeze_Udev_Watch *watch) +{ + if (event == EEZE_UDEV_EVENT_ADD) + { + g_keyboard_connecting = EINA_TRUE; + e_input_panel_visibility_change(EINA_FALSE); + } + else if (event == EEZE_UDEV_EVENT_REMOVE) + g_keyboard_connecting = EINA_FALSE; +} + EAPI void * e_modapi_init(E_Module *m) { @@ -950,6 +969,13 @@ e_modapi_init(E_Module *m) if (!_e_text_input_manager_create(cdata)) goto err; + eeze_udev_watch_hander = eeze_udev_watch_add(EEZE_UDEV_TYPE_KEYBOARD, + EEZE_UDEV_EVENT_ADD | EEZE_UDEV_EVENT_REMOVE, + _e_mod_eeze_udev_watch_cb, + NULL); + if (!eeze_udev_watch_hander) + goto err; + return m; err: _e_mod_text_input_shutdown(); @@ -959,6 +985,11 @@ err: EAPI int e_modapi_shutdown(E_Module *m EINA_UNUSED) { + if (eeze_udev_watch_hander) + { + eeze_udev_watch_del(eeze_udev_watch_hander); + eeze_udev_watch_hander = NULL; + } _e_mod_text_input_shutdown(); e_input_panel_shutdown(NULL);