From b82f7f1c0e7ec74542f26fb3c3ac0c81998b34f4 Mon Sep 17 00:00:00 2001 From: Dan-Korn <54856191+Dan-Korn@users.noreply.github.com> Date: Fri, 6 Sep 2019 01:58:33 -0500 Subject: [PATCH] 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. --- src/osx/cocoa/nonownedwnd.mm | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/osx/cocoa/nonownedwnd.mm b/src/osx/cocoa/nonownedwnd.mm index 61ea6270a0..95319f6ce5 100644 --- a/src/osx/cocoa/nonownedwnd.mm +++ b/src/osx/cocoa/nonownedwnd.mm @@ -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];