1
0
Fork 0

wayland/tablet-tool: Fix grabbing tablet devices

The NULL check was inverted, meaning we'd grab with no leader device.
That meant updates coming from the what-should-have-been leader device
getting lost because incorrectly being classified as non-leader of
the grab.

Fix this by only allowing to grab if we have a device, and always mark
the current tool device as the grab leader.

Fixes: e4004a7c4f ("wayland: Use the tool's current_tablet device instead of caching it")
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/4033>
This commit is contained in:
Jonas Ådahl 2024-09-17 13:29:03 +02:00 committed by Marge Bot
parent 2ce64ac0c3
commit 3bc3740a9e

View file

@ -983,6 +983,9 @@ meta_wayland_tablet_tool_can_grab_surface (MetaWaylandTabletTool *tool,
MetaWaylandSurface *surface,
uint32_t serial)
{
if (!tool->current_tablet || !tool->current_tablet->device)
return FALSE;
return ((tool->down_serial == serial || tool->button_serial == serial) &&
tablet_tool_can_grab_surface (tool, surface));
}
@ -1000,7 +1003,7 @@ meta_wayland_tablet_tool_get_grab_info (MetaWaylandTabletTool *tool,
meta_wayland_tablet_tool_can_grab_surface (tool, surface, serial))
{
if (device_out)
*device_out = tool->current_tablet ? NULL : tool->current_tablet->device;
*device_out = tool->current_tablet->device;
if (x)
*x = tool->grab_x;