OSX: Only update the window level if it has changed

Updating the level could lead to windows being reordered in that level
on some OS versions, so for safety don't do it unless it is needed.
This commit is contained in:
Ian McInerney
2020-01-24 00:06:14 +00:00
parent f5c3d9d1fb
commit 654ef6d729

View File

@@ -939,9 +939,13 @@ void wxNonOwnedWindowCocoaImpl::SetWindowStyleFlag( long style )
level = NSModalPanelWindowLevel;
else if (( style & wxFRAME_FLOAT_ON_PARENT ) || ( style & wxFRAME_TOOL_WINDOW ))
level = NSFloatingWindowLevel;
[m_macWindow setLevel: level];
m_macWindowLevel = level;
// Only update the level when it has changed, setting a level can cause the OS to reorder the windows in the level
if ( level != m_macWindowLevel )
{
[m_macWindow setLevel: level];
m_macWindowLevel = level;
}
}
}