Is there a way to change rotation of gesture events?

佐手、 提交于 2019-12-24 11:16:32

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!