HumbleUI / JWM

Cross-platform window management and OS integration library for Java
Apache License 2.0
570 stars 46 forks source link

macOS: trackpad touch events #249

Closed shaunlebron closed 1 year ago

shaunlebron commented 1 year ago

Looking at adding access to macOS trackpad touch events. Some references to start:

tonsky commented 1 year ago

I think web api should be studied for this too

shaunlebron commented 1 year ago

setAcceptsTouchEvents:YES seems to be deprecated for allowedTouchTypes. I had to find a usage example on GitHub.

The acceptsTouchEvents property also seemed necessary. Does Apple have newer docs on this?

I confirmed that the touch events are being caught now (see 49a4483cda4619b45133482f95cee91e2620de32). I will look at logging the touch event data to the window.

shaunlebron commented 1 year ago

I added EventTrackpadTouch* events and the dashboard event panel is logging them successfully. I will look at drawing the touch points in a new trackpad panel.

tonsky commented 1 year ago

That would be cool!

shaunlebron commented 1 year ago

I put a trackpad panel next to the mouse panel:

https://user-images.githubusercontent.com/116838/205144208-9e586e33-e8fd-4195-953f-82c71b99f766.mp4

Problems so far:

  1. The dashboard starts hiccuping when I move the touch points too quickly. Not sure what’s going on there.
  2. Touch point state goes out of sync if you use a four-finger gesture that exits the view (swipe up, down, out or in). Not sure how to get external touch events to keep those in sync.