I'm working on an application that uses bits of Carbon and Cocoa to handle some C++ code that was written for Windows. I've currently got an issue whereby, when the user either cmd+tabs out of the window, or just hovers their mouse over the dock (not just the app's icon - anywhere on the dock), the cursor (using the Cocoa NSCursor class) changes from a custom cursor to the normal OS X cursor.
Basically, does anyone know what gets sent to an app (by both Carbon and Cocoa) when the user hovers over the dock?
This is because the Dock overrides any cursor changes. What you need to do is set a timer that repeatedly fires to change the cursor.
First create a method that lets you change your cursor and then set the customCursor
Then when you are ready to change the cursor, you need to star the timer and let it repeatedly fire
And when you're done, you can invalidate the timer
Also this will only work if your app is the front most. If someone presses command+tab, your app will no longer be able to set the cursor. To enable your app to control the cursor while in the background you have to use private APIs, so no Mac App Store.
In your bridging header you can add the following code
And then in your AppDelegate you can add this code in
applicationDidFinishLaunching