mpv
mpv copied to clipboard
touchinput on wayland/sway broken after 0.38.0
OSD does not register touchinput on wayland after 0.38.0. I could bisect it to first bad commit a140d2788c33e729c4a0867c69cfe596458653dc. Reverting this commit fixes touchinput and restores 0.37.0 behavior.
Important Information
Provide following Information:
- mpv version: 0.38.0
- Linux Distribution and Version: Archlinux
- Source of the mpv binary: repos
- If known which version of mpv introduced the problem: 0.38.0 (or commit a140d2788c33e729c4a0867c69cfe596458653dc)
- Window Manager and version: sway 1.9 + wlroots 0.17.2 + wayland 1.22.0
- GPU model, driver and version: AMD igp
Reproduction steps
- run any build after a140d2788c33e729c4a0867c69cfe596458653dc
- try to use the osd with touchinput on wayland+sway
Expected behavior
Working touchinput on OSD, like in 0.37.0
Actual behavior
OSD shows up, but input does nothing.
Sway chooses to send pointer leave events just before touch down and pointer enter just after touch up. This results in the mouse being moved to the pointer position which is different from the last touch position. Reverting that commit leads to other bugs: clicking the mouse after performing a touch goes to the last touch position instead of the current mouse position.
The fundamental problem is that the mpv input system has no concept of touch inputs, so they interfere with mouse inputs. Without mpv treating mouse and touch inputs differently, this cannot be properly solved.
I wasn't suggesting reverting https://github.com/mpv-player/mpv/commit/a140d2788c33e729c4a0867c69cfe596458653dc as the way to solve this, just that it solves this particular regression (on sway) for reproducibility.
Is there a possibility to handle different WMs differently, e.g. by querying DESKTOP_SESSION? (although I agree that proper touch handling would obviously be preferable)
Is there a possibility to handle different WMs differently, e.g. by querying
DESKTOP_SESSION?
I think this is not done on purpose. WM behaviors can change between versions so this is also improper. There are some special handlings in mpv where the Wayland protocol is underspecified, but not for this case where it's clear that mpv's current handling is incorrect.
There are other short-term solutions for this, but I'm not sure if it's worth the effort since they will be trashed when proper touch handling is in place.
https://github.com/mpv-player/mpv/pull/14003 implements proper multi-touch support, which gives scripts (like the OSC) a way to distinguish between mouse and touch events.
Note that the PR doesn't fix this issue by itself, since this arises from the fact that a mouse event on the top half of the window always immediately hides the OSC. But now I think the OSC can be modified so that it responds to touch differently to fix this issue: when anywhere on the window is touched, the OSC shows for a fixed time before it disappears, regardless of the mouse position. This makes sense since mobile video player touch UIs behave similarly.