mirror of
https://github.com/brl/mutter.git
synced 2024-11-22 16:10:41 -05:00
wayland: Refactor pointer grab checks
Move the bulk of the implementation inside MetaWaylandPointer files, like it happens in other places (e.g. MetaWaylandTabletSeat). This avoids MetaWaylandPointer struct peeking from outside. Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3627>
This commit is contained in:
parent
84d48254d7
commit
03b504fc38
@ -1259,7 +1259,7 @@ pointer_can_grab_surface (MetaWaylandPointer *pointer,
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
gboolean
|
||||
static gboolean
|
||||
meta_wayland_pointer_can_grab_surface (MetaWaylandPointer *pointer,
|
||||
MetaWaylandSurface *surface,
|
||||
uint32_t serial)
|
||||
@ -1268,6 +1268,32 @@ meta_wayland_pointer_can_grab_surface (MetaWaylandPointer *pointer,
|
||||
pointer_can_grab_surface (pointer, surface));
|
||||
}
|
||||
|
||||
gboolean
|
||||
meta_wayland_pointer_get_grab_info (MetaWaylandPointer *pointer,
|
||||
MetaWaylandSurface *surface,
|
||||
uint32_t serial,
|
||||
gboolean require_pressed,
|
||||
ClutterInputDevice **device_out,
|
||||
float *x,
|
||||
float *y)
|
||||
{
|
||||
if ((!require_pressed || pointer->button_count > 0) &&
|
||||
meta_wayland_pointer_can_grab_surface (pointer, surface, serial))
|
||||
{
|
||||
if (device_out)
|
||||
*device_out = pointer->device;
|
||||
|
||||
if (x)
|
||||
*x = pointer->grab_x;
|
||||
if (y)
|
||||
*y = pointer->grab_y;
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
gboolean
|
||||
meta_wayland_pointer_can_popup (MetaWaylandPointer *pointer, uint32_t serial)
|
||||
{
|
||||
|
@ -100,9 +100,13 @@ void meta_wayland_pointer_create_new_resource (MetaWaylandPointer *pointer,
|
||||
struct wl_resource *seat_resource,
|
||||
uint32_t id);
|
||||
|
||||
gboolean meta_wayland_pointer_can_grab_surface (MetaWaylandPointer *pointer,
|
||||
MetaWaylandSurface *surface,
|
||||
uint32_t serial);
|
||||
gboolean meta_wayland_pointer_get_grab_info (MetaWaylandPointer *pointer,
|
||||
MetaWaylandSurface *surface,
|
||||
uint32_t serial,
|
||||
gboolean require_pressed,
|
||||
ClutterInputDevice **device_out,
|
||||
float *x,
|
||||
float *y);
|
||||
|
||||
gboolean meta_wayland_pointer_can_popup (MetaWaylandPointer *pointer,
|
||||
uint32_t serial);
|
||||
|
@ -601,23 +601,17 @@ meta_wayland_seat_get_grab_info (MetaWaylandSeat *seat,
|
||||
}
|
||||
}
|
||||
|
||||
if (meta_wayland_seat_has_pointer (seat))
|
||||
if (meta_wayland_seat_has_pointer (seat) &&
|
||||
meta_wayland_pointer_get_grab_info (seat->pointer,
|
||||
surface,
|
||||
serial,
|
||||
require_pressed,
|
||||
device_out,
|
||||
x, y))
|
||||
{
|
||||
if ((!require_pressed || seat->pointer->button_count > 0) &&
|
||||
meta_wayland_pointer_can_grab_surface (seat->pointer, surface, serial))
|
||||
{
|
||||
if (device_out)
|
||||
*device_out = seat->pointer->device;
|
||||
if (sequence_out)
|
||||
*sequence_out = NULL;
|
||||
|
||||
if (x)
|
||||
*x = seat->pointer->grab_x;
|
||||
if (y)
|
||||
*y = seat->pointer->grab_y;
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
if (sequence_out)
|
||||
*sequence_out = NULL;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
if (meta_wayland_tablet_seat_get_grab_info (seat->tablet_seat,
|
||||
|
Loading…
Reference in New Issue
Block a user