问题
I need to trigger gesture events in Mac OS X. I found this question: Is there a way to trigger gesture events on Mac OS X? It works for me, but if I want to change rotation? For example,
- (void)rotateWithEvent:(NSEvent *)event {
NSLog(@"ROTATE: %f", [event rotation]);
}
-(IBAction)button:(id)sender {
...
CGEventSourceRef eventSource = CGEventSourceCreate(kCGEventSourceStateCombinedSessionState);
CGEventRef event = CGEventCreate(eventSource);
CGEventSetType(event, NSEventTypeRotate);
CGEventPost(kCGHIDEventTap, event);
...
}
will log
ROTATE: 0.0
I was searching how to change rotation, but had not found anything... Thanks for any help.
来源:https://stackoverflow.com/questions/10799666/is-there-a-way-to-change-rotation-of-gesture-events