diff options
author | vaxerski <[email protected]> | 2023-03-15 15:11:41 +0000 |
---|---|---|
committer | vaxerski <[email protected]> | 2023-03-15 15:11:41 +0000 |
commit | 25d3d73dbfcd2dd4d7b8254cb97f0f7737cd7c03 (patch) | |
tree | 3f2cbb8f063874321d23f392c9a719e6f2ff8e64 | |
parent | 569ae86c90df483b56b7eeefc2453c2ee3325361 (diff) | |
download | Hyprland-25d3d73dbfcd2dd4d7b8254cb97f0f7737cd7c03.tar.gz Hyprland-25d3d73dbfcd2dd4d7b8254cb97f0f7737cd7c03.zip |
monitors: fixes to unsafe mode
-rw-r--r-- | src/config/ConfigManager.cpp | 3 | ||||
-rw-r--r-- | src/events/Monitors.cpp | 7 |
2 files changed, 10 insertions, 0 deletions
diff --git a/src/config/ConfigManager.cpp b/src/config/ConfigManager.cpp index cf882b0c..c0f2d5c1 100644 --- a/src/config/ConfigManager.cpp +++ b/src/config/ConfigManager.cpp @@ -1693,6 +1693,9 @@ void CConfigManager::performMonitorReload() { bool overAgain = false; for (auto& m : g_pCompositor->m_vRealMonitors) { + if (!m->output) + continue; + auto rule = getMonitorRuleFor(m->szName, m->output->description ? m->output->description : ""); if (!g_pHyprRenderer->applyMonitorRule(m.get(), &rule)) { diff --git a/src/events/Monitors.cpp b/src/events/Monitors.cpp index 13de69a5..aade1f6e 100644 --- a/src/events/Monitors.cpp +++ b/src/events/Monitors.cpp @@ -106,6 +106,10 @@ void Events::listener_monitorFrame(void* owner, void* data) { if ((g_pCompositor->m_sWLRSession && !g_pCompositor->m_sWLRSession->active) || !g_pCompositor->m_bSessionActive || g_pCompositor->m_bUnsafeState) { Debug::log(WARN, "Attempted to render frame on inactive session!"); + + if (g_pCompositor->m_bUnsafeState) + g_pConfigManager->performMonitorReload(); + return; // cannot draw on session inactive (different tty) } @@ -351,6 +355,9 @@ void Events::listener_monitorDestroy(void* owner, void* data) { pMonitor->onDisconnect(); + pMonitor->output = nullptr; + pMonitor->m_bRenderingInitPassed = false; + // cleanup if not unsafe if (!g_pCompositor->m_bUnsafeState) { Debug::log(LOG, "Removing monitor %s from realMonitors", pMonitor->output->name); |