summaryrefslogtreecommitdiffstats
path: root/src/plugins/platforms/windows/qwindowswindow.cpp
diff options
context:
space:
mode:
authorAndreas Holzammer <andreas.holzammer@kdab.com>2012-07-19 11:05:18 +0200
committerQt by Nokia <qt-info@nokia.com>2012-07-19 11:45:33 +0200
commita1db174ea98fab8669da498639895bac4c894baf (patch)
tree4e93304ba7d33db3ed8354076b7edcf5196250b9 /src/plugins/platforms/windows/qwindowswindow.cpp
parent2d504d01dc02f64b02fa1bcdbcbd496463378230 (diff)
Fix window state handling
There is no need to query each time the window state from windows, as we already know in which state it is. We are also getting state change notifications. This fixes issues under Windows CE. Change-Id: I69f4d5d504e2341555d9991c68e82beed2e8129c Reviewed-by: Joerg Bornemann <joerg.bornemann@nokia.com> Reviewed-by: Friedemann Kleint <Friedemann.Kleint@nokia.com>
Diffstat (limited to 'src/plugins/platforms/windows/qwindowswindow.cpp')
-rw-r--r--src/plugins/platforms/windows/qwindowswindow.cpp34
1 files changed, 9 insertions, 25 deletions
diff --git a/src/plugins/platforms/windows/qwindowswindow.cpp b/src/plugins/platforms/windows/qwindowswindow.cpp
index 184669d0a5..bc886f077f 100644
--- a/src/plugins/platforms/windows/qwindowswindow.cpp
+++ b/src/plugins/platforms/windows/qwindowswindow.cpp
@@ -981,8 +981,9 @@ void QWindowsWindow::handleResized(int wParam)
handleGeometryChange();
break;
case SIZE_RESTORED:
- if (m_windowState != Qt::WindowNoState)
- handleWindowStateChange(isFullScreen_sys() ? Qt::WindowFullScreen : Qt::WindowNoState);
+ bool fullScreen = isFullScreen_sys();
+ if ((m_windowState != Qt::WindowNoState) || fullScreen)
+ handleWindowStateChange(fullScreen ? Qt::WindowFullScreen : Qt::WindowNoState);
handleGeometryChange();
break;
}
@@ -1166,25 +1167,6 @@ Qt::WindowState QWindowsWindow::setWindowState(Qt::WindowState state)
return state;
}
-Qt::WindowState QWindowsWindow::windowState_sys() const
-{
- if (IsIconic(m_data.hwnd))
- return Qt::WindowMinimized;
- if (IsZoomed(m_data.hwnd))
- return Qt::WindowMaximized;
- if (isFullScreen_sys())
- return Qt::WindowFullScreen;
- return Qt::WindowNoState;
-}
-
-Qt::WindowStates QWindowsWindow::windowStates_sys() const
-{
- Qt::WindowStates result = windowState_sys();
- if (GetActiveWindow() == m_data.hwnd)
- result |= Qt::WindowActive;
- return result;
-}
-
bool QWindowsWindow::isFullScreen_sys() const
{
return geometry_sys() == window()->screen()->geometry();
@@ -1203,11 +1185,11 @@ bool QWindowsWindow::isFullScreen_sys() const
void QWindowsWindow::setWindowState_sys(Qt::WindowState newState)
{
- const Qt::WindowStates oldStates = windowStates_sys();
+ const Qt::WindowStates oldStates = m_windowState;
// Maintain the active flag as the platform window API does not
// use it.
Qt::WindowStates newStates = newState;
- if (oldStates & Qt::WindowActive)
+ if (isActive())
newStates |= Qt::WindowActive;
if (oldStates == newStates)
return;
@@ -1239,19 +1221,21 @@ 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.
-#ifndef Q_OS_WINCE // there is no style under wince
if (!m_savedStyle) {
m_savedStyle = style();
+#ifndef Q_OS_WINCE
if (oldStates & Qt::WindowMinimized) {
WINDOWPLACEMENT wp;
wp.length = sizeof(WINDOWPLACEMENT);
if (GetWindowPlacement(m_data.hwnd, &wp))
m_savedFrameGeometry = qrectFromRECT(wp.rcNormalPosition);
} else {
+#endif
m_savedFrameGeometry = frameGeometry_sys();
+#ifndef Q_OS_WINCE
}
- }
#endif
+ }
if (m_savedStyle & WS_SYSMENU)
newStyle |= WS_SYSMENU;
if (visible)