From ae7d8870e776deca116d2a5099eaba5c3fc9c33a Mon Sep 17 00:00:00 2001 From: Tony Crisci Date: Thu, 16 Nov 2017 16:45:56 -0500 Subject: [PATCH] data-device: bug: fix touch detection --- types/wlr_data_device.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/types/wlr_data_device.c b/types/wlr_data_device.c index 999faa22..bac8dbf3 100644 --- a/types/wlr_data_device.c +++ b/types/wlr_data_device.c @@ -630,15 +630,15 @@ static bool seat_client_start_drag(struct wlr_seat_client *client, client->seat->pointer_state.focused_surface == origin; bool is_touch_grab = client->touch && - wl_list_length(&client->seat->touch_state.touch_points) == 1 && + wlr_seat_touch_num_points(client->seat) == 1 && client->seat->touch_state.grab_serial == serial; + // set in the iteration struct wlr_touch_point *point = NULL; + if (is_touch_grab) { wl_list_for_each(point, &client->seat->touch_state.touch_points, link) { - if (point->surface && point->surface == origin) { - is_touch_grab = true; - } + is_touch_grab = point->surface && point->surface == origin; break; } } @@ -677,6 +677,7 @@ static bool seat_client_start_drag(struct wlr_seat_client *client, wlr_seat_pointer_clear_focus(drag->seat); wlr_seat_pointer_start_grab(drag->seat, &drag->pointer_grab); } else { + assert(point); wlr_seat_touch_start_grab(drag->seat, &drag->touch_grab); wlr_drag_set_focus(drag, point->surface, point->sx, point->sy); }