From: duna.oh Date: Mon, 23 Sep 2024 11:23:18 +0000 (+0900) Subject: e_comp_wl_input: allow cursor warping to hint position requested by inactive window X-Git-Tag: accepted/tizen/unified/20240926.050059~27 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=refs%2Fchanges%2F28%2F318028%2F1;p=platform%2Fupstream%2Fenlightenment.git e_comp_wl_input: allow cursor warping to hint position requested by inactive window In cases where active constraint window doesn't set its cursor hint position, the cursor will be warped to the hint position provided by the inactive window requesting it. < Scenario > 1. The left edge window becomes locked. 2. To release the pointer lock, the left edge window requests warp_pointer, without setting its cursor hint position. 3. The top edge window sets its cursor hint position because it expects the cursor to appear from the top rather than the left side. Change-Id: Ia4ee073bdc30e29d7a844c5c3bf542d46cd1c48c --- diff --git a/src/bin/server/e_comp_wl_input.c b/src/bin/server/e_comp_wl_input.c index b61a9af7a1..11dd22909e 100644 --- a/src/bin/server/e_comp_wl_input.c +++ b/src/bin/server/e_comp_wl_input.c @@ -76,6 +76,9 @@ static char *_env_e_default_xkb_layout = NULL; static char *_env_e_default_xkb_variant = NULL; static char *_env_e_default_xkb_opts = NULL; +static int constraint_last_hint_x = -1; +static int constraint_last_hint_y = -1; + static Eina_Bool _e_comp_wl_input_is_position_inside_constraint_region(E_Comp_Wl_Pointer_Constraint *constraint, wl_fixed_t fx, @@ -679,10 +682,15 @@ _e_comp_wl_input_pointer_constraint_notify_deactivated(E_Comp_Wl_Pointer_Constra if (constraint->ec && constraint->has_hint_set) { - INF("Pointer Constraint. Pointer Warp to (%d, %d)", constraint->hint_x, constraint->hint_y); e_input_device_pointer_warp(NULL, constraint->hint_x, constraint->hint_y); } + else if (constraint_last_hint_x != -1 && constraint_last_hint_y != -1) + { + INF("Pointer Constraint. Pointer Warp to (%d, %d) last_hint_x/y", + constraint_last_hint_x, constraint_last_hint_y); + e_input_device_pointer_warp(NULL, constraint_last_hint_x, constraint_last_hint_y); + } } static void @@ -777,6 +785,10 @@ _e_comp_wl_input_pointer_constraint_enable(E_Comp_Wl_Data *comp_wl, E_Comp_Wl_Po } constraint->active = EINA_TRUE; + constraint->has_hint_set = EINA_FALSE; // reset the value for new lock + constraint->is_hint_pending = EINA_FALSE; // reset the value for new lock + constraint_last_hint_x = -1; + constraint_last_hint_y = -1; E_Client *ec = constraint->ec; comp_wl->ptr_constraints.activated = EINA_TRUE; comp_wl->ptr_constraints.ec = ec; @@ -899,6 +911,12 @@ _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); } + if (!constraint->active) + { + WRN("Pointer Constraint. Committed. constraint not active"); + constraint_last_hint_x = constraint->hint_x; + constraint_last_hint_y = constraint->hint_y; + } } if (constraint->is_region_pending)