Windows QPA: Make frameless window respect WORKAREA
Windows that have only set the WS_POPUP style do not take the WORKAREA into account and maximize to fullscreen geometry. This patch maximizes a WS_POPUP window to the size of the current working area, which can be smaller than the screen geometry. Fixes: QTBUG-129791 Fixes: QTBUG-130865 Pick-to: 6.5 Change-Id: I4c5beb0cd69c7ea4c585785a579a9d66bab12cc6 Reviewed-by: Oliver Wolff <oliver.wolff@qt.io> (cherry picked from commit 90be6609bdfc14df6aec52cbbba6adb4a610301e) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
This commit is contained in:
parent
27ae8dbab4
commit
2c1a23f3c8
@ -2736,8 +2736,24 @@ void QWindowsWindow::setWindowState_sys(Qt::WindowStates newState)
|
|||||||
setFlag(WithinMaximize);
|
setFlag(WithinMaximize);
|
||||||
if (newState & Qt::WindowFullScreen)
|
if (newState & Qt::WindowFullScreen)
|
||||||
setFlag(MaximizeToFullScreen);
|
setFlag(MaximizeToFullScreen);
|
||||||
ShowWindow(m_data.hwnd,
|
if (m_data.flags & Qt::FramelessWindowHint) {
|
||||||
(newState & Qt::WindowMaximized) ? SW_MAXIMIZE : SW_SHOWNOACTIVATE);
|
if (newState == Qt::WindowNoState) {
|
||||||
|
const QRect &rect = m_savedFrameGeometry;
|
||||||
|
MoveWindow(m_data.hwnd, rect.x(), rect.y(), rect.width(), rect.height(), true);
|
||||||
|
} else {
|
||||||
|
HMONITOR monitor = MonitorFromWindow(m_data.hwnd, MONITOR_DEFAULTTONEAREST);
|
||||||
|
MONITORINFO monitorInfo = {};
|
||||||
|
monitorInfo.cbSize = sizeof(MONITORINFO);
|
||||||
|
GetMonitorInfo(monitor, &monitorInfo);
|
||||||
|
const RECT &rect = monitorInfo.rcWork;
|
||||||
|
m_savedFrameGeometry = geometry();
|
||||||
|
MoveWindow(m_data.hwnd, rect.left, rect.top,
|
||||||
|
rect.right - rect.left, rect.bottom - rect.top, true);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
ShowWindow(m_data.hwnd,
|
||||||
|
(newState & Qt::WindowMaximized) ? SW_MAXIMIZE : SW_SHOWNOACTIVATE);
|
||||||
|
}
|
||||||
clearFlag(WithinMaximize);
|
clearFlag(WithinMaximize);
|
||||||
clearFlag(MaximizeToFullScreen);
|
clearFlag(MaximizeToFullScreen);
|
||||||
} else if (visible && (oldState & newState & Qt::WindowMinimized)) {
|
} else if (visible && (oldState & newState & Qt::WindowMinimized)) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user