monitors: fixes to unsafe mode

This commit is contained in:
vaxerski 2023-03-15 15:11:41 +00:00
parent 569ae86c90
commit 25d3d73dbf
2 changed files with 10 additions and 0 deletions

View File

@ -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)) {

View File

@ -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);