clutter: Also pick on BUTTON_PRESS events

In an x11 session, we don't receive motion events from X when the
pointer is above a window. Since commit 734a1859 we only do picking on
motion events though, which means when clicking the mouse to focus a
window, we don't repick and might still think the pointer is hovering
above another window or actor, ending up not focussing the window.

Fix this by always repicking on BUTTON_PRESS events. While this is not
necessary in the wayland session, button presses happen rarely compared
to motion events, so it's not a performance regression to do it in
Wayland sessions, too.

Fixes https://gitlab.gnome.org/GNOME/mutter/-/issues/1660

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1752>
This commit is contained in:
Jonas Dreßler 2021-03-01 15:51:51 +01:00
parent c6935ad5b7
commit 4d54c3c556

View File

@ -1701,7 +1701,12 @@ _clutter_process_event_details (ClutterActor *stage,
break;
}
if (event->type == CLUTTER_MOTION)
/* We need to repick on both motion and button press events, the
* latter is only needed for X11 (there the device actor might be
* stale because we don't always receive motion events).
*/
if (event->type == CLUTTER_BUTTON_PRESS ||
event->type == CLUTTER_MOTION)
{
event->any.source =
update_device_for_event (CLUTTER_STAGE (stage), event, TRUE);