Touchpad support

Questions about the LÖVE API, installing LÖVE and other support related questions go here.
Forum rules
Before you make a thread asking for help, read this.
Post Reply
boj44
Prole
Posts: 3
Joined: Tue May 02, 2023 3:50 pm

Touchpad support

Post by boj44 »

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.
User avatar
BrotSagtMist
Party member
Posts: 636
Joined: Fri Aug 06, 2021 10:30 pm

Re: Touchpad support

Post by BrotSagtMist »

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.
obey
boj44
Prole
Posts: 3
Joined: Tue May 02, 2023 3:50 pm

Re: Touchpad support

Post by boj44 »

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.
> "love.touchmoved: Callback function triggered when a touch press moves inside the touch screen."

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
User avatar
BrotSagtMist
Party member
Posts: 636
Joined: Fri Aug 06, 2021 10:30 pm

Re: Touchpad support

Post by BrotSagtMist »

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....
obey
User avatar
Bigfoot71
Party member
Posts: 287
Joined: Fri Mar 11, 2022 11:07 am

Re: Touchpad support

Post by Bigfoot71 »

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)
My avatar code for the curious :D V1, V2, V3.
boj44
Prole
Posts: 3
Joined: Tue May 02, 2023 3:50 pm

Re: Touchpad support

Post by boj44 »

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
Post Reply

Who is online

Users browsing this forum: No registered users and 6 guests