Support to hide input panel or not according to the window type 93/88893/2
authorJihoon Kim <jihoon48.kim@samsung.com>
Wed, 21 Sep 2016 05:44:23 +0000 (14:44 +0900)
committerJihoon Kim <jihoon48.kim@samsung.com>
Wed, 21 Sep 2016 06:05:26 +0000 (15:05 +0900)
Change-Id: I6fa37db72965a6916d2b597c20374d22e426fc80
Signed-off-by: Jihoon Kim <jihoon48.kim@samsung.com>
configure.ac
packaging/e-mod-tizen-wl-textinput.spec
src/e_mod_main.c

index 4934f5a..3b71017 100644 (file)
@@ -31,6 +31,7 @@ PKG_CHECK_MODULES(WAYLAND, [wayland-server, text-server, input-method-server])
 PKG_CHECK_MODULES(ENLIGHTENMENT, [enlightenment])
 PKG_CHECK_MODULES(EEZE, [eeze])
 PKG_CHECK_MODULES(VCONF, [vconf])
+PKG_CHECK_MODULES(DLOG, [dlog])
 
 AC_SUBST(ENLIGHTENMENT_CFLAGS)
 AC_SUBST(ENLIGHTENMENT_LIBS)
index 1517c2d..8a09ce7 100644 (file)
@@ -12,6 +12,7 @@ BuildRequires: pkgconfig(input-method-server)
 BuildRequires: pkgconfig(enlightenment)
 BuildRequires: pkgconfig(eeze)
 BuildRequires: pkgconfig(vconf)
+BuildRequires: pkgconfig(dlog)
 %if !%{with wayland}
 ExclusiveArch:
 %endif
index 3ba44b7..9151e7a 100644 (file)
@@ -5,7 +5,14 @@
 #include <input-method-server-protocol.h>
 #include <vconf.h>
 #include <vconf-keys.h>
-#include "Eeze.h"
+#include <Eeze.h>
+#include <Ecore_Wayland.h>
+#include <dlog.h>
+
+#ifdef LOG_TAG
+#undef LOG_TAG
+#endif
+#define LOG_TAG "WL_TEXTINPUT"
 
 static Eina_Bool _e_text_input_method_context_cb_client_resize(void *data EINA_UNUSED, int type, void *event);
 static void set_soft_keyboard_mode();
@@ -1572,6 +1579,40 @@ _e_text_input_cb_reset_sync(struct wl_client *client EINA_UNUSED, struct wl_reso
      }
 }
 
+static void
+_e_text_input_cb_get_hide_permission(struct wl_client *client EINA_UNUSED, struct wl_resource *resource)
+{
+   E_Text_Input *text_input = wl_resource_get_user_data(resource);
+   uint32_t permission = 1;
+   E_Client *ec = NULL;
+
+   if (!text_input)
+     {
+        wl_resource_post_error(resource,
+                               WL_DISPLAY_ERROR_INVALID_OBJECT,
+                               "No Text Input For Resource");
+        return;
+     }
+
+   ec = e_client_focused_get();
+   if (ec)
+     {
+        E_Window_Type focus_win_type = ec->netwm.type;
+        LOGD("Window ID : 0x%08x, Name : %s, type : %d\n", (unsigned int)e_client_util_win_get(ec), (char *)e_client_util_name_get(ec), focus_win_type);
+
+        if (focus_win_type == E_WINDOW_TYPE_NOTIFICATION ||
+            focus_win_type == E_WINDOW_TYPE_POPUP_MENU)
+          permission = 0;
+     }
+   else
+     {
+        LOGD("Can't get focus window\n");
+     }
+
+   if (text_input->resource)
+     wl_text_input_send_hide_permission(text_input->resource, permission);
+}
+
 static const struct wl_text_input_interface _e_text_input_implementation = {
      _e_text_input_cb_activate,
      _e_text_input_cb_deactivate,
@@ -1590,7 +1631,8 @@ static const struct wl_text_input_interface _e_text_input_implementation = {
      _e_text_input_cb_cursor_position_set,
      _e_text_input_cb_process_input_device_event,
      _e_text_input_cb_filter_key_event,
-     _e_text_input_cb_reset_sync
+     _e_text_input_cb_reset_sync,
+     _e_text_input_cb_get_hide_permission
 };
 
 static void