mirror of
https://github.com/brl/mutter.git
synced 2025-08-07 00:54:42 +00:00
wayland: Handle window drags for touch events
The grabbing state is now checked for both pointer/touch devices within the seat, and the grab start coordinates returned by meta_wayland_seat_get_grab_info(). https://bugzilla.gnome.org/show_bug.cgi?id=733631
This commit is contained in:
@@ -46,6 +46,8 @@ struct _MetaWaylandTouchInfo
|
||||
MetaWaylandTouchSurface *touch_surface;
|
||||
guint32 slot_serial;
|
||||
gint32 slot;
|
||||
gfloat start_x;
|
||||
gfloat start_y;
|
||||
gfloat x;
|
||||
gfloat y;
|
||||
guint updated : 1;
|
||||
@@ -231,6 +233,7 @@ meta_wayland_touch_update (MetaWaylandTouch *touch,
|
||||
|
||||
touch_info = touch_get_info (touch, sequence, TRUE);
|
||||
touch_info->touch_surface = touch_surface_get (touch, surface);
|
||||
clutter_event_get_coords (event, &touch_info->start_x, &touch_info->start_y);
|
||||
}
|
||||
else
|
||||
touch_info = touch_get_info (touch, sequence, FALSE);
|
||||
@@ -545,3 +548,52 @@ meta_wayland_touch_create_new_resource (MetaWaylandTouch *touch,
|
||||
wl_resource_set_implementation (cr, &touch_interface, touch, unbind_resource);
|
||||
wl_list_insert (&touch->resource_list, wl_resource_get_link (cr));
|
||||
}
|
||||
|
||||
ClutterEventSequence *
|
||||
meta_wayland_touch_find_grab_sequence (MetaWaylandTouch *touch,
|
||||
MetaWaylandSurface *surface,
|
||||
uint32_t serial)
|
||||
{
|
||||
MetaWaylandTouchInfo *touch_info;
|
||||
ClutterEventSequence *sequence;
|
||||
GHashTableIter iter;
|
||||
|
||||
if (!touch->touches)
|
||||
return NULL;
|
||||
|
||||
g_hash_table_iter_init (&iter, touch->touches);
|
||||
|
||||
while (g_hash_table_iter_next (&iter, (gpointer*) &sequence,
|
||||
(gpointer*) &touch_info))
|
||||
{
|
||||
if (touch_info->slot_serial == serial &&
|
||||
touch_info->touch_surface->surface == surface)
|
||||
return sequence;
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
gboolean
|
||||
meta_wayland_touch_get_press_coords (MetaWaylandTouch *touch,
|
||||
ClutterEventSequence *sequence,
|
||||
gfloat *x,
|
||||
gfloat *y)
|
||||
{
|
||||
MetaWaylandTouchInfo *touch_info;
|
||||
|
||||
if (!touch->touches)
|
||||
return FALSE;
|
||||
|
||||
touch_info = g_hash_table_lookup (touch->touches, sequence);
|
||||
|
||||
if (!touch_info)
|
||||
return FALSE;
|
||||
|
||||
if (x)
|
||||
*x = touch_info->start_x;
|
||||
if (y)
|
||||
*y = touch_info->start_y;
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
Reference in New Issue
Block a user