Skip to content

Commit

Permalink
Partial fix for view getting cut off when entering fullscreen with to…
Browse files Browse the repository at this point in the history
…olbar enabled.
  • Loading branch information
alinebee committed Nov 29, 2014
1 parent b5f9483 commit 4453cd2
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions Boxer/DOS window/BXDOSWindowController.m
Original file line number Diff line number Diff line change
Expand Up @@ -1324,7 +1324,7 @@ - (BOOL) isResizing
return _resizingProgrammatically || self.inputView.inLiveResize;
}

//Warn the emulator to prepare for emulation cutout when resizing the window
//Warn the emulator to prepare for emulation cutout when resizing the rendered view
- (void) windowWillStartLiveResize: (NSNotification *)notification
{
[[NSNotificationCenter defaultCenter] postNotificationName: BXWillBeginInterruptionNotification object: self];
Expand All @@ -1337,13 +1337,13 @@ - (void) windowDidEndLiveResize: (NSNotification *)notification
}


//Snap to multiples of the base render size as we scale
//Snap to multiples of the base render size as we scale, and ensure the aspect ratio conforms to that of the window.
- (NSSize) windowWillResize: (NSWindow *)theWindow toSize: (NSSize) proposedFrameSize
{
NSInteger snapThreshold = BXWindowSnapThreshold;

NSSize snapIncrement = self.renderingView.currentFrame.scaledResolution;
CGFloat aspectRatio = aspectRatioOfSize(theWindow.contentAspectRatio);
CGFloat aspectRatio = aspectRatioOfSize(self.renderingView.frame.size);

NSRect proposedFrame = NSMakeRect(0, 0, proposedFrameSize.width, proposedFrameSize.height);
NSRect renderFrame = [theWindow contentRectForFrameRect: proposedFrame];
Expand Down Expand Up @@ -1418,6 +1418,9 @@ - (void) windowWillEnterFullScreen: (NSNotification *)notification

BXDOSWindow *window = (BXDOSWindow *)self.window;
_renderingViewSizeBeforeFullScreen = window.actualContentViewSize;

//Disable aspect ratio clamping
window.resizeIncrements = NSMakeSize(1.0, 1.0);
}

- (void) windowDidEnterFullScreen: (NSNotification *)notification
Expand All @@ -1436,6 +1439,8 @@ - (void) windowDidFailToEnterFullScreen: (NSWindow *)window

self.renderingView.managesViewport = NO;
[self.inputController setMouseLocked: NO force: YES];

window.contentAspectRatio = _renderingViewSizeBeforeFullScreen;
}

- (void) windowWillExitFullScreen: (NSNotification *)notification
Expand Down Expand Up @@ -1466,6 +1471,8 @@ - (void) windowDidExitFullScreen: (NSNotification *)notification

NSNotificationCenter *center = [NSNotificationCenter defaultCenter];
[center postNotificationName: BXSessionDidExitFullScreenNotification object: self.document];

self.window.contentAspectRatio = _renderingViewSizeBeforeFullScreen;
}

- (void) windowDidFailToExitFullScreen: (NSWindow *)window
Expand Down

0 comments on commit 4453cd2

Please sign in to comment.