Supporting deeper nesting levels of modal dialogs on macOS
In order to make sure a parent NSPanel cannot be activated, turn off its worksWhenModal flag while the child has its turn see #18204
This commit is contained in:
@@ -435,9 +435,26 @@ void wxModalEventLoop::OSXDoRun()
|
|||||||
#if OSX_USE_MODAL_SESSION
|
#if OSX_USE_MODAL_SESSION
|
||||||
if ( m_modalWindow )
|
if ( m_modalWindow )
|
||||||
{
|
{
|
||||||
|
bool restoreWorksWhenModal = false;
|
||||||
|
wxDialog* const parentDialog = wxDynamicCast(wxGetTopLevelParent(m_modalWindow->GetParent()), wxDialog);
|
||||||
|
NSWindow* parentWindow = parentDialog && parentDialog->IsModal() ? parentDialog->GetWXWindow() : nil;
|
||||||
|
if ( parentWindow != nil )
|
||||||
|
{
|
||||||
|
if ( [parentWindow isKindOfClass:[NSPanel class]] && [(NSPanel*)parentWindow worksWhenModal] == YES )
|
||||||
|
{
|
||||||
|
[(NSPanel*)parentWindow setWorksWhenModal:NO];
|
||||||
|
restoreWorksWhenModal = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
BeginModalSession(m_modalWindow);
|
BeginModalSession(m_modalWindow);
|
||||||
wxCFEventLoop::OSXDoRun();
|
wxCFEventLoop::OSXDoRun();
|
||||||
EndModalSession();
|
EndModalSession();
|
||||||
|
|
||||||
|
if ( restoreWorksWhenModal )
|
||||||
|
{
|
||||||
|
[(NSPanel*)parentWindow setWorksWhenModal:YES];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
#endif
|
#endif
|
||||||
|
Reference in New Issue
Block a user