From 9d3cd2268ce3beafcf6fa886bb70d8463260d602 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tor=20Arne=20Vestb=C3=B8?= Date: Thu, 6 Jul 2017 17:03:41 +0200 Subject: [PATCH] macOS: Account for fullscreen geometry bug in AppKit on OS X 10.10 Task-number: QTBUG-61776 Change-Id: Ifac502cf422088eafe9211d759f2f5cd9769d0d3 Reviewed-by: Gabriel de Dietrich --- src/plugins/platforms/cocoa/qnswindowdelegate.mm | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/src/plugins/platforms/cocoa/qnswindowdelegate.mm b/src/plugins/platforms/cocoa/qnswindowdelegate.mm index ce74aa9973..a18fe693fa 100644 --- a/src/plugins/platforms/cocoa/qnswindowdelegate.mm +++ b/src/plugins/platforms/cocoa/qnswindowdelegate.mm @@ -78,6 +78,21 @@ return m_cocoaWindow->screen()->availableGeometry().toCGRect(); } +#if QT_MACOS_DEPLOYMENT_TARGET_BELOW(__MAC_10_11) +/* + AppKit on OS X 10.10 wrongly calls windowWillUseStandardFrame:defaultFrame + from -[NSWindow _frameForFullScreenMode] when going into fullscreen, resulting + in black bars on top and bottom of the window. By implementing the following + method, AppKit will choose that instead, and resolve the right fullscreen + geometry. +*/ +- (NSSize)window:(NSWindow *)window willUseFullScreenContentSize:(NSSize)proposedSize +{ + Q_ASSERT(NSEqualSizes(m_cocoaWindow->screen()->geometry().size().toCGSize(), proposedSize)); + return proposedSize; +} +#endif + - (BOOL)window:(NSWindow *)window shouldPopUpDocumentPathMenu:(NSMenu *)menu { Q_UNUSED(window);