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

前端 未结 4 1246
佛祖请我去吃肉
佛祖请我去吃肉 2021-01-04 05:14

I guess I should check if [NSApplication presentationOptions] contains NSFullScreenModeApplicationPresentationOptions, but how do I achieve that?

4条回答
  •  隐瞒了意图╮
    2021-01-04 05:42

    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
    

提交回复
热议问题