From 063708df26e8b930f492200e1907eb47950f50e6 Mon Sep 17 00:00:00 2001 From: Vaxry Date: Sun, 3 Mar 2024 18:39:20 +0000 Subject: config: improve config value infrastructure --- src/desktop/Subsurface.cpp | 5 +++-- src/desktop/Workspace.cpp | 9 +++++---- 2 files changed, 8 insertions(+), 6 deletions(-) (limited to 'src/desktop') diff --git a/src/desktop/Subsurface.cpp b/src/desktop/Subsurface.cpp index 74ae7748..d9aa3d6d 100644 --- a/src/desktop/Subsurface.cpp +++ b/src/desktop/Subsurface.cpp @@ -1,6 +1,7 @@ #include "Subsurface.hpp" #include "../events/Events.hpp" #include "../Compositor.hpp" +#include "../config/ConfigValue.hpp" static void onNewSubsurface(void* owner, void* data); @@ -119,8 +120,8 @@ void CSubsurface::onCommit() { if (!g_pHyprRenderer->shouldRenderWindow(m_pWindowParent)) { m_vLastSize = Vector2D{m_sWLSurface.wlr()->current.width, m_sWLSurface.wlr()->current.height}; - static auto* const PLOGDAMAGE = (Hyprlang::INT* const*)g_pConfigManager->getConfigValuePtr("debug:log_damage"); - if (**PLOGDAMAGE) + static auto PLOGDAMAGE = CConfigValue("debug:log_damage"); + if (*PLOGDAMAGE) Debug::log(LOG, "Refusing to commit damage from a subsurface of {} because it's invisible.", m_pWindowParent); return; } diff --git a/src/desktop/Workspace.cpp b/src/desktop/Workspace.cpp index e2ba1d5a..470d23e6 100644 --- a/src/desktop/Workspace.cpp +++ b/src/desktop/Workspace.cpp @@ -1,5 +1,6 @@ #include "Workspace.hpp" #include "../Compositor.hpp" +#include "../config/ConfigValue.hpp" CWorkspace::CWorkspace(int monitorID, std::string name, bool special) { const auto PMONITOR = g_pCompositor->getMonitorFromID(monitorID); @@ -42,8 +43,8 @@ CWorkspace::~CWorkspace() { } void CWorkspace::startAnim(bool in, bool left, bool instant) { - const auto ANIMSTYLE = m_fAlpha.m_pConfig->pValues->internalStyle; - static auto* const PWORKSPACEGAP = (Hyprlang::INT* const*)g_pConfigManager->getConfigValuePtr("general:gaps_workspaces"); + const auto ANIMSTYLE = m_fAlpha.m_pConfig->pValues->internalStyle; + static auto PWORKSPACEGAP = CConfigValue("general:gaps_workspaces"); if (ANIMSTYLE.starts_with("slidefade")) { const auto PMONITOR = g_pCompositor->getMonitorFromID(m_iMonitorID); @@ -95,7 +96,7 @@ void CWorkspace::startAnim(bool in, bool left, bool instant) { } else if (ANIMSTYLE == "slidevert") { // fallback is slide const auto PMONITOR = g_pCompositor->getMonitorFromID(m_iMonitorID); - const auto YDISTANCE = PMONITOR->vecSize.y + **PWORKSPACEGAP; + const auto YDISTANCE = PMONITOR->vecSize.y + *PWORKSPACEGAP; m_fAlpha.setValueAndWarp(1.f); // fix a bug, if switching from fade -> slide. @@ -108,7 +109,7 @@ void CWorkspace::startAnim(bool in, bool left, bool instant) { } else { // fallback is slide const auto PMONITOR = g_pCompositor->getMonitorFromID(m_iMonitorID); - const auto XDISTANCE = PMONITOR->vecSize.x + **PWORKSPACEGAP; + const auto XDISTANCE = PMONITOR->vecSize.x + *PWORKSPACEGAP; m_fAlpha.setValueAndWarp(1.f); // fix a bug, if switching from fade -> slide. -- cgit v1.2.3