make monitor IDs permanent

This commit is contained in:
vaxerski 2022-08-03 16:19:00 +02:00
parent b9be405d32
commit c3edb20e04
3 changed files with 3 additions and 2 deletions

View file

@ -1281,7 +1281,7 @@ void CCompositor::moveWindowToWorkspace(CWindow* pWindow, const std::string& wor
int CCompositor::getNextAvailableMonitorID() { int CCompositor::getNextAvailableMonitorID() {
int64_t topID = -1; int64_t topID = -1;
for (auto& m : m_vMonitors) { for (auto& m : m_vRealMonitors) {
if ((int64_t)m->ID > topID) if ((int64_t)m->ID > topID)
topID = m->ID; topID = m->ID;
} }

View file

@ -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<CMonitor>()); const auto PNEWMONITORWRAP = &g_pCompositor->m_vRealMonitors.emplace_back(std::make_shared<CMonitor>());
const auto PNEWMONITOR = PNEWMONITORWRAP->get(); const auto PNEWMONITOR = PNEWMONITORWRAP->get();
PNEWMONITOR->ID = g_pCompositor->getNextAvailableMonitorID();
wlr_output_init_render(OUTPUT, g_pCompositor->m_sWLRAllocator, g_pCompositor->m_sWLRRenderer); wlr_output_init_render(OUTPUT, g_pCompositor->m_sWLRAllocator, g_pCompositor->m_sWLRRenderer);
PNEWMONITOR->output = OUTPUT; PNEWMONITOR->output = OUTPUT;

View file

@ -27,7 +27,6 @@ void CMonitor::onConnect(bool noRule) {
m_bEnabled = true; m_bEnabled = true;
ID = g_pCompositor->getNextAvailableMonitorID();
szName = output->name; szName = output->name;
wlr_output_set_scale(output, monitorRule.scale); wlr_output_set_scale(output, monitorRule.scale);