mirror of
https://github.com/brl/mutter.git
synced 2025-02-19 14:44:10 +00:00
wayland: Move checks for grabbing into a central location
This means that we won't have as much work to do to introduce similar checks for touch.
This commit is contained in:
parent
47d72680ff
commit
6408e59c7c
@ -805,3 +805,13 @@ meta_wayland_pointer_create_new_resource (MetaWaylandPointer *pointer,
|
|||||||
if (pointer->focus_surface && wl_resource_get_client (pointer->focus_surface->resource) == client)
|
if (pointer->focus_surface && wl_resource_get_client (pointer->focus_surface->resource) == client)
|
||||||
meta_wayland_pointer_set_focus (pointer, pointer->focus_surface);
|
meta_wayland_pointer_set_focus (pointer, pointer->focus_surface);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
gboolean
|
||||||
|
meta_wayland_pointer_can_grab_surface (MetaWaylandPointer *pointer,
|
||||||
|
MetaWaylandSurface *surface,
|
||||||
|
uint32_t serial)
|
||||||
|
{
|
||||||
|
return (pointer->button_count == 0 &&
|
||||||
|
pointer->grab_serial == serial &&
|
||||||
|
pointer->focus_surface == surface);
|
||||||
|
}
|
||||||
|
@ -110,4 +110,8 @@ void meta_wayland_pointer_create_new_resource (MetaWaylandPointer *pointer,
|
|||||||
struct wl_resource *seat_resource,
|
struct wl_resource *seat_resource,
|
||||||
uint32_t id);
|
uint32_t id);
|
||||||
|
|
||||||
|
gboolean meta_wayland_pointer_can_grab_surface (MetaWaylandPointer *pointer,
|
||||||
|
MetaWaylandSurface *surface,
|
||||||
|
uint32_t serial);
|
||||||
|
|
||||||
#endif /* META_WAYLAND_POINTER_H */
|
#endif /* META_WAYLAND_POINTER_H */
|
||||||
|
@ -182,3 +182,11 @@ meta_wayland_seat_update_cursor_surface (MetaWaylandSeat *seat)
|
|||||||
{
|
{
|
||||||
meta_wayland_pointer_update_cursor_surface (&seat->pointer);
|
meta_wayland_pointer_update_cursor_surface (&seat->pointer);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
gboolean
|
||||||
|
meta_wayland_seat_can_grab_surface (MetaWaylandSeat *seat,
|
||||||
|
MetaWaylandSurface *surface,
|
||||||
|
uint32_t serial)
|
||||||
|
{
|
||||||
|
return meta_wayland_pointer_can_grab_surface (&seat->pointer, surface, serial);
|
||||||
|
}
|
||||||
|
@ -70,4 +70,8 @@ gboolean meta_wayland_seat_handle_event (MetaWaylandSeat *seat,
|
|||||||
void meta_wayland_seat_repick (MetaWaylandSeat *seat);
|
void meta_wayland_seat_repick (MetaWaylandSeat *seat);
|
||||||
void meta_wayland_seat_update_cursor_surface (MetaWaylandSeat *seat);
|
void meta_wayland_seat_update_cursor_surface (MetaWaylandSeat *seat);
|
||||||
|
|
||||||
|
gboolean meta_wayland_seat_can_grab_surface (MetaWaylandSeat *seat,
|
||||||
|
MetaWaylandSurface *surface,
|
||||||
|
uint32_t serial);
|
||||||
|
|
||||||
#endif /* META_WAYLAND_SEAT_H */
|
#endif /* META_WAYLAND_SEAT_H */
|
||||||
|
@ -802,9 +802,7 @@ xdg_surface_move (struct wl_client *client,
|
|||||||
MetaWaylandSeat *seat = wl_resource_get_user_data (seat_resource);
|
MetaWaylandSeat *seat = wl_resource_get_user_data (seat_resource);
|
||||||
MetaWaylandSurface *surface = wl_resource_get_user_data (resource);
|
MetaWaylandSurface *surface = wl_resource_get_user_data (resource);
|
||||||
|
|
||||||
if (seat->pointer.button_count == 0 ||
|
if (!meta_wayland_seat_can_grab_surface (seat, surface, serial))
|
||||||
seat->pointer.grab_serial != serial ||
|
|
||||||
seat->pointer.focus_surface != surface)
|
|
||||||
return;
|
return;
|
||||||
|
|
||||||
begin_grab_op_on_surface (surface, seat, META_GRAB_OP_MOVING);
|
begin_grab_op_on_surface (surface, seat, META_GRAB_OP_MOVING);
|
||||||
@ -847,9 +845,7 @@ xdg_surface_resize (struct wl_client *client,
|
|||||||
MetaWaylandSeat *seat = wl_resource_get_user_data (seat_resource);
|
MetaWaylandSeat *seat = wl_resource_get_user_data (seat_resource);
|
||||||
MetaWaylandSurface *surface = wl_resource_get_user_data (resource);
|
MetaWaylandSurface *surface = wl_resource_get_user_data (resource);
|
||||||
|
|
||||||
if (seat->pointer.button_count == 0 ||
|
if (!meta_wayland_seat_can_grab_surface (seat, surface, serial))
|
||||||
seat->pointer.grab_serial != serial ||
|
|
||||||
seat->pointer.focus_surface != surface)
|
|
||||||
return;
|
return;
|
||||||
|
|
||||||
begin_grab_op_on_surface (surface, seat, grab_op_for_xdg_surface_resize_edge (edges));
|
begin_grab_op_on_surface (surface, seat, grab_op_for_xdg_surface_resize_edge (edges));
|
||||||
@ -1105,9 +1101,7 @@ wl_shell_surface_move (struct wl_client *client,
|
|||||||
MetaWaylandSeat *seat = wl_resource_get_user_data (seat_resource);
|
MetaWaylandSeat *seat = wl_resource_get_user_data (seat_resource);
|
||||||
MetaWaylandSurface *surface = wl_resource_get_user_data (resource);
|
MetaWaylandSurface *surface = wl_resource_get_user_data (resource);
|
||||||
|
|
||||||
if (seat->pointer.button_count == 0 ||
|
if (!meta_wayland_seat_can_grab_surface (seat, surface, serial))
|
||||||
seat->pointer.grab_serial != serial ||
|
|
||||||
seat->pointer.focus_surface != surface)
|
|
||||||
return;
|
return;
|
||||||
|
|
||||||
begin_grab_op_on_surface (surface, seat, META_GRAB_OP_MOVING);
|
begin_grab_op_on_surface (surface, seat, META_GRAB_OP_MOVING);
|
||||||
@ -1150,9 +1144,7 @@ wl_shell_surface_resize (struct wl_client *client,
|
|||||||
MetaWaylandSeat *seat = wl_resource_get_user_data (seat_resource);
|
MetaWaylandSeat *seat = wl_resource_get_user_data (seat_resource);
|
||||||
MetaWaylandSurface *surface = wl_resource_get_user_data (resource);
|
MetaWaylandSurface *surface = wl_resource_get_user_data (resource);
|
||||||
|
|
||||||
if (seat->pointer.button_count == 0 ||
|
if (!meta_wayland_seat_can_grab_surface (seat, surface, serial))
|
||||||
seat->pointer.grab_serial != serial ||
|
|
||||||
seat->pointer.focus_surface != surface)
|
|
||||||
return;
|
return;
|
||||||
|
|
||||||
begin_grab_op_on_surface (surface, seat, grab_op_for_wl_shell_surface_resize_edge (edges));
|
begin_grab_op_on_surface (surface, seat, grab_op_for_wl_shell_surface_resize_edge (edges));
|
||||||
|
Loading…
x
Reference in New Issue
Block a user