Windows QPA: Suppress bogus resize events when using native menus
Account for the (not yet created) native menu height when handling
the initial resize message.
Complements 7849aa6e96.
Task-number: QTBUG-65917
Task-number: QTBUG-55967
Change-Id: I65c75d796634ecf1a90a72fef8ff3e6e89de11c4
Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
Reviewed-by: J-P Nurmi <jpnurmi@qt.io>
bb10
parent
a966991b3a
commit
95a08a711e
|
|
@ -996,8 +996,10 @@ bool QWindowsContext::windowsProc(HWND hwnd, UINT message,
|
|||
case QtWindows::QuerySizeHints:
|
||||
d->m_creationContext->applyToMinMaxInfo(reinterpret_cast<MINMAXINFO *>(lParam));
|
||||
return true;
|
||||
case QtWindows::ResizeEvent:
|
||||
d->m_creationContext->obtainedGeometry.setSize(QSize(GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam)));
|
||||
case QtWindows::ResizeEvent: {
|
||||
const QSize size(GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam) - d->m_creationContext->menuHeight);
|
||||
d->m_creationContext->obtainedGeometry.setSize(size);
|
||||
}
|
||||
return true;
|
||||
case QtWindows::MoveEvent:
|
||||
d->m_creationContext->obtainedGeometry.moveTo(GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam));
|
||||
|
|
|
|||
|
|
@ -1027,8 +1027,10 @@ QWindowCreationContext::QWindowCreationContext(const QWindow *w,
|
|||
const QMargins effectiveMargins = margins + customMargins;
|
||||
frameWidth = effectiveMargins.left() + geometry.width() + effectiveMargins.right();
|
||||
frameHeight = effectiveMargins.top() + geometry.height() + effectiveMargins.bottom();
|
||||
if (QWindowsMenuBar::menuBarOf(w) != nullptr)
|
||||
frameHeight += GetSystemMetrics(SM_CYMENU);
|
||||
if (QWindowsMenuBar::menuBarOf(w) != nullptr) {
|
||||
menuHeight = GetSystemMetrics(SM_CYMENU);
|
||||
frameHeight += menuHeight;
|
||||
}
|
||||
const bool isDefaultPosition = !frameX && !frameY && w->isTopLevel();
|
||||
if (!QWindowsGeometryHint::positionIncludesFrame(w) && !isDefaultPosition) {
|
||||
frameX -= effectiveMargins.left();
|
||||
|
|
|
|||
|
|
@ -101,6 +101,7 @@ struct QWindowCreationContext
|
|||
int frameY = CW_USEDEFAULT;
|
||||
int frameWidth = CW_USEDEFAULT;
|
||||
int frameHeight = CW_USEDEFAULT;
|
||||
int menuHeight = 0;
|
||||
};
|
||||
|
||||
struct QWindowsWindowData
|
||||
|
|
|
|||
Loading…
Reference in New Issue