Windows QPA: Correct mistake when calculating minmaxinfo

Amends 46e9852a1d

The previous code would fail if the windows taskbars are placed
to the top or left on the screen. The mistake was missed because
Windows seems to adjust the window position automatically
in case the window handles WM_NCCALCSIZE and returns 0,
which was the case for me.

Task-number: QTBUG-51327
Pick-to: 5.15 6.2 6.3
Change-Id: I38ef974f7518be63a0bacf080f3359c219284078
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
This commit is contained in:
Viktor Arvidsson 2022-02-14 12:19:46 +01:00
parent c6958cbbd6
commit 7794421bea

View File

@ -2844,7 +2844,7 @@ void QWindowsWindow::getSizeHints(MINMAXINFO *mmi) const
mmi->ptMaxSize.x = availableGeometry.width();
// If you have the taskbar on top, or on the left you don't want it at (0,0):
QPoint availablePositionDiff = geometry.topLeft() - availableGeometry.topLeft();
QPoint availablePositionDiff = availableGeometry.topLeft() - geometry.topLeft();
mmi->ptMaxPosition.x = availablePositionDiff.x();
mmi->ptMaxPosition.y = availablePositionDiff.y();
if (!m_data.flags.testFlag(Qt::FramelessWindowHint)) {