Question

Are there any resources that might guide me in how to make my app respond to any type of mouse click that is not the left / right button? Globally, even when my app is not active.

And for magic mouse / trackpad, are there any frameworks or resources available to easily attach my code to a specific gesture?

OTHER TIPS

Here's a code example based on Shashank's (very helpful) answer.

NSEventMask eventMask = NSOtherMouseDownMask|NSOtherMouseUpMask;
[NSEvent addGlobalMonitorForEventsMatchingMask:eventMask
       handler:^(NSEvent *event) {
           if (event.type == NSOtherMouseDown) {
               NSLog(@"middle click down");
           } else if (event.type == NSOtherMouseUp) {
               NSLog(@"middle click up");
           }
       }];
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top