From 5ba33f846129f3e6c0505b19f94634b24505e828 Mon Sep 17 00:00:00 2001 From: Vaxry <43317083+vaxerski@users.noreply.github.com> Date: Sun, 26 Apr 2026 15:16:36 +0100 Subject: config/lua: init lua config manager, use lua if available (#13817) Adds a new lua config manager, which will automatically be used if there is a lua config present. --- src/managers/PointerManager.cpp | 39 ++++++++++++++++++++------------------- 1 file changed, 20 insertions(+), 19 deletions(-) (limited to 'src/managers/PointerManager.cpp') diff --git a/src/managers/PointerManager.cpp b/src/managers/PointerManager.cpp index 04deca9a..b6419e71 100644 --- a/src/managers/PointerManager.cpp +++ b/src/managers/PointerManager.cpp @@ -1,6 +1,7 @@ #include "PointerManager.hpp" #include "../Compositor.hpp" #include "../config/ConfigValue.hpp" +#include "../config/shared/actions/ConfigActions.hpp" #include "../config/legacy/ConfigManager.hpp" #include "../protocols/PointerGestures.hpp" #include "../protocols/RelativePointer.hpp" @@ -415,7 +416,7 @@ SP CPointerManager::renderHWCursorBuffer(SPmonitor->m_output->cursorPlaneSize(); auto const& cursorSize = m_currentCursorImage.size; - static auto PCPUBUFFER = CConfigValue("cursor:use_cpu_buffer"); + static auto PCPUBUFFER = CConfigValue("cursor:use_cpu_buffer"); const bool shouldUseCpuBuffer = *PCPUBUFFER == 1 || (*PCPUBUFFER != 0 && g_pHyprRenderer->isNvidia()); @@ -686,7 +687,7 @@ CBox CPointerManager::getCursorBoxGlobal() { } Vector2D CPointerManager::closestValid(const Vector2D& pos) { - static auto PADDING = CConfigValue("cursor:hotspot_padding"); + static auto PADDING = CConfigValue("cursor:hotspot_padding"); auto CURSOR_PADDING = std::clamp(sc(*PADDING), 0, 100); CBox hotBox = {{pos.x - CURSOR_PADDING, pos.y - CURSOR_PADDING}, {2 * CURSOR_PADDING, 2 * CURSOR_PADDING}}; @@ -926,7 +927,7 @@ void CPointerManager::attachPointer(SP pointer) { if (!pointer) return; - static auto PMOUSEDPMS = CConfigValue("misc:mouse_move_enables_dpms"); + static auto PMOUSEDPMS = CConfigValue("misc:mouse_move_enables_dpms"); // auto listener = m_pointerListeners.emplace_back(makeShared()); @@ -939,8 +940,8 @@ void CPointerManager::attachPointer(SP pointer) { PROTO::idle->onActivity(); - if (!g_pCompositor->m_dpmsStateOn && *PMOUSEDPMS) - CKeybindManager::dpms("on"); + if (!g_pCompositor->m_dpmsStateOn && *PMOUSEDPMS) // NOLINTNEXTLINE + Config::Actions::dpms(Config::Actions::TOGGLE_ACTION_ENABLE, std::nullopt); }); listener->motionAbsolute = pointer->m_pointerEvents.motionAbsolute.listen([](const IPointer::SMotionAbsoluteEvent& event) { @@ -948,8 +949,8 @@ void CPointerManager::attachPointer(SP pointer) { PROTO::idle->onActivity(); - if (!g_pCompositor->m_dpmsStateOn && *PMOUSEDPMS) - CKeybindManager::dpms("on"); + if (!g_pCompositor->m_dpmsStateOn && *PMOUSEDPMS) // NOLINTNEXTLINE + Config::Actions::dpms(Config::Actions::TOGGLE_ACTION_ENABLE, std::nullopt); }); listener->button = pointer->m_pointerEvents.button.listen([weak = WP(pointer)](const IPointer::SButtonEvent& event) { @@ -968,8 +969,8 @@ void CPointerManager::attachPointer(SP pointer) { PROTO::idle->onActivity(); - if (!g_pCompositor->m_dpmsStateOn && *PMOUSEDPMS) - CKeybindManager::dpms("on"); + if (!g_pCompositor->m_dpmsStateOn && *PMOUSEDPMS) // NOLINTNEXTLINE + Config::Actions::dpms(Config::Actions::TOGGLE_ACTION_ENABLE, std::nullopt); }); listener->swipeEnd = pointer->m_pointerEvents.swipeEnd.listen([](const IPointer::SSwipeEndEvent& event) { @@ -987,8 +988,8 @@ void CPointerManager::attachPointer(SP pointer) { PROTO::idle->onActivity(); - if (!g_pCompositor->m_dpmsStateOn && *PMOUSEDPMS) - CKeybindManager::dpms("on"); + if (!g_pCompositor->m_dpmsStateOn && *PMOUSEDPMS) // NOLINTNEXTLINE + Config::Actions::dpms(Config::Actions::TOGGLE_ACTION_ENABLE, std::nullopt); }); listener->pinchEnd = pointer->m_pointerEvents.pinchEnd.listen([](const IPointer::SPinchEndEvent& event) { @@ -1020,7 +1021,7 @@ void CPointerManager::attachTouch(SP touch) { if (!touch) return; - static auto PMOUSEDPMS = CConfigValue("misc:mouse_move_enables_dpms"); + static auto PMOUSEDPMS = CConfigValue("misc:mouse_move_enables_dpms"); // auto listener = m_touchListeners.emplace_back(makeShared()); @@ -1034,8 +1035,8 @@ void CPointerManager::attachTouch(SP touch) { PROTO::idle->onActivity(); - if (!g_pCompositor->m_dpmsStateOn && *PMOUSEDPMS) - CKeybindManager::dpms("on"); + if (!g_pCompositor->m_dpmsStateOn && *PMOUSEDPMS) // NOLINTNEXTLINE + Config::Actions::dpms(Config::Actions::TOGGLE_ACTION_ENABLE, std::nullopt); }); listener->up = touch->m_touchEvents.up.listen([](const ITouch::SUpEvent& event) { @@ -1061,7 +1062,7 @@ void CPointerManager::attachTablet(SP tablet) { if (!tablet) return; - static auto PMOUSEDPMS = CConfigValue("misc:mouse_move_enables_dpms"); + static auto PMOUSEDPMS = CConfigValue("misc:mouse_move_enables_dpms"); // auto listener = m_tabletListeners.emplace_back(makeShared()); @@ -1075,8 +1076,8 @@ void CPointerManager::attachTablet(SP tablet) { PROTO::idle->onActivity(); - if (!g_pCompositor->m_dpmsStateOn && *PMOUSEDPMS) - CKeybindManager::dpms("on"); + if (!g_pCompositor->m_dpmsStateOn && *PMOUSEDPMS) // NOLINTNEXTLINE + Config::Actions::dpms(Config::Actions::TOGGLE_ACTION_ENABLE, std::nullopt); }); listener->proximity = tablet->m_tabletEvents.proximity.listen([](const CTablet::SProximityEvent& event) { @@ -1089,8 +1090,8 @@ void CPointerManager::attachTablet(SP tablet) { PROTO::idle->onActivity(); - if (!g_pCompositor->m_dpmsStateOn && *PMOUSEDPMS) - CKeybindManager::dpms("on"); + if (!g_pCompositor->m_dpmsStateOn && *PMOUSEDPMS) // NOLINTNEXTLINE + Config::Actions::dpms(Config::Actions::TOGGLE_ACTION_ENABLE, std::nullopt); }); listener->button = tablet->m_tabletEvents.button.listen([](const CTablet::SButtonEvent& event) { -- cgit v1.2.3