From 70b3acf5812f681ffe612b8df1f62764259500f5 Mon Sep 17 00:00:00 2001 From: dmitry Date: Wed, 25 Apr 2018 01:38:10 +0000 Subject: [PATCH] cocoa: forcing collection behaviour to allow full screen, if fullscreen is requested. (not same by default for some unknown conditions on macOS 10.8) git-svn-id: trunk@57694 - --- lcl/interfaces/cocoa/cocoa_extra.pas | 6 ++++++ lcl/interfaces/cocoa/cocoaprivate.pp | 10 +++++++++- 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/lcl/interfaces/cocoa/cocoa_extra.pas b/lcl/interfaces/cocoa/cocoa_extra.pas index 29680590ee..764c21e17a 100644 --- a/lcl/interfaces/cocoa/cocoa_extra.pas +++ b/lcl/interfaces/cocoa/cocoa_extra.pas @@ -107,6 +107,12 @@ const //kCGAssistiveTechHighWindowLevelKey = 20; //kCGNumberOfWindowLevelKeys = 21; { Must be last. } +const + NSWindowCollectionBehaviorFullScreenPrimary = 1 shl 7; // 10.7 + NSWindowCollectionBehaviorFullScreenAuxiliary = 1 shl 8; // 10.7 + NSWindowCollectionBehaviorFullScreenAllowsTiling = 1 shl 11; // 10.11 + NSWindowCollectionBehaviorFullScreenDisallowsTiling = 1 shl 12; // 10.11 + implementation end. diff --git a/lcl/interfaces/cocoa/cocoaprivate.pp b/lcl/interfaces/cocoa/cocoaprivate.pp index 7dbbaf974c..79c6171037 100644 --- a/lcl/interfaces/cocoa/cocoaprivate.pp +++ b/lcl/interfaces/cocoa/cocoaprivate.pp @@ -2164,6 +2164,10 @@ begin end; procedure TCocoaWindow.lclSwitchFullScreen(AEnabled: Boolean); +const + fsmask = NSWindowCollectionBehaviorFullScreenPrimary + or + NSWindowCollectionBehaviorFullScreenAuxiliary; begin if isInFullScreen = AEnabled then Exit; // nothing to do @@ -2174,7 +2178,11 @@ begin isInFullScreen := AEnabled; if NSAppKitVersionNumber >= NSAppKitVersionNumber10_7 then - Self.toggleFullScreen(nil) + begin + if Self.collectionBehavior and fsmask = 0 then + Self.setCollectionBehavior(Self.collectionBehavior or NSWindowCollectionBehaviorFullScreenPrimary); + Self.toggleFullScreen(nil); + end else begin if AEnabled then