Trigger Gesture Events on OS X – do you want to trigger multi-touch gesture events on OS X? Is there a way to do this? Let us See! Mouse or keyboard events can be triggered with CGEventCreateMouseEvent and CGEventCreateKeyboardEvent. Similar low level function for multitouch events exists. Trigger Gesture Events on OS X is more towards a discussion than a simple guide.
Trigger Gesture Events on OS X : Introduction
You can use CGEventCreate to create a gesture event. The event types “officially” defined for CGEventCreate do not include gesture event types, but you could pass in the values defined in NSEvent.h
In an attempt to do so, you have to figured out how to use Event Taps to see if the lowest level event tap would allow me to get the raw data, interpret it and send up your own events in its place. The event tap, even at the HID level, is still a step above where the input is being interpreted in MultitouchSupport.framework.
1 | https://developer.apple.com/library/mac/documentation/Carbon/Reference/QuartzEventServicesRef/Reference/reference.html |
Trigger Gesture Events on OS X : Extending Functionality
How does what is happening in MultitouchSupport.framework differ between the Magic Mouse and a glass trackpad. If it is based on IOKit device properties, we can suspect that you will need a KEXT that emulates a trackpad but actually communicates with the mouse. Apple have some documentation on Darwin kernel programming and kernel extensions specifically:
---
1 2 3 | http://developer.apple.com/Mac/library/documentation/Darwin/Conceptual/KEXTConcept/KEXTConceptAbout/about_kexts.html http://developer.apple.com/mac/library/documentation/DeviceDrivers/Conceptual/WritingDeviceDriver/Introduction/Intro.html http://developer.apple.com/mac/library/documentation/Darwin/Conceptual/KernelProgramming/About/About.html |
It requires two hacks: using the private Multitouch framework to get the device input, and injecting undocumented CGEvent structures into Quartz Event Services :
1 | https://github.com/calftrail/Touch |
Synergy is free and open source software for sharing one mouse and keyboard between multiple computers :
1 | http://synergy-foss.org/ |