summaryrefslogtreecommitdiffstats
path: root/video/out/wayland_common.c
diff options
context:
space:
mode:
authorDudemanguy <random342@airmail.cc>2022-12-01 10:16:49 -0600
committerDudemanguy <random342@airmail.cc>2022-12-01 11:14:03 -0600
commit11229e7f7177220dd1607625a3a1bfc9d34a5f51 (patch)
tree9ab80a665e2c90ea4aebfefba75755f596ccdf6b /video/out/wayland_common.c
parentbca516bd2c282670aa2c92663329e7d5ddf978e0 (diff)
downloadmpv-11229e7f7177220dd1607625a3a1bfc9d34a5f51.tar.bz2
mpv-11229e7f7177220dd1607625a3a1bfc9d34a5f51.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.
Diffstat (limited to 'video/out/wayland_common.c')
-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 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;
- 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,