summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDudemanguy <random342@airmail.cc>2022-12-01 10:16:49 -0600
committersfan5 <sfan5@live.de>2023-01-24 15:56:56 +0100
commitae7ee7417fcd09a75f2b1d71a375233bb23e0ea6 (patch)
tree05fe2fb8b58262e2c6eedebd47acc1511fb93984
parent74baedffec5a8c4dfa1e603c9e2b8c03d164fb79 (diff)
downloadmpv-ae7ee7417fcd09a75f2b1d71a375233bb23e0ea6.tar.bz2
mpv-ae7ee7417fcd09a75f2b1d71a375233bb23e0ea6.tar.xz
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.
-rw-r--r--video/out/wayland_common.c17
1 files changed, 9 insertions, 8 deletions
diff --git a/video/out/wayland_common.c b/video/out/wayland_common.c
index 5978a3a6d2..c4c7582957 100644
--- a/video/out/wayland_common.c
+++ b/video/out/wayland_common.c
@@ -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;
- 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);
+ 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);
}
static void touch_handle_up(void *data, struct wl_touch *wl_touch,