Browse Source

NSViewComponentPeer: Avoid making temporary windows (dropdowns, callouts) full-screen when in full-screen mode

eabcfbad26 incorrectly set the collection
behaviour NSWindowCollectionBehaviorFullScreenPrimary on all top-level
components, which would cause popup menus and callouts to appear in
their own space when launched from an app running in full-screen mode.
v6.1.6
reuk 3 years ago
parent
commit
9bd52d59af
No known key found for this signature in database GPG Key ID: 9ADCD339CFC98A11
1 changed files with 23 additions and 1 deletions
  1. +23
    -1
      modules/juce_gui_basics/native/juce_mac_NSViewComponentPeer.mm

+ 23
- 1
modules/juce_gui_basics/native/juce_mac_NSViewComponentPeer.mm View File

@@ -198,7 +198,7 @@ public:
[window setExcludedFromWindowsMenu: (windowStyleFlags & windowIsTemporary) != 0];
[window setIgnoresMouseEvents: (windowStyleFlags & windowIgnoresMouseClicks) != 0];
[window setCollectionBehavior: NSWindowCollectionBehaviorFullScreenPrimary];
setCollectionBehaviour (false);
[window setRestorable: NO];
@@ -407,11 +407,32 @@ public:
return [window isMiniaturized];
}
NSWindowCollectionBehavior getCollectionBehavior (bool forceFullScreen) const
{
if (forceFullScreen)
return NSWindowCollectionBehaviorFullScreenPrimary;
// Some SDK versions don't define NSWindowCollectionBehaviorFullScreenNone
constexpr auto fullScreenNone = (NSUInteger) (1 << 9);
return (getStyleFlags() & (windowHasMaximiseButton | windowIsResizable)) == (windowHasMaximiseButton | windowIsResizable)
? NSWindowCollectionBehaviorFullScreenPrimary
: fullScreenNone;
}
void setCollectionBehaviour (bool forceFullScreen) const
{
[window setCollectionBehavior: getCollectionBehavior (forceFullScreen)];
}
void setFullScreen (bool shouldBeFullScreen) override
{
if (isSharedWindow)
return;
if (shouldBeFullScreen)
setCollectionBehaviour (true);
if (isMinimised())
setMinimised (false);
@@ -1573,6 +1594,7 @@ public:
}
[NSApp setPresentationOptions: NSApplicationPresentationDefault];
setCollectionBehaviour (isFullScreen());
}
void setHasChangedSinceSaved (bool b) override


Loading…
Cancel
Save