From 57ce4f759c1625e23c6105413af421d55ec53f71 Mon Sep 17 00:00:00 2001 From: Vaxry Date: Thu, 22 Feb 2024 00:36:01 +0000 Subject: [PATCH] config: add no_fade_in fixes #55 --- src/config/ConfigManager.cpp | 1 + src/renderer/Renderer.cpp | 10 +++++++--- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/src/config/ConfigManager.cpp b/src/config/ConfigManager.cpp index 7acba01..2df7955 100644 --- a/src/config/ConfigManager.cpp +++ b/src/config/ConfigManager.cpp @@ -37,6 +37,7 @@ void CConfigManager::init() { m_config.addConfigValue("general:disable_loading_bar", Hyprlang::INT{0}); m_config.addConfigValue("general:hide_cursor", Hyprlang::INT{0}); m_config.addConfigValue("general:grace", Hyprlang::INT{0}); + m_config.addConfigValue("general:no_fade_in", Hyprlang::INT{0}); m_config.addSpecialCategory("background", Hyprlang::SSpecialCategoryOptions{.key = nullptr, .anonymousKeyBased = true}); m_config.addSpecialConfigValue("background", "monitor", Hyprlang::STRING{""}); diff --git a/src/renderer/Renderer.cpp b/src/renderer/Renderer.cpp index 634ff37..e9ebc43 100644 --- a/src/renderer/Renderer.cpp +++ b/src/renderer/Renderer.cpp @@ -157,6 +157,7 @@ static int frames = 0; // CRenderer::SRenderFeedback CRenderer::renderLock(const CSessionLockSurface& surf) { static auto* const PDISABLEBAR = (Hyprlang::INT* const*)g_pConfigManager->getValuePtr("general:disable_loading_bar"); + static auto* const PNOFADEIN = (Hyprlang::INT* const*)g_pConfigManager->getValuePtr("general:no_fade_in"); matrixProjection(projection.data(), surf.size.x, surf.size.y, WL_OUTPUT_TRANSFORM_NORMAL); @@ -171,9 +172,9 @@ CRenderer::SRenderFeedback CRenderer::renderLock(const CSessionLockSurface& surf SRenderFeedback feedback; - const float bga = asyncResourceGatherer->applied ? - std::clamp(std::chrono::duration_cast(std::chrono::system_clock::now() - gatheredAt).count() / 500000.0, 0.0, 1.0) : - 0.0; + float bga = asyncResourceGatherer->applied ? + std::clamp(std::chrono::duration_cast(std::chrono::system_clock::now() - gatheredAt).count() / 500000.0, 0.0, 1.0) : + 0.0; if (!asyncResourceGatherer->ready) { // render status @@ -188,6 +189,9 @@ CRenderer::SRenderFeedback CRenderer::renderLock(const CSessionLockSurface& surf gatheredAt = std::chrono::system_clock::now(); } + if (**PNOFADEIN) + bga = 1.0; + // render widgets const auto WIDGETS = getOrCreateWidgetsFor(&surf); for (auto& w : *WIDGETS) {