From c3edb20e04c7cf9dbad02ddf5ac066f4a725ccaa Mon Sep 17 00:00:00 2001 From: vaxerski <43317083+vaxerski@users.noreply.github.com> Date: Wed, 3 Aug 2022 16:19:00 +0200 Subject: [PATCH] make monitor IDs permanent --- src/Compositor.cpp | 2 +- src/events/Monitors.cpp | 2 ++ src/helpers/Monitor.cpp | 1 - 3 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/Compositor.cpp b/src/Compositor.cpp index d67226e2..e32d4caa 100644 --- a/src/Compositor.cpp +++ b/src/Compositor.cpp @@ -1281,7 +1281,7 @@ void CCompositor::moveWindowToWorkspace(CWindow* pWindow, const std::string& wor int CCompositor::getNextAvailableMonitorID() { int64_t topID = -1; - for (auto& m : m_vMonitors) { + for (auto& m : m_vRealMonitors) { if ((int64_t)m->ID > topID) topID = m->ID; } diff --git a/src/events/Monitors.cpp b/src/events/Monitors.cpp index 6bde6f34..ee831187 100644 --- a/src/events/Monitors.cpp +++ b/src/events/Monitors.cpp @@ -62,6 +62,8 @@ void Events::listener_newOutput(wl_listener* listener, void* data) { const auto PNEWMONITORWRAP = &g_pCompositor->m_vRealMonitors.emplace_back(std::make_shared()); const auto PNEWMONITOR = PNEWMONITORWRAP->get(); + PNEWMONITOR->ID = g_pCompositor->getNextAvailableMonitorID(); + wlr_output_init_render(OUTPUT, g_pCompositor->m_sWLRAllocator, g_pCompositor->m_sWLRRenderer); PNEWMONITOR->output = OUTPUT; diff --git a/src/helpers/Monitor.cpp b/src/helpers/Monitor.cpp index e3b22e0d..dd2db9aa 100644 --- a/src/helpers/Monitor.cpp +++ b/src/helpers/Monitor.cpp @@ -27,7 +27,6 @@ void CMonitor::onConnect(bool noRule) { m_bEnabled = true; - ID = g_pCompositor->getNextAvailableMonitorID(); szName = output->name; wlr_output_set_scale(output, monitorRule.scale);