diff options
Diffstat (limited to 'src/plugins/platforms/windows/qwindowsscreen.cpp')
| -rw-r--r-- | src/plugins/platforms/windows/qwindowsscreen.cpp | 22 |
1 files changed, 20 insertions, 2 deletions
diff --git a/src/plugins/platforms/windows/qwindowsscreen.cpp b/src/plugins/platforms/windows/qwindowsscreen.cpp index 53548622dfc..7908f22d99d 100644 --- a/src/plugins/platforms/windows/qwindowsscreen.cpp +++ b/src/plugins/platforms/windows/qwindowsscreen.cpp @@ -553,12 +553,14 @@ void QWindowsScreen::handleChanges(const QWindowsScreenData &newData) const bool orientationChanged = m_data.orientation != newData.orientation; const bool primaryChanged = (newData.flags & QWindowsScreenData::PrimaryScreen) && !(m_data.flags & QWindowsScreenData::PrimaryScreen); + const bool refreshRateChanged = m_data.refreshRateHz != newData.refreshRateHz; m_data.dpi = newData.dpi; m_data.orientation = newData.orientation; m_data.geometry = newData.geometry; m_data.availableGeometry = newData.availableGeometry; m_data.flags = (m_data.flags & ~QWindowsScreenData::PrimaryScreen) | (newData.flags & QWindowsScreenData::PrimaryScreen); + m_data.refreshRateHz = newData.refreshRateHz; if (dpiChanged) { QWindowSystemInterface::handleScreenLogicalDotsPerInchChange(screen(), @@ -573,6 +575,9 @@ void QWindowsScreen::handleChanges(const QWindowsScreenData &newData) } if (primaryChanged) QWindowSystemInterface::handlePrimaryScreenChanged(this); + + if (refreshRateChanged) + QWindowSystemInterface::handleScreenRefreshRateChange(screen(), newData.refreshRateHz); } HMONITOR QWindowsScreen::handle() const @@ -869,9 +874,8 @@ const QWindowsScreen *QWindowsScreenManager::screenAtDp(const QPoint &p) const return nullptr; } -const QWindowsScreen *QWindowsScreenManager::screenForHwnd(HWND hwnd) const +const QWindowsScreen *QWindowsScreenManager::screenForMonitor(HMONITOR hMonitor) const { - HMONITOR hMonitor = MonitorFromWindow(hwnd, MONITOR_DEFAULTTONULL); if (hMonitor == nullptr) return nullptr; const auto it = @@ -884,4 +888,18 @@ const QWindowsScreen *QWindowsScreenManager::screenForHwnd(HWND hwnd) const return it != m_screens.cend() ? *it : nullptr; } +const QWindowsScreen *QWindowsScreenManager::screenForHwnd(HWND hwnd) const +{ + HMONITOR hMonitor = MonitorFromWindow(hwnd, MONITOR_DEFAULTTONULL); + return screenForMonitor(hMonitor); +} + +const QWindowsScreen *QWindowsScreenManager::screenForRect(const RECT *rect) const +{ + if (rect == nullptr) + return nullptr; + HMONITOR hMonitor = MonitorFromRect(rect, MONITOR_DEFAULTTONULL); + return screenForMonitor(hMonitor); +} + QT_END_NAMESPACE |
