e_comp_wl: send touch cancel event on zone_display_state_change 25/63825/5 accepted/tizen/ivi/20160405.083749 accepted/tizen/mobile/20160405.083657 accepted/tizen/tv/20160405.083712 accepted/tizen/wearable/20160405.083728 submit/tizen/20160405.063630
authorDuna Oh <duna.oh@samsung.com>
Mon, 28 Mar 2016 04:47:28 +0000 (13:47 +0900)
committerSung-Jin Park <sj76.park@samsung.com>
Tue, 5 Apr 2016 06:21:15 +0000 (23:21 -0700)
Signed-off-by: Duna Oh <duna.oh@samsung.com>
Change-Id: If4d44864cabe2111903481f6f88b4517a4806da1

src/bin/e_comp_wl.c

index b6c77b87935297b5fcd9c9b9bd1543ebcee70c08..c8b0734387383cb8f470ba1e99b59ac813abb193 100644 (file)
@@ -514,6 +514,29 @@ _e_comp_wl_evas_cb_move(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA_U
      evas_object_move(ec->comp_data->sub.below_obj, ec->x, ec->y);
 }
 
+static void
+_e_comp_wl_send_touch_cancel(E_Client *ec)
+{
+   Eina_List *l;
+   struct wl_resource *res;
+   struct wl_client *wc;
+
+   if (!ec) return;
+   if (e_object_is_del(E_OBJECT(ec))) return;
+   if (!ec->comp_data->surface) return;
+   if (ec->ignored) return;
+
+   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);
+     }
+}
+
 static void
 _e_comp_wl_evas_cb_restack(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED)
 {
@@ -526,25 +549,8 @@ _e_comp_wl_evas_cb_restack(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EIN
 
    if (e_comp_wl->ptr.ec && need_send_released)
      {
-        E_Client *ec;
-        Eina_List *l;
-        struct wl_resource *res;
-        struct wl_client *wc;
-
-        if (!(ec = e_comp_wl->ptr.ec)) return;
-        if (e_object_is_del(E_OBJECT(ec))) return;
-        if (!ec->comp_data->surface) return;
-        if (ec->ignored) return;
-
-        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;
+        _e_comp_wl_send_touch_cancel(e_comp_wl->ptr.ec);
 
-             wl_touch_send_cancel(res);
-          }
         need_send_released = EINA_FALSE;
         need_send_motion = EINA_FALSE;
      }
@@ -1023,7 +1029,6 @@ _e_comp_wl_evas_cb_mouse_up(void *data, Evas *evas EINA_UNUSED, Evas_Object *obj
    if (!need_send_released)
      {
         need_send_motion = EINA_TRUE;
-        return;
      }
 
    dev = ev->dev;
@@ -1790,29 +1795,24 @@ _e_comp_wl_cb_mouse_move(void *d EINA_UNUSED, int t EINA_UNUSED, Ecore_Event_Mou
 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;
+   if (e_comp_wl->ptr.ec)
+     _e_comp_wl_send_touch_cancel(e_comp_wl->ptr.ec);
 
-   wc = wl_resource_get_client(ec->comp_data->surface);
+   return ECORE_CALLBACK_PASS_ON;
+}
 
-   EINA_LIST_FOREACH(e_comp->wl_comp_data->touch.resources, l, res)
+static Eina_Bool
+_e_comp_wl_cb_zone_display_state_change(void *d EINA_UNUSED, int t EINA_UNUSED, E_Event_Zone_Display_State_Change *ev EINA_UNUSED)
+{
+   if (e_comp_wl->ptr.ec && need_send_released)
      {
-        if (wl_resource_get_client(res) != wc) continue;
-        if (!e_comp_wl_input_touch_check(res)) continue;
+        _e_comp_wl_send_touch_cancel(e_comp_wl->ptr.ec);
 
-        wl_touch_send_cancel(res);
-     }
-
-   return ECORE_CALLBACK_PASS_ON;
-}
+        need_send_released = EINA_FALSE;
+      }
 
+    return ECORE_CALLBACK_PASS_ON;
+ }
 
 static void
 _e_comp_wl_subsurface_restack(E_Client *ec)
@@ -4188,6 +4188,7 @@ e_comp_wl_init(void)
    E_LIST_HANDLER_APPEND(handlers, E_EVENT_COMP_OBJECT_ADD,         _e_comp_wl_cb_comp_object_add,     NULL);
    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);
+   E_LIST_HANDLER_APPEND(handlers, E_EVENT_ZONE_DISPLAY_STATE_CHANGE, _e_comp_wl_cb_zone_display_state_change, NULL);
 
    /* add hooks to catch e_client events */
    e_client_hook_add(E_CLIENT_HOOK_NEW_CLIENT,   _e_comp_wl_client_cb_new,          NULL);