Closed shaunlebron closed 1 year ago
Let me know when it’s ready for review.
BTW are you using touchpad by any chance? Did you notice that quick taps sometimes do not generate mouseDown event (but they seem to generate touches)
Feel free to review! I think I need more feedback on how you want things. The events are not batched together when there are multiple changed touch points, but are fired off one at a time. I didn’t know how to put arrays of things in a single event, but I’m not sure how much this matters.
BTW are you using touchpad by any chance? Did you notice that quick taps sometimes do not generate mouseDown event (but they seem to generate touches)
Yeah that’s strange. It’s happening for me too on my trackpad. I also see that behavior on the main branch.
I also see that behavior on the main branch.
Yeah, I noticed it on main first
Ok, I am happy with everything so far.
Only note I have is this: what do you think about removing the word “Touchpad” from events? Should we reuse same events for touchscreens in the future? Web seems to do it
Sure, I can replace the “Trackpad” name with a “touchType” attribute.
direct
| stylus
(no trackpad type)direct
| indirect
(indirect = trackpad)I’ll go with the macOS enums for now. I guess we can add a stylus constant whenever we support it.
The trackpad drivers seem really finicky. I can’t figure out why some “phantom touches” stick around, or how they’re finally removed:
https://user-images.githubusercontent.com/116838/206004510-40e89056-a28b-4963-baff-da88f96b1395.mp4
I’m going to try this GestureHUD project to see if it has the same problem:
edit: GestureHUD had compiler errors when I tried it
I guess the problem is that you are now processing every touch as new in onTouch
, but NSEvent reports all currently active touches. Take a look at this execution log:
[ 11187 ] JWMMainView.mm:432 MOVED
[ 11187 ] JWMMainView.mm:267 touch 2 (0x600001678720) moved (2) at 57, 12
[ 11187 ] JWMMainView.mm:267 touch 1 (0x600001644090) moved (2) at 59, 95
[ 11196 ] JWMMainView.mm:432 MOVED
[ 11196 ] JWMMainView.mm:267 touch 2 (0x600001678720) moved (2) at 57, 12
[ 11196 ] JWMMainView.mm:267 touch 1 (0x600001644090) ended (8) at 59, 95
[ 11196 ] JWMMainView.mm:437 ENDED
[ 11196 ] JWMMainView.mm:267 touch 2 (0x600001678720) moved (2) at 57, 12
[ 11204 ] JWMMainView.mm:427 BEGAN
[ 11204 ] JWMMainView.mm:267 touch 2 (0x600001678720) moved (2) at 57, 12
[ 11204 ] JWMMainView.mm:267 touch 3 (0x600001679cb0) began (1) at 59, 95
[ 11204 ] JWMMainView.mm:432 MOVED
[ 11204 ] JWMMainView.mm:267 touch 2 (0x600001678720) moved (2) at 57, 12
[ 11204 ] JWMMainView.mm:267 touch 4 (0x600001679cb0) began (1) at 59, 95
Notice how touch 3 and touch 4 are the same, but processed twice, once in touchesBeganWithEvent and once in touchesMovedWithEvent
I moved your branch as it was to the main repo (https://github.com/HumbleUI/JWM/commits/macos-touch) and added one commit on top of it (7a4dfa070689dc8e281a850d20913f7276cd2aba). Can you work from that? I gave you write access to the repo. This will be simpler for me to compare code, will give us option to collaborate and hopefully will be easier (or at least the same) for you?
Actually, I think it’s good enough as is to be merged. If you think there’s more work needed, feel free to start a new branch, either in this repo (preferred by me) or in your fork. And thanks for such a huge contribution!
P.S. I also added some release
calls, because ARC is turned off
Great! Thanks for fixing. Good to know that the NSEvent reports all active touches, I was able to confirm that myself. I’m still seeing some phantom touches, so it still looks like the deltas aren’t completely reliable. I can try an alternate system that uses all the active touches to correct the deltas, or just report all of them at once like the web api. (not sure how to put arrays onto events yet)
Trying #249. See progress details there.