From 1c2d95d1b7538fa91e2c07c163833da8e415ed91 Mon Sep 17 00:00:00 2001 From: Joerg Bornemann Date: Fri, 6 Jul 2012 14:58:45 +0200 Subject: QWindowsWindow: fix FullScreen state transition When putting the window into FullScreen state, we - must not override the saved style and geometry if it has been saved before. E.g. FullScreen -> Minimized -> FullScreen - have to retrieve the window's normal geometry if the window is currently minimized. E.g. Minimized -> FullScreen Task-number: QTBUG-26420 Change-Id: If4164feee5997682406701f0ea7018d7f6257d35 Reviewed-by: Friedemann Kleint --- src/plugins/platforms/windows/qwindowswindow.cpp | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/src/plugins/platforms/windows/qwindowswindow.cpp b/src/plugins/platforms/windows/qwindowswindow.cpp index d6d12865b4..4be743aaf0 100644 --- a/src/plugins/platforms/windows/qwindowswindow.cpp +++ b/src/plugins/platforms/windows/qwindowswindow.cpp @@ -1237,8 +1237,17 @@ void QWindowsWindow::setWindowState_sys(Qt::WindowState newState) // Save geometry and style to be restored when fullscreen // is turned off again, since on Windows, it is not a real // Window state but emulated by changing geometry and style. - m_savedStyle = style(); - m_savedFrameGeometry = frameGeometry_sys(); + if (!m_savedStyle) { + m_savedStyle = style(); + if (oldStates & Qt::WindowMinimized) { + WINDOWPLACEMENT wp; + wp.length = sizeof(WINDOWPLACEMENT); + if (GetWindowPlacement(m_data.hwnd, &wp)) + m_savedFrameGeometry = qrectFromRECT(wp.rcNormalPosition); + } else { + m_savedFrameGeometry = frameGeometry_sys(); + } + } if (m_savedStyle & WS_SYSMENU) newStyle |= WS_SYSMENU; if (visible) -- cgit v1.2.3