Fix wxPOPUP_WINDOW to work as documented (Cocoa): (#1535)

Ensure that wxPOPUP_WINDOW on Mac always sets the window level
to NSPopupWindowLevel, regardless of the wxSTAY_ON_TOP and
wxFRAME_TOOL_WINDOW flags.

As the comment for wxPOPUP_WINDOW in defs.h says,
"set this flag to create a special popup window:
it will be always shown on top of other windows"

So, that should *always* be true, even in relation to other
Windows with wxSTAY_ON_TOP, since NSPopUpMenuWindowLevel
is greater (higher) than NSModalPanelWindowLevel.

It should also *always* be true even if the window has both
wxPOPUP_WINDOW and wxFRAME_TOOL_WINDOW styles, since there's
no reason why we can't have a panel with NSUtilityWindowMask
and NSPopUpMenuWindowLevel.
This commit is contained in:
Dan-Korn
2019-09-06 01:58:33 -05:00
committed by Stefan Csomor
parent a7cc686853
commit b82f7f1c0e

View File

@@ -707,10 +707,6 @@ long style, long extraStyle, const wxString& WXUNUSED(name) )
{
windowstyle |= NSUtilityWindowMask;
}
else if ( ( style & wxPOPUP_WINDOW ) )
{
level = NSPopUpMenuWindowLevel;
}
else if ( ( style & wxFRAME_DRAWER ) )
{
/*
@@ -744,6 +740,9 @@ long style, long extraStyle, const wxString& WXUNUSED(name) )
if ( ( style & wxSTAY_ON_TOP ) )
level = NSModalPanelWindowLevel;
if ( ( style & wxPOPUP_WINDOW ) )
level = NSPopUpMenuWindowLevel;
NSRect r = wxToNSRect( NULL, wxRect( pos, size) );
r = [NSWindow contentRectForFrameRect:r styleMask:windowstyle];