SDL icon indicating copy to clipboard operation
SDL copied to clipboard

tablet virtual mouse (aka evdev's EV_ABS) is broken

Open stsp opened this issue 3 years ago • 15 comments

0001-evdev-scale-tablet-coords-for-mouse.patch.txt

Hello.

This patch fixes the mouse under qemu when tablet emulation is used for passing abs coords. Abs coords need to be scaled from 32767x32767 to the window resolution, see this: https://github.com/telmich/gpm/pull/23/commits/99e29cb2206d1c5a43c3035098ae1a7f434b9b8f as a reference. I am not saying my patch is the best possible solution. In particular the one may try to obtain these 32767 values from evdev, rather than to hard-code. So please either apply it or improve the way you think suits.

stsp avatar Nov 27 '21 19:11 stsp

@icculus or @slouken to review.

sezero avatar Nov 27 '21 20:11 sezero

Let's take a look at this for 2.0.20.

slouken avatar Nov 27 '21 22:11 slouken

We should use EVIOCGABS to get the min and max axis values like we do for touchscreens

cgutman avatar Nov 28 '21 13:11 cgutman

In SDL_udev.c I tried to identify that device with "ID_INPUT_TABLET" ID just to find out whether we need to use EVIOCGABS, but it doesn't accept that ID. I suppose some udev fix is needed to identify that device correctly before we can handle it as a tablet...

stsp avatar Nov 28 '21 15:11 stsp

Hmm, I believe EVIOCGABS support is mandatory for ABS axes. Without that range information, it’s impossible to properly interpret the axis values.

Libevdev definitely seems to expect no failures for that ioctl on any ABS axis that is present on the device: https://github.com/freedesktop/libevdev/blob/066d9caf551b4d4662a776e3e3702918b0b8f3a7/libevdev/libevdev.c#L507-L518

cgutman avatar Nov 28 '21 15:11 cgutman

Yes, but do you suggest doing EVIOCGABS when we already got EV_ABS? I supposed we need to first identify and query the device similar to SDL currently deals with touchpad, and then have the resolution handly for us in some struct.

stsp avatar Nov 28 '21 15:11 stsp

@cgutman, is this something you'd like to get in for 2.0.22?

slouken avatar Mar 17 '22 18:03 slouken

I had a PoC branch, but I wasn't able to get VirtualBox to cooperate to be able to test it.

We can move this to 2.0.24.

cgutman avatar Apr 06 '22 01:04 cgutman

Please let me know if any testing is needed on qemu.

stsp avatar Apr 06 '22 09:04 stsp

Hey @cgutman, is this something that will make this milestone?

slouken avatar Jul 25 '22 21:07 slouken

I don't think so. I'm not actively working on this, so someone else is free to take it if they want it.

That code needs some fairly significant work to properly handle input from modern touchpads (which report individual fingers) and absolute pointing devices like VirtualBox's USB tablet device. It should probably be done early in the milestone to allow time to identify regressions.

cgutman avatar Jul 27 '22 04:07 cgutman

Okay, bumped to the next milestone, thanks!

slouken avatar Jul 27 '22 04:07 slouken

I haven't looked at this, but we still have an issue open in this milestone about wildly wrong relative mouse coordinates on VMware, and I'm wondering if this is the same bug.

icculus avatar Jul 27 '22 05:07 icculus

I don't think they're related.

slouken avatar Jul 27 '22 12:07 slouken

I cleaned up and pushed the fixes I had for the evdev code. It still needs more work to handle touchpads and absolute mice properly. Normalizing the absolute axis values and figuring out whether a device is direct or indirect might be tricky.

Right now we are just sending touch events for touchpads, which is probably not what applications are expecting to have to handle (similar to the situation we had with the Cocoa touchpads handling).

cgutman avatar Jul 31 '22 19:07 cgutman