From 550de9a680556eb8e65b028c687402b7a4c50493 Mon Sep 17 00:00:00 2001 From: "Carsten Haitzler (Rasterman)" Date: Fri, 17 Apr 2020 18:48:57 +0100 Subject: [PATCH] fix spurious pointer jumps due to previous commit bugfix 690ab94c06e46d0fbf52054475800d2b74dc80d0 fixed one bug and added another - this fixes the other spurious pointer warps. --- src/bin/e_comp_object.c | 3 ++- src/bin/e_comp_x.c | 42 +++++++++++++++++++++++++++-------------- src/bin/e_focus.c | 4 ++-- 3 files changed, 32 insertions(+), 17 deletions(-) diff --git a/src/bin/e_comp_object.c b/src/bin/e_comp_object.c index bdadb3b45..75cea33aa 100644 --- a/src/bin/e_comp_object.c +++ b/src/bin/e_comp_object.c @@ -416,7 +416,8 @@ _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))) return; - e_client_mouse_in(cw->ec, ev->output.x, ev->output.y); + if (!cw->ec->mouse.in) + e_client_mouse_in(cw->ec, ev->output.x, ev->output.y); } /* handle evas mouse-out events on client object */ diff --git a/src/bin/e_comp_x.c b/src/bin/e_comp_x.c index a4858e5bc..c3c0e2352 100644 --- a/src/bin/e_comp_x.c +++ b/src/bin/e_comp_x.c @@ -2501,8 +2501,13 @@ _e_comp_x_mapping_change(void *data EINA_UNUSED, int type EINA_UNUSED, Ecore_X_E static void _e_comp_x_mouse_in_job(void *d EINA_UNUSED) { - if (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)); + E_Client *ec = mouse_client; + + 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; } @@ -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 (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); } 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 _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], * [mouse_client] should have focus here. @@ -3037,15 +3042,20 @@ _e_comp_x_focus_timer_cb(void *d EINA_UNUSED) * client as necessary */ 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; 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) - e_client_mouse_in(mouse_client, x, y); + if (!_e_comp_x_client_data_get(ec)->deleted) + { + if (!ec->mouse.in) + e_client_mouse_in(ec, x, y); + } } } focus_timer = NULL; @@ -3130,14 +3140,18 @@ _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 ? */ if (ev->time >= focus_time) { - if (!evas_object_focus_get(ec->frame)) + if ((!e_grabinput_mouse_win_get()) && (!e_grabinput_key_win_get())) { - evas_object_focus_set(ec->frame, 1); - if (!e_client_focus_policy_click(ec)) - e_client_pointer_warp_to_center_now(ec); + if (ecore_x_window_focus_get() != e_client_util_win_get(ec)) + { + evas_object_focus_set(ec->frame, 1); + if ((!e_client_focus_policy_click(ec)) && + (!ec->mouse.in)) + e_client_pointer_warp_to_center_now(ec); + } + else + evas_object_focus_set(ec->frame, 1); } - else - evas_object_focus_set(ec->frame, 1); } /* handle case of someone trying to benchmark focus handling */ if ((!e_client_focus_policy_click(ec)) && (focused && (!e_client_focus_policy_click(focused))) && diff --git a/src/bin/e_focus.c b/src/bin/e_focus.c index 5dd3d7b6d..940733362 100644 --- a/src/bin/e_focus.c +++ b/src/bin/e_focus.c @@ -9,11 +9,11 @@ static Eina_Bool _e_focus_raise_timer(void *data); E_API void e_focus_event_mouse_in(E_Client *ec) { - if ((e_config->focus_policy == E_FOCUS_MOUSE) || (e_config->focus_policy == E_FOCUS_SLOPPY)) { - evas_object_focus_set(ec->frame, 1); + if (!ec->focused) + evas_object_focus_set(ec->frame, 1); } E_FREE_FUNC(ec->raise_timer, ecore_timer_del); if (e_config->use_auto_raise)