0
votes

I am trying to move the mouse cursor programmatically (which is working), and then read the cursor position inside of a web browser (like Chrome).

CGPoint = CGPointMake(x, y);
CGDisplayMoveCursorToPoint(kCGDirectMainDisplay,point);

CGEventRef theEvent = CGEventCreateMouseEvent(NULL, kCGEventMouseMoved, point, kCGMouseButtonLeft);
CGEventSetType(theEvent, kCGEventMouseMoved);
CGEventPost(kCGHIDEventTap, theEvent);
CFRelease(theEvent);

The mouse moves, but a mouse move event handler in chrome does not detect the movements the way it does if the trackpad is actually used. I have tried countless numbers of permutations of the code above. My best guess is that chrome is trying to read an additional mouse event, or I need to channel the event directly to the PID of Chrome?? Any ideas? Am I missing something?

1

1 Answers

0
votes

The issue was sandboxing in xcode.. To fix the issue, in xcode -> capabilities -> App Sandbox (off). If you are going to sandbox something, please show a console log entry you stupid turdbisquits