enforce mouse grabs and block client/compositor event propagation while active

fixes cases where mouse events could filter to objects and cause unwanted effects,
such as evry hiding randomly under wayland
This commit is contained in:
Mike Blumenkrantz 2016-06-18 10:54:23 -04:00
parent 4bd97bfd5c
commit aa1768a9d9
2 changed files with 8 additions and 4 deletions

View File

@ -72,7 +72,7 @@ _e_comp_canvas_cb_mouse_in(void *d EINA_UNUSED, Evas *e EINA_UNUSED, Evas_Object
E_Client *ec; E_Client *ec;
e_screensaver_notidle(); e_screensaver_notidle();
if (e_client_action_get()) return; if (e_client_action_get() || e_grabinput_mouse_win_get()) return;
ec = e_client_focused_get(); ec = e_client_focused_get();
if (ec && (!ec->border_menu)) e_focus_event_mouse_out(ec); if (ec && (!ec->border_menu)) e_focus_event_mouse_out(ec);
} }
@ -81,7 +81,7 @@ static void
_e_comp_canvas_cb_mouse_down(void *d EINA_UNUSED, Evas *e EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info) _e_comp_canvas_cb_mouse_down(void *d EINA_UNUSED, Evas *e EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info)
{ {
e_screensaver_notidle(); e_screensaver_notidle();
if (e_client_action_get()) return; if (e_client_action_get() || e_grabinput_mouse_win_get()) return;
e_bindings_mouse_down_evas_event_handle(E_BINDING_CONTEXT_COMPOSITOR, E_OBJECT(e_comp), event_info); e_bindings_mouse_down_evas_event_handle(E_BINDING_CONTEXT_COMPOSITOR, E_OBJECT(e_comp), event_info);
} }
@ -89,7 +89,7 @@ static void
_e_comp_canvas_cb_mouse_up(void *d EINA_UNUSED, Evas *e EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info) _e_comp_canvas_cb_mouse_up(void *d EINA_UNUSED, Evas *e EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info)
{ {
e_screensaver_notidle(); e_screensaver_notidle();
if (e_client_action_get()) return; if (e_client_action_get() || e_grabinput_mouse_win_get()) return;
e_bindings_mouse_up_evas_event_handle(E_BINDING_CONTEXT_COMPOSITOR, E_OBJECT(e_comp), event_info); e_bindings_mouse_up_evas_event_handle(E_BINDING_CONTEXT_COMPOSITOR, E_OBJECT(e_comp), event_info);
} }
@ -97,7 +97,7 @@ static void
_e_comp_canvas_cb_mouse_wheel(void *d EINA_UNUSED, Evas *e EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info) _e_comp_canvas_cb_mouse_wheel(void *d EINA_UNUSED, Evas *e EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info)
{ {
e_screensaver_notidle(); e_screensaver_notidle();
if (e_client_action_get()) return; if (e_client_action_get() || e_grabinput_mouse_win_get()) return;
e_bindings_wheel_evas_event_handle(E_BINDING_CONTEXT_COMPOSITOR, E_OBJECT(e_comp), event_info); e_bindings_wheel_evas_event_handle(E_BINDING_CONTEXT_COMPOSITOR, E_OBJECT(e_comp), event_info);
} }

View File

@ -405,6 +405,8 @@ _e_comp_object_cb_mouse_in(void *data, Evas *e EINA_UNUSED, Evas_Object *obj, vo
if (E_INSIDE(ev->output.x, ev->output.y, cw->ec->client.x, cw->ec->client.y, if (E_INSIDE(ev->output.x, ev->output.y, cw->ec->client.x, cw->ec->client.y,
cw->ec->client.w, cw->ec->client.h)) return; cw->ec->client.w, cw->ec->client.h)) return;
} }
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); e_client_mouse_in(cw->ec, ev->output.x, ev->output.y);
} }
@ -415,6 +417,8 @@ _e_comp_object_cb_mouse_out(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EI
Evas_Event_Mouse_Out *ev = event_info; Evas_Event_Mouse_Out *ev = event_info;
E_Comp_Object *cw = data; E_Comp_Object *cw = data;
if (e_grabinput_mouse_win_get() && (e_grabinput_mouse_win_get() != e_client_util_win_get(cw->ec)))
return;
e_client_mouse_out(cw->ec, ev->output.x, ev->output.y); e_client_mouse_out(cw->ec, ev->output.x, ev->output.y);
} }