Touchpad works fine in X11 but has touchscreen behaviour in KMSDRM
Description
I can use my SDL3 application fine when using X11 display but when using direct rendering through KMSDRM:
- mouse pointer gets set to finger position on the touchpad, as if it was a touchscreen,
- scrolling with two fingers does not work.
Testing conditions
- OS: FreeBSD 14.3-RELEASE-p5
- Library: SDL 3.2.24
- Apps: FreeRDP 3.17.2 and Ymir 0.2.0
I don't have FreeBSD or a touchpad, but you're welcome to contribute a fix if you find out why it's not working correctly.
Sure, I will look into it when I find some time. In the meantime it would be nice if someone could test under Linux to confirm, I don't think there is specific code for FreeBSD for that part.
I guess it's quite obvious then: https://github.com/libsdl-org/SDL/blob/0d2f081d41bb47015ae16743491a0032bdc869fd/src/core/linux/SDL_evdev.c#L942-L951
I guess it's quite obvious then:
SDL/src/core/linux/SDL_evdev.c
Lines 942 to 951 in 0d2f081
// For now, we just treat a touchpad like a touchscreen if (udev_class & (SDL_UDEV_DEVICE_TOUCHSCREEN | SDL_UDEV_DEVICE_TOUCHPAD)) { item->is_touchscreen = true; if (!SDL_EVDEV_init_touchscreen(item, udev_class)) { close(item->fd); SDL_free(item->path); SDL_free(item); return false; } }
Yep, probably whoever wrote that code didn't have a touchpad for testing. Please feel free to submit a tested PR to add support for touchpads!