From c50ed7b75e9c99b5a01de3ac17aa91d767af6dda Mon Sep 17 00:00:00 2001 From: Ivan Malison Date: Wed, 29 Apr 2026 22:53:28 -0700 Subject: [PATCH] hyprexpo: defer config value binding --- hyprexpo/overview.cpp | 33 +++++++++++++++++---------------- 1 file changed, 17 insertions(+), 16 deletions(-) diff --git a/hyprexpo/overview.cpp b/hyprexpo/overview.cpp index b702dd4..1dbe98f 100644 --- a/hyprexpo/overview.cpp +++ b/hyprexpo/overview.cpp @@ -26,22 +26,12 @@ using namespace Hyprutils::String; -static const CConfigValue PCOLUMNS("plugin:hyprexpo:columns"); -static const CConfigValue PGAPS("plugin:hyprexpo:gap_size"); -static const CConfigValue PCOL("plugin:hyprexpo:bg_col"); -static const CConfigValue PSKIP("plugin:hyprexpo:skip_empty"); -static const CConfigValue PMAXWS("plugin:hyprexpo:max_workspace"); -static const CConfigValue PSHOWNUM("plugin:hyprexpo:show_workspace_numbers"); -static const CConfigValue PNUMCOL("plugin:hyprexpo:workspace_number_color"); -static const CConfigValue PMETHOD("plugin:hyprexpo:workspace_method"); -static const CConfigValue PDISTANCE("plugin:hyprexpo:gesture_distance"); - static uint32_t framebufferFormatWithAlpha(uint32_t drmFormat) { const auto alphaFormat = NFormatUtils::alphaFormat(drmFormat); return alphaFormat == 0 ? DRM_FORMAT_ABGR8888 : alphaFormat; } -static void clearWithColor(const CHyprColor& color) { +static void clearWithColor(const CHyprColor& color) { glClearColor(color.r, color.g, color.b, color.a); glClear(GL_COLOR_BUFFER_BIT); } @@ -72,6 +62,15 @@ COverview::COverview(PHLWORKSPACE startedOn_, bool swipe_) : startedOn(startedOn const auto PMONITOR = Desktop::focusState()->monitor(); pMonitor = PMONITOR; + static const CConfigValue PCOLUMNS("plugin:hyprexpo:columns"); + static const CConfigValue PGAPS("plugin:hyprexpo:gap_size"); + static const CConfigValue PCOL("plugin:hyprexpo:bg_col"); + static const CConfigValue PSKIP("plugin:hyprexpo:skip_empty"); + static const CConfigValue PMAXWS("plugin:hyprexpo:max_workspace"); + static const CConfigValue PSHOWNUM("plugin:hyprexpo:show_workspace_numbers"); + static const CConfigValue PNUMCOL("plugin:hyprexpo:workspace_number_color"); + static const CConfigValue PMETHOD("plugin:hyprexpo:workspace_method"); + SIDE_LENGTH = *PCOLUMNS; GAP_WIDTH = *PGAPS; BG_COLOR = CHyprColor(*PCOL); @@ -549,13 +548,15 @@ void COverview::resetSwipe() { void COverview::onSwipeUpdate(double delta) { m_isSwiping = true; - const float PERC = closing ? std::clamp(delta / (double)*PDISTANCE, 0.0, 1.0) : 1.0 - std::clamp(delta / (double)*PDISTANCE, 0.0, 1.0); - const auto WORKSPACE_FOCUS_ID = closing && closeOnID != -1 ? closeOnID : openedID; + static const CConfigValue PDISTANCE("plugin:hyprexpo:gesture_distance"); - Vector2D tileSize = (pMonitor->m_size / SIDE_LENGTH); + const float PERC = closing ? std::clamp(delta / (double)*PDISTANCE, 0.0, 1.0) : 1.0 - std::clamp(delta / (double)*PDISTANCE, 0.0, 1.0); + const auto WORKSPACE_FOCUS_ID = closing && closeOnID != -1 ? closeOnID : openedID; - const auto SIZEMAX = pMonitor->m_size * pMonitor->m_size / tileSize; - const auto POSMAX = (-((pMonitor->m_size / (double)SIDE_LENGTH) * Vector2D{WORKSPACE_FOCUS_ID % SIDE_LENGTH, WORKSPACE_FOCUS_ID / SIDE_LENGTH}) * pMonitor->m_scale) * + Vector2D tileSize = (pMonitor->m_size / SIDE_LENGTH); + + const auto SIZEMAX = pMonitor->m_size * pMonitor->m_size / tileSize; + const auto POSMAX = (-((pMonitor->m_size / (double)SIDE_LENGTH) * Vector2D{WORKSPACE_FOCUS_ID % SIDE_LENGTH, WORKSPACE_FOCUS_ID / SIDE_LENGTH}) * pMonitor->m_scale) * (pMonitor->m_size / tileSize); const auto SIZEMIN = pMonitor->m_size;