rules: fix some monitor rules (#11873)

This commit is contained in:
ItsOhen 2025-09-29 20:10:34 +02:00 committed by GitHub
parent 0959672591
commit 38c1e72c9d
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 18 additions and 23 deletions

View file

@ -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;
}
}