How to disappear the mouse cursor

Raconteur's picture

Hi gang,

This is so far off-topic I am not even sure it belongs in THIS forum! I have been banging my head against the wall on this for days, and since this place is full of the smartest people I know on the Internet, I thought I'd post here to see if someone could allay my increasingly painful headache.

How, under OSX 10.6.x can I either change the mouse cursor image (say to a single transparent pixel), or just disappear it completely?

We are demoing a UI for a specific piece of hardware (which isn't ready yet), but need to show it on a computer. Problem is, the specific piece of hardware will not have a "cursor" and showing a cursor will detract from the demo.

I have looked at Apple Script, and it seems like there might be a way there, but I cannot find it. I have looked at cursor replacement/enhancement add-ons but the all modify the existing arrow, rather than remove or change it completely. And I have tried the simple things like hitting an arrow key, which works, but the moment a mouse event is fired it appears again, and our entire model hijacks the mouse events to handle navigation on the screen.

ANY input would be TREMENDOUSLY appreciated!

Cheers,

Chris

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.

cwright's picture
Re: How to disappear the mouse cursor

The function you're interested in is CGDisplayHideCursor

you can find documentation on it here: http://developer.apple.com/library/mac/#documentation/GraphicsImaging/Re...

gtoledo3's picture
Re: How to disappear the mouse cursor

Also, if this is basically for doing some computer screenshots/vid without the cursor showing up, you may try Cursorcerer. I remember using it in 10.5 and it working ok; you invoke some kind of hotkey command and your cursor disappears, another and it reappears. I haven't used it in Snow Leopard.

dust's picture
Re: How to disappear the mouse cursor

here is some code that will help you hide the cursor inside an application. its chris's full screen code i modified to hide the cursor and show parameters i believe sort of like how quartz builder does it i guess. its been awhile as i did this when sl first came out.

 CGDisplayHideCursor (kCGDirectMainDisplay);

only when you go fullscreen does it hide the cursor. you will want to note the level at which to render and hide the cursor. in this example im rendering to the desktop level as when sl first came out i was testing mouse forward mask events etc.. to different levels.

[visWindow setLevel:kCGDesktopWindowLevel]

you will want to set "kCGDesktopWindowLevel" to one of these constants apple gives you.

enum _CGCommonWindowLevelKey {
    kCGBaseWindowLevelKey      = 0,
    kCGMinimumWindowLevelKey,
    kCGDesktopWindowLevelKey,
    kCGBackstopMenuLevelKey,
    kCGNormalWindowLevelKey,
    kCGFloatingWindowLevelKey,
    kCGTornOffMenuWindowLevelKey,
    kCGDockWindowLevelKey,
    kCGMainMenuWindowLevelKey,
    kCGStatusWindowLevelKey,
    kCGModalPanelWindowLevelKey,
    kCGPopUpMenuWindowLevelKey,
    kCGDraggingWindowLevelKey,
    kCGScreenSaverWindowLevelKey,
    kCGMaximumWindowLevelKey,
    kCGOverlayWindowLevelKey,
    kCGHelpWindowLevelKey,
    kCGUtilityWindowLevelKey,
    kCGDesktopIconWindowLevelKey,
    kCGCursorWindowLevelKey,
    kCGAssistiveTechHighWindowLevelKey,
    kCGNumberOfWindowLevelKeys   /* Internal bookkeeping; must be last */
};

more than likely as i don't know what your trying to really accomplish as qc has a hide cursor option in the prefs but make your qc cursor have a transparent background then render to the constant.

"kCGCursorWindowLevelKey"

this should render a custom cursor made in quartz composer for you.

im attaching the example code. its actually quite a very minimal amount of code you just need to sub class nswindow and override a few things.

basically the list here of constants is larger then the app controller. ;)

PreviewAttachmentSize
QCFullscreen_0.zip1.18 MB