You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
On Apple computers with Magic Trackpads (MacBooks, and the standalone Magic Trackpad product), the surface is actually a multi-touch pad. This is important for implementations of e.g. natural scrolling, which depends on access to touch events themselves. E.g. on any scrollable surface on macOS, you can initiate a scroll with inertia, lift off your fingers, and then stop it dead by simply touching again (just an example, there are a lot more gestures). I'd like to make use of some of the gestures in Love, but currently MTs don't register touch events - as far as I can tell, please correct me if I'm wrong!
I'd like to propose adding a config option that allows settings this hint from a game's config.lua. SDL has indicated the same hint will apply to future touchpad support beyond macOS, but it is specific to Cocoa right now.
I tried to add this to the latest Love source, but I'm not sure where the right place is. The hint docs indicate it should be called before video init, so I added it to Window.cpp before the init call, but it didn't do anything. To test, I used the default touch example from the Wiki:
// in the Window constructor, before SDL_InitSubSystem
#ifdef LOVE_MACOS
/** * The variable can be set to the following values: * * - "0": Trackpad will send mouse events. (default) * - "1": Trackpad will send touch events. * * This hint should be set before SDL is initialized.*/SDL_SetHint(SDL_HINT_TRACKPAD_IS_TOUCH_ONLY, "1");
#endif
The text was updated successfully, but these errors were encountered:
Hm, looking a bit more into the SDL source, I'm not sure if this is fully implemented after all. But that's a judgement beyond my understanding of SDL internals.
I gave up on my SDL investigation. For anyone stumbling upon this, I solved this for me by compiling this code which talks directly to MultitouchSupport (a system Framework) to a C library and then using it from Lua. This doesn't just give the position of touches, but also the velocity and even the rotation (which is very accurate!) for each finger.
turbo
changed the title
[Request] Add conf.lua option to respect SDL_HINT_TRACKPAD_IS_TOUCH_ONLY on macOS
[Request] Add conf.lua option to enable touchpad touch events on macOS
Aug 18, 2024
On Apple computers with Magic Trackpads (MacBooks, and the standalone Magic Trackpad product), the surface is actually a multi-touch pad. This is important for implementations of e.g. natural scrolling, which depends on access to touch events themselves. E.g. on any scrollable surface on macOS, you can initiate a scroll with inertia, lift off your fingers, and then stop it dead by simply touching again (just an example, there are a lot more gestures). I'd like to make use of some of the gestures in Love, but currently MTs don't register touch events - as far as I can tell, please correct me if I'm wrong!
SDL2 has solved this problem a while ago with this hint: https://github.com/love2d/love-apple-dependencies/blob/b3397c1464537d7ad418a1d60ffced71fc919cd4/macOS/Frameworks/SDL2.framework/Versions/A/Headers/SDL_hints.h#L2442-L2461
I'd like to propose adding a config option that allows settings this hint from a game's config.lua. SDL has indicated the same hint will apply to future touchpad support beyond macOS, but it is specific to Cocoa right now.
I tried to add this to the latest Love source, but I'm not sure where the right place is. The hint docs indicate it should be called before video init, so I added it to Window.cpp before the init call, but it didn't do anything. To test, I used the default touch example from the Wiki:
The text was updated successfully, but these errors were encountered: