Dae
Dae

Reputation: 2427

Detecting CGAssociateMouseAndMouseCursorPosition

We're making a user-space device driver for OS X that moves the cursor using Quartz Events, and we ran into a problem when games — especially ones that run in a windowed mode — can't properly capture the mouse pointer (= contain/keep it within the boundaries of their windows). For example, it would go outside the game window and click on the desktop or nearby inactive applications.

We could fix this if only we could detect when an active application calls CGAssociateMouseAndMouseCursorPosition.

How would you do this? Any ideas are appreciated.

Upvotes: 67

Views: 2161

Answers (2)

Mauricio Gracia Gutierrez
Mauricio Gracia Gutierrez

Reputation: 10864

I dont know if this can help you

There is an option called Focus Follows Mouse

Focus Follows Mouse - The Mouse pointer will grab automatically change focus to a new window inisde this one app if you mouse over it, instead of having to click a window to get focus, then clicking to do something.

http://wineskin.urgesoftware.com/tiki-index.php?page=Manual+4.6+Advanced+-+Options

Upvotes: 1

Daniel
Daniel

Reputation: 19

I have written a few different mouse logical layers (for bridging different input devices, etc.). I have found that hooking into the OS level WM_INPUT event is a sure way of getting very real-time mouse position information. There is also a less rigorous solution of just polling the mouse data you need from one of Windows' very primitive DLLs. They are lightning fast. You could poll on a 10ms timer and never see performance loss on a modern machine.

Upvotes: 0

Related Questions