Windows QPA: Add convenient overload to query window frame
To be used in a later commit. As a drive-by, return early in the frameOnPrimaryScreen overload to avoid calling GetWindowLong in cases we don't need them. Pick-to: 6.3 6.2 Change-Id: Ia69f4acbbf3e044073f818f357e614d4c6680d21 Reviewed-by: André de la Rocha <andre.rocha@qt.io>bb10
parent
77d0ad6657
commit
540745e599
|
|
@ -1065,6 +1065,8 @@ QMargins QWindowsGeometryHint::frameOnPrimaryScreen(const QWindow *w, DWORD styl
|
|||
|
||||
QMargins QWindowsGeometryHint::frameOnPrimaryScreen(const QWindow *w, HWND hwnd)
|
||||
{
|
||||
if (!w->isTopLevel() || w->flags().testFlag(Qt::FramelessWindowHint))
|
||||
return {};
|
||||
return frameOnPrimaryScreen(w, DWORD(GetWindowLongPtr(hwnd, GWL_STYLE)),
|
||||
DWORD(GetWindowLongPtr(hwnd, GWL_EXSTYLE)));
|
||||
}
|
||||
|
|
@ -1101,6 +1103,14 @@ QMargins QWindowsGeometryHint::frame(const QWindow *w, HWND hwnd, DWORD style, D
|
|||
return frame(w, style, exStyle, dpi);
|
||||
}
|
||||
|
||||
QMargins QWindowsGeometryHint::frame(const QWindow *w, HWND hwnd)
|
||||
{
|
||||
if (!w->isTopLevel() || w->flags().testFlag(Qt::FramelessWindowHint))
|
||||
return {};
|
||||
return frame(w, hwnd, DWORD(GetWindowLongPtrW(hwnd, GWL_STYLE)),
|
||||
DWORD(GetWindowLongPtrW(hwnd, GWL_EXSTYLE)));
|
||||
}
|
||||
|
||||
// For newly created windows.
|
||||
QMargins QWindowsGeometryHint::frame(const QWindow *w, const QRect &geometry,
|
||||
DWORD style, DWORD exStyle)
|
||||
|
|
|
|||
|
|
@ -66,6 +66,7 @@ struct QWindowsGeometryHint
|
|||
static QMargins frameOnPrimaryScreen(const QWindow *w, HWND hwnd);
|
||||
static QMargins frame(const QWindow *w, DWORD style, DWORD exStyle, qreal dpi);
|
||||
static QMargins frame(const QWindow *w, HWND hwnd, DWORD style, DWORD exStyle);
|
||||
static QMargins frame(const QWindow *w, HWND hwnd);
|
||||
static QMargins frame(const QWindow *w, const QRect &geometry,
|
||||
DWORD style, DWORD exStyle);
|
||||
static bool handleCalculateSize(const QMargins &customMargins, const MSG &msg, LRESULT *result);
|
||||
|
|
|
|||
Loading…
Reference in New Issue