fix spurious pointer jumps due to previous commit bugfix

690ab94c06 fixed one bug and added
another - this fixes the other spurious pointer warps.
This commit is contained in:
Carsten Haitzler 2020-04-17 18:48:57 +01:00
parent 876f509be4
commit 550de9a680
3 changed files with 32 additions and 17 deletions

View File

@ -416,6 +416,7 @@ _e_comp_object_cb_mouse_in(void *data, Evas *e EINA_UNUSED, Evas_Object *obj, vo
} }
if (e_grabinput_mouse_win_get() && (e_grabinput_mouse_win_get() != e_client_util_win_get(cw->ec))) if (e_grabinput_mouse_win_get() && (e_grabinput_mouse_win_get() != e_client_util_win_get(cw->ec)))
return; return;
if (!cw->ec->mouse.in)
e_client_mouse_in(cw->ec, ev->output.x, ev->output.y); e_client_mouse_in(cw->ec, ev->output.x, ev->output.y);
} }

View File

@ -2501,8 +2501,13 @@ _e_comp_x_mapping_change(void *data EINA_UNUSED, int type EINA_UNUSED, Ecore_X_E
static void static void
_e_comp_x_mouse_in_job(void *d EINA_UNUSED) _e_comp_x_mouse_in_job(void *d EINA_UNUSED)
{ {
if (mouse_client) E_Client *ec = mouse_client;
e_client_mouse_in(mouse_client, e_comp_canvas_x_root_adjust(mouse_in_coords.x), e_comp_canvas_y_root_adjust(mouse_in_coords.y));
if (ec)
{
if (!ec->mouse.in)
e_client_mouse_in(ec, e_comp_canvas_x_root_adjust(mouse_in_coords.x), e_comp_canvas_y_root_adjust(mouse_in_coords.y));
}
mouse_in_job = NULL; mouse_in_job = NULL;
} }
@ -2702,7 +2707,7 @@ _e_comp_x_mouse_move(void *d EINA_UNUSED, int t EINA_UNUSED, Ecore_Event_Mouse_M
if (!evas_object_visible_get(tec->frame)) continue; if (!evas_object_visible_get(tec->frame)) continue;
if (E_INSIDE(x, y, tec->x, tec->y, tec->w, tec->h)) return ECORE_CALLBACK_RENEW; if (E_INSIDE(x, y, tec->x, tec->y, tec->w, tec->h)) return ECORE_CALLBACK_RENEW;
} }
if (!mouse_in_job) if ((!mouse_in_job) && (!mouse_in_fix_check_timer))
e_client_mouse_in(ec, x, y); e_client_mouse_in(ec, x, y);
} }
return ECORE_CALLBACK_RENEW; return ECORE_CALLBACK_RENEW;
@ -3020,7 +3025,7 @@ _e_comp_x_move_resize_request(void *data EINA_UNUSED, int type EINA_UNUSED, Ecor
static Eina_Bool static Eina_Bool
_e_comp_x_focus_timer_cb(void *d EINA_UNUSED) _e_comp_x_focus_timer_cb(void *d EINA_UNUSED)
{ {
E_Client *focused; E_Client *focused, *ec;
/* if mouse-based focus policy clients exist for [focused] and [mouse_client], /* if mouse-based focus policy clients exist for [focused] and [mouse_client],
* [mouse_client] should have focus here. * [mouse_client] should have focus here.
@ -3037,15 +3042,20 @@ _e_comp_x_focus_timer_cb(void *d EINA_UNUSED)
* client as necessary * client as necessary
*/ */
focused = e_client_focused_get(); focused = e_client_focused_get();
if (mouse_client && focused && (!e_client_focus_policy_click(focused)) && (mouse_client != focused)) ec = mouse_client;
if (ec && focused && (ec != focused) &&
(!e_client_focus_policy_click(focused)))
{ {
int x, y; int x, y;
ecore_evas_pointer_xy_get(e_comp->ee, &x, &y); ecore_evas_pointer_xy_get(e_comp->ee, &x, &y);
if (E_INSIDE(x, y, mouse_client->x, mouse_client->y, mouse_client->w, mouse_client->h)) if (E_INSIDE(x, y, ec->x, ec->y, ec->w, ec->h))
{ {
if (!_e_comp_x_client_data_get(mouse_client)->deleted) if (!_e_comp_x_client_data_get(ec)->deleted)
e_client_mouse_in(mouse_client, x, y); {
if (!ec->mouse.in)
e_client_mouse_in(ec, x, y);
}
} }
} }
focus_timer = NULL; focus_timer = NULL;
@ -3130,15 +3140,19 @@ _e_comp_x_focus_in(void *data EINA_UNUSED, int type EINA_UNUSED, Ecore_X_Event_W
/* should be equal, maybe some clients don't reply with the proper timestamp ? */ /* should be equal, maybe some clients don't reply with the proper timestamp ? */
if (ev->time >= focus_time) if (ev->time >= focus_time)
{ {
if (!evas_object_focus_get(ec->frame)) if ((!e_grabinput_mouse_win_get()) && (!e_grabinput_key_win_get()))
{
if (ecore_x_window_focus_get() != e_client_util_win_get(ec))
{ {
evas_object_focus_set(ec->frame, 1); evas_object_focus_set(ec->frame, 1);
if (!e_client_focus_policy_click(ec)) if ((!e_client_focus_policy_click(ec)) &&
(!ec->mouse.in))
e_client_pointer_warp_to_center_now(ec); e_client_pointer_warp_to_center_now(ec);
} }
else else
evas_object_focus_set(ec->frame, 1); evas_object_focus_set(ec->frame, 1);
} }
}
/* handle case of someone trying to benchmark focus handling */ /* handle case of someone trying to benchmark focus handling */
if ((!e_client_focus_policy_click(ec)) && (focused && (!e_client_focus_policy_click(focused))) && if ((!e_client_focus_policy_click(ec)) && (focused && (!e_client_focus_policy_click(focused))) &&
(ev->time - focus_time <= 2)) (ev->time - focus_time <= 2))

View File

@ -9,10 +9,10 @@ static Eina_Bool _e_focus_raise_timer(void *data);
E_API void E_API void
e_focus_event_mouse_in(E_Client *ec) e_focus_event_mouse_in(E_Client *ec)
{ {
if ((e_config->focus_policy == E_FOCUS_MOUSE) || if ((e_config->focus_policy == E_FOCUS_MOUSE) ||
(e_config->focus_policy == E_FOCUS_SLOPPY)) (e_config->focus_policy == E_FOCUS_SLOPPY))
{ {
if (!ec->focused)
evas_object_focus_set(ec->frame, 1); evas_object_focus_set(ec->frame, 1);
} }
E_FREE_FUNC(ec->raise_timer, ecore_timer_del); E_FREE_FUNC(ec->raise_timer, ecore_timer_del);