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/events/Monitors.cpp | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) (limited to 'src/events/Monitors.cpp') diff --git a/src/events/Monitors.cpp b/src/events/Monitors.cpp index 01ea24f8..e235096b 100644 --- a/src/events/Monitors.cpp +++ b/src/events/Monitors.cpp @@ -4,6 +4,7 @@ #include "../render/Renderer.hpp" #include "Events.hpp" #include "../debug/HyprCtl.hpp" +#include "../config/ConfigValue.hpp" // --------------------------------------------------------- // // __ __ ____ _ _ _____ _______ ____ _____ _____ // @@ -147,12 +148,12 @@ void Events::listener_monitorFrame(void* owner, void* data) { PMONITOR->tearingState.frameScheduledWhileBusy = false; } - static auto* const PENABLERAT = (Hyprlang::INT* const*)g_pConfigManager->getConfigValuePtr("misc:render_ahead_of_time"); - static auto* const PRATSAFE = (Hyprlang::INT* const*)g_pConfigManager->getConfigValuePtr("misc:render_ahead_safezone"); + static auto PENABLERAT = CConfigValue("misc:render_ahead_of_time"); + static auto PRATSAFE = CConfigValue("misc:render_ahead_safezone"); PMONITOR->lastPresentationTimer.reset(); - if (**PENABLERAT && !PMONITOR->tearingState.nextRenderTorn) { + if (*PENABLERAT && !PMONITOR->tearingState.nextRenderTorn) { if (!PMONITOR->RATScheduled) { // render g_pHyprRenderer->renderMonitor(PMONITOR); @@ -162,14 +163,14 @@ void Events::listener_monitorFrame(void* owner, void* data) { const auto& [avg, max, min] = g_pHyprRenderer->getRenderTimes(PMONITOR); - if (max + **PRATSAFE > 1000.0 / PMONITOR->refreshRate) + if (max + *PRATSAFE > 1000.0 / PMONITOR->refreshRate) return; const auto MSLEFT = 1000.0 / PMONITOR->refreshRate - PMONITOR->lastPresentationTimer.getMillis(); PMONITOR->RATScheduled = true; - const auto ESTRENDERTIME = std::ceil(avg + **PRATSAFE); + const auto ESTRENDERTIME = std::ceil(avg + *PRATSAFE); const auto TIMETOSLEEP = std::floor(MSLEFT - ESTRENDERTIME); if (MSLEFT < 1 || MSLEFT < ESTRENDERTIME || TIMETOSLEEP < 1) -- cgit v1.2.3