e - do workaround with in events due to flags to get ptr focus right

so we egnore some mouse in evets due to their flags (crossing events
thansk to grab changes or other stuff) that we want to ignore for
other reasons like when a popup menu happens and so on... so if we get
a mouse in... 0.1 sec later double check where the pointer is with a
poll then fix focus. this should patch over a long standing annoyance
here in x11.

@fix
This commit is contained in:
Carsten Haitzler 2017-08-06 18:31:19 +09:00
parent 4fe7827af2
commit 3ee5a0378d
1 changed files with 34 additions and 9 deletions

View File

@ -68,6 +68,8 @@ static int screen_size_index = -1;
static Ecore_X_Atom backlight_atom = 0;
extern double e_bl_val;
static Ecore_Timer *mouse_in_fix_check_timer = NULL;
static Eina_Hash *dead_wins;
static Ecore_Window _e_comp_x_suspend_grabbed; // window grabber for suspending pointer
@ -2377,6 +2379,23 @@ _e_comp_x_mouse_in_job(void *d EINA_UNUSED)
mouse_in_job = NULL;
}
static Eina_Bool
_e_comp_x_mouse_in_fix_check_timer_cb(void *data EINA_UNUSED)
{
E_Client *ec;
mouse_in_fix_check_timer = NULL;
ec = e_client_under_pointer_get
(e_desk_current_get(e_zone_current_get()), NULL);
if (ec)
{
mouse_client = ec;
if (mouse_in_job) ecore_job_del(mouse_in_job);
mouse_in_job = ecore_job_add(_e_comp_x_mouse_in_job, NULL);
}
return EINA_FALSE;
}
static Eina_Bool
_e_comp_x_mouse_in(void *data EINA_UNUSED, int type EINA_UNUSED, Ecore_X_Event_Mouse_In *ev)
{
@ -2384,27 +2403,32 @@ _e_comp_x_mouse_in(void *data EINA_UNUSED, int type EINA_UNUSED, Ecore_X_Event_M
if (e_comp->comp_type != E_PIXMAP_TYPE_X) return ECORE_CALLBACK_RENEW;
ec = _e_comp_x_client_find_by_window(ev->win);
if (!ec) return ECORE_CALLBACK_RENEW;
if (!ec) goto done;
if (ev->mode == ECORE_X_EVENT_MODE_NORMAL)
{
if (ev->detail == ECORE_X_EVENT_DETAIL_INFERIOR)
{
if (ev->win != e_client_util_pwin_get(ec)) return ECORE_CALLBACK_RENEW;
if (ev->event_win != e_client_util_win_get(ec)) return ECORE_CALLBACK_RENEW;
if (ev->win != e_client_util_pwin_get(ec)) goto done;
if (ev->event_win != e_client_util_win_get(ec)) goto done;
}
if (ev->detail == ECORE_X_EVENT_DETAIL_VIRTUAL)
{
if (ev->win != e_client_util_win_get(ec)) return ECORE_CALLBACK_RENEW;
if (ev->event_win != e_client_util_pwin_get(ec)) return ECORE_CALLBACK_RENEW;
if (ev->win != e_client_util_win_get(ec)) goto done;
if (ev->event_win != e_client_util_pwin_get(ec)) goto done;
}
if (!evas_object_visible_get(ec->frame)) return ECORE_CALLBACK_RENEW;
if (!evas_object_visible_get(ec->frame)) goto done;
}
if (_e_comp_x_client_data_get(ec)->deleted) return ECORE_CALLBACK_RENEW;
if (_e_comp_x_client_data_get(ec)->deleted) goto done;
mouse_client = ec;
if (!mouse_in_job)
mouse_in_job = ecore_job_add(_e_comp_x_mouse_in_job, NULL);
if (mouse_in_job) ecore_job_del(mouse_in_job);
mouse_in_job = ecore_job_add(_e_comp_x_mouse_in_job, NULL);
mouse_in_coords.x = ev->root.x;
mouse_in_coords.y = ev->root.y;
done:
if (mouse_in_fix_check_timer)
ecore_timer_del(mouse_in_fix_check_timer);
mouse_in_fix_check_timer =
ecore_timer_add(0.1, _e_comp_x_mouse_in_fix_check_timer_cb, NULL);
return ECORE_CALLBACK_RENEW;
}
@ -5812,6 +5836,7 @@ e_comp_x_shutdown(void)
E_FREE_FUNC(damages_hash, eina_hash_free);
E_FREE_FUNC(alarm_hash, eina_hash_free);
E_FREE_FUNC(frame_extents, eina_hash_free);
E_FREE_FUNC(mouse_in_fix_check_timer, ecore_timer_del);
e_xsettings_shutdown();
if (e_comp->comp_type == E_PIXMAP_TYPE_X)
ecore_x_screensaver_custom_blanking_disable();