H-M-H / Weylus

Use your tablet as graphic tablet/touch screen on your computer.
Other
6.88k stars 274 forks source link

Wayland with dual screens causes input to be relative to both monitors #229

Open dolfandringa opened 1 year ago

dolfandringa commented 1 year ago

Hey all, I love weylus. Its really cool. But I have an issue with Wayland and Dual Monitor setup. I can totally choose to share a specific screen or window, but the input coordinates that are being sent (to pipewire) seem to be relative to both monitors. So if I share my left monitor (or a specific window that is full screen on the left monitor), and draw on the right edge of the tablet, the pointer actually moves to the right edge of my right monitor, not the right edge of my left monitor. And the middle of the tablet, actually ends up as the right edge of the left monitor. This problem doesn't seem to happen in X11.

nfoert commented 1 year ago

I'm experiencing this issue as well. Disabling the Wayland checkbox and selecting the option for my monitor under Capture on the iPad seemed to fix it for me. I'm running Ubuntu 22.04 LTS.

dolfandringa commented 1 year ago

Unfortunately for me showing a specific monitor turns the video black. So the input works correctly at that point, but I have no video on my tablet, making it really hard to really draw at the right location.

H-M-H commented 3 days ago

Thanks for the report! Unfortunately this is a hard problem to solve, the reason being the way the Wayland protocol is designed. For more details see: https://github.com/H-M-H/Weylus/issues/3#issuecomment-877163099

Simply put, Wayland does not provide the coordinates of the selected window/screen. That's why Weylus can not map the emulated input to the correct window/screen and always maps the input to all screens. Another option is to use the RemoteDesktop Portal. Unfortunately it lacks some features, like pressure sensitivity. That's why I have not yet bothered to implement it for Weylus.