mirror of
https://github.com/hyprwm/Hyprland
synced 2026-05-07 06:18:05 +02:00
config/refresher: fix refreshing of cursor zooms (#14283)
This commit is contained in:
parent
a531c2ed6b
commit
6dc42e0f6d
5 changed files with 19 additions and 16 deletions
|
|
@ -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", ""});
|
||||
|
|
|
|||
|
|
@ -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", ""});
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
});
|
||||
|
|
|
|||
|
|
@ -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>;
|
||||
|
|
|
|||
|
|
@ -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),
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue