From 225ada44ebb2f2ddc0efb29b1a93c09661653837 Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Wed, 26 Mar 2014 16:34:02 +0100 Subject: [PATCH] Windows: Suppress window state change to normal when going from maximized to fullscreen. Task-number: QTBUG-35166 Change-Id: Idcf2d2a5fd0dc59f35a287c106ca772d801550c0 Reviewed-by: Joerg Bornemann --- src/plugins/platforms/windows/qwindowswindow.cpp | 10 +++++++--- src/plugins/platforms/windows/qwindowswindow.h | 3 ++- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/src/plugins/platforms/windows/qwindowswindow.cpp b/src/plugins/platforms/windows/qwindowswindow.cpp index 3cf9481c17..ee9bf9936c 100644 --- a/src/plugins/platforms/windows/qwindowswindow.cpp +++ b/src/plugins/platforms/windows/qwindowswindow.cpp @@ -1359,9 +1359,10 @@ void QWindowsWindow::handleResized(int wParam) handleGeometryChange(); break; case SIZE_RESTORED: - bool fullScreen = isFullScreen_sys(); - if ((m_windowState != Qt::WindowNoState) || fullScreen) - handleWindowStateChange(fullScreen ? Qt::WindowFullScreen : Qt::WindowNoState); + if (isFullScreen_sys()) + handleWindowStateChange(Qt::WindowFullScreen); + else if (m_windowState != Qt::WindowNoState && !testFlag(MaximizeToFullScreen)) + handleWindowStateChange(Qt::WindowNoState); handleGeometryChange(); break; } @@ -1617,8 +1618,11 @@ void QWindowsWindow::setWindowState_sys(Qt::WindowState newState) if ((oldState == Qt::WindowMaximized) != (newState == Qt::WindowMaximized)) { if (visible && !(newState == Qt::WindowMinimized)) { setFlag(WithinMaximize); + if (newState == Qt::WindowFullScreen) + setFlag(MaximizeToFullScreen); ShowWindow(m_data.hwnd, (newState == Qt::WindowMaximized) ? SW_MAXIMIZE : SW_SHOWNOACTIVATE); clearFlag(WithinMaximize); + clearFlag(MaximizeToFullScreen); } } diff --git a/src/plugins/platforms/windows/qwindowswindow.h b/src/plugins/platforms/windows/qwindowswindow.h index ba0f22bb0a..cb437b76d0 100644 --- a/src/plugins/platforms/windows/qwindowswindow.h +++ b/src/plugins/platforms/windows/qwindowswindow.h @@ -153,7 +153,8 @@ public: AlertState = 0x8000, Exposed = 0x10000, WithinCreate = 0x20000, - WithinMaximize = 0x40000 + WithinMaximize = 0x40000, + MaximizeToFullScreen = 0x80000 }; QWindowsWindow(QWindow *window, const QWindowsWindowData &data);