e_comp_wl: send a pointer_leave event to focused client if mouse_down events is not... 29/61229/1 accepted/tizen/ivi/20160307.105156 accepted/tizen/mobile/20160307.105100 accepted/tizen/tv/20160307.105118 accepted/tizen/wearable/20160307.105138 submit/tizen/20160307.023110
authorDuna Oh <duna.oh@samsung.com>
Mon, 7 Mar 2016 01:27:18 +0000 (10:27 +0900)
committerDuna Oh <duna.oh@samsung.com>
Mon, 7 Mar 2016 01:29:58 +0000 (10:29 +0900)
Once the application gets touch_down, ecore_wl sends a pointer_enter event to the application.
So it steals all events even if events is out of the application.
in this case, e_comp_wl need to send a pointer_leave event to focused client.
Changing this code to fix wierd behaviors of cursor when I touch IME(input panel) after touching entry.
Test Plan:
1. launch entry demo.
2. touch entry point. The cursor image is changed to 'xterm'.
3. touch IME. the demo app gets MOUSE_OUT and The cursor image is changed to 'left_ptr'.
   And the demo also gets MOUSE_IN and the cursor become 'xterm' again.

Signed-off-by: Duna Oh <duna.oh@samsung.com>
Change-Id: I46779a7f9f84c40de35083f96a19906dc4768aae

src/bin/e_comp_wl.c

index ae16c03..0e96c3c 100644 (file)
@@ -45,6 +45,7 @@ static Eina_Hash *clients_buffer_hash = NULL;
 static Eina_List *handlers = NULL;
 static double _last_event_time = 0.0;
 static E_Client *cursor_timer_ec = NULL;
+static Eina_Bool need_send_leave = EINA_TRUE;
 
 /* local functions */
 static void
@@ -1149,12 +1150,31 @@ _e_comp_wl_evas_handle_mouse_button_to_touch(E_Client *ec, uint32_t timestamp, i
 }
 
 static void
+_e_comp_wl_send_mouse_out(E_Client *ec)
+{
+   struct wl_resource *res;
+   struct wl_client *wc;
+   uint32_t serial;
+   Eina_List *l;
+
+   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;
+        wl_pointer_send_leave(res, serial, ec->comp_data->surface);
+     }
+}
+
+static void
 _e_comp_wl_evas_cb_mouse_down(void *data, Evas *evas EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event)
 {
    E_Client *ec = data;
    Evas_Event_Mouse_Down *ev = event;
    Evas_Device *dev = NULL;
    const char *dev_name;
+   E_Client *focused;
 
    if (!ec) return;
    if (e_object_is_del(E_OBJECT(ec))) return;
@@ -1169,6 +1189,18 @@ _e_comp_wl_evas_cb_mouse_down(void *data, Evas *evas EINA_UNUSED, Evas_Object *o
    else
      e_comp_wl_evas_handle_mouse_button(ec, ev->timestamp, ev->button,
                                         WL_POINTER_BUTTON_STATE_PRESSED);
+
+   focused = e_client_focused_get();
+   if ((focused) && (ec != focused))
+     {
+        if (need_send_leave)
+          {
+             need_send_leave = EINA_FALSE;
+             _e_comp_wl_send_mouse_out(focused);
+          }
+     }
+   else
+     need_send_leave = EINA_TRUE;
 }
 
 static void