Mailing Lists: Apple Mailing Lists
Image of Mac OS face in stamp
Re: Changing or hiding the cursor in a background app?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Changing or hiding the cursor in a background app?

On Jan 19, 2006, at 12:02 AM, Eric Schlegel wrote:
Nope, sorry. There's no support for this, at least not in Carbon. (I don't know about Cocoa.)

On Jan 18, 2006, at 8:53 PM, Laurence Harris wrote:
No. Only the active application should be changing the cursor. Anything else
is not supported because it is likely to confuse users. This falls squarely
into the Bad Idea™ category.

It's a very "bad idea" in most instances, but sometimes it makes a lot of sense. To say it's wrong in all cases is closed-minded. For instance, an LSUIElement application can be firmly in control of the focused piece of UI without being the "frontmost application." It's stupid to prevent such an application from changing the cursor, yet Apple does.

I have worked around this limitation in FastScripts (although sometimes it doesn't seem to work and I haven't yet figured that out) by investigating and taking advantage of the "Apple Internal" hook that Apple exposes to let their own applications take advantage of this valid UI control. Below is an example of some code that you might benefit from. It goes without saying that this code is completely unsupported and might stop working at any time. Consider using it a form of civil disobedience:

long sysVers = GetSystemVersion();
    // This trick doesn't work on 10.1 
if (sysVers >= 0x1020)
void CGSSetConnectionProperty(int, int, int, int);
int CGSCreateCString(char *);
int CGSCreateBoolean(BOOL);
int _CGSDefaultConnection();
void CGSReleaseObj(int);
int propertyString, boolVal;
// Hack to make background cursor setting work
propertyString = CGSCreateCString("SetsCursorInBackground");
boolVal = CGSCreateBoolean(TRUE);
CGSSetConnectionProperty(_CGSDefaultConnection(), _CGSDefaultConnection(), propertyString, boolVal);

Is there a less tweaky way of doing this and I've simply fallen behind the times? Please let me (us, the developer community!) know...


Do not post admin requests to the list. They will be ignored.
Carbon-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

 >Changing or hiding the cursor in a background app? (From: "Brian Kendall" <email@hidden>)
 >Re: Changing or hiding the cursor in a background app? (From: Eric Schlegel <email@hidden>)

Visit the Apple Store online or at retail locations.

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2011 Apple Inc. All rights reserved.