On Aug 18, 2010, at 17:56, Joe Turner wrote:

> I'm trying to post an event (using CGEventRef) that at least behaves like a 
> double click (even if it's not officially one). What I do now is immediately 
> have a down click, then .01 second later have an up click, then .1 second 
> later have a down click, and then .01 second later have an up click. It works 
> perfectly as two consecutive clicks, but doesn't trigger a double click. I 
> know the timing is not an issue, because my double click delay right now is 
> currently at at least .5 seconds. Is there something special I have to do to 
> trigger it? What about triple-click?
> 
> This is my code for each down click. To get the up one just replace 
> "kCGEventLeftMouseDown" with "kCGEventLeftMouseUp". source is already defined 
> and works.
> 
> CGEventRef mouseEvent = CGEventCreateMouseEvent(source, 
> kCGEventLeftMouseDown, point, kCGMouseButtonLeft);

How about, for the second event:

        CGEventSetIntegerValueField (mouseEvent, kCGMouseEventClickState, 2);

(which I found in a quick scan of the documentation)?

> CGEventPost(kCGHIDEventTap, mouseEvent);
> CFRelease(mouseEvent);

_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to