wayland: Add device/sequence out parameters getting wayland grab info

This information will become necessary for window move/resize ops.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2683>
This commit is contained in:
Carlos Garnacho 2022-10-21 19:36:59 +02:00 committed by Marge Bot
parent f2ff317206
commit 18535928e7
5 changed files with 41 additions and 17 deletions

View File

@ -308,7 +308,8 @@ token_can_activate (MetaXdgActivationToken *token)
return meta_wayland_seat_get_grab_info (seat,
token->surface,
token->serial,
FALSE, NULL, NULL);
FALSE,
NULL, NULL, NULL, NULL);
}
static gboolean

View File

@ -235,7 +235,8 @@ gtk_surface_titlebar_gesture (struct wl_client *client,
if (!window)
return;
if (!meta_wayland_seat_get_grab_info (seat, surface, serial, FALSE, &x, &y))
if (!meta_wayland_seat_get_grab_info (seat, surface, serial, FALSE,
NULL, NULL, &x, &y))
return;
switch (gesture)

View File

@ -433,12 +433,14 @@ meta_wayland_seat_set_input_focus (MetaWaylandSeat *seat,
}
gboolean
meta_wayland_seat_get_grab_info (MetaWaylandSeat *seat,
MetaWaylandSurface *surface,
uint32_t serial,
gboolean require_pressed,
gfloat *x,
gfloat *y)
meta_wayland_seat_get_grab_info (MetaWaylandSeat *seat,
MetaWaylandSurface *surface,
uint32_t serial,
gboolean require_pressed,
ClutterInputDevice **device_out,
ClutterEventSequence **sequence_out,
float *x,
float *y)
{
MetaWaylandCompositor *compositor;
MetaWaylandTabletSeat *tablet_seat;
@ -456,6 +458,11 @@ meta_wayland_seat_get_grab_info (MetaWaylandSeat *seat,
serial);
if (sequence)
{
if (device_out)
*device_out = seat->pointer->device;
if (sequence_out)
*sequence_out = sequence;
meta_wayland_touch_get_press_coords (seat->touch, sequence, x, y);
return TRUE;
}
@ -466,6 +473,11 @@ meta_wayland_seat_get_grab_info (MetaWaylandSeat *seat,
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)
@ -482,6 +494,11 @@ meta_wayland_seat_get_grab_info (MetaWaylandSeat *seat,
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 (sequence_out)
*sequence_out = NULL;
if (x)
*x = tool->grab_x;
if (y)

View File

@ -67,12 +67,14 @@ gboolean meta_wayland_seat_handle_event (MetaWaylandSeat *seat,
void meta_wayland_seat_set_input_focus (MetaWaylandSeat *seat,
MetaWaylandSurface *surface);
gboolean meta_wayland_seat_get_grab_info (MetaWaylandSeat *seat,
MetaWaylandSurface *surface,
uint32_t serial,
gboolean require_pressed,
gfloat *x,
gfloat *y);
gboolean meta_wayland_seat_get_grab_info (MetaWaylandSeat *seat,
MetaWaylandSurface *surface,
uint32_t serial,
gboolean require_pressed,
ClutterInputDevice **device_out,
ClutterEventSequence **sequence_out,
float *x,
float *y);
gboolean meta_wayland_seat_can_popup (MetaWaylandSeat *seat,
uint32_t serial);

View File

@ -299,7 +299,8 @@ xdg_toplevel_show_window_menu (struct wl_client *client,
if (!window)
return;
if (!meta_wayland_seat_get_grab_info (seat, surface, serial, FALSE, NULL, NULL))
if (!meta_wayland_seat_get_grab_info (seat, surface, serial, FALSE,
NULL, NULL, NULL, NULL))
return;
monitor_scale = meta_window_wayland_get_geometry_scale (window);
@ -323,7 +324,8 @@ xdg_toplevel_move (struct wl_client *client,
if (!window)
return;
if (!meta_wayland_seat_get_grab_info (seat, surface, serial, TRUE, &x, &y))
if (!meta_wayland_seat_get_grab_info (seat, surface, serial, TRUE,
NULL, NULL, &x, &y))
return;
meta_wayland_surface_begin_grab_op (surface, seat, META_GRAB_OP_MOVING, x, y);
@ -372,7 +374,8 @@ xdg_toplevel_resize (struct wl_client *client,
if (!window->has_resize_func)
return;
if (!meta_wayland_seat_get_grab_info (seat, surface, serial, TRUE, &x, &y))
if (!meta_wayland_seat_get_grab_info (seat, surface, serial, TRUE,
NULL, NULL, &x, &y))
return;
grab_op = grab_op_for_xdg_toplevel_resize_edge (edges);