diff options
| author | Vaxry <vaxry@vaxry.net> | 2025-10-26 13:52:09 +0000 |
|---|---|---|
| committer | Vaxry <vaxry@vaxry.net> | 2025-10-26 13:52:09 +0000 |
| commit | 05aa4e1c54da31d95663f9b4bc757e2a6ca65538 (patch) | |
| tree | bfc9a4f456b2057aea7d4417f5acabb1cbc2569d /src/Compositor.cpp | |
| parent | 748d2f656ee4952090eb4ce8702ee05c82d228cb (diff) | |
compositor: check for monitor layout issues post rule apply
fixes #12108
Diffstat (limited to 'src/Compositor.cpp')
| -rw-r--r-- | src/Compositor.cpp | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/src/Compositor.cpp b/src/Compositor.cpp index 5ea88b11..78b19c71 100644 --- a/src/Compositor.cpp +++ b/src/Compositor.cpp @@ -2842,6 +2842,38 @@ PHLWINDOW CCompositor::getForceFocus() { return nullptr; } +void CCompositor::scheduleMonitorStateRecheck() { + static bool scheduled = false; + + if (!scheduled) { + scheduled = true; + g_pEventLoopManager->doLater([this] { + arrangeMonitors(); + checkMonitorOverlaps(); + + scheduled = false; + }); + } +} + +void CCompositor::checkMonitorOverlaps() { + CRegion monitorRegion; + + for (const auto& m : m_monitors) { + if (!monitorRegion.copy().intersect(m->logicalBox()).empty()) { + Debug::log(ERR, "Monitor {}: detected overlap with layout", m->m_name); + g_pHyprNotificationOverlay->addNotification(std::format("Your monitor layout is set up incorrectly. Monitor {} overlaps with other monitor(s) in the " + "layout.\nPlease see the wiki (Monitors page) for more. This will cause issues.", + m->m_name), + CHyprColor{}, 15000, ICON_WARNING); + + break; + } + + monitorRegion.add(m->logicalBox()); + } +} + void CCompositor::arrangeMonitors() { static auto* const PXWLFORCESCALEZERO = rc<Hyprlang::INT* const*>(g_pConfigManager->getConfigValuePtr("xwayland:force_zero_scaling")); |
