Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

windows WM_TOUCH events? #1089

Open
voidware opened this issue Aug 8, 2024 · 3 comments
Open

windows WM_TOUCH events? #1089

voidware opened this issue Aug 8, 2024 · 3 comments

Comments

@voidware
Copy link

voidware commented Aug 8, 2024

Sorry if asked already. Are there any plans to support WM_TOUCH under windows. Or Maybe there is a patch?

Thanks.

@floooh
Copy link
Owner

floooh commented Aug 9, 2024

Currently none of the desktop OS backends support the touch events.

I'm curious, what is your use case, laptops with touch screen or gesture recognition via touchpad?

@voidware
Copy link
Author

voidware commented Aug 9, 2024

I have a pinch-and-zoom action on Android/iOS and I wondered if this could work on a Windows touch-screen laptop.

But after investigation, i ran into more problems. The Windows laptop seems to do pinch-and-zoom itself. I don't know whether this can be changed, but i can pinch any app and it does it. Although sometimes it seems Windows converts an apparent pinch/zoom into scroll-wheel zoom. This means Windows might not be sending the WM_TOUCH in such case.

I cannot figure out whether this can be adjusted. Presumably Windows must still send WM_TOUCH for 3 and 4 finger touches, but maybe it converts to scroll-wheel for 2 finger. Is this even optional.

This whole thing came about because I was debugging my pinch/zoom code. Turns out if I compile for Web then run this under Windows, the touches work as expected. So weirdly the browser here must be intercepting the touch events and sending those as web touch events (or something similar) and it all works.

So I don't think WM_TOUCH for windows is a priority, but I guess at some point it makes sense.

@floooh
Copy link
Owner

floooh commented Aug 9, 2024

If WM_TOUCH is fundamentally compatible with the cross-platform low level touch events exposed by sokol_app.h (e.g. TOUCHES_BEGAN/MOVED/ENDED/CANCELLED) then it should be relatively easy.

This doesn't include any sort of gesture recognition though (e.g. pinch/zoom/rotate). Some platforms have integrated gesture recognition, some don't, so it's hard to expose gestures as a cross-platform feature. Instead gesture recognition would need to be done on top of the lower level touch events and could go into a new sokol_gestures.h header (I had a small number of gesture recognizers which were ported from example code in the Android NDK: https://github.com/floooh/oryol/blob/master/code/Modules/Input/private/gestureDetectors.h).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants