wayland: check for resize/move in touch event first

8300830951 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.
This commit is contained in:
Dudemanguy 2022-12-01 10:16:49 -06:00 committed by sfan5
parent 74baedffec
commit ae7ee7417f
1 changed files with 9 additions and 8 deletions

View File

@ -299,19 +299,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,