summaryrefslogtreecommitdiff
path: root/src/helpers/Monitor.cpp
diff options
context:
space:
mode:
authorvaxerski <43317083+vaxerski@users.noreply.github.com>2022-12-12 20:51:20 +0000
committervaxerski <43317083+vaxerski@users.noreply.github.com>2022-12-12 20:51:20 +0000
commitf8a6799d4e41662f8a624da3e4eb3622161dd705 (patch)
tree549ac02ae88b00b5634d2074023165d845f01fc6 /src/helpers/Monitor.cpp
parent111d209bff5448c3a55e07f344cf89715536bba4 (diff)
verify lastmon status on connect
Diffstat (limited to 'src/helpers/Monitor.cpp')
-rw-r--r--src/helpers/Monitor.cpp12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/helpers/Monitor.cpp b/src/helpers/Monitor.cpp
index f5ddee30..d7daa355 100644
--- a/src/helpers/Monitor.cpp
+++ b/src/helpers/Monitor.cpp
@@ -142,6 +142,18 @@ void CMonitor::onConnect(bool noRule) {
// ensure VRR (will enable if necessary)
g_pConfigManager->ensureVRR(this);
+
+ // verify last mon valid
+ bool found = false;
+ for (auto& m : g_pCompositor->m_vMonitors) {
+ if (m.get() == g_pCompositor->m_pLastMonitor) {
+ found = true;
+ break;
+ }
+ }
+
+ if (!found)
+ g_pCompositor->setActiveMonitor(this);
}
void CMonitor::onDisconnect() {