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, return meta_wayland_seat_get_grab_info (seat,
token->surface, token->surface,
token->serial, token->serial,
FALSE, NULL, NULL); FALSE,
NULL, NULL, NULL, NULL);
} }
static gboolean static gboolean

View File

@ -235,7 +235,8 @@ gtk_surface_titlebar_gesture (struct wl_client *client,
if (!window) if (!window)
return; 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; return;
switch (gesture) switch (gesture)

View File

@ -437,8 +437,10 @@ meta_wayland_seat_get_grab_info (MetaWaylandSeat *seat,
MetaWaylandSurface *surface, MetaWaylandSurface *surface,
uint32_t serial, uint32_t serial,
gboolean require_pressed, gboolean require_pressed,
gfloat *x, ClutterInputDevice **device_out,
gfloat *y) ClutterEventSequence **sequence_out,
float *x,
float *y)
{ {
MetaWaylandCompositor *compositor; MetaWaylandCompositor *compositor;
MetaWaylandTabletSeat *tablet_seat; MetaWaylandTabletSeat *tablet_seat;
@ -456,6 +458,11 @@ meta_wayland_seat_get_grab_info (MetaWaylandSeat *seat,
serial); serial);
if (sequence) 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); meta_wayland_touch_get_press_coords (seat->touch, sequence, x, y);
return TRUE; return TRUE;
} }
@ -466,6 +473,11 @@ meta_wayland_seat_get_grab_info (MetaWaylandSeat *seat,
if ((!require_pressed || seat->pointer->button_count > 0) && if ((!require_pressed || seat->pointer->button_count > 0) &&
meta_wayland_pointer_can_grab_surface (seat->pointer, surface, serial)) 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) if (x)
*x = seat->pointer->grab_x; *x = seat->pointer->grab_x;
if (y) if (y)
@ -482,6 +494,11 @@ meta_wayland_seat_get_grab_info (MetaWaylandSeat *seat,
if ((!require_pressed || tool->button_count > 0) && if ((!require_pressed || tool->button_count > 0) &&
meta_wayland_tablet_tool_can_grab_surface (tool, surface, serial)) 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) if (x)
*x = tool->grab_x; *x = tool->grab_x;
if (y) if (y)

View File

@ -71,8 +71,10 @@ gboolean meta_wayland_seat_get_grab_info (MetaWaylandSeat *seat,
MetaWaylandSurface *surface, MetaWaylandSurface *surface,
uint32_t serial, uint32_t serial,
gboolean require_pressed, gboolean require_pressed,
gfloat *x, ClutterInputDevice **device_out,
gfloat *y); ClutterEventSequence **sequence_out,
float *x,
float *y);
gboolean meta_wayland_seat_can_popup (MetaWaylandSeat *seat, gboolean meta_wayland_seat_can_popup (MetaWaylandSeat *seat,
uint32_t serial); uint32_t serial);

View File

@ -299,7 +299,8 @@ xdg_toplevel_show_window_menu (struct wl_client *client,
if (!window) if (!window)
return; 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; return;
monitor_scale = meta_window_wayland_get_geometry_scale (window); monitor_scale = meta_window_wayland_get_geometry_scale (window);
@ -323,7 +324,8 @@ xdg_toplevel_move (struct wl_client *client,
if (!window) if (!window)
return; 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; return;
meta_wayland_surface_begin_grab_op (surface, seat, META_GRAB_OP_MOVING, x, y); 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) if (!window->has_resize_func)
return; 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; return;
grab_op = grab_op_for_xdg_toplevel_resize_edge (edges); grab_op = grab_op_for_xdg_toplevel_resize_edge (edges);