diff options
author | Friedemann Kleint <Friedemann.Kleint@qt.io> | 2019-05-06 15:06:52 +0200 |
---|---|---|
committer | Friedemann Kleint <Friedemann.Kleint@qt.io> | 2019-05-13 14:46:48 +0000 |
commit | d2fd9b1b9818b3ec88487967e010f66e92952f55 (patch) | |
tree | 9211603087be7fb6028e8b254783ea9d9df9f7aa /src/plugins/platforms/windows/qwindowscontext.h | |
parent | 3af7b279177f7fb092f0e0fb9ffc8e8d846ed774 (diff) |
Windows QPA: Fix window frame calculation in multi-monitor setups
When introducing EnableNonClientDpiScaling() for QTBUG-53255, the window
frame calculation was not adapted. That is, window frames were calculated
from the style for the primary screen only, causing
- minimum size constraints not being calculated correctly for applications
on secondary screens when populating the MINMAXINFO structure.
- warnings about not being able to apply a geometry when moving fixed
size windows across screens.
The calculation of the frames for propagating size hints is also no longer
required after 3035400f36731c400adb9204b94e9afe346a71b7, which retrieves
them from the WM_NCCALCSIZE message; QWindowsWindow::fullFrameMargins() can
be used instead.
For newly created windows, use the newly added AdjustWindowRectExForDpi()
function to calculate the initial frame size.
Change QWindowsGeometryHint from a class to a collection of static functions
and add overloads to calculate the frame.
In checkForScreenChanged(), update the margins until WM_NCCALCSIZE is
received.
Task-number: QTBUG-67777
Task-number: QTBUG-65580
Task-number: QTBUG-53255
Change-Id: Iff2d382b2b316adec6c1a0622ae8015dba6de371
Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
Reviewed-by: Andre de la Rocha <andre.rocha@qt.io>
Diffstat (limited to 'src/plugins/platforms/windows/qwindowscontext.h')
-rw-r--r-- | src/plugins/platforms/windows/qwindowscontext.h | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/src/plugins/platforms/windows/qwindowscontext.h b/src/plugins/platforms/windows/qwindowscontext.h index fd6c72668c..4908f14629 100644 --- a/src/plugins/platforms/windows/qwindowscontext.h +++ b/src/plugins/platforms/windows/qwindowscontext.h @@ -102,6 +102,7 @@ struct QWindowsUser32DLL typedef BOOL (WINAPI *RemoveClipboardFormatListener)(HWND); typedef BOOL (WINAPI *GetDisplayAutoRotationPreferences)(DWORD *); typedef BOOL (WINAPI *SetDisplayAutoRotationPreferences)(DWORD); + typedef BOOL (WINAPI *AdjustWindowRectExForDpi)(LPRECT,DWORD,BOOL,DWORD,UINT); typedef BOOL (WINAPI *EnableNonClientDpiScaling)(HWND); typedef int (WINAPI *GetWindowDpiAwarenessContext)(HWND); typedef int (WINAPI *GetAwarenessFromDpiAwarenessContext)(int); @@ -131,6 +132,7 @@ struct QWindowsUser32DLL GetDisplayAutoRotationPreferences getDisplayAutoRotationPreferences = nullptr; SetDisplayAutoRotationPreferences setDisplayAutoRotationPreferences = nullptr; + AdjustWindowRectExForDpi adjustWindowRectExForDpi = nullptr; EnableNonClientDpiScaling enableNonClientDpiScaling = nullptr; GetWindowDpiAwarenessContext getWindowDpiAwarenessContext = nullptr; GetAwarenessFromDpiAwarenessContext getAwarenessFromDpiAwarenessContext = nullptr; @@ -201,6 +203,8 @@ public: QWindowsWindow *findPlatformWindowAt(HWND parent, const QPoint &screenPoint, unsigned cwex_flags) const; + static bool shouldHaveNonClientDpiScaling(const QWindow *window); + QWindow *windowUnderMouse() const; void clearWindowUnderMouse(); |