Make wxFrame::EnableFullScreenView() work under macOS 10.11+

We must explicitly turn on NSWindowCollectionBehaviorFullScreenAuxiliary
flag to prevent the window from becoming shown in full screen.

Closes #18168.
This commit is contained in:
Andy Robinson 2018-11-11 01:33:53 +01:00 committed by Vadim Zeitlin
parent 4e2d26b22e
commit fe4f35b0a3
2 changed files with 9 additions and 0 deletions

View File

@ -175,6 +175,7 @@ wxOSX:
- supporting native image formst like NSImage and UIImage in wxBitmap
- native implementation for wxStaticBitmap for correct rendering of template images
- Fill column value in wxEVT_DATAVIEW_ITEM_ACTIVATED events (Igor Korot).
- Make wxFrame::EnableFullScreenView() work under macOS 10.11+ (Andy Robinson).
wxQt:

View File

@ -1092,10 +1092,18 @@ bool wxNonOwnedWindowCocoaImpl::EnableFullScreenView(bool enable)
if (enable)
{
collectionBehavior |= NSWindowCollectionBehaviorFullScreenPrimary;
collectionBehavior &= ~NSWindowCollectionBehaviorFullScreenAuxiliary;
}
else
{
// Note that just turning "Full Screen Primary" is not enough, the
// window would still be made full screen when the green button in the
// title bar is pressed, and we need to explicitly turn on the "Full
// Screen Auxiliary" style to prevent this from happening. This works,
// at least under 10.11 and 10.14, even though it's not really clear
// from the documentation that it should.
collectionBehavior &= ~NSWindowCollectionBehaviorFullScreenPrimary;
collectionBehavior |= NSWindowCollectionBehaviorFullScreenAuxiliary;
}
[m_macWindow setCollectionBehavior: collectionBehavior];