Closed e-su closed 1 year ago
All the logic handling finger and cursor movement happens in trackpadCallback
in trackpad_mapper_util.c
The function receives an array of finger data including which finger is touching the trackpad, how hard it is pressing, how fast it is moving, etc
Note that the data doesn't tell you a finger tapped, but you can guess it by interpreting MTTouch.state field.
You will need to for each finger data
Actually I have tried doing similar thing on a local branch that wasn't pushed to github. I wanted yo tap on trackpad to generate z and x key presses to play osu but I couldn't get it working consistently.
I don't really recommend doing this because the latency is unknown and probably inconsistent. I never did a benchmark measuring time from MTTouch triggering callback to an application receiving mouse move event but you may want to try it.
I tried mouse click events and keyboard key events, but it didn't work as expected, sometimes tapping the trackpad didn't respond, sometimes tapping the trackpad repeated the output. I have no idea.
I will push my code to github after fixing bug in SO-copy-pasted code
Go checkout tapping branch (generateClick()
) to see how I implemented tapping. It is not what you want but you can see how I interpret finger states
I implemented tapping the left or right side of the trackpad to generate the specified event. Appreciate it.
Hello, I want to tap the left side of the trackpad to simulate the left mouse button, to tap the right side to simulate the right mouse button, how can I modify the code? I want use this to play Muse Dash on Mac with trackpad. Thank you very much.