Full-screen mode broken after upgrading to Yosemite
Full-screen mode broken after upgrading to Yosemite
- Subject: Full-screen mode broken after upgrading to Yosemite
- From: Daryle Walker <email@hidden>
- Date: Fri, 13 Mar 2015 17:29:38 -0400
[My first attempted post was 3KB too big.]
I restarted work on my web browser project from a few months ago. Since then, I upgraded my MacBook Air from Mavericks to Yosemite, and Xcode from 6.0 to 6.1.1 (and, as of yesterday, 6.2). The deployment level is still (implicitly) 10.9, but the SDK was automatically upgraded to 10.10.
My main browser window supports full-screen and optimized zoom. In Yosemite, those two functions share the green titlebar button. When I activate full-screen mode, with either the green button or the menu item, the window freezes without any visual change. The window can’t be moved or shifted out of the way upon switching apps. (The window doesn’t corrupt other Spaces, though.) The rest of the app still works, but new windows are always beneath the frozen one.
When trying full-screen, this appears on the Xcode debug log:
> 2015-03-13 17:17:18.850 Prairie[7319:1920249] *** Assertion failure in -[PrBrowserController windowWillUseStandardFrame:defaultFrame:], /Users/.../Prairie/PrBrowserController.m:297
> 2015-03-13 17:17:18.856 Prairie[7319:1920249] An uncaught exception was raised
> 2015-03-13 17:17:18.857 Prairie[7319:1920249] Standard web-browser window size too tall.
> 2015-03-13 17:17:18.894 Prairie[7319:1920249] (
> 0 CoreFoundation 0x00007fff8417d66c __exceptionPreprocess + 172
> 1 libobjc.A.dylib 0x00007fff896c076e objc_exception_throw + 43
> 2 CoreFoundation 0x00007fff8417d44a +[NSException raise:format:arguments:] + 106
> 3 Foundation 0x00007fff9062d3a9 -[NSAssertionHandler handleFailureInMethod:object:file:lineNumber:description:] + 195
> 4 Prairie 0x00000001000118f1 -[PrBrowserController windowWillUseStandardFrame:defaultFrame:] + 2545
> 5 AppKit 0x00007fff90f60bf5 -[NSWindow _frameForFullScreenMode] + 735
> 6 AppKit 0x00007fff914fa0a4 __62-[_NSWindowFullScreenTransition setWindowToHaveFullScreenSize]_block_invoke + 71
> 7 AppKit 0x00007fff90d6f6b3 NSPerformWithScreenUpdatesDisabled + 65
> 8 AppKit 0x00007fff914fa057 -[_NSWindowFullScreenTransition setWindowToHaveFullScreenSize] + 73
> 9 AppKit 0x00007fff90f0ba6e -[_NSFullScreenTransition enterFullScreenTransitionWithOptions:animated:activatingIt:] + 1059
> 10 AppKit 0x00007fff90f0aded -[NSWindow _enterFullScreenMode:animating:activating:] + 294
> 11 libsystem_trace.dylib 0x00007fff843b2cd7 _os_activity_initiate + 75
> 12 AppKit 0x00007fff90e45b71 -[NSApplication sendAction:to:from:] + 452
> 13 AppKit 0x00007fff90e5fcbe -[NSMenuItem _corePerformAction] + 382
> 14 AppKit 0x00007fff90e5f9dc -[NSCarbonMenuImpl performActionWithHighlightingForItemAtIndex:] + 114
> 15 libsystem_trace.dylib 0x00007fff843b2cd7 _os_activity_initiate + 75
> 16 AppKit 0x00007fff90ead4e0 -[NSMenu performActionForItemAtIndex:] + 131
> ...
> )
Why is my optimized-zoom sizing method called during a full-screen adjustment?
After quitting and restarting the app, the resume feature remembers the window’s state and starts with a broken view. The full-screen is black with the window’s content in its pre-full-screen size in the middle. The title bar and toolbar areas are there in the inner window but blank. The top of the screen has the toolbar with buttons. Going to the top of the screen reveals the title bar with the red/yellow/green buttons, but the title string is off center, keeping the same spacing it had pre-full-screen. Undoing full-screen mode works fine, though!
Here’s my zoom sizing method:
> - (NSRect)windowWillUseStandardFrame:(NSWindow *)window defaultFrame:(NSRect)newFrame {
> NSParameterAssert(self.window == window);
>
> // Based on the web content, get the maximum desired width and height.
> NSView<WebDocumentView> * const view = self.webView.mainFrame.frameView.documentView;
> NSSize const desiredContentSize = NSMakeSize(NSWidth(view.frame), NSHeight(view.frame) + ((CGFloat)!!self.isLoadingBarVisible * PrLoadingBarHeight) + ((CGFloat)!!self.isStatusBarVisible * PrStatusBarHeight));
>
> // Adjust that desired size to what's actually available.
> NSRect frame = [window contentRectForFrameRect:newFrame];
>
> frame.size.width = MIN(desiredContentSize.width, frame.size.width);
> frame.size.height = MIN(desiredContentSize.height, frame.size.height);
>
> // Adjust to the window's size bounds.
> frame = [window frameRectForContentRect:frame];
> frame.size.width = MAX(window.minSize.width, frame.size.width);
> frame.size.height = MAX(window.minSize.height, frame.size.height);
> NSAssert(frame.size.width <= newFrame.size.width, @"Standard web-browser window size too wide.");
> NSAssert(frame.size.height <= newFrame.size.height, @"Standard web-browser window size too tall.");
>
> // Try minimizing the amount the window moves from its current spot on the chosen screen.
> NSRect const oldOverlapFrame = NSIntersectionRect(window.frame, newFrame);
>
> frame = NSOffsetRect(frame, NSMidX(oldOverlapFrame) - NSMidX(frame), NSMidY(oldOverlapFrame) - NSMidY(frame));
> if (NSMaxX(frame) > NSMaxX(newFrame)) {
> frame = NSOffsetRect(frame, NSMaxX(newFrame) - NSMaxX(frame), 0.0);
> } else if (NSMinX(frame) < NSMinX(newFrame)) {
> frame = NSOffsetRect(frame, NSMinX(newFrame) - NSMinX(frame), 0.0);
> }
> if (NSMaxY(frame) > NSMaxY(newFrame)) {
> frame = NSOffsetRect(frame, 0.0, NSMaxY(newFrame) - NSMaxY(frame));
> } else if (NSMinY(frame) < NSMinY(newFrame)) {
> frame = NSOffsetRect(frame, 0.0, NSMinY(newFrame) - NSMinY(frame));
> }
>
> return frame;
> }
—
Daryle Walker
Mac, Internet, and Video Game Junkie
darylew AT mac DOT com
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden