I can't find any APIs to read touchpad events. Am I missing something? I see some old posts about it, but the conversation quickly turns into talking about touchscreens.
My use case: I have a custom map editor and I'd like to pan using 2 finger motion on a laptop touchpad. Would be a big quality of life upgrade.
Touchpad support
Forum rules
Before you make a thread asking for help, read this.
Before you make a thread asking for help, read this.
- BrotSagtMist
- Party member
- Posts: 659
- Joined: Fri Aug 06, 2021 10:30 pm
Re: Touchpad support
Have you considered reading the Touch section on the wiki? https://love2d.org/wiki/love
It is however an OS software question if your touchpad is actually exposed as a touchpad or just a mouse.
If you only get mouse events, there is little you can do from the löve side.
It is however an OS software question if your touchpad is actually exposed as a touchpad or just a mouse.
If you only get mouse events, there is little you can do from the löve side.
obey
Re: Touchpad support
> "love.touchmoved: Callback function triggered when a touch press moves inside the touch screen."BrotSagtMist wrote: ↑Tue May 02, 2023 7:40 pm Have you considered reading the Touch section on the wiki? https://love2d.org/wiki/love
It is however an OS software question if your touchpad is actually exposed as a touchpad or just a mouse.
If you only get mouse events, there is little you can do from the löve side.
I'm not asking about touchscreen. Asking about laptop touchpad. I tried anyway, and I see no events from this API generated by my touchpad
- BrotSagtMist
- Party member
- Posts: 659
- Joined: Fri Aug 06, 2021 10:30 pm
Re: Touchpad support
Again, a touchpad is usually NOT designed to work as such software wise. Its a mouse. The driver reports it to be a mouse.
Your two finger zoom stuff needs to be set up in your OS settings.
Either you find a way to enable this to be a touch area or you map it to the scroll wheel.
The pinch gesture could very well work as horizontal wheel.
And no that description is wrong, it is not only triggered on touch screens. Painting areas, graphic tablets, digital signing boards could work too. Just not pads that work as mouse....
Your two finger zoom stuff needs to be set up in your OS settings.
Either you find a way to enable this to be a touch area or you map it to the scroll wheel.
The pinch gesture could very well work as horizontal wheel.
And no that description is wrong, it is not only triggered on touch screens. Painting areas, graphic tablets, digital signing boards could work too. Just not pads that work as mouse....
obey
Re: Touchpad support
As BrotSagtMist said it is the mouse driver or the generic one of the operating system which takes care of this kind of thing and which returns for example the information of the two fingers as being the movement of the wheel.
You might see love.wheelmoved to try to tinker with something.
Alternatively, if you're brave enough, there seem to be tools written in C/C++ to obtain these things by interpreting driver output or injecting into system processes, but it will work differently depending on hardware and OS so it can be constraining to use this kind of technique in a game that should be able to launch everywhere, here is an example of a project to use Synaptics touchpads as a touch screen: https://github.com/apsun/AbsoluteTouchEx
There must surely be others, it's up to you. (moreover the last technique could potentially be detected as a virus depending on its implementation)
You might see love.wheelmoved to try to tinker with something.
Alternatively, if you're brave enough, there seem to be tools written in C/C++ to obtain these things by interpreting driver output or injecting into system processes, but it will work differently depending on hardware and OS so it can be constraining to use this kind of technique in a game that should be able to launch everywhere, here is an example of a project to use Synaptics touchpads as a touch screen: https://github.com/apsun/AbsoluteTouchEx
There must surely be others, it's up to you. (moreover the last technique could potentially be detected as a virus depending on its implementation)
Re: Touchpad support
The wheel API works out of the box! I didn't think to look there. Ty Brot, thread closed.
Note: it's not smooth scrolling, but that's a lot to ask for on linux. Even firefox doesn't know how to do it by default without setting `MOZ_USE_XINPUT2=1` in my case
Note: it's not smooth scrolling, but that's a lot to ask for on linux. Even firefox doesn't know how to do it by default without setting `MOZ_USE_XINPUT2=1` in my case
Who is online
Users browsing this forum: Ahrefs [Bot] and 11 guests