From 38c1e72c9d81fcdad8f173e06102a5da18836230 Mon Sep 17 00:00:00 2001 From: ItsOhen Date: Mon, 29 Sep 2025 20:10:34 +0200 Subject: rules: fix some monitor rules (#11873) --- src/events/Windows.cpp | 26 ++++++++++---------------- 1 file changed, 10 insertions(+), 16 deletions(-) (limited to 'src/events/Windows.cpp') diff --git a/src/events/Windows.cpp b/src/events/Windows.cpp index 8f40c0e1..16f71534 100644 --- a/src/events/Windows.cpp +++ b/src/events/Windows.cpp @@ -15,6 +15,7 @@ #include "../protocols/ToplevelExport.hpp" #include "../protocols/types/ContentType.hpp" #include "../xwayland/XSurface.hpp" +#include "desktop/DesktopTypes.hpp" #include "managers/animation/AnimationManager.hpp" #include "managers/animation/DesktopAnimationManager.hpp" #include "managers/PointerManager.hpp" @@ -147,23 +148,16 @@ void Events::listener_mapWindow(void* owner, void* data) { try { const auto MONITORSTR = trim(r->m_rule.substr(r->m_rule.find(' '))); - if (MONITORSTR == "unset") { + if (MONITORSTR == "unset") PWINDOW->m_monitor = PMONITOR; - } else { - if (isNumber(MONITORSTR)) { - const MONITORID MONITOR = std::stoi(MONITORSTR); - if (const auto PM = g_pCompositor->getMonitorFromID(MONITOR); PM) - PWINDOW->m_monitor = PM; - else - PWINDOW->m_monitor = g_pCompositor->m_monitors.at(0); - } else { - const auto PMONITOR = g_pCompositor->getMonitorFromName(MONITORSTR); - if (PMONITOR) - PWINDOW->m_monitor = PMONITOR; - else { - Debug::log(ERR, "No monitor in monitor {} rule", MONITORSTR); - continue; - } + else { + const auto MONITOR = g_pCompositor->getMonitorFromString(MONITORSTR); + + if (MONITOR) + PWINDOW->m_monitor = MONITOR; + else { + Debug::log(ERR, "No monitor in monitor {} rule", MONITORSTR); + continue; } } -- cgit v1.2.3