From: Duna Oh Date: Mon, 7 Mar 2016 01:27:18 +0000 (+0900) Subject: e_comp_wl: send a pointer_leave event to focused client if mouse_down events is not... X-Git-Tag: accepted/tizen/ivi/20160307.105156^0 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=8cbc611f383d3144751f5506dafdc4003dd61167;p=platform%2Fupstream%2Fenlightenment.git e_comp_wl: send a pointer_leave event to focused client if mouse_down events is not occurred on it 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 Change-Id: I46779a7f9f84c40de35083f96a19906dc4768aae --- diff --git a/src/bin/e_comp_wl.c b/src/bin/e_comp_wl.c index ae16c03..0e96c3c 100644 --- a/src/bin/e_comp_wl.c +++ b/src/bin/e_comp_wl.c @@ -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