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

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

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

4条回答
  •  -上瘾入骨i
    2021-01-04 05:49

    The way I handled it in pre-10.7 (where neither NSApplicationPresentationFullScreen nor NSFullScreenWindowMask was available) was to check

    if ([mainWindow frame].size.height == [[mainWindow screen] frame].size.height)
    {
        // window is fullscreen
    }
    

    and this piece of really old code seem to still work not only on "Lion" but also on today's - at the time of writing 10.14.x - OS.

提交回复
热议问题