Windows QPA: More fine-grained suppression of geometry/state change events

When switching windows from fullscreen to maximized, move and resize events are
triggered when changing the window decorations, ending up in
QWindowsWindow::handleResized(), QWindowsWindow::handleMoved() which then may
call handleGeometryChange().

Change 917ef57874 blocks the emission of events
depending on flag WithinSetStyle from handleGeometryChange() for Windows CE.
This has issues which become visible when switching from fullscreen to
maximized repeatedly:

- State change events are still sent from QWindowsWindow::handleResized(),
  QWindowsWindow::handleMoved() when changing the window style programmatically
  causing the maximized state to be lost after a few cycles(QTBUG-53368).
- Geometry change events are actually needed on the desktop for proper redrawing
  (QTBUG-53577).

Make this more fine-grained by suppressing all state changed events while
WithinSetStyle is set and allowing geometry changes.
Amends 917ef57874.

Task-number: QTBUG-53368
Task-number: QTBUG-53577
Change-Id: Icc8dc935cfc29b314aab2d6fac02c97174c79c3e
Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
bb10
Friedemann Kleint 2016-05-25 11:51:17 +02:00
parent dfa8894bd3
commit 0c415793b9
1 changed files with 11 additions and 10 deletions

View File

@ -1488,18 +1488,22 @@ void QWindowsWindow::handleResized(int wParam)
case SIZE_MAXHIDE: // Some other window affected.
case SIZE_MAXSHOW:
return;
case SIZE_MINIMIZED:
handleWindowStateChange(Qt::WindowMinimized);
case SIZE_MINIMIZED: // QTBUG-53577, prevent state change events during programmatic state change
if (!testFlag(WithinSetStyle))
handleWindowStateChange(Qt::WindowMinimized);
return;
case SIZE_MAXIMIZED:
handleWindowStateChange(Qt::WindowMaximized);
if (!testFlag(WithinSetStyle))
handleWindowStateChange(Qt::WindowMaximized);
handleGeometryChange();
break;
case SIZE_RESTORED:
if (isFullScreen_sys())
handleWindowStateChange(Qt::WindowFullScreen);
else if (m_windowState != Qt::WindowNoState && !testFlag(MaximizeToFullScreen))
handleWindowStateChange(Qt::WindowNoState);
if (!testFlag(WithinSetStyle)) {
if (isFullScreen_sys())
handleWindowStateChange(Qt::WindowFullScreen);
else if (m_windowState != Qt::WindowNoState && !testFlag(MaximizeToFullScreen))
handleWindowStateChange(Qt::WindowNoState);
}
handleGeometryChange();
break;
}
@ -1507,9 +1511,6 @@ void QWindowsWindow::handleResized(int wParam)
void QWindowsWindow::handleGeometryChange()
{
//Prevent recursive resizes for Windows CE
if (testFlag(WithinSetStyle))
return;
const QRect previousGeometry = m_data.geometry;
m_data.geometry = geometry_sys();
QPlatformWindow::setGeometry(m_data.geometry);