Allow non-modal windows shown from modal dialogs to work in wxOSX.
Use kCGUtilityWindowLevel for such windows instead of kCGFloatingWindowLevel and also call setWorksWhenModal:YES. Closes #12187. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@65130 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -14,6 +14,7 @@
|
||||
#include "wx/nonownedwnd.h"
|
||||
#include "wx/frame.h"
|
||||
#include "wx/app.h"
|
||||
#include "wx/dialog.h"
|
||||
#endif
|
||||
|
||||
#include "wx/osx/private.h"
|
||||
@@ -408,7 +409,7 @@ void wxNonOwnedWindowCocoaImpl::WillBeDestroyed()
|
||||
}
|
||||
}
|
||||
|
||||
void wxNonOwnedWindowCocoaImpl::Create( wxWindow* WXUNUSED(parent), const wxPoint& pos, const wxSize& size,
|
||||
void wxNonOwnedWindowCocoaImpl::Create( wxWindow* parent, const wxPoint& pos, const wxSize& size,
|
||||
long style, long extraStyle, const wxString& WXUNUSED(name) )
|
||||
{
|
||||
static wxNonOwnedWindowController* controller = NULL;
|
||||
@@ -516,6 +517,29 @@ long style, long extraStyle, const wxString& WXUNUSED(name) )
|
||||
defer:NO
|
||||
];
|
||||
|
||||
// If the parent is modal, windows with wxFRAME_FLOAT_ON_PARENT style need
|
||||
// to be in kCGUtilityWindowLevel and not kCGFloatingWindowLevel to stay
|
||||
// above the parent.
|
||||
wxDialog * const parentDialog = wxDynamicCast(parent, wxDialog);
|
||||
if (parentDialog && parentDialog->IsModal())
|
||||
{
|
||||
if (level == kCGFloatingWindowLevel)
|
||||
{
|
||||
level = kCGUtilityWindowLevel;
|
||||
}
|
||||
|
||||
// Cocoa's modal loop does not process other windows by default, but
|
||||
// don't call this on normal window levels so nested modal dialogs will
|
||||
// still behave modally.
|
||||
if (level != kCGNormalWindowLevel)
|
||||
{
|
||||
if ([m_macWindow isKindOfClass:[NSPanel class]])
|
||||
{
|
||||
[(NSPanel*)m_macWindow setWorksWhenModal:YES];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
[m_macWindow setLevel:level];
|
||||
|
||||
[m_macWindow setDelegate:controller];
|
||||
|
Reference in New Issue
Block a user