summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorMorten Johan Sorvig <morten.sorvig@nokia.com>2012-04-26 12:29:01 +0200
committerQt by Nokia <qt-info@nokia.com>2012-04-30 14:01:22 +0200
commit4e59daf34f57dffb1caddb46799ea4e866a640ff (patch)
tree36ad4da12aff41134c85d1ea90af6e83c1adef28 /src
parentb7cd9647618d63162a0c923437d86813fa90e11b (diff)
Cocoa: Fix beep-on-show for Creator menus.
Maintain a current window state variable in QCocoaWindnow and use it when setting the new window state on the NSWindow. The NSWindow state accessors can apparently not be trusted, in particular isZoomed always returns true for the Creator popup menu. Change-Id: I78f13de251f3730752813bba17459011f8558aee Reviewed-by: James Turner <james.turner@kdab.com> Reviewed-by: Christoph Schleifenbaum <christoph.schleifenbaum@kdab.com> Reviewed-by: Bradley T. Hughes <bradley.hughes@nokia.com>
Diffstat (limited to 'src')
-rw-r--r--src/plugins/platforms/cocoa/qcocoawindow.h1
-rw-r--r--src/plugins/platforms/cocoa/qcocoawindow.mm50
2 files changed, 21 insertions, 30 deletions
diff --git a/src/plugins/platforms/cocoa/qcocoawindow.h b/src/plugins/platforms/cocoa/qcocoawindow.h
index cbcdbcbded..d08bbe79ce 100644
--- a/src/plugins/platforms/cocoa/qcocoawindow.h
+++ b/src/plugins/platforms/cocoa/qcocoawindow.h
@@ -140,6 +140,7 @@ public: // for QNSView
QNSView *m_contentView;
NSWindow *m_nsWindow;
Qt::WindowFlags m_windowFlags;
+ Qt::WindowState m_synchedWindowState;
QPointer<QWindow> m_activePopupWindow;
bool m_inConstructor;
diff --git a/src/plugins/platforms/cocoa/qcocoawindow.mm b/src/plugins/platforms/cocoa/qcocoawindow.mm
index 32c87e752a..83b6534b7c 100644
--- a/src/plugins/platforms/cocoa/qcocoawindow.mm
+++ b/src/plugins/platforms/cocoa/qcocoawindow.mm
@@ -97,6 +97,7 @@
QCocoaWindow::QCocoaWindow(QWindow *tlw)
: QPlatformWindow(tlw)
, m_nsWindow(0)
+ , m_synchedWindowState(Qt::WindowActive)
, m_inConstructor(true)
, m_glContext(0)
, m_hasModalSession(false)
@@ -543,41 +544,30 @@ void QCocoaWindow::syncWindowState(Qt::WindowState newState)
if (!m_nsWindow)
return;
- switch (newState) {
- case Qt::WindowMinimized:
- [m_nsWindow performMiniaturize : m_nsWindow];
- break;
- case Qt::WindowMaximized:
- [m_nsWindow performZoom : m_nsWindow];
- break;
- case Qt::WindowFullScreen:
-#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_7
- if (QSysInfo::QSysInfo::MacintoshVersion >= QSysInfo::MV_10_7) {
- [m_nsWindow toggleFullScreen : m_nsWindow];
- } else {
- qWarning("Not implemented: setWindowState WindowFullScreen");
- }
-#endif
- break;
-
- default:
- // Undo current states
- if ([m_nsWindow isMiniaturized])
- [m_nsWindow deminiaturize : m_nsWindow];
+ if ((m_synchedWindowState & Qt::WindowMaximized) != (newState & Qt::WindowMaximized)) {
+ [m_nsWindow performZoom : m_nsWindow]; // toggles
+ }
- if ([m_nsWindow isZoomed])
- [m_nsWindow performZoom : m_nsWindow]; // toggles
+ if ((m_synchedWindowState & Qt::WindowMinimized) != (newState & Qt::WindowMinimized)) {
+ if (newState & Qt::WindowMinimized) {
+ [m_nsWindow performMiniaturize : m_nsWindow];
+ } else {
+ [m_nsWindow deminiaturize : m_nsWindow];
+ }
+ }
+ if ((m_synchedWindowState & Qt::WindowFullScreen) != (newState & Qt::WindowFullScreen)) {
#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_7
- if (QSysInfo::QSysInfo::MacintoshVersion >= QSysInfo::MV_10_7) {
- if (window()->windowState() & Qt::WindowFullScreen)
- [m_nsWindow toggleFullScreen : m_nsWindow];
- } else {
- qWarning("Not implemented: setWindowState WindowFullScreen");
- }
+ if (QSysInfo::QSysInfo::MacintoshVersion >= QSysInfo::MV_10_7) {
+ [m_nsWindow toggleFullScreen : m_nsWindow];
+ } else {
+ // TODO: "normal" fullscreen
+ }
#endif
- break;
}
+
+ // New state is now the current synched state
+ m_synchedWindowState = newState;
}
bool QCocoaWindow::setWindowModified(bool modified)