How to push a popup window above a full screen window?

Mike Swingler swingler at
Tue Feb 21 10:25:36 PST 2012

I don't think using -[NSView enterFullScreen:] is a good idea. We used it in Java SE 6, and it was a never-ending source of problems around exactly these issues. If you open a popup in Java SE 6 and switch to another app, it will float above everything else (including the screensaver!).

Instead of hacking around with window levels, why not just use the 10.7 full screen API (-[NSWindow toggleFullScreen]) where windows stay at their normal levels, and leave the functionality unimplemented on 10.6? You get the nice full screen transition, an automatic space created that the user can enter and exit, and it will make Java full screen look less foreign.

Mike Swingler
Apple Inc.

On Feb 21, 2012, at 7:01 AM, Anthony Petrov wrote:

> Hi Mike,
> I've further experimented and tried to set the kCGMaximumWindowLevel level to the popup window. The value of kCGMaximumWindowLevel is 2147483631 which is greater than 2147483629 (the level of the full-screen window itself - see the quoted message). Nevertheless, the popup window stays behind the full screen window.
> Any thoughts?
> --
> best regards,
> Anthony
> On 2/17/2012 7:29 PM, Anthony Petrov wrote:
>> Hi Mike,
>> I'm currently working on 7145818 ([macosx] dialogs not showing when JFrame is in full screen mode) and it seems I can't find a proper solution. Here's what I did:
>> 1. Tried to setLevel:(NSScreenSaverWindowLevel) to the dialog. Also tried using (NSScreenSaverWindowLevel+1). No luck.
>> 2. In CWrapper.NSView.enterFullScreenMode() implementation I tried passing
>>> [NSApp presentationOptions], NSFullScreenModeApplicationPresentationOptions
>> as an option in addition to #1. No luck.
>> 3. I've also added the following option to the withOptions: dictionary for NSView enterFullScreenMode:
>>> [NSNumber numberWithInteger:NSNormalWindowLevel], NSFullScreenModeWindowLevel,
>> which, according to the documentation, must put the full screen window on the normal level. This (together with #2 and #1) didn't work either.
>> I've added an fprintf() for [[view window] level] after calling enterFullScreenMode:, and it always printed 2147483629 as the level of the window that has just entered the full screen mode. Note that the NSScreenSaverWindowLevel has a value of 1000.
>> The only solution that I think could work is to abandon using NSView enterFullScreenMode:, and instead emulate it by placing the window to the NSScreenSaverWindowLevel when it's entering the FS mode, and also calling [NSMenu setMenuBarVisible:NO] to hide the menu bar and the dock. But this doesn't seem like an excellent solution.
>> What could you suggest?
>> [1]
>> -- 
>> best regards,
>> Anthony

More information about the macosx-port-dev mailing list