From 867b11596be8bb5864650f98698d1015c4f26812 Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Thu, 7 Jan 2021 15:16:31 +0100 Subject: Windows QPA: Fix missing QScreen change updates Remove the logic compressing WM_DISPLAYCHANGE signals by the WParam/LParam since it also triggers when the geometry is changed by rearranging screens. Fixes: QTBUG-79442 Change-Id: I00042c9e687bdb67fc17d6c507818b79a7aee0a2 Reviewed-by: Oliver Wolff --- src/plugins/platforms/windows/qwindowscontext.cpp | 3 ++- src/plugins/platforms/windows/qwindowsscreen.cpp | 24 ----------------------- src/plugins/platforms/windows/qwindowsscreen.h | 4 ---- 3 files changed, 2 insertions(+), 29 deletions(-) (limited to 'src/plugins') diff --git a/src/plugins/platforms/windows/qwindowscontext.cpp b/src/plugins/platforms/windows/qwindowscontext.cpp index b2cbae408c..67d38a95ce 100644 --- a/src/plugins/platforms/windows/qwindowscontext.cpp +++ b/src/plugins/platforms/windows/qwindowscontext.cpp @@ -1235,7 +1235,8 @@ bool QWindowsContext::windowsProc(HWND hwnd, UINT message, if (QWindowsTheme *t = QWindowsTheme::instance()) t->displayChanged(); QWindowsWindow::displayChanged(); - return d->m_screenManager.handleDisplayChange(wParam, lParam); + d->m_screenManager.handleScreenChanges(); + return false; case QtWindows::SettingChangedEvent: { QWindowsWindow::settingsChanged(); const bool darkMode = QWindowsTheme::queryDarkMode(); diff --git a/src/plugins/platforms/windows/qwindowsscreen.cpp b/src/plugins/platforms/windows/qwindowsscreen.cpp index cddc384418..19557bfcd0 100644 --- a/src/plugins/platforms/windows/qwindowsscreen.cpp +++ b/src/plugins/platforms/windows/qwindowsscreen.cpp @@ -537,30 +537,6 @@ bool QWindowsScreenManager::isSingleScreen() return QWindowsContext::instance()->screenManager().screens().size() < 2; } -/*! - \brief Triggers synchronization of screens (WM_DISPLAYCHANGE). - - Subsequent events are compressed since WM_DISPLAYCHANGE is sent to - each top level window. -*/ - -bool QWindowsScreenManager::handleDisplayChange(WPARAM wParam, LPARAM lParam) -{ - const int newDepth = int(wParam); - const WORD newHorizontalResolution = LOWORD(lParam); - const WORD newVerticalResolution = HIWORD(lParam); - if (newDepth != m_lastDepth || newHorizontalResolution != m_lastHorizontalResolution - || newVerticalResolution != m_lastVerticalResolution) { - m_lastDepth = newDepth; - m_lastHorizontalResolution = newHorizontalResolution; - m_lastVerticalResolution = newVerticalResolution; - qCDebug(lcQpaWindows) << __FUNCTION__ << "Depth=" << newDepth - << ", resolution " << newHorizontalResolution << 'x' << newVerticalResolution; - handleScreenChanges(); - } - return false; -} - static inline int indexOfMonitor(const QWindowsScreenManager::WindowsScreenList &screens, const QString &monitorName) { diff --git a/src/plugins/platforms/windows/qwindowsscreen.h b/src/plugins/platforms/windows/qwindowsscreen.h index 1989934ad4..2052648933 100644 --- a/src/plugins/platforms/windows/qwindowsscreen.h +++ b/src/plugins/platforms/windows/qwindowsscreen.h @@ -133,7 +133,6 @@ public: void clearScreens(); bool handleScreenChanges(); - bool handleDisplayChange(WPARAM wParam, LPARAM lParam); const WindowsScreenList &screens() const { return m_screens; } const QWindowsScreen *screenAtDp(const QPoint &p) const; @@ -145,9 +144,6 @@ private: void removeScreen(int index); WindowsScreenList m_screens; - int m_lastDepth = -1; - WORD m_lastHorizontalResolution = 0; - WORD m_lastVerticalResolution = 0; }; QT_END_NAMESPACE -- cgit v1.2.3