From f2b03e9679bc1a091fecffd98b50a4179b5c7d43 Mon Sep 17 00:00:00 2001 From: Vaxry Date: Mon, 29 Apr 2024 17:42:07 +0100 Subject: ext-idle-notify: move to new impl --- src/managers/input/IdleInhibitor.cpp | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) (limited to 'src/managers/input/IdleInhibitor.cpp') diff --git a/src/managers/input/IdleInhibitor.cpp b/src/managers/input/IdleInhibitor.cpp index 6ec5fc81..40c8c637 100644 --- a/src/managers/input/IdleInhibitor.cpp +++ b/src/managers/input/IdleInhibitor.cpp @@ -1,6 +1,7 @@ #include "InputManager.hpp" #include "../../Compositor.hpp" #include "../../protocols/IdleInhibit.hpp" +#include "../../protocols/IdleNotify.hpp" void CInputManager::newIdleInhibitor(std::any inhibitor) { const auto PINHIBIT = m_vIdleInhibitors.emplace_back(std::make_unique()).get(); @@ -29,11 +30,11 @@ void CInputManager::newIdleInhibitor(std::any inhibitor) { void CInputManager::recheckIdleInhibitorStatus() { for (auto& ii : m_vIdleInhibitors) { - if (ii->pWindow.expired()) { - g_pCompositor->setIdleActivityInhibit(false); - return; - } else if (g_pHyprRenderer->shouldRenderWindow(ii->pWindow.lock())) { - g_pCompositor->setIdleActivityInhibit(false); + if (ii->pWindow.expired()) + continue; + + if (g_pHyprRenderer->shouldRenderWindow(ii->pWindow.lock())) { + PROTO::idle->setInhibit(true); return; } } @@ -44,21 +45,21 @@ void CInputManager::recheckIdleInhibitorStatus() { continue; if (w->m_eIdleInhibitMode == IDLEINHIBIT_ALWAYS) { - g_pCompositor->setIdleActivityInhibit(false); + PROTO::idle->setInhibit(true); return; } if (w->m_eIdleInhibitMode == IDLEINHIBIT_FOCUS && g_pCompositor->isWindowActive(w)) { - g_pCompositor->setIdleActivityInhibit(false); + PROTO::idle->setInhibit(true); return; } if (w->m_eIdleInhibitMode == IDLEINHIBIT_FULLSCREEN && w->m_bIsFullscreen && g_pCompositor->isWorkspaceVisible(w->m_pWorkspace)) { - g_pCompositor->setIdleActivityInhibit(false); + PROTO::idle->setInhibit(true); return; } } - g_pCompositor->setIdleActivityInhibit(true); + PROTO::idle->setInhibit(false); return; } -- cgit v1.2.3