From 806ec8594f001391961e924b99f6734c63f58bc4 Mon Sep 17 00:00:00 2001 From: In-Hwan Kim Date: Mon, 7 Dec 2015 16:48:44 +1300 Subject: [PATCH] REVIEW BUGFIX: Fixed issue where the menu bar and dock would show up in full screen mode (VP-2801) It seems NSApplicationPresentationOptions is set to default (NSApplicationPresentationDefault) whenever the window focus is lost. The workaround is to set the desired presentation options (NSApplicationPresentationHideDock | NSApplicationPresentationHideMenuBar) again once focus is regained. Port of JUCE 3 CODEX modification (b23d02d) to JUCE 4 Change-Id: I8b09b9ea250a250d3113158cec95d612b7c49977 --- .../native/juce_mac_NSViewComponentPeer.mm | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/juce3/JuceLibraryCode/modules/juce_gui_basics/native/juce_mac_NSViewComponentPeer.mm b/juce3/JuceLibraryCode/modules/juce_gui_basics/native/juce_mac_NSViewComponentPeer.mm index 5d83fc2..fd9c75a 100644 --- a/juce3/JuceLibraryCode/modules/juce_gui_basics/native/juce_mac_NSViewComponentPeer.mm +++ b/juce3/JuceLibraryCode/modules/juce_gui_basics/native/juce_mac_NSViewComponentPeer.mm @@ -69,6 +69,9 @@ public: view (nil), isSharedWindow (viewToAttachTo != nil), fullScreen (false), + // CODEX (VP-2801) + allowMenusAndBars(true), + // END CODEX #if USE_COREGRAPHICS_RENDERING usingCoreGraphics (true), #else @@ -364,6 +367,13 @@ public: { return fullScreen; } + + // CODEX (VP-2801) + void setAllowMenusAndBars(bool shouldAllowMenusAndBars) + { + allowMenusAndBars = shouldAllowMenusAndBars; + } + // END CODEX bool isKioskMode() const override { @@ -1277,6 +1287,11 @@ public: //============================================================================== void viewFocusGain() { + // CODEX (VP-2801) + if (!allowMenusAndBars) + [NSApp setPresentationOptions: NSApplicationPresentationHideMenuBar | NSApplicationPresentationHideDock]; + // END CODEX + if (currentlyFocusedPeer != this) { if (ComponentPeer::isValidPeer (currentlyFocusedPeer)) @@ -1320,6 +1335,9 @@ public: NSWindow* window; NSView* view; bool isSharedWindow, fullScreen; + // CODEX (VP-2801) + bool allowMenusAndBars; + // END CODEX bool usingCoreGraphics, isZooming, textWasInserted; String stringBeingComposed; NSNotificationCenter* notificationCenter; @@ -2013,6 +2031,10 @@ void Desktop::setKioskComponent (Component* kioskComp, bool shouldBeEnabled, boo NSViewComponentPeer* const peer = dynamic_cast (kioskComp->getPeer()); jassert (peer != nullptr); // (this should have been checked by the caller) + + // CODEX (VP-2801) + peer->setAllowMenusAndBars(allowMenusAndBars); + // END CODEX #if defined (MAC_OS_X_VERSION_10_7) && MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_7 if (peer->hasNativeTitleBar() -- 2.2.1