mirror of
https://github.com/brl/mutter.git
synced 2024-12-25 20:32:16 +00:00
core: Pass device/sequence on meta_window_begin_grab_op()
This is a public API change. Add device/sequence parameters to this operation, so that window dragging and resizing can stick to one set of pointing events of them all. Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2683>
This commit is contained in:
parent
18535928e7
commit
d687e5634d
@ -81,10 +81,12 @@ ClutterStage * meta_compositor_get_stage (MetaCompositor *compositor);
|
||||
|
||||
gboolean meta_compositor_is_switching_workspace (MetaCompositor *compositor);
|
||||
|
||||
gboolean meta_compositor_drag_window (MetaCompositor *compositor,
|
||||
MetaWindow *window,
|
||||
MetaGrabOp grab_op,
|
||||
uint32_t timestamp);
|
||||
gboolean meta_compositor_drag_window (MetaCompositor *compositor,
|
||||
MetaWindow *window,
|
||||
MetaGrabOp grab_op,
|
||||
ClutterInputDevice *device,
|
||||
ClutterEventSequence *sequence,
|
||||
uint32_t timestamp);
|
||||
|
||||
MetaWindowDrag * meta_compositor_get_current_window_drag (MetaCompositor *compositor);
|
||||
|
||||
|
@ -1688,10 +1688,12 @@ on_window_drag_ended (MetaWindowDrag *window_drag,
|
||||
}
|
||||
|
||||
gboolean
|
||||
meta_compositor_drag_window (MetaCompositor *compositor,
|
||||
MetaWindow *window,
|
||||
MetaGrabOp grab_op,
|
||||
uint32_t timestamp)
|
||||
meta_compositor_drag_window (MetaCompositor *compositor,
|
||||
MetaWindow *window,
|
||||
MetaGrabOp grab_op,
|
||||
ClutterInputDevice *device,
|
||||
ClutterEventSequence *sequence,
|
||||
uint32_t timestamp)
|
||||
{
|
||||
MetaCompositorPrivate *priv =
|
||||
meta_compositor_get_instance_private (compositor);
|
||||
@ -1702,7 +1704,7 @@ meta_compositor_drag_window (MetaCompositor *compositor,
|
||||
|
||||
window_drag = meta_window_drag_new (window, grab_op);
|
||||
|
||||
if (!meta_window_drag_begin (window_drag, timestamp))
|
||||
if (!meta_window_drag_begin (window_drag, device, sequence, timestamp))
|
||||
return FALSE;
|
||||
|
||||
g_signal_connect (window_drag, "ended",
|
||||
|
@ -55,6 +55,8 @@ struct _MetaWindowDrag {
|
||||
MetaGrabOp grab_op;
|
||||
ClutterGrab *grab;
|
||||
|
||||
ClutterInputDevice *leading_device;
|
||||
ClutterEventSequence *leading_touch_sequence;
|
||||
int anchor_root_x;
|
||||
int anchor_root_y;
|
||||
MetaRectangle anchor_window_pos;
|
||||
@ -1572,6 +1574,7 @@ process_pointer_event (MetaWindowDrag *window_drag,
|
||||
const ClutterEvent *event)
|
||||
{
|
||||
ClutterEventSequence *sequence = clutter_event_get_event_sequence (event);
|
||||
ClutterInputDevice *device = clutter_event_get_device (event);
|
||||
ClutterModifierType modifier_state;
|
||||
MetaEdgeResistanceFlags flags;
|
||||
MetaWindow *window;
|
||||
@ -1580,6 +1583,10 @@ process_pointer_event (MetaWindowDrag *window_drag,
|
||||
window = window_drag->effective_grab_window;
|
||||
if (!window)
|
||||
return;
|
||||
if (window_drag->leading_device != device)
|
||||
return;
|
||||
if (window_drag->leading_touch_sequence != sequence)
|
||||
return;
|
||||
|
||||
switch (event->type)
|
||||
{
|
||||
@ -1592,21 +1599,18 @@ process_pointer_event (MetaWindowDrag *window_drag,
|
||||
end_grab_op (window_drag, event);
|
||||
break;
|
||||
case CLUTTER_TOUCH_END:
|
||||
if (!meta_display_is_pointer_emulating_sequence (window->display, sequence))
|
||||
return;
|
||||
|
||||
end_grab_op (window_drag, event);
|
||||
break;
|
||||
case CLUTTER_BUTTON_RELEASE:
|
||||
if (window_drag->leading_touch_sequence)
|
||||
return;
|
||||
|
||||
if (event->button.button == 1 ||
|
||||
event->button.button == (unsigned int) meta_prefs_get_mouse_button_resize ())
|
||||
end_grab_op (window_drag, event);
|
||||
|
||||
break;
|
||||
case CLUTTER_TOUCH_UPDATE:
|
||||
if (!meta_display_is_pointer_emulating_sequence (window->display, sequence))
|
||||
return;
|
||||
|
||||
G_GNUC_FALLTHROUGH;
|
||||
case CLUTTER_MOTION:
|
||||
modifier_state = clutter_event_get_state (event);
|
||||
@ -1659,8 +1663,10 @@ on_window_drag_event (MetaWindowDrag *window_drag,
|
||||
}
|
||||
|
||||
gboolean
|
||||
meta_window_drag_begin (MetaWindowDrag *window_drag,
|
||||
uint32_t timestamp)
|
||||
meta_window_drag_begin (MetaWindowDrag *window_drag,
|
||||
ClutterInputDevice *device,
|
||||
ClutterEventSequence *sequence,
|
||||
uint32_t timestamp)
|
||||
{
|
||||
MetaWindow *window = window_drag->window, *grab_window = NULL;
|
||||
MetaDisplay *display = meta_window_get_display (window);
|
||||
@ -1678,11 +1684,9 @@ meta_window_drag_begin (MetaWindowDrag *window_drag,
|
||||
{
|
||||
ClutterBackend *clutter_backend = meta_backend_get_clutter_backend (backend);
|
||||
ClutterSeat *seat = clutter_backend_get_default_seat (clutter_backend);
|
||||
ClutterInputDevice *device;
|
||||
graphene_point_t pos;
|
||||
|
||||
device = clutter_seat_get_pointer (seat);
|
||||
clutter_seat_query_state (seat, device, NULL, &pos, NULL);
|
||||
clutter_seat_query_state (seat, device, sequence, &pos, NULL);
|
||||
root_x = pos.x;
|
||||
root_y = pos.y;
|
||||
}
|
||||
@ -1756,6 +1760,8 @@ meta_window_drag_begin (MetaWindowDrag *window_drag,
|
||||
G_CALLBACK (on_grab_window_size_changed), window_drag);
|
||||
}
|
||||
|
||||
window_drag->leading_device = device;
|
||||
window_drag->leading_touch_sequence = sequence;
|
||||
window_drag->tile_mode = grab_window->tile_mode;
|
||||
window_drag->tile_monitor_number = grab_window->tile_monitor_number;
|
||||
window_drag->anchor_root_x = root_x;
|
||||
|
@ -32,8 +32,10 @@ G_DECLARE_FINAL_TYPE (MetaWindowDrag, meta_window_drag,
|
||||
MetaWindowDrag * meta_window_drag_new (MetaWindow *window,
|
||||
MetaGrabOp grab_op);
|
||||
|
||||
gboolean meta_window_drag_begin (MetaWindowDrag *drag,
|
||||
uint32_t timestamp);
|
||||
gboolean meta_window_drag_begin (MetaWindowDrag *drag,
|
||||
ClutterInputDevice *device,
|
||||
ClutterEventSequence *sequence,
|
||||
uint32_t timestamp);
|
||||
|
||||
void meta_window_drag_end (MetaWindowDrag *drag);
|
||||
|
||||
|
@ -2705,9 +2705,17 @@ handle_begin_move (MetaDisplay *display,
|
||||
{
|
||||
if (window->has_move_func)
|
||||
{
|
||||
MetaContext *context = meta_display_get_context (display);
|
||||
MetaBackend *backend = meta_context_get_backend (context);
|
||||
ClutterBackend *clutter_backend = meta_backend_get_clutter_backend (backend);
|
||||
ClutterSeat *seat = clutter_backend_get_default_seat (clutter_backend);
|
||||
ClutterInputDevice *device;
|
||||
|
||||
device = clutter_seat_get_pointer (seat);
|
||||
meta_window_begin_grab_op (window,
|
||||
META_GRAB_OP_KEYBOARD_MOVING |
|
||||
META_GRAB_OP_WINDOW_FLAG_UNCONSTRAINED,
|
||||
device, NULL,
|
||||
event->time);
|
||||
}
|
||||
}
|
||||
@ -2721,9 +2729,17 @@ handle_begin_resize (MetaDisplay *display,
|
||||
{
|
||||
if (window->has_resize_func)
|
||||
{
|
||||
MetaContext *context = meta_display_get_context (display);
|
||||
MetaBackend *backend = meta_context_get_backend (context);
|
||||
ClutterBackend *clutter_backend = meta_backend_get_clutter_backend (backend);
|
||||
ClutterSeat *seat = clutter_backend_get_default_seat (clutter_backend);
|
||||
ClutterInputDevice *device;
|
||||
|
||||
device = clutter_seat_get_pointer (seat);
|
||||
meta_window_begin_grab_op (window,
|
||||
META_GRAB_OP_KEYBOARD_RESIZING_UNKNOWN |
|
||||
META_GRAB_OP_WINDOW_FLAG_UNCONSTRAINED,
|
||||
device, NULL,
|
||||
event->time);
|
||||
}
|
||||
}
|
||||
|
@ -6084,13 +6084,24 @@ meta_window_is_ancestor_of_transient (MetaWindow *window,
|
||||
return d.found;
|
||||
}
|
||||
|
||||
/**
|
||||
* meta_window_begin_grab_op:
|
||||
* @window:
|
||||
* @op:
|
||||
* @device: (nullable):
|
||||
* @sequence: (nullable):
|
||||
* @timestamp:
|
||||
**/
|
||||
gboolean
|
||||
meta_window_begin_grab_op (MetaWindow *window,
|
||||
MetaGrabOp op,
|
||||
guint32 timestamp)
|
||||
meta_window_begin_grab_op (MetaWindow *window,
|
||||
MetaGrabOp op,
|
||||
ClutterInputDevice *device,
|
||||
ClutterEventSequence *sequence,
|
||||
guint32 timestamp)
|
||||
{
|
||||
return meta_compositor_drag_window (window->display->compositor,
|
||||
window, op,
|
||||
device, sequence,
|
||||
timestamp);
|
||||
}
|
||||
|
||||
@ -7703,6 +7714,8 @@ meta_window_handle_ungrabbed_event (MetaWindow *window,
|
||||
op |= META_GRAB_OP_WINDOW_FLAG_UNCONSTRAINED;
|
||||
meta_window_begin_grab_op (window,
|
||||
op,
|
||||
clutter_event_get_device (event),
|
||||
clutter_event_get_event_sequence (event),
|
||||
event->any.time);
|
||||
}
|
||||
}
|
||||
@ -7722,6 +7735,8 @@ meta_window_handle_ungrabbed_event (MetaWindow *window,
|
||||
meta_window_begin_grab_op (window,
|
||||
META_GRAB_OP_MOVING |
|
||||
META_GRAB_OP_WINDOW_FLAG_UNCONSTRAINED,
|
||||
clutter_event_get_device (event),
|
||||
clutter_event_get_event_sequence (event),
|
||||
event->any.time);
|
||||
}
|
||||
}
|
||||
|
@ -409,9 +409,11 @@ void meta_window_get_work_area_all_monitors (MetaWindow *window,
|
||||
MetaRectangle *area);
|
||||
|
||||
META_EXPORT
|
||||
gboolean meta_window_begin_grab_op (MetaWindow *window,
|
||||
MetaGrabOp op,
|
||||
guint32 timestamp);
|
||||
gboolean meta_window_begin_grab_op (MetaWindow *window,
|
||||
MetaGrabOp op,
|
||||
ClutterInputDevice *device,
|
||||
ClutterEventSequence *sequence,
|
||||
guint32 timestamp);
|
||||
|
||||
META_EXPORT
|
||||
gboolean meta_window_can_maximize (MetaWindow *window);
|
||||
|
@ -1543,11 +1543,13 @@ meta_wayland_surface_create (MetaWaylandCompositor *compositor,
|
||||
}
|
||||
|
||||
gboolean
|
||||
meta_wayland_surface_begin_grab_op (MetaWaylandSurface *surface,
|
||||
MetaWaylandSeat *seat,
|
||||
MetaGrabOp grab_op,
|
||||
gfloat x,
|
||||
gfloat y)
|
||||
meta_wayland_surface_begin_grab_op (MetaWaylandSurface *surface,
|
||||
MetaWaylandSeat *seat,
|
||||
MetaGrabOp grab_op,
|
||||
ClutterInputDevice *device,
|
||||
ClutterEventSequence *sequence,
|
||||
gfloat x,
|
||||
gfloat y)
|
||||
{
|
||||
MetaWindow *window = meta_wayland_surface_get_window (surface);
|
||||
|
||||
@ -1559,6 +1561,7 @@ meta_wayland_surface_begin_grab_op (MetaWaylandSurface *surface,
|
||||
being moved/resized via a SSD event. */
|
||||
return meta_window_begin_grab_op (window,
|
||||
grab_op,
|
||||
device, sequence,
|
||||
meta_display_get_current_time_roundtrip (window->display));
|
||||
}
|
||||
|
||||
|
@ -341,11 +341,13 @@ MetaWaylandSurface * meta_wayland_surface_role_get_surface (MetaWaylandSurfaceRo
|
||||
cairo_region_t * meta_wayland_surface_calculate_input_region (MetaWaylandSurface *surface);
|
||||
|
||||
|
||||
gboolean meta_wayland_surface_begin_grab_op (MetaWaylandSurface *surface,
|
||||
MetaWaylandSeat *seat,
|
||||
MetaGrabOp grab_op,
|
||||
gfloat x,
|
||||
gfloat y);
|
||||
gboolean meta_wayland_surface_begin_grab_op (MetaWaylandSurface *surface,
|
||||
MetaWaylandSeat *seat,
|
||||
MetaGrabOp grab_op,
|
||||
ClutterInputDevice *device,
|
||||
ClutterEventSequence *sequence,
|
||||
gfloat x,
|
||||
gfloat y);
|
||||
|
||||
void meta_wayland_surface_window_managed (MetaWaylandSurface *surface,
|
||||
MetaWindow *window);
|
||||
|
@ -318,6 +318,8 @@ xdg_toplevel_move (struct wl_client *client,
|
||||
MetaWaylandSeat *seat = wl_resource_get_user_data (seat_resource);
|
||||
MetaWaylandSurface *surface = surface_from_xdg_toplevel_resource (resource);
|
||||
MetaWindow *window;
|
||||
ClutterInputDevice *device;
|
||||
ClutterEventSequence *sequence;
|
||||
float x, y;
|
||||
|
||||
window = meta_wayland_surface_get_window (surface);
|
||||
@ -325,10 +327,11 @@ xdg_toplevel_move (struct wl_client *client,
|
||||
return;
|
||||
|
||||
if (!meta_wayland_seat_get_grab_info (seat, surface, serial, TRUE,
|
||||
NULL, NULL, &x, &y))
|
||||
&device, &sequence, &x, &y))
|
||||
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,
|
||||
device, sequence, x, y);
|
||||
}
|
||||
|
||||
static MetaGrabOp
|
||||
@ -366,6 +369,8 @@ xdg_toplevel_resize (struct wl_client *client,
|
||||
MetaWindow *window;
|
||||
gfloat x, y;
|
||||
MetaGrabOp grab_op;
|
||||
ClutterInputDevice *device;
|
||||
ClutterEventSequence *sequence;
|
||||
|
||||
window = meta_wayland_surface_get_window (surface);
|
||||
if (!window)
|
||||
@ -375,11 +380,12 @@ xdg_toplevel_resize (struct wl_client *client,
|
||||
return;
|
||||
|
||||
if (!meta_wayland_seat_get_grab_info (seat, surface, serial, TRUE,
|
||||
NULL, NULL, &x, &y))
|
||||
&device, &sequence, &x, &y))
|
||||
return;
|
||||
|
||||
grab_op = grab_op_for_xdg_toplevel_resize_edge (edges);
|
||||
meta_wayland_surface_begin_grab_op (surface, seat, grab_op, x, y);
|
||||
meta_wayland_surface_begin_grab_op (surface, seat, grab_op,
|
||||
device, sequence, x, y);
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -3349,7 +3349,15 @@ meta_window_x11_client_message (MetaWindow *window,
|
||||
((window->has_move_func && op == META_GRAB_OP_KEYBOARD_MOVING) ||
|
||||
(window->has_resize_func && op == META_GRAB_OP_KEYBOARD_RESIZING_UNKNOWN)))
|
||||
{
|
||||
meta_window_begin_grab_op (window, op, timestamp);
|
||||
MetaContext *context = meta_display_get_context (display);
|
||||
MetaBackend *backend = meta_context_get_backend (context);
|
||||
ClutterBackend *clutter_backend = meta_backend_get_clutter_backend (backend);
|
||||
ClutterSeat *seat = clutter_backend_get_default_seat (clutter_backend);
|
||||
|
||||
meta_window_begin_grab_op (window, op,
|
||||
clutter_seat_get_pointer (seat),
|
||||
NULL,
|
||||
timestamp);
|
||||
}
|
||||
else if (op != META_GRAB_OP_NONE &&
|
||||
((window->has_move_func && op == META_GRAB_OP_MOVING) ||
|
||||
@ -3357,12 +3365,17 @@ meta_window_x11_client_message (MetaWindow *window,
|
||||
(op != META_GRAB_OP_MOVING &&
|
||||
op != META_GRAB_OP_KEYBOARD_MOVING))))
|
||||
{
|
||||
MetaContext *context = meta_display_get_context (display);
|
||||
MetaBackend *backend = meta_context_get_backend (context);
|
||||
ClutterBackend *clutter_backend = meta_backend_get_clutter_backend (backend);
|
||||
ClutterSeat *seat = clutter_backend_get_default_seat (clutter_backend);
|
||||
int button_mask;
|
||||
|
||||
meta_topic (META_DEBUG_WINDOW_OPS,
|
||||
"Beginning move/resize with button = %d", button);
|
||||
meta_window_begin_grab_op (window,
|
||||
op,
|
||||
meta_window_begin_grab_op (window, op,
|
||||
clutter_seat_get_pointer (seat),
|
||||
NULL,
|
||||
timestamp);
|
||||
|
||||
button_mask = query_pressed_buttons (window);
|
||||
|
Loading…
Reference in New Issue
Block a user