From fd379ae7d3952cf423f87afbaed943d10e790432 Mon Sep 17 00:00:00 2001 From: Morten Johan Sorvig Date: Wed, 21 Mar 2012 14:58:20 +0100 Subject: [PATCH] Cocoa: Add window fullscreen button on OS X Lion. Use the heuristic that windows that are not an NSPanel and has the MaximizedButtonHint get the fullscreen button. Change-Id: I9a3520b7e4cd1833421d5d2f5b73da7edbfc3e74 Reviewed-by: Bradley T. Hughes --- src/plugins/platforms/cocoa/qcocoawindow.mm | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/plugins/platforms/cocoa/qcocoawindow.mm b/src/plugins/platforms/cocoa/qcocoawindow.mm index b4c4e31..b5e8ff2 100644 --- a/src/plugins/platforms/cocoa/qcocoawindow.mm +++ b/src/plugins/platforms/cocoa/qcocoawindow.mm @@ -382,6 +382,15 @@ NSWindow * QCocoaWindow::createNSWindow() defer:NO]; // Deferring window creation breaks OpenGL (the GL context is set up // before the window is shown and needs a proper window.). window->m_cocoaPlatformWindow = this; + +#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_7 + if (QSysInfo::QSysInfo::MacintoshVersion >= QSysInfo::MV_10_7) { + // All windows with the WindowMaximizeButtonHint set also get a full-screen button. + if (flags & Qt::WindowMaximizeButtonHint) + [window setCollectionBehavior:NSWindowCollectionBehaviorFullScreenPrimary]; + } +#endif + createdWindow = window; } return createdWindow; -- 2.7.4