1

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.

Community
  • 1
  • 1
Dan
  • 11
  • 2
  • Are you asking how to pass the values for a CGEvent? Or what the event field constants are for different kinds of gesture events? Or something completely different? – abarnert May 29 '12 at 18:52
  • I am asking how to change magnification of NSEvent which would be passed through CGEvent. It doesn't matter how to do it. It will be great to change it through CGEvent fields. – Dan May 30 '12 at 04:39
  • Has anyone found a solution for this??? I am struggling with a similar problem a couple of days already, but nothing seems to work :( – Nostradamus Oct 16 '12 at 08:05
  • Yeah I also consider how to set this (which?) fields to set rotation or magnification or swipe direction of this touch gestures – Michał Ziobro Aug 25 '16 at 21:02
  • Maybe there could be possible to CGEventSetDoubleField(event, field_num, 15.0); and check field_num – Michał Ziobro Aug 25 '16 at 21:07

0 Answers0