From bcd612e78d8a330af1a6e9f2f68b3e33140a7140 Mon Sep 17 00:00:00 2001 From: "Carsten Haitzler (Rasterman)" Date: Fri, 17 Apr 2020 19:02:08 +0100 Subject: [PATCH] revert last focus fixes - they both end up worse than before. Revert "fix spurious pointer jumps due to previous commit bugfix" This reverts commit 550de9a680556eb8e65b028c687402b7a4c50493. Revert "focus - fix emacs buffer switch focus set reported by felipe" This reverts commit 690ab94c06e46d0fbf52054475800d2b74dc80d0. --- src/bin/e_comp_object.c | 3 +-- src/bin/e_comp_x.c | 45 ++++++++++------------------------------- src/bin/e_focus.c | 4 ++-- 3 files changed, 14 insertions(+), 38 deletions(-) diff --git a/src/bin/e_comp_object.c b/src/bin/e_comp_object.c index 75cea33aa..bdadb3b45 100644 --- a/src/bin/e_comp_object.c +++ b/src/bin/e_comp_object.c @@ -416,8 +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))) 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); } /* 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 c3c0e2352..f6b93792f 100644 --- a/src/bin/e_comp_x.c +++ b/src/bin/e_comp_x.c @@ -2501,13 +2501,8 @@ _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) { - 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)); - } + 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)); mouse_in_job = NULL; } @@ -2707,7 +2702,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) && (!mouse_in_fix_check_timer)) + if (!mouse_in_job) e_client_mouse_in(ec, x, y); } return ECORE_CALLBACK_RENEW; @@ -3025,7 +3020,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, *ec; + E_Client *focused; /* if mouse-based focus policy clients exist for [focused] and [mouse_client], * [mouse_client] should have focus here. @@ -3042,20 +3037,15 @@ _e_comp_x_focus_timer_cb(void *d EINA_UNUSED) * client as necessary */ focused = e_client_focused_get(); - ec = mouse_client; - if (ec && focused && (ec != focused) && - (!e_client_focus_policy_click(focused))) + if (mouse_client && focused && (!e_client_focus_policy_click(focused)) && (mouse_client != focused)) { int x, y; ecore_evas_pointer_xy_get(e_comp->ee, &x, &y); - if (E_INSIDE(x, y, ec->x, ec->y, ec->w, ec->h)) + if (E_INSIDE(x, y, mouse_client->x, mouse_client->y, mouse_client->w, mouse_client->h)) { - if (!_e_comp_x_client_data_get(ec)->deleted) - { - if (!ec->mouse.in) - e_client_mouse_in(ec, x, y); - } + if (!_e_comp_x_client_data_get(mouse_client)->deleted) + e_client_mouse_in(mouse_client, x, y); } } focus_timer = NULL; @@ -3139,20 +3129,7 @@ _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 ((!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); - 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); - } - } + 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))) && (ev->time - focus_time <= 2)) @@ -4924,8 +4901,8 @@ _e_comp_x_hook_client_focus_set(void *d EINA_UNUSED, E_Client *ec) } if (ec->override) return; focus_job_client = ec; - if (focus_job) ecore_job_del(focus_job); - focus_job = ecore_job_add(_e_comp_x_hook_client_focus_set_job, NULL); + if (!focus_job) + focus_job = ecore_job_add(_e_comp_x_hook_client_focus_set_job, NULL); } static void diff --git a/src/bin/e_focus.c b/src/bin/e_focus.c index 940733362..5dd3d7b6d 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)) { - 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); if (e_config->use_auto_raise)