e_client: Add APIs to send mouse in / out events 03/122603/7
authorJengHyun Kang <jhyuni.kang@samsung.com>
Mon, 3 Apr 2017 05:02:50 +0000 (14:02 +0900)
committerJeongHyun Kang <jhyuni.kang@samsung.com>
Wed, 5 Apr 2017 06:22:58 +0000 (23:22 -0700)
Change-Id: I9de27f8adbd1e1e4eab6795f2437e3cddf045b66

src/bin/e_client.c
src/bin/e_client.h
src/bin/e_comp_wl.c
src/bin/e_comp_wl.h

index a1334481979a8491b4ac5b7bb14f41a7f9bba6b6..cc3baee907072f6ff7dea74268b6f348a447e7f7 100644 (file)
@@ -6662,6 +6662,26 @@ e_client_mouse_wheel_send(E_Client *ec, int direction, int z, Ecore_Device *dev,
    return res;
 }
 
+E_API Eina_Bool
+e_client_mouse_in_send(E_Client *ec, int x, int y, Ecore_Device *dev, unsigned int time)
+{
+   Eina_Bool res;
+
+   res = e_comp_wl_mouse_in_send(ec, x, y, dev, time);
+
+   return res;
+}
+
+E_API Eina_Bool
+e_client_mouse_out_send(E_Client *ec, Ecore_Device *dev, unsigned int time)
+{
+   Eina_Bool res;
+
+   res = e_comp_wl_mouse_out_send(ec, dev, time);
+
+   return res;
+}
+
 E_API Eina_Bool
 e_client_video_client_has(E_Client *ec)
 {
index 4d8f03e72e73ae37053e87746984eb366d486aee..c53c446643f444ec5ac75b518f888c09259dbd7f 100644 (file)
@@ -1102,6 +1102,8 @@ E_API Eina_Bool e_client_touch_cancel_send(E_Client *ec);
 E_API Eina_Bool e_client_mouse_button_send(E_Client *ec, int buttons, Eina_Bool pressed, Ecore_Device *dev, unsigned int time);
 E_API Eina_Bool e_client_mouse_move_send(E_Client *ec, int x, int y, Ecore_Device *dev, unsigned int time);
 E_API Eina_Bool e_client_mouse_wheel_send(E_Client *ec, int direction, int z, Ecore_Device *dev, unsigned int time);
+E_API Eina_Bool e_client_mouse_in_send(E_Client *ec, int x, int y, Ecore_Device *dev, unsigned int time);
+E_API Eina_Bool e_client_mouse_out_send(E_Client *ec, Ecore_Device *dev, unsigned int time);
 
 E_API Eina_Bool e_client_video_client_has(E_Client *ec);
 E_API Eina_Bool e_client_normal_client_has(E_Client *ec);
index 2d35c254894cb2b90b1ad7011f316a1ecb3b4938..ddd076689131803e0276d370f1a1ba2eb43cb105 100644 (file)
@@ -5970,6 +5970,69 @@ e_comp_wl_mouse_wheel_send(E_Client *ec, int direction, int z, Ecore_Device *dev
    return EINA_TRUE;
 }
 
+EINTERN Eina_Bool
+e_comp_wl_mouse_in_send(E_Client *ec, int x, int y, Ecore_Device *dev, uint32_t time)
+{
+   uint32_t serial;
+   struct wl_client *wc;
+   struct wl_resource *res;
+   Eina_List *l;
+
+   EINA_SAFETY_ON_NULL_RETURN_VAL(ec, EINA_FALSE);
+   EINA_SAFETY_ON_NULL_RETURN_VAL(ec->comp_data, EINA_FALSE);
+   EINA_SAFETY_ON_NULL_RETURN_VAL(e_comp_wl, EINA_FALSE);
+   EINA_SAFETY_ON_TRUE_RETURN_VAL(e_object_is_del(E_OBJECT(ec)), EINA_FALSE);
+
+   if (!eina_list_count(e_comp_wl->ptr.resources)) return EINA_FALSE;
+   wc = wl_resource_get_client(ec->comp_data->surface);
+   serial = wl_display_next_serial(e_comp_wl->wl.disp);
+   EINA_LIST_FOREACH(e_comp_wl->ptr.resources, l, res)
+     {
+        if (!e_comp_wl_input_pointer_check(res)) continue;
+        if (wl_resource_get_client(res) != wc) continue;
+
+        if (dev) _e_comp_wl_send_event_device(wc, time, dev, serial);
+        else _e_comp_wl_device_send_last_event_device(ec, ECORE_DEVICE_CLASS_MOUSE, time);
+
+        wl_pointer_send_enter(res, serial, ec->comp_data->surface,
+                              wl_fixed_from_int(x),
+                              wl_fixed_from_int(y));
+     }
+
+   return EINA_TRUE;
+}
+
+EINTERN Eina_Bool
+e_comp_wl_mouse_out_send(E_Client *ec, Ecore_Device *dev, uint32_t time)
+{
+   uint32_t serial;
+   struct wl_client *wc;
+   struct wl_resource *res;
+   Eina_List *l;
+
+   EINA_SAFETY_ON_NULL_RETURN_VAL(e_comp_wl, EINA_FALSE);
+   EINA_SAFETY_ON_NULL_RETURN_VAL(ec, EINA_FALSE);
+   EINA_SAFETY_ON_NULL_RETURN_VAL(ec->comp_data, EINA_FALSE);
+   EINA_SAFETY_ON_NULL_RETURN_VAL(ec->comp_data->surface, EINA_FALSE);
+   EINA_SAFETY_ON_TRUE_RETURN_VAL(e_object_is_del(E_OBJECT(ec)), EINA_FALSE);
+
+   if (!eina_list_count(e_comp_wl->ptr.resources)) return EINA_FALSE;
+   wc = wl_resource_get_client(ec->comp_data->surface);
+   serial = wl_display_next_serial(e_comp_wl->wl.disp);
+   EINA_LIST_FOREACH(e_comp_wl->ptr.resources, l, res)
+     {
+        if (!e_comp_wl_input_pointer_check(res)) continue;
+        if (wl_resource_get_client(res) != wc) continue;
+
+        if (dev) _e_comp_wl_send_event_device(wc, time, dev, serial);
+        else _e_comp_wl_device_send_last_event_device(ec, ECORE_DEVICE_CLASS_MOUSE, time);
+
+        wl_pointer_send_leave(res, serial, ec->comp_data->surface);
+     }
+
+   return EINA_TRUE;
+}
+
 EINTERN Eina_Bool
 e_comp_wl_cursor_hide(E_Client *ec)
 {
index 51558516b3b733f26c166f12682eea83f1ab918e..c65510b063cb0ae2278a6176f469cff5273f0da5 100644 (file)
@@ -547,6 +547,9 @@ EINTERN Eina_Bool e_comp_wl_touch_cancel_send(E_Client *ec);
 EINTERN Eina_Bool e_comp_wl_mouse_button_send(E_Client *ec, int buttons, Eina_Bool pressed, Ecore_Device *dev, uint32_t time);
 EINTERN Eina_Bool e_comp_wl_mouse_move_send(E_Client *ec, int x, int y, Ecore_Device *dev, uint32_t time);
 EINTERN Eina_Bool e_comp_wl_mouse_wheel_send(E_Client *ec, int direction, int z, Ecore_Device *dev, uint32_t time);
+EINTERN Eina_Bool e_comp_wl_mouse_in_send(E_Client *ec, int x, int y, Ecore_Device *dev, uint32_t time);
+EINTERN Eina_Bool e_comp_wl_mouse_out_send(E_Client *ec, Ecore_Device *dev, uint32_t time);
+
 EINTERN Eina_Bool e_comp_wl_cursor_hide(E_Client *ec);
 
 EINTERN void     e_comp_wl_feed_focus_in(E_Client *ec);