From 11229e7f7177220dd1607625a3a1bfc9d34a5f51 Mon Sep 17 00:00:00 2001 From: Dudemanguy Date: Thu, 1 Dec 2022 10:16:49 -0600 Subject: [PATCH] wayland: check for resize/move in touch event first 8300830951e2b0b90b22fc7d33b7556ed05e139c rearranged/simplified some of the wayland touch code mainly because what was there before was completely broken on my machine in those days (dragging was unreliable, resizing was really buggy, etc.). However, one user said that touch input no longer worked for him after that change. I could not ever reproduce it, but it seems the issue was putting down the key before testing for resize/move in the code. Now who knows why this actually matters, but apparently it works for the user in question and I don't observe any unexpected behavior on my end when swapping the order. Like the mouse/pointer code, we also now do a test for dragging before actually trying a resize/move which is a little more consistent than before. Fixes #9771. --- video/out/wayland_common.c | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/video/out/wayland_common.c b/video/out/wayland_common.c index 7987dcef44..04db490c5e 100644 --- a/video/out/wayland_common.c +++ b/video/out/wayland_common.c @@ -304,19 +304,20 @@ static void touch_handle_down(void *data, struct wl_touch *wl_touch, int32_t id, wl_fixed_t x_w, wl_fixed_t y_w) { struct vo_wayland_state *wl = data; - wl->mouse_x = wl_fixed_to_int(x_w) * wl->scaling; wl->mouse_y = wl_fixed_to_int(y_w) * wl->scaling; + enum xdg_toplevel_resize_edge edge; + if (!mp_input_test_dragging(wl->vo->input_ctx, wl->mouse_x, wl->mouse_y)) { + if (check_for_resize(wl, x_w, y_w, wl->opts->edge_pixels_touch, &edge)) { + xdg_toplevel_resize(wl->xdg_toplevel, wl->seat, serial, edge); + } else { + xdg_toplevel_move(wl->xdg_toplevel, wl->seat, serial); + } + } + mp_input_set_mouse_pos(wl->vo->input_ctx, wl->mouse_x, wl->mouse_y); mp_input_put_key(wl->vo->input_ctx, MP_MBTN_LEFT | MP_KEY_STATE_DOWN); - - enum xdg_toplevel_resize_edge edge; - if (check_for_resize(wl, x_w, y_w, wl->opts->edge_pixels_touch, &edge)) { - xdg_toplevel_resize(wl->xdg_toplevel, wl->seat, serial, edge); - } else { - xdg_toplevel_move(wl->xdg_toplevel, wl->seat, serial); - } } static void touch_handle_up(void *data, struct wl_touch *wl_touch,