diff options
author | Tor Arne Vestbø <tor.arne.vestbo@qt.io> | 2022-06-16 12:01:36 +0200 |
---|---|---|
committer | Tor Arne Vestbø <tor.arne.vestbo@qt.io> | 2022-06-18 21:08:02 +0200 |
commit | fa0b2ef81c0d22f4038235871fbc1abda55887d1 (patch) | |
tree | a8e67e11a00b6319569b7ffe8916e60351db7932 /src/plugins/platforms/windows/qwindowscontext.h | |
parent | e457aeec3802e79d33347768cb9c50eb87deed92 (diff) |
Windows: Decouple screen change monitoring from top level QWindows
The WM_DISPLAYCHANGE message it sent when displays are added, removed,
or update their properties such as the scale/DPI.
We were processing this message as part of QWindowsContext::windowsProc(),
which meant that we would only react to display changes if there was a
QWindow on screen. Just creating a QGuiApplication was insufficient to
pick up changes to screens after startup.
In addition, despite being documented to post messages to child windows,
WM_DISPLAYCHANGE only ends up in top level windows. Presumably it's the
top level window's responsibility to post the message to child windows.
As a result, if a QWindow was a native child window of a foreign window,
such as in audio plugins being hosted in a DAW, we would again fail to
pick up display changes.
We solve both these cases by decoupling the WM_DISPLAYCHANGE handling
from QWindowsContext::windowsProc(), by creating a dedicated window
for listening to WM_DISPLAYCHANGE. This is similar to how we already
handle tray icons, power notifications, clipboard, etc -- the only
difference being that since purely HWND_MESSAGE windows do not
receive WM_DISPLAYCHANGE it's an actual invisible WS_TILED window.
This also lets us remove the workaround for QTBUG-79248, which was
doing screen updates in response to WM_DPICHANGED when detecting
that there were no QWindows.
Task-number: QTBUG-103383
Task-number: QTBUG-79248
Fixes: QTBUG-102343
Pick-to: 6.4
Change-Id: I905d8253069ec339b193edf05c052d21361ca3e9
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Diffstat (limited to 'src/plugins/platforms/windows/qwindowscontext.h')
-rw-r--r-- | src/plugins/platforms/windows/qwindowscontext.h | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/src/plugins/platforms/windows/qwindowscontext.h b/src/plugins/platforms/windows/qwindowscontext.h index 4cc47a3ba4..af92690b3b 100644 --- a/src/plugins/platforms/windows/qwindowscontext.h +++ b/src/plugins/platforms/windows/qwindowscontext.h @@ -31,6 +31,7 @@ Q_DECLARE_LOGGING_CATEGORY(lcQpaTablet) Q_DECLARE_LOGGING_CATEGORY(lcQpaAccessibility) Q_DECLARE_LOGGING_CATEGORY(lcQpaUiAutomation) Q_DECLARE_LOGGING_CATEGORY(lcQpaTrayIcon) +Q_DECLARE_LOGGING_CATEGORY(lcQpaScreen) class QWindow; class QPlatformScreen; |