summaryrefslogtreecommitdiffstats
path: root/src/plugins/platforms/cocoa/qnsview.mm
diff options
context:
space:
mode:
authorShawn Rutledge <shawn.rutledge@digia.com>2014-03-21 14:31:23 +0100
committerThe Qt Project <gerrit-noreply@qt-project.org>2014-03-25 12:44:54 +0100
commita6bf169479df40f489fed549c893958f2519010e (patch)
treeeee487299c1a63c61bf2a2f6d7c1e3bc56e916f9 /src/plugins/platforms/cocoa/qnsview.mm
parentce8271ce051677a90e975db3a3b82b1e9c7261eb (diff)
OSX: make reported window state consistent with reality
You can't always get what you want: if you exit from fullscreen mode via showNormal, it might actually be maximized; or if you exit via showMaximized, it might actually be normal, if that's the mode the NSWindow remembers. We can't set the state, we can only toggle it. But now at least it's predictable, so that if you call showNormal or showMaximized twice, you will definitely get back to that state. Task-number: QTBUG-35166 Change-Id: I7422960a64f624920566c25763f5c3b03a684fb5 Reviewed-by: Gabriel de Dietrich <gabriel.dedietrich@digia.com>
Diffstat (limited to 'src/plugins/platforms/cocoa/qnsview.mm')
-rw-r--r--src/plugins/platforms/cocoa/qnsview.mm8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/plugins/platforms/cocoa/qnsview.mm b/src/plugins/platforms/cocoa/qnsview.mm
index 47081ab890..1197aa9148 100644
--- a/src/plugins/platforms/cocoa/qnsview.mm
+++ b/src/plugins/platforms/cocoa/qnsview.mm
@@ -281,6 +281,12 @@ static QTouchDevice *touchDevice = 0;
- (void)notifyWindowStateChanged:(Qt::WindowState)newState
{
+ // If the window was maximized, then fullscreen, then tried to go directly to "normal" state,
+ // this notification will say that it is "normal", but it will still look maximized, and
+ // if you called performZoom it would actually take it back to "normal".
+ // So we should say that it is maximized because it actually is.
+ if (newState == Qt::WindowNoState && m_platformWindow->m_effectivelyMaximized)
+ newState = Qt::WindowMaximized;
QWindowSystemInterface::handleWindowStateChanged(m_window, newState);
// We want to read the window state back from the window,
// but the event we just sent may be asynchronous.
@@ -346,6 +352,8 @@ static QTouchDevice *touchDevice = 0;
- (void)notifyWindowWillZoom:(BOOL)willZoom
{
Qt::WindowState newState = willZoom ? Qt::WindowMaximized : Qt::WindowNoState;
+ if (!willZoom)
+ m_platformWindow->m_effectivelyMaximized = false;
[self notifyWindowStateChanged:newState];
}