Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

CGWarpMouseCursorPosition and CarbonEvents



According to the header and the docs, CGWarpMouseCursorPosition is not
supposed to generate events:

===========================================================================
/*
 * Warp the mouse cursor to the desired position in global
 * coordinates without generating events
 */
CG_EXTERN CGError CGWarpMouseCursorPosition( CGPoint newCursorPosition );
===========================================================================

And I should be able to call CGAssociateMouseAndMouseCursorPosition(false)
to disconnect the mouse from the cursor location, then use mouse deltas
instead of absolute location and use CGWarpMouseCursorPosition to then put
the cursor where I want without generating further events:

===========================================================================
/*
 * Helper function to connect or disconnect the mouse and mouse cursor while
 * the calling app is in the foreground.
 *
 * While disconnected, mouse move and drag events will reflect the current
 * position of the mouse cursor position, which will not change with mouse
 * movement. Use the <CoreGraphics/CGDirectDisplay.h> function:
 *
 * void CGGetLastMouseDelta( CGMouseDelta * deltaX, CGMouseDelta * deltaY );
 *
 * This will report mouse movement associated with the last mouse move or
 * drag event.
 *
 * To update the display cursor position, use the function defined in this
 * module:
 *
 *    CGError CGWarpMouseCursorPosition( CGPoint newCursorPosition );
 *
 * Note: The Force Quit key combination (CMD-OPT-ESC by default) will
 * reconnect the mouse and cursor.
 */
CG_EXTERN CGError CGAssociateMouseAndMouseCursorPosition(boolean_t
connected);
===========================================================================


I'm trying exactly what this suggests, although I'm using the
kEventParamMouseDelta from a kEventMouseMoved instead of
CGGetLastMouseDelta.  The problem I'm having is that if I call
CGWarpMouseCursorPosition it DOES generate an additional kEventMouseMoved.

Have I misinterpreted the docs?  Anyone else tried this and have any tips?

-Marc

 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Quartz-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/quartz-dev/email@hidden

This email sent to email@hidden



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.