Fixing an annoying Exposé bug with NSWindows

An image of my desktop with the Exposé bug visible on two foreground iChat windows

You’ve seen it before — Exposé’s F-​10 mode stops working for no apparent reason. F-​9 is still good to go, but F-​10 just looks busted.

Why?

Your application has set one of it’s NSWindow instances to the desktop level or lower (kCGDesktopIconWindowLevel or kCGDesktopWindowLevelKey are where it all seems to start).

Can I fix it?

Yes — fixing this problem is simple — either stop using windows at or below the desktop icon level, or add the following code to a window category or subclass in your project and execute the “clearExposeTags” method upon an active instance of your troublesome NSWindow. If you’re using CGSPrivate.h, you can just include the method without all the typedefs and externs.

typedef int CGSConnection;
typedef int CGSWindow;
typedef enum {
    CGSTagNone          = 0,        // No tags
    CGSTagExposeFade    = 0x0002,    // Fade out when Expose activates.
    CGSTagNoShadow      = 0x0008,    // No window shadow.
    CGSTagTransparent   = 0x0200,   // Transparent to mouse clicks.
    CGSTagSticky        = 0x0800,    // Appears on all workspaces.
} CGSWindowTag;
extern CGSConnection _CGSDefaultConnection(void);
extern CGError CGSClearWindowTags(const CGSConnection cid, const CGSWindow wid, CGSWindowTag *tags, int thirtyTwo);

- (OSStatus)clearExposeTags
{
    CGSConnection cid;
    CGSWindow wid;
    CGSWindowTag tags[2];

    wid = [self windowNumber];
    cid = _CGSDefaultConnection();
    tags[0] = 0x02;
    tags[1] = 0;
    return CGSClearWindowTags(cid, wid, tags, 32);
}

Comments

Gravatar for Fips.

Hey, since you seem to have WAY greater knowledge :)

maybe you can point me in the right direction.

As soon as i open Itunes, “Appli­ca­tion win­dows” breaks, as it is not dim­ming out the other win­dows in the back­ground anymore.

10.5.7 + up2date

Thanks in advance for any input

greet­ings from Aus­tria, phil

Posted by Fips on

Gravatar for Tony Arnold.

@Fips are you run­ning Cov­er­Su­tra or Bowtie? Both cause this prob­lem to occur, and acti­vate when iTunes does.

I’ve sent the fixes to Sophia for Cov­er­Su­tra and I believe they will be incor­po­rated in the next release. I’m not sure about Bowtie — I think I sent the fix through to them as well, but I can’t recall.

Posted by Tony Arnold on

Sorry, this conversation has finished.

This post is a bit old now, so I've closed the conversation. If you're keen to keep talking about it, please email me directly.