Cocoa Port:

- Fix bug where restoring full screen windows on startup would fail. (Regression from r5349.)
- Fix bug where the dock would fail to reappear when the last window exited full screen mode. (Regression from r5349.)
This commit is contained in:
rogerman 2016-02-12 08:50:35 +00:00
parent e8f660b381
commit 549f754be2
3 changed files with 43 additions and 12 deletions

View File

@ -113,7 +113,9 @@ class OGLVideoOutput;
NSUInteger _statusBarHeight;
BOOL _isUpdatingDisplayScaleValueOnly;
BOOL _useMavericksFullScreen;
BOOL _willRestoreStatusBarFromFullScreen;
BOOL _masterStatusBarState;
NSRect _masterWindowFrame;
double _masterWindowScale;
OSSpinLock spinlockScale;
OSSpinLock spinlockRotation;
@ -161,6 +163,9 @@ class OGLVideoOutput;
- (double) maxScalarForContentBoundsWidth:(double)contentBoundsWidth height:(double)contentBoundsHeight;
- (void) enterFullScreen;
- (void) exitFullScreen;
- (BOOL) masterStatusBarState;
- (NSRect) masterWindowFrame;
- (double) masterWindowScale;
- (IBAction) copy:(id)sender;
- (IBAction) changeHardwareMicGain:(id)sender;

View File

@ -110,12 +110,14 @@ static std::unordered_map<NSScreen *, DisplayWindowController *> _screenMap; //
_displayMode = DS_DISPLAY_TYPE_DUAL;
_displayOrientation = DS_DISPLAY_ORIENTATION_VERTICAL;
_minDisplayViewSize = NSMakeSize(GPU_DISPLAY_WIDTH, GPU_DISPLAY_HEIGHT*2.0 + (DS_DISPLAY_UNSCALED_GAP*_displayGap));
_minDisplayViewSize = NSMakeSize(GPU_DISPLAY_WIDTH, (GPU_DISPLAY_HEIGHT*2.0) + (DS_DISPLAY_UNSCALED_GAP*_displayGap));
_isMinSizeNormal = YES;
_statusBarHeight = WINDOW_STATUS_BAR_HEIGHT;
_isUpdatingDisplayScaleValueOnly = NO;
_useMavericksFullScreen = IsOSXVersionSupported(10, 9, 0);
_willRestoreStatusBarFromFullScreen = NO;
_masterWindowScale = 1.0;
_masterWindowFrame = NSMakeRect(0.0, 0.0, GPU_DISPLAY_WIDTH, (GPU_DISPLAY_HEIGHT*2.0) + (DS_DISPLAY_UNSCALED_GAP*_displayGap));
_masterStatusBarState = NO;
[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(saveScreenshotAsFinish:)
@ -1420,7 +1422,7 @@ static std::unordered_map<NSScreen *, DisplayWindowController *> _screenMap; //
- (NSApplicationPresentationOptions)window:(NSWindow *)window willUseFullScreenPresentationOptions:(NSApplicationPresentationOptions)proposedOptions
{
[[NSApplication sharedApplication] setPresentationOptions:(NSApplicationPresentationHideDock)];
[[NSApplication sharedApplication] setPresentationOptions:NSApplicationPresentationHideDock];
NSApplicationPresentationOptions options = (NSApplicationPresentationHideDock |
NSApplicationPresentationAutoHideMenuBar |
@ -1436,19 +1438,44 @@ static std::unordered_map<NSScreen *, DisplayWindowController *> _screenMap; //
- (void)windowWillEnterFullScreen:(NSNotification *)notification
{
_willRestoreStatusBarFromFullScreen = [self isShowingStatusBar];
_masterWindowScale = [self displayScale];
_masterWindowFrame = [masterWindow frame];
_masterStatusBarState = [self isShowingStatusBar];
[self setIsShowingStatusBar:NO];
}
- (void)windowDidEnterFullScreen:(NSNotification *)notification
{
[self setAssignedScreen:[masterWindow screen]];
NSScreen *targetScreen = [masterWindow screen];
[self setAssignedScreen:targetScreen];
_screenMap[targetScreen] = self;
}
- (void)windowWillExitFullScreen:(NSNotification *)notification
{
_screenMap.erase([self assignedScreen]);
[self setAssignedScreen:nil];
[self setIsShowingStatusBar:_willRestoreStatusBarFromFullScreen];
[self setIsShowingStatusBar:_masterStatusBarState];
if (_screenMap.size() == 0)
{
[[NSApplication sharedApplication] setPresentationOptions:NSApplicationPresentationDefault];
}
}
- (BOOL) masterStatusBarState
{
return ([self assignedScreen] == nil) ? [self isShowingStatusBar] : _masterStatusBarState;
}
- (NSRect) masterWindowFrame
{
return ([self assignedScreen] == nil) ? [masterWindow frame] : _masterWindowFrame;
}
- (double) masterWindowScale
{
return ([self assignedScreen] == nil) ? [self displayScale] : _masterWindowScale;
}
#endif
@ -1529,7 +1556,6 @@ static std::unordered_map<NSScreen *, DisplayWindowController *> _screenMap; //
{
[theItem setLabel:NSSTRING_TITLE_ENABLE_HUD];
}
}
return enable;

View File

@ -699,7 +699,7 @@
if (isInFullScreenMode &&
([[NSScreen screens] indexOfObject:[[windowController window] screen]] == screenIndex))
{
[windowController enterFullScreen];
[windowController toggleFullScreenDisplay:self];
[[windowController window] makeKeyAndOrderFront:self];
[[windowController window] makeMainWindow];
}
@ -722,13 +722,13 @@
const BOOL isInFullScreenMode = ([windowController assignedScreen] != nil);
const NSUInteger screenIndex = [[NSScreen screens] indexOfObject:[[windowController masterWindow] screen]];
const NSRect windowFrame = [[windowController masterWindow] frame];
const NSRect windowFrame = [windowController masterWindowFrame];
NSString *windowFrameStr = [NSString stringWithFormat:@"%i %i %i %i",
(int)windowFrame.origin.x, (int)windowFrame.origin.y, (int)windowFrame.size.width, (int)windowFrame.size.height];
NSDictionary *windowProperties = [NSDictionary dictionaryWithObjectsAndKeys:
[NSNumber numberWithInteger:[windowController displayMode]], @"displayMode",
[NSNumber numberWithDouble:[windowController displayScale]], @"displayScale",
[NSNumber numberWithDouble:[windowController masterWindowScale]], @"displayScale",
[NSNumber numberWithDouble:[windowController displayRotation]], @"displayRotation",
[NSNumber numberWithInteger:[windowController displayOrientation]], @"displayOrientation",
[NSNumber numberWithInteger:[windowController displayOrder]], @"displayOrder",
@ -747,7 +747,7 @@
[NSNumber numberWithBool:[[windowController view] isHUDCPULoadAverageVisible]], @"hudShowCPULoadAverage",
[NSNumber numberWithBool:[[windowController view] isHUDRealTimeClockVisible]], @"hudShowRTC",
[NSNumber numberWithBool:[windowController isMinSizeNormal]], @"isMinSizeNormal",
[NSNumber numberWithBool:[windowController isShowingStatusBar]], @"isShowingStatusBar",
[NSNumber numberWithBool:[windowController masterStatusBarState]], @"isShowingStatusBar",
[NSNumber numberWithBool:isInFullScreenMode], @"isInFullScreenMode",
[NSNumber numberWithUnsignedInteger:screenIndex], @"screenIndex",
windowFrameStr, @"windowFrame",