diff --git a/src/Compositor.hpp b/src/Compositor.hpp index 3eaafb47..37738295 100644 --- a/src/Compositor.hpp +++ b/src/Compositor.hpp @@ -89,7 +89,6 @@ class CCompositor { bool m_bUnsafeState = false; // unsafe state is when there is no monitors. bool m_bNextIsUnsafe = false; CMonitor* m_pUnsafeOutput = nullptr; // fallback output for the unsafe state - bool m_bExitTriggered = false; // For exit dispatcher bool m_bIsShuttingDown = false; // ------------------------------------------------- // diff --git a/src/events/Monitors.cpp b/src/events/Monitors.cpp index 3fda1654..573eb52d 100644 --- a/src/events/Monitors.cpp +++ b/src/events/Monitors.cpp @@ -17,13 +17,6 @@ // --------------------------------------------------------- // void Events::listener_monitorFrame(void* owner, void* data) { - if (g_pCompositor->m_bExitTriggered) { - // Only signal cleanup once - g_pCompositor->m_bExitTriggered = false; - g_pCompositor->cleanup(); - return; - } - CMonitor* const PMONITOR = (CMonitor*)owner; if ((g_pCompositor->m_pAqBackend->hasSession() && !g_pCompositor->m_pAqBackend->session->active) || !g_pCompositor->m_bSessionActive || g_pCompositor->m_bUnsafeState) { diff --git a/src/managers/KeybindManager.cpp b/src/managers/KeybindManager.cpp index 19c7bca6..e9dfd1ae 100644 --- a/src/managers/KeybindManager.cpp +++ b/src/managers/KeybindManager.cpp @@ -9,6 +9,7 @@ #include "PointerManager.hpp" #include "Compositor.hpp" #include "TokenManager.hpp" +#include "eventLoop/EventLoopManager.hpp" #include "debug/Log.hpp" #include "helpers/varlist/VarList.hpp" @@ -1661,7 +1662,7 @@ void CKeybindManager::renameWorkspace(std::string args) { } void CKeybindManager::exitHyprland(std::string argz) { - g_pCompositor->m_bExitTriggered = true; + g_pEventLoopManager->doLater([]() { g_pCompositor->cleanup(); }); } void CKeybindManager::moveCurrentWorkspaceToMonitor(std::string args) { diff --git a/src/managers/input/InputManager.cpp b/src/managers/input/InputManager.cpp index b6c454b2..2db9de6f 100644 --- a/src/managers/input/InputManager.cpp +++ b/src/managers/input/InputManager.cpp @@ -1191,6 +1191,8 @@ static void removeFromHIDs(WP hid) { } void CInputManager::destroyKeyboard(SP pKeyboard) { + Debug::log(LOG, "Keyboard at {:x} removed", (uintptr_t)pKeyboard.get()); + std::erase_if(m_vKeyboards, [pKeyboard](const auto& other) { return other == pKeyboard; }); if (m_vKeyboards.size() > 0) { @@ -1213,6 +1215,8 @@ void CInputManager::destroyKeyboard(SP pKeyboard) { } void CInputManager::destroyPointer(SP mouse) { + Debug::log(LOG, "Pointer at {:x} removed", (uintptr_t)mouse.get()); + std::erase_if(m_vPointers, [mouse](const auto& other) { return other == mouse; }); g_pSeatManager->setMouse(m_vPointers.size() > 0 ? m_vPointers.front() : nullptr);