core: Make meta_window_begin_grab_op() more generic

Currently, it is thought out to be called with META_GRAB_OP_KEYBOARD*
grab op parameters. Make it more generic so it can also be called for
pointer operations (avoiding pointer warping in that situation).

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2683>
This commit is contained in:
Carlos Garnacho 2022-09-29 17:13:56 +02:00 committed by Marge Bot
parent 43081fc8bd
commit 5e4d69c3a8
2 changed files with 35 additions and 20 deletions

View File

@ -6730,7 +6730,7 @@ warp_grab_pointer (MetaWindow *window,
return TRUE; return TRUE;
} }
void gboolean
meta_window_begin_grab_op (MetaWindow *window, meta_window_begin_grab_op (MetaWindow *window,
MetaGrabOp op, MetaGrabOp op,
gboolean frame_action, gboolean frame_action,
@ -6738,10 +6738,25 @@ meta_window_begin_grab_op (MetaWindow *window,
{ {
int x, y; int x, y;
warp_grab_pointer (window, if ((op & META_GRAB_OP_KEYBOARD_MOVING) == META_GRAB_OP_KEYBOARD_MOVING)
op, &x, &y); {
warp_grab_pointer (window, op, &x, &y);
}
else
{
MetaBackend *backend = backend_from_window (window);
ClutterBackend *clutter_backend = meta_backend_get_clutter_backend (backend);
ClutterSeat *seat = clutter_backend_get_default_seat (clutter_backend);
ClutterInputDevice *device;
graphene_point_t pos;
meta_display_begin_grab_op (window->display, device = clutter_seat_get_pointer (seat);
clutter_seat_query_state (seat, device, NULL, &pos, NULL);
x = pos.x;
y = pos.y;
}
return meta_display_begin_grab_op (window->display,
window, window,
op, op,
FALSE, FALSE,

View File

@ -409,7 +409,7 @@ void meta_window_get_work_area_all_monitors (MetaWindow *window,
MetaRectangle *area); MetaRectangle *area);
META_EXPORT META_EXPORT
void meta_window_begin_grab_op (MetaWindow *window, gboolean meta_window_begin_grab_op (MetaWindow *window,
MetaGrabOp op, MetaGrabOp op,
gboolean frame_action, gboolean frame_action,
guint32 timestamp); guint32 timestamp);