mirror of
https://github.com/hyprwm/Hyprland.git
synced 2025-07-31 20:21:54 -07:00
ensure VRR for current display only in onConnect
This commit is contained in:
@@ -1553,10 +1553,10 @@ void CConfigManager::ensureDPMS() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void CConfigManager::ensureVRR() {
|
void CConfigManager::ensureVRR(CMonitor* pMonitor) {
|
||||||
static auto *const PNOVRR = &getConfigValuePtr("misc:no_vfr")->intValue;
|
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) {
|
if (!*PNOVRR && !m->vrrActive) {
|
||||||
// Adaptive sync (VRR)
|
// Adaptive sync (VRR)
|
||||||
wlr_output_enable_adaptive_sync(m->output, 1);
|
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);
|
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());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -152,7 +152,7 @@ public:
|
|||||||
bool m_bForceReload = false;
|
bool m_bForceReload = false;
|
||||||
bool m_bNoMonitorReload = false;
|
bool m_bNoMonitorReload = false;
|
||||||
void ensureDPMS();
|
void ensureDPMS();
|
||||||
void ensureVRR();
|
void ensureVRR(CMonitor* pMonitor = nullptr);
|
||||||
|
|
||||||
std::string parseKeyword(const std::string&, const std::string&, bool dynamic = false);
|
std::string parseKeyword(const std::string&, const std::string&, bool dynamic = false);
|
||||||
|
|
||||||
|
@@ -134,7 +134,7 @@ void CMonitor::onConnect(bool noRule) {
|
|||||||
g_pEventManager->postEvent(SHyprIPCEvent{"monitoradded", szName});
|
g_pEventManager->postEvent(SHyprIPCEvent{"monitoradded", szName});
|
||||||
|
|
||||||
// ensure VRR (will enable if necessary)
|
// ensure VRR (will enable if necessary)
|
||||||
g_pConfigManager->ensureVRR();
|
g_pConfigManager->ensureVRR(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CMonitor::onDisconnect() {
|
void CMonitor::onDisconnect() {
|
||||||
|
Reference in New Issue
Block a user