diff options
author | vaxerski <[email protected]> | 2022-10-28 23:48:48 +0100 |
---|---|---|
committer | vaxerski <[email protected]> | 2022-10-28 23:48:48 +0100 |
commit | 74d05d0adc14d920aa780b2ca2a51c9ca14fadd7 (patch) | |
tree | 54c6eace3929884f2f1f0d30bced665eb301dbe6 /src | |
parent | 341a0616aa792508c2ee31949a4ad595148880ee (diff) | |
download | Hyprland-74d05d0adc14d920aa780b2ca2a51c9ca14fadd7.tar.gz Hyprland-74d05d0adc14d920aa780b2ca2a51c9ca14fadd7.zip |
ensure VRR for current display only in onConnect
Diffstat (limited to 'src')
-rw-r--r-- | src/config/ConfigManager.cpp | 15 | ||||
-rw-r--r-- | src/config/ConfigManager.hpp | 2 | ||||
-rw-r--r-- | src/helpers/Monitor.cpp | 2 |
3 files changed, 14 insertions, 5 deletions
diff --git a/src/config/ConfigManager.cpp b/src/config/ConfigManager.cpp index bad134b1..d3b6e507 100644 --- a/src/config/ConfigManager.cpp +++ b/src/config/ConfigManager.cpp @@ -1553,10 +1553,10 @@ void CConfigManager::ensureDPMS() { } } -void CConfigManager::ensureVRR() { +void CConfigManager::ensureVRR(CMonitor* pMonitor) { static auto *const PNOVRR = &getConfigValuePtr("misc:no_vfr")->intValue; - - for (auto& m : g_pCompositor->m_vMonitors) { + + auto ensureVRRForDisplay = [&](CMonitor* m) -> void { if (!*PNOVRR && !m->vrrActive) { // Adaptive sync (VRR) wlr_output_enable_adaptive_sync(m->output, 1); @@ -1584,6 +1584,15 @@ void CConfigManager::ensureVRR() { Debug::log(LOG, "VRR ensured on %s -> false", m->output->name); } + }; + + if (pMonitor) { + ensureVRRForDisplay(pMonitor); + return; + } + + for (auto& m : g_pCompositor->m_vMonitors) { + ensureVRRForDisplay(m.get()); } } diff --git a/src/config/ConfigManager.hpp b/src/config/ConfigManager.hpp index 549beab8..e390a93b 100644 --- a/src/config/ConfigManager.hpp +++ b/src/config/ConfigManager.hpp @@ -152,7 +152,7 @@ public: bool m_bForceReload = false; bool m_bNoMonitorReload = false; void ensureDPMS(); - void ensureVRR(); + void ensureVRR(CMonitor* pMonitor = nullptr); std::string parseKeyword(const std::string&, const std::string&, bool dynamic = false); diff --git a/src/helpers/Monitor.cpp b/src/helpers/Monitor.cpp index 7b008566..39f1b910 100644 --- a/src/helpers/Monitor.cpp +++ b/src/helpers/Monitor.cpp @@ -134,7 +134,7 @@ void CMonitor::onConnect(bool noRule) { g_pEventManager->postEvent(SHyprIPCEvent{"monitoradded", szName}); // ensure VRR (will enable if necessary) - g_pConfigManager->ensureVRR(); + g_pConfigManager->ensureVRR(this); } void CMonitor::onDisconnect() { |