How to know if a NSWindow is fullscreen in Mac OS X Lion?

cocoa, fullscreen, nsapplication, nswindow, osx-lion

Solution

I was just looking for a solution myself and based on Matthieu's answer I created a category on NSWindow that works fine for me.

@interface NSWindow (FullScreen)

- (BOOL)mn_isFullScreen;

@end

@implementation NSWindow (FullScreen)

- (BOOL)mn_isFullScreen
{
    return (([self styleMask] & NSFullScreenWindowMask) == NSFullScreenWindowMask);
}

@end

Problem

I guess I should check if `[NSApplication presentationOptions]` contains `NSFullScreenModeApplicationPresentationOptions`, but how do I achieve that? EDIT: using `[NSApplication presentationOptions]` doesn't work as in my document-based app there might be some documents in fullscreen and others not. I'm now looking for another solution. I'm wondering why there isn't a property called `[NSWindow isFullscreen]` or something like that.

Original source