diff options
| author | Vaxry <43317083+vaxerski@users.noreply.github.com> | 2026-05-06 12:41:06 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2026-05-06 12:41:06 +0100 |
| commit | 6dc42e0f6d777109b6c8203dccf5c5d421b1fa04 (patch) | |
| tree | e7b3d75a0475c805c9f535590ba91add77a152af | |
| parent | a531c2ed6bb4cd4eb2c6cb51838cb07a37226377 (diff) | |
config/refresher: fix refreshing of cursor zooms (#14283)
| -rw-r--r-- | src/config/legacy/ConfigManager.cpp | 9 | ||||
| -rw-r--r-- | src/config/lua/ConfigManager.cpp | 10 | ||||
| -rw-r--r-- | src/config/supplementary/propRefresher/PropRefresher.cpp | 11 | ||||
| -rw-r--r-- | src/config/supplementary/propRefresher/PropRefresher.hpp | 3 | ||||
| -rw-r--r-- | src/config/values/ConfigValues.cpp | 2 |
5 files changed, 19 insertions, 16 deletions
diff --git a/src/config/legacy/ConfigManager.cpp b/src/config/legacy/ConfigManager.cpp index e4c485e0..3b397b42 100644 --- a/src/config/legacy/ConfigManager.cpp +++ b/src/config/legacy/ConfigManager.cpp @@ -965,13 +965,6 @@ void CConfigManager::postConfigReload(const Hyprlang::CParseResult& result) { w->uncacheWindowDecos(); } - static auto PZOOMFACTOR = CConfigValue<Hyprlang::FLOAT>("cursor:zoom_factor"); - for (auto const& m : g_pCompositor->m_monitors) { - *(m->m_cursorZoom) = *PZOOMFACTOR; - if (m->m_activeWorkspace) - m->m_activeWorkspace->m_space->recalculate(); - } - // Update the keyboard layout to the cfg'd one if this is not the first launch if (!m_isFirstLaunch) { g_pInputManager->setKeyboardLayout(); @@ -1074,6 +1067,8 @@ void CConfigManager::postConfigReload(const Hyprlang::CParseResult& result) { // update layouts Layout::Supplementary::algoMatcher()->updateWorkspaceLayouts(); + Config::Supplementary::refresher()->scheduleRefresh(Supplementary::REFRESH_ALL); + Event::bus()->m_events.config.reloaded.emit(); if (g_pEventManager) g_pEventManager->postEvent(SHyprIPCEvent{"configreloaded", ""}); diff --git a/src/config/lua/ConfigManager.cpp b/src/config/lua/ConfigManager.cpp index b4fc791d..685f925f 100644 --- a/src/config/lua/ConfigManager.cpp +++ b/src/config/lua/ConfigManager.cpp @@ -476,8 +476,6 @@ void CConfigManager::reload() { } void CConfigManager::postConfigReload() { - - static auto PZOOMFACTOR = CConfigValue<Config::FLOAT>("cursor.zoom_factor"); static auto PSUPPRESSERRORS = CConfigValue<Config::INTEGER>("debug.suppress_errors"); static auto PXWAYLAND = CConfigValue<Config::INTEGER>("xwayland.enabled"); static auto PMANUALCRASH = CConfigValue<Config::INTEGER>("debug.manual_crash"); @@ -490,12 +488,6 @@ void CConfigManager::postConfigReload() { w->uncacheWindowDecos(); } - for (auto const& m : g_pCompositor->m_monitors) { - *(m->m_cursorZoom) = *PZOOMFACTOR; - if (m->m_activeWorkspace) - m->m_activeWorkspace->m_space->recalculate(); - } - // Update the keyboard layout to the cfg'd one if this is not the first launch if (!m_isFirstLaunch) { g_pInputManager->setKeyboardLayout(); @@ -611,6 +603,8 @@ void CConfigManager::postConfigReload() { Layout::Supplementary::algoMatcher()->updateWorkspaceLayouts(); + Config::Supplementary::refresher()->scheduleRefresh(Supplementary::REFRESH_ALL); + Event::bus()->m_events.config.reloaded.emit(); if (g_pEventManager) g_pEventManager->postEvent(SHyprIPCEvent{"configreloaded", ""}); diff --git a/src/config/supplementary/propRefresher/PropRefresher.cpp b/src/config/supplementary/propRefresher/PropRefresher.cpp index 909624a0..0715594b 100644 --- a/src/config/supplementary/propRefresher/PropRefresher.cpp +++ b/src/config/supplementary/propRefresher/PropRefresher.cpp @@ -6,6 +6,7 @@ #include "../../../Compositor.hpp" #include "../../../layout/supplementary/WorkspaceAlgoMatcher.hpp" #include "../../../layout/LayoutManager.hpp" +#include "../../../layout/space/Space.hpp" #include "../../../desktop/rule/Engine.hpp" #include "../../shared/monitor/MonitorRuleManager.hpp" @@ -19,6 +20,8 @@ UP<CPropRefresher>& Supplementary::refresher() { } void CPropRefresher::scheduleRefresh(PropRefreshBits prop) { + static auto PZOOMFACTOR = CConfigValue<Config::FLOAT>("cursor.zoom_factor"); + m_propsTripped |= prop; if (!m_scheduled) { @@ -81,6 +84,14 @@ void CPropRefresher::scheduleRefresh(PropRefreshBits prop) { } } + if (m_propsTripped & REFRESH_CURSOR_ZOOMS) { + for (auto const& m : g_pCompositor->m_monitors) { + *(m->m_cursorZoom) = *PZOOMFACTOR; + if (m->m_activeWorkspace) + m->m_activeWorkspace->m_space->recalculate(); + } + } + m_scheduled = false; m_propsTripped = 0; }); diff --git a/src/config/supplementary/propRefresher/PropRefresher.hpp b/src/config/supplementary/propRefresher/PropRefresher.hpp index 563b33a2..e8094753 100644 --- a/src/config/supplementary/propRefresher/PropRefresher.hpp +++ b/src/config/supplementary/propRefresher/PropRefresher.hpp @@ -14,6 +14,9 @@ namespace Config::Supplementary { REFRESH_RULES = (1 << 4), REFRESH_WINDOW_STATES = (1 << 5) | REFRESH_RULES, REFRESH_MONITOR_STATES = (1 << 6) | REFRESH_LAYOUTS, + REFRESH_CURSOR_ZOOMS = (1 << 7), + + REFRESH_ALL = std::numeric_limits<std::underlying_type_t<ePropRefreshProp>>::max(), }; using PropRefreshBits = std::underlying_type_t<ePropRefreshProp>; diff --git a/src/config/values/ConfigValues.cpp b/src/config/values/ConfigValues.cpp index 2c44b172..ff23ab5d 100644 --- a/src/config/values/ConfigValues.cpp +++ b/src/config/values/ConfigValues.cpp @@ -559,7 +559,7 @@ std::vector<SP<IValue>> Values::getConfigValues() { MS<Int>("cursor:warp_on_toggle_special", "Move the cursor to the last focused window when toggling a special workspace.", 0, {.min = 0, .max = 2, .map = OptionMap{{"disable", 0}, {"enable", 1}, {"force", 2}}}), MS<String>("cursor:default_monitor", "the name of a default monitor for the cursor to be set to on startup", STRVAL_EMPTY), - MS<Float>("cursor:zoom_factor", "the factor to zoom by around the cursor. 1 means no zoom.", 1, {.min = 1, .max = 10}), + MS<Float>("cursor:zoom_factor", "the factor to zoom by around the cursor. 1 means no zoom.", 1, {.min = 1, .max = 10, .refresh = Supplementary::REFRESH_CURSOR_ZOOMS}), MS<Bool>("cursor:zoom_rigid", "whether the zoom should follow the cursor rigidly or loosely", false), MS<Bool>("cursor:zoom_disable_aa", "If enabled, when zooming, no antialiasing will be used", false), MS<Bool>("cursor:zoom_detached_camera", "Detaches the camera from the mouse when zoomed in", true), |
