Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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.

like image 611
Nickkk Avatar asked Jul 25 '11 12:07

Nickkk


1 Answers

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
like image 50
Markus Müller-Simhofer Avatar answered Oct 13 '22 22:10

Markus Müller-Simhofer