diff options
author | vaxerski <[email protected]> | 2022-11-19 13:01:32 +0000 |
---|---|---|
committer | vaxerski <[email protected]> | 2022-11-19 13:01:32 +0000 |
commit | e887149f257802efdca3df231675c54c911dda9b (patch) | |
tree | b0ce9cdd5809d22f8a27d479e38064ffe10c1eb7 | |
parent | 250d61e0b3e23ed7088dd7a309b3a5b3a2d6577c (diff) | |
download | Hyprland-e887149f257802efdca3df231675c54c911dda9b.tar.gz Hyprland-e887149f257802efdca3df231675c54c911dda9b.zip |
minor fixes for mirrors & log more monitor events
-rw-r--r-- | src/Compositor.cpp | 3 | ||||
-rw-r--r-- | src/config/ConfigManager.cpp | 6 | ||||
-rw-r--r-- | src/events/Monitors.cpp | 15 | ||||
-rw-r--r-- | src/helpers/Monitor.cpp | 2 | ||||
-rw-r--r-- | src/render/Renderer.cpp | 1 |
5 files changed, 22 insertions, 5 deletions
diff --git a/src/Compositor.cpp b/src/Compositor.cpp index 581cf0fb..5e8910e6 100644 --- a/src/Compositor.cpp +++ b/src/Compositor.cpp @@ -1801,6 +1801,9 @@ void CCompositor::scheduleFrameForMonitor(CMonitor* pMonitor) { if ((m_sWLRSession && !m_sWLRSession->active) || !m_bSessionActive) return; + if (!pMonitor->m_bEnabled) + return; + wlr_output_schedule_frame(pMonitor->output); } diff --git a/src/config/ConfigManager.cpp b/src/config/ConfigManager.cpp index fae72be1..83ecd3f4 100644 --- a/src/config/ConfigManager.cpp +++ b/src/config/ConfigManager.cpp @@ -1479,14 +1479,14 @@ void CConfigManager::performMonitorReload() { for (auto& m : g_pCompositor->m_vRealMonitors) { auto rule = getMonitorRuleFor(m->szName, m->output->description ? m->output->description : ""); - // ensure mirror - m->setMirror(rule.mirrorOf); - if (!g_pHyprRenderer->applyMonitorRule(m.get(), &rule)) { overAgain = true; break; } + // ensure mirror + m->setMirror(rule.mirrorOf); + g_pHyprRenderer->arrangeLayersForMonitor(m->ID); } diff --git a/src/events/Monitors.cpp b/src/events/Monitors.cpp index b2b15136..be598f0f 100644 --- a/src/events/Monitors.cpp +++ b/src/events/Monitors.cpp @@ -66,6 +66,13 @@ void Events::listener_newOutput(wl_listener* listener, void* data) { } } + if (PNEWMONITORWRAP && PNEWMONITORWRAP->get()->m_bEnabled) { + Debug::log(LOG, "Connected an enabled monitor???"); + g_pConfigManager->m_bWantsMonitorReload = true; + g_pCompositor->scheduleFrameForMonitor(PNEWMONITORWRAP->get()); + return; + } + if (!PNEWMONITORWRAP) { Debug::log(LOG, "Adding completely new monitor."); PNEWMONITORWRAP = &g_pCompositor->m_vRealMonitors.emplace_back(std::make_shared<CMonitor>()); @@ -88,6 +95,9 @@ void Events::listener_newOutput(wl_listener* listener, void* data) { g_pCompositor->m_bReadyToProcess = true; g_pCompositor->m_bUnsafeState = false; } + + g_pConfigManager->m_bWantsMonitorReload = true; + g_pCompositor->scheduleFrameForMonitor(PNEWMONITOR); } void Events::listener_monitorFrame(void* owner, void* data) { @@ -326,11 +336,14 @@ void Events::listener_monitorDestroy(void* owner, void* data) { if (!pMonitor) return; + Debug::log(LOG, "Destroy called for monitor %s", pMonitor->output->name); + pMonitor->onDisconnect(); // cleanup if not unsafe - if (!g_pCompositor->m_bUnsafeState) { + Debug::log(LOG, "Removing monitor %s from realMonitors", pMonitor->output->name); + g_pCompositor->m_vRealMonitors.erase(std::remove_if(g_pCompositor->m_vRealMonitors.begin(), g_pCompositor->m_vRealMonitors.end(), [&](std::shared_ptr<CMonitor>& el) { return el.get() == pMonitor; })); if (pMostHzMonitor == pMonitor) { diff --git a/src/helpers/Monitor.cpp b/src/helpers/Monitor.cpp index 9e7ec66e..70c18aaf 100644 --- a/src/helpers/Monitor.cpp +++ b/src/helpers/Monitor.cpp @@ -142,6 +142,8 @@ void CMonitor::onDisconnect() { if (!m_bEnabled || g_pCompositor->m_bIsShuttingDown) return; + Debug::log(LOG, "onDisconnect called for %s", output->name); + // Cleanup everything. Move windows back, snap cursor, shit. CMonitor* BACKUPMON = nullptr; for (auto& m : g_pCompositor->m_vMonitors) { diff --git a/src/render/Renderer.cpp b/src/render/Renderer.cpp index ce1f83f0..28ed0c7c 100644 --- a/src/render/Renderer.cpp +++ b/src/render/Renderer.cpp @@ -1371,7 +1371,6 @@ bool CHyprRenderer::applyMonitorRule(CMonitor* pMonitor, SMonitorRule* pMonitorR if (!wlr_output_commit(pMonitor->output)) { Debug::log(ERR, "Couldn't commit output named %s", pMonitor->output->name); - return true; } int x, y; |