Windows QPA: don't take dpi rounding policy into account when fullscreen
With some HighDpiScaleFactorRoundingPolicy, going fullscreen can end up not filling the whole screen. In this case, ignore the rounding (only for the window size, not its content). Fixes: QTBUG-115954 Pick-to: 6.6 Change-Id: Ie87196358ef28dbe2fcbc180b1740ed9f784b4a0 Reviewed-by: Oliver Wolff <oliver.wolff@qt.io> (cherry picked from commit da473f3a80798d84d0f1bd9175158024a548ec68) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
This commit is contained in:
parent
2a18c00c2a
commit
073340a6d8
@ -2579,26 +2579,26 @@ void QWindowsWindow::setWindowState_sys(Qt::WindowStates newState)
|
||||
if (testFlag(HasBorderInFullScreen))
|
||||
newStyle |= WS_BORDER;
|
||||
setStyle(newStyle);
|
||||
// Use geometry of QWindow::screen() within creation or the virtual screen the
|
||||
// window is in (QTBUG-31166, QTBUG-30724).
|
||||
const QScreen *screen = window()->screen();
|
||||
if (!screen)
|
||||
screen = QGuiApplication::primaryScreen();
|
||||
const QRect r = screen ? QHighDpi::toNativePixels(screen->geometry(), window()) : m_savedFrameGeometry;
|
||||
|
||||
const HMONITOR monitor = MonitorFromWindow(m_data.hwnd, MONITOR_DEFAULTTONEAREST);
|
||||
MONITORINFO monitorInfo = {};
|
||||
monitorInfo.cbSize = sizeof(MONITORINFO);
|
||||
GetMonitorInfoW(monitor, &monitorInfo);
|
||||
const QRect screenGeometry(monitorInfo.rcMonitor.left, monitorInfo.rcMonitor.top,
|
||||
monitorInfo.rcMonitor.right - monitorInfo.rcMonitor.left,
|
||||
monitorInfo.rcMonitor.bottom - monitorInfo.rcMonitor.top);
|
||||
if (newState & Qt::WindowMinimized) {
|
||||
setMinimizedGeometry(m_data.hwnd, r);
|
||||
setMinimizedGeometry(m_data.hwnd, screenGeometry);
|
||||
if (stateChange & Qt::WindowMaximized)
|
||||
setRestoreMaximizedFlag(m_data.hwnd, newState & Qt::WindowMaximized);
|
||||
} else {
|
||||
const UINT swpf = SWP_FRAMECHANGED | SWP_NOACTIVATE;
|
||||
const bool wasSync = testFlag(SynchronousGeometryChangeEvent);
|
||||
setFlag(SynchronousGeometryChangeEvent);
|
||||
SetWindowPos(m_data.hwnd, HWND_TOP, r.left(), r.top(), r.width(), r.height(), swpf);
|
||||
SetWindowPos(m_data.hwnd, HWND_TOP, screenGeometry.left(), screenGeometry.top(), screenGeometry.width(), screenGeometry.height(), swpf);
|
||||
if (!wasSync)
|
||||
clearFlag(SynchronousGeometryChangeEvent);
|
||||
clearFlag(MaximizeToFullScreen);
|
||||
QWindowSystemInterface::handleGeometryChange(window(), r);
|
||||
QWindowSystemInterface::handleGeometryChange(window(), screenGeometry);
|
||||
QWindowSystemInterface::flushWindowSystemEvents(QEventLoop::ExcludeUserInputEvents);
|
||||
}
|
||||
} else {
|
||||
|
Loading…
x
Reference in New Issue
Block a user