From: duna.oh Date: Thu, 9 May 2024 02:24:18 +0000 (+0900) Subject: e_comp_wl: update evas's mouse position before ungrab input when pointer constrainted X-Git-Tag: accepted/tizen/8.0/unified/20240513.165331^0 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=refs%2Fchanges%2F06%2F311006%2F1;p=platform%2Fupstream%2Fenlightenment.git e_comp_wl: update evas's mouse position before ungrab input when pointer constrainted There is a bug that mouse out/in events are not generated for correct clients because evas's mouse position is not updated when pointer warp is requested. To fix this issue, call evas_event_feed_mouse_move() before ungrab input. Change-Id: I1ad3c1d345de4ba2372061c8151f7bb54c34ba75 --- diff --git a/src/bin/e_comp.c b/src/bin/e_comp.c index 127e74635e..1a70124575 100644 --- a/src/bin/e_comp.c +++ b/src/bin/e_comp.c @@ -798,6 +798,8 @@ e_comp_grab_input(Eina_Bool mouse, Eina_Bool kbd) Eina_Bool ret = EINA_FALSE; Ecore_Window mwin = 0, kwin = 0; + INF("E_Comp grab_input"); + mouse = !!mouse; kbd = !!kbd; if (mouse || e_comp->input_mouse_grabs) @@ -821,6 +823,8 @@ e_comp_ungrab_input(Eina_Bool mouse, Eina_Bool kbd) { Ecore_Window mwin = 0, kwin = 0; + INF("E_Comp ungrab_input"); + mouse = !!mouse; kbd = !!kbd; if (e_comp->input_mouse_grabs) diff --git a/src/bin/e_comp_wl.c b/src/bin/e_comp_wl.c index 68edd4a4e7..42adc1097a 100644 --- a/src/bin/e_comp_wl.c +++ b/src/bin/e_comp_wl.c @@ -1263,7 +1263,6 @@ _e_comp_wl_evas_cb_mouse_in(void *data, Evas *evas EINA_UNUSED, Evas_Object *obj struct wl_client *wc; Eina_List *l; uint32_t serial; - E_Comp_Config *comp_conf; E_Client *prev_ptr_ec; ev = event; @@ -1285,11 +1284,9 @@ _e_comp_wl_evas_cb_mouse_in(void *data, Evas *evas EINA_UNUSED, Evas_Object *obj e_comp_wl->ptr.ec = ec; - comp_conf = e_comp_config_get(); - if (comp_conf && comp_conf->input_log_enable) - ELOGF("Mouse", "In (obj: %p, time: %d, canvas(%d, %d) output(%d, %d), name:%20s)", - ec, obj, ev->timestamp, ev->canvas.x, ev->canvas.y, ev->output.x, ev->output.y, - e_client_util_name_get(ec)); + ELOGF("Mouse", "In (obj: %p, time: %d, canvas(%d, %d) output(%d, %d), name:%20s)", + ec, obj, ev->timestamp, ev->canvas.x, ev->canvas.y, ev->output.x, ev->output.y, + e_client_util_name_get(ec)); if (_e_comp_wl_check_cursor_timer_needed(ec)) { @@ -1312,10 +1309,7 @@ _e_comp_wl_evas_cb_mouse_in(void *data, Evas *evas EINA_UNUSED, Evas_Object *obj wl_fixed_from_int(ev->canvas.y - ec->client.y)); ec->pointer_enter_sent = EINA_TRUE; } - if (ev->timestamp) wl_signal_emit(&e_comp_wl->ptr_constraints.surface_mousein_signal, ec); - else - ELOGF("Mouse", "In. Event doesn't have timestamp. no need to send signal", NULL); } static void @@ -1328,7 +1322,6 @@ _e_comp_wl_evas_cb_mouse_out(void *data, Evas *evas EINA_UNUSED, Evas_Object *ob Eina_List *l; uint32_t serial; Eina_Bool inside_check; - E_Comp_Config *comp_conf; ev = event; @@ -1344,11 +1337,9 @@ _e_comp_wl_evas_cb_mouse_out(void *data, Evas *evas EINA_UNUSED, Evas_Object *ob struct wl_resource *surface = e_comp_wl_client_surface_get(ec); if (!surface) return; - comp_conf = e_comp_config_get(); - if (comp_conf && comp_conf->input_log_enable) - ELOGF("Mouse", "Out (obj: %p, time: %d, canvas(%d, %d) output(%d, %d), name:%20s)", - ec, obj, ev->timestamp, ev->canvas.x, ev->canvas.y, ev->output.x, ev->output.y, - e_client_util_name_get(ec)); + ELOGF("Mouse", "Out (obj: %p, time: %d, canvas(%d, %d) output(%d, %d), name:%20s)", + ec, obj, ev->timestamp, ev->canvas.x, ev->canvas.y, ev->output.x, ev->output.y, + e_client_util_name_get(ec)); if (_e_comp_wl_check_cursor_timer_needed(ec)) { @@ -1371,10 +1362,7 @@ _e_comp_wl_evas_cb_mouse_out(void *data, Evas *evas EINA_UNUSED, Evas_Object *ob wl_pointer_send_leave(res, serial, surface); ec->pointer_enter_sent = EINA_FALSE; } - if (ev->timestamp) wl_signal_emit(&e_comp_wl->ptr_constraints.surface_mouseout_signal, ec); - else - ELOGF("Mouse", "Out. Event doesn't have timestamp. no need to send signal", NULL); } static void diff --git a/src/bin/e_comp_wl_input.c b/src/bin/e_comp_wl_input.c index 6546f04427..593b275605 100644 --- a/src/bin/e_comp_wl_input.c +++ b/src/bin/e_comp_wl_input.c @@ -829,11 +829,6 @@ _e_comp_wl_input_cb_pointer_constraints_surface_committed(struct wl_listener *li WRN("Pointer Constraint. Committed. hint (%d, %d)", constraint->hint_x, constraint->hint_y); } - - // Workaround: Feed mouse out/in to make sure that mouse in to correct client. - // Since Mouse move event doesn't generate mouse in/out if mouse(input) is grabbed, - // ungrab input before warping a pointer to cursor position hint. - e_comp_ungrab_input(1,1); } if (constraint->is_region_pending) diff --git a/src/bin/e_devicemgr_input.c b/src/bin/e_devicemgr_input.c index 9658d30804..94d2af623f 100644 --- a/src/bin/e_devicemgr_input.c +++ b/src/bin/e_devicemgr_input.c @@ -24,6 +24,23 @@ _e_devicemgr_input_pointer_warp(int x, int y) e_input_device_pointer_warp(NULL, x, y); DMWRN("The pointer warped to (%d, %d) !\n", x, y); + if (e_comp_wl_input_pointer_constraint_activated_get()) + { + // update evas' mouse position to the requested warp position + // This generates mouse out/in to correct client. + DMWRN("Pointer Constraint activated. feed_mouse_move"); + evas_event_feed_mouse_move(e_comp->evas, x, y, 0, NULL); + } + + if (e_comp_wl_input_pointer_constraint_activated_get()) + { + // Workaround: Feed mouse out/in to make sure that mouse in to correct client. + // Since Mouse move event doesn't generate mouse in/out if mouse(input) is grabbed, + // ungrab input before warping a pointer to cursor position hint. + DMWRN("Pointer Constraint activated. call e_comp_ungrab_input"); + e_comp_ungrab_input(1, 1); + } + return TIZEN_INPUT_DEVICE_MANAGER_ERROR_NONE; } diff --git a/src/bin/e_input_device.c b/src/bin/e_input_device.c index e3eadfa1e2..d9080e5717 100644 --- a/src/bin/e_input_device.c +++ b/src/bin/e_input_device.c @@ -358,12 +358,14 @@ e_input_device_pointer_warp(E_Input_Device *dev, int x, int y) if (warp_dev) { - _e_input_hook_call(E_INPUT_HOOK_POINTER_WARP, libinput_device_get_name(warp_dev->device)); - - seat->ptr.dx = seat->ptr.ix = x; - seat->ptr.dy = seat->ptr.iy = y; - _e_input_pointer_motion_post(warp_dev); + if (seat->ptr.ix != x || seat->ptr.iy != y) + { + _e_input_hook_call(E_INPUT_HOOK_POINTER_WARP, libinput_device_get_name(warp_dev->device)); + seat->ptr.dx = seat->ptr.ix = x; + seat->ptr.dy = seat->ptr.iy = y; + _e_input_pointer_motion_post(warp_dev); + } found = EINA_TRUE; } }