wayland: Refactor tablet tool grab checks
Move the bulk of the implementation inside MetaWaylandTabletTool files, so MetaWaylandTablet does not need to access at tool struct fields. Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3627>
This commit is contained in:
parent
314ab7c3cb
commit
f17300a22e
@ -587,20 +587,14 @@ meta_wayland_tablet_seat_get_grab_info (MetaWaylandTabletSeat *tablet_seat,
|
||||
{
|
||||
MetaWaylandTabletTool *tool = l->data;
|
||||
|
||||
if ((!require_pressed || tool->button_count > 0) &&
|
||||
meta_wayland_tablet_tool_can_grab_surface (tool, surface, serial))
|
||||
{
|
||||
if (device_out)
|
||||
*device_out = tool->device;
|
||||
|
||||
if (x)
|
||||
*x = tool->grab_x;
|
||||
if (y)
|
||||
*y = tool->grab_y;
|
||||
|
||||
if (meta_wayland_tablet_tool_get_grab_info (tool,
|
||||
surface,
|
||||
serial,
|
||||
require_pressed,
|
||||
device_out,
|
||||
x, y))
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
@ -913,7 +913,7 @@ tablet_tool_can_grab_surface (MetaWaylandTabletTool *tool,
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
gboolean
|
||||
static gboolean
|
||||
meta_wayland_tablet_tool_can_grab_surface (MetaWaylandTabletTool *tool,
|
||||
MetaWaylandSurface *surface,
|
||||
uint32_t serial)
|
||||
@ -922,6 +922,32 @@ meta_wayland_tablet_tool_can_grab_surface (MetaWaylandTabletTool *tool,
|
||||
tablet_tool_can_grab_surface (tool, surface));
|
||||
}
|
||||
|
||||
gboolean
|
||||
meta_wayland_tablet_tool_get_grab_info (MetaWaylandTabletTool *tool,
|
||||
MetaWaylandSurface *surface,
|
||||
uint32_t serial,
|
||||
gboolean require_pressed,
|
||||
ClutterInputDevice **device_out,
|
||||
float *x,
|
||||
float *y)
|
||||
{
|
||||
if ((!require_pressed || tool->button_count > 0) &&
|
||||
meta_wayland_tablet_tool_can_grab_surface (tool, surface, serial))
|
||||
{
|
||||
if (device_out)
|
||||
*device_out = tool->device;
|
||||
|
||||
if (x)
|
||||
*x = tool->grab_x;
|
||||
if (y)
|
||||
*y = tool->grab_y;
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
gboolean
|
||||
meta_wayland_tablet_tool_can_popup (MetaWaylandTabletTool *tool,
|
||||
uint32_t serial)
|
||||
|
@ -76,9 +76,14 @@ void meta_wayland_tablet_tool_update (MetaWaylandTabletTool *t
|
||||
gboolean meta_wayland_tablet_tool_handle_event (MetaWaylandTabletTool *tool,
|
||||
const ClutterEvent *event);
|
||||
|
||||
gboolean meta_wayland_tablet_tool_can_grab_surface (MetaWaylandTabletTool *tool,
|
||||
gboolean meta_wayland_tablet_tool_get_grab_info (MetaWaylandTabletTool *tool,
|
||||
MetaWaylandSurface *surface,
|
||||
uint32_t serial);
|
||||
uint32_t serial,
|
||||
gboolean require_pressed,
|
||||
ClutterInputDevice **device_out,
|
||||
float *x,
|
||||
float *y);
|
||||
|
||||
gboolean meta_wayland_tablet_tool_can_popup (MetaWaylandTabletTool *tool,
|
||||
uint32_t serial);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user