Add a api to send key to focus client
authorJengHyun Kang <jhyuni.kang@samsung.com>
Mon, 4 Apr 2016 12:34:39 +0000 (21:34 +0900)
committerGwanglim Lee <gl77.lee@samsung.com>
Wed, 6 Apr 2016 00:50:06 +0000 (09:50 +0900)
Change-Id: I8b70f2f7771f86c5e93dccc698dee63ddb0bc480

src/bin/e_comp_wl.c

index 92ef9df3e8c5412a51bf57fff47223072b67a13e..b57db8819e2121dfb9e00bc8d7ff52fd68dd3462 100644 (file)
@@ -4707,6 +4707,31 @@ e_comp_wl_output_remove(const char *id)
      }
 }
 
+EAPI void
+e_comp_wl_key_send_to_focus(int keycode, int timestamp, Eina_Bool pressed)
+{
+   E_Client *ec = NULL;
+   int serial;
+
+   if (!e_comp) return;
+   if (e_comp->comp_type != E_PIXMAP_TYPE_WL) return;
+   if (!(e_comp_wl = e_comp->wl_comp_data)) return;
+
+   ec = e_client_focused_get();
+   if (ec && ec->comp_data->surface && e_comp_wl->kbd.focused)
+     {
+        struct wl_resource *res;
+        Eina_List *l;
+
+        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,
+                                  pressed ? WL_KEYBOARD_KEY_STATE_PRESSED : WL_KEYBOARD_KEY_STATE_RELEASED);
+          }
+     }
+}
+
 EINTERN Eina_Bool
 e_comp_wl_key_down(Ecore_Event_Key *ev)
 {