summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorZeno Albisser <zeno.albisser@digia.com>2013-11-27 13:34:55 +0100
committerThe Qt Project <gerrit-noreply@qt-project.org>2013-11-27 15:10:36 +0100
commitca73f493a1c902bb4ddf5ce21a24c1ca2a29ba87 (patch)
tree72b542479507e6c3feae47044a1a8838e24568ad /src
parent95ffd606f8a632a8a963486ce340e7e1b707be0a (diff)
Allow resetting Qt::WindowFullscreenButtonHint
Currently Qt::WindowFulscreenButtonHint is only respected on window creation. But flags can also be adjusted later on. Further setWindowShadow can be removed from within createNSWindow, as it operates on a Nil object in that case. It is however called by recreateWindow / setWindowFlags subsequently. Change-Id: I507d6fde5ad2f0ee5b9db322325ede99b70e151e Reviewed-by: Gabriel de Dietrich <gabriel.dedietrich@digia.com>
Diffstat (limited to 'src')
-rw-r--r--src/plugins/platforms/cocoa/qcocoawindow.mm24
1 files changed, 14 insertions, 10 deletions
diff --git a/src/plugins/platforms/cocoa/qcocoawindow.mm b/src/plugins/platforms/cocoa/qcocoawindow.mm
index 4da47f4f1f..b5b9cec2be 100644
--- a/src/plugins/platforms/cocoa/qcocoawindow.mm
+++ b/src/plugins/platforms/cocoa/qcocoawindow.mm
@@ -522,6 +522,20 @@ void QCocoaWindow::setWindowFlags(Qt::WindowFlags flags)
if (!(styleMask & NSBorderlessWindowMask)) {
setWindowTitle(window()->title());
}
+
+#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_7
+ if (QSysInfo::QSysInfo::MacintoshVersion >= QSysInfo::MV_10_7) {
+ Qt::WindowType type = window()->type();
+ if ((type & Qt::Popup) != Qt::Popup && (type & Qt::Dialog) != Qt::Dialog) {
+ NSWindowCollectionBehavior behavior = [m_nsWindow collectionBehavior];
+ if (flags & Qt::WindowFullscreenButtonHint)
+ behavior |= NSWindowCollectionBehaviorFullScreenPrimary;
+ else
+ behavior &= ~NSWindowCollectionBehaviorFullScreenPrimary;
+ [m_nsWindow setCollectionBehavior:behavior];
+ }
+ }
+#endif
}
m_windowFlags = flags;
@@ -871,8 +885,6 @@ NSWindow * QCocoaWindow::createNSWindow()
// before the window is shown and needs a proper window.).
if ((type & Qt::Popup) == Qt::Popup)
[window setHasShadow:YES];
- else
- setWindowShadow(flags);
[window setHidesOnDeactivate: NO];
#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_7
@@ -894,14 +906,6 @@ 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;
- setWindowShadow(flags);
-
-#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_7
- if (QSysInfo::QSysInfo::MacintoshVersion >= QSysInfo::MV_10_7) {
- if (flags & Qt::WindowFullscreenButtonHint)
- [window setCollectionBehavior:NSWindowCollectionBehaviorFullScreenPrimary];
- }
-#endif
createdWindow = window;
}