Send touch cancel event to client 26/61526/3
authorJengHyun Kang <jhyuni.kang@samsung.com>
Tue, 15 Mar 2016 12:27:32 +0000 (21:27 +0900)
committerSung-Jin Park <sj76.park@samsung.com>
Thu, 17 Mar 2016 02:22:34 +0000 (19:22 -0700)
Change-Id: I193de3935365339fc9d71280d3cdd68df3ac16f0

src/bin/e_comp_wl.c

index edd9e6f..f4d7f40 100644 (file)
@@ -2005,6 +2005,33 @@ _e_comp_wl_cb_mouse_move(void *d EINA_UNUSED, int t EINA_UNUSED, Ecore_Event_Mou
    return ECORE_CALLBACK_RENEW;
 }
 
+static Eina_Bool
+_e_comp_wl_cb_mouse_button_cancel(void *d EINA_UNUSED, int t EINA_UNUSED, Ecore_Event_Mouse_Button *ev)
+{
+   E_Client *ec;
+   Eina_List *l;
+   struct wl_resource *res;
+   struct wl_client *wc;
+
+   if (!(ec = e_comp_wl->ptr.ec)) return ECORE_CALLBACK_PASS_ON;
+   if (e_object_is_del(E_OBJECT(ec))) return ECORE_CALLBACK_PASS_ON;
+   if (!ec->comp_data->surface) return ECORE_CALLBACK_PASS_ON;
+   if (ec->ignored) return ECORE_CALLBACK_PASS_ON;
+
+   wc = wl_resource_get_client(ec->comp_data->surface);
+
+   EINA_LIST_FOREACH(e_comp->wl_comp_data->touch.resources, l, res)
+     {
+        if (wl_resource_get_client(res) != wc) continue;
+        if (!e_comp_wl_input_touch_check(res)) continue;
+
+        wl_touch_send_cancel(res);
+     }
+
+   return ECORE_CALLBACK_PASS_ON;
+}
+
+
 static void
 _e_comp_wl_subsurface_restack(E_Client *ec)
 {
@@ -4538,6 +4565,8 @@ e_comp_wl_init(void)
 
    E_LIST_HANDLER_APPEND(handlers, ECORE_EVENT_MOUSE_MOVE,
                          _e_comp_wl_cb_mouse_move, NULL);
+   E_LIST_HANDLER_APPEND(handlers, ECORE_EVENT_MOUSE_BUTTON_CANCEL,
+                         _e_comp_wl_cb_mouse_button_cancel, NULL);
 
    /* add hooks to catch e_client events */
    e_client_hook_add(E_CLIENT_HOOK_NEW_CLIENT, _e_comp_wl_client_cb_new, NULL);