Skip to content

Commit

Permalink
The code nows registers all multitouch devices, so if you Magic Mouse…
Browse files Browse the repository at this point in the history
… is connected, it will accept the 1 tap 3 fingers middle click
  • Loading branch information
carlosh committed Nov 8, 2009
1 parent 192fab9 commit 8527c5a
Showing 1 changed file with 12 additions and 4 deletions.
16 changes: 12 additions & 4 deletions main.m
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
MTDeviceRef MTDeviceCreateDefault();
void MTRegisterContactFrameCallback(MTDeviceRef, MTContactCallbackFunction);
void MTDeviceStart(MTDeviceRef);
CFMutableArrayRef MTDeviceCreateList(void); //returns a CFMutableArrayRef array of all multitouch devices

BOOL maybeMiddleClick;
NSDate *touchStartTime;
Expand Down Expand Up @@ -119,10 +120,17 @@ int main(int argc, char *argv[]) {
[NSApplication sharedApplication];


//register a callback to get raw touch data
dev = MTDeviceCreateDefault();
MTRegisterContactFrameCallback(dev, callback);
MTDeviceStart(dev);
//Get list of all multi touch devices
NSMutableArray* deviceList = (NSMutableArray*)MTDeviceCreateList(); //grab our device list


//Iterate and register callbacks for multitouch devices.
for(int i = 0; i<[deviceList count]; i++) //iterate available devices
{
MTRegisterContactFrameCallback((MTDeviceRef)[deviceList objectAtIndex:i], callback); //assign callback for device
MTDeviceStart((MTDeviceRef)[deviceList objectAtIndex:i]); //start sending events
}


//register a callback to know when osx come back from sleep
WakeObserver *wo = [[WakeObserver alloc] init];
Expand Down

0 comments on commit 8527c5a

Please sign in to comment.