summaryrefslogtreecommitdiff
path: root/src/managers
diff options
context:
space:
mode:
authorMike Will <myQwil@gmail.com>2024-12-06 01:16:58 -0500
committerVaxry <vaxry@vaxry.net>2024-12-11 17:27:49 +0000
commitdf956a0f6fbcfd7397b2d7b86883c0936c7795ec (patch)
tree269946352158faa6a455c9e87337cb83c37998eb /src/managers
parent33f271c29a0069a95755b1d3252aeebe0fd85287 (diff)
windowrules: add rules for mouse and touchpad scroll factors (#8655)
Diffstat (limited to 'src/managers')
-rw-r--r--src/managers/KeybindManager.cpp7
-rw-r--r--src/managers/input/InputManager.cpp4
2 files changed, 10 insertions, 1 deletions
diff --git a/src/managers/KeybindManager.cpp b/src/managers/KeybindManager.cpp
index 2eb04d41..67c2c5d0 100644
--- a/src/managers/KeybindManager.cpp
+++ b/src/managers/KeybindManager.cpp
@@ -3014,6 +3014,13 @@ SDispatchResult CKeybindManager::setProp(std::string args) {
search->second(PWINDOW)->unset(PRIORITY_SET_PROP);
else if (const auto V = configStringToInt(VAL); V)
*(search->second(PWINDOW)) = CWindowOverridableVar((int)*V, PRIORITY_SET_PROP);
+ } else if (auto search = g_pConfigManager->mfWindowProperties.find(PROP); search != g_pConfigManager->mfWindowProperties.end()) {
+ if (VAL == "unset")
+ search->second(PWINDOW)->unset(PRIORITY_SET_PROP);
+ else {
+ const auto V = std::stof(VAL);
+ *(search->second(PWINDOW)) = CWindowOverridableVar(V, PRIORITY_SET_PROP);
+ }
} else
return {.success = false, .error = "Prop not found"};
} catch (std::exception& e) { return {.success = false, .error = std::format("Error parsing prop value: {}", std::string(e.what()))}; }
diff --git a/src/managers/input/InputManager.cpp b/src/managers/input/InputManager.cpp
index 6883717c..d1eb7c4c 100644
--- a/src/managers/input/InputManager.cpp
+++ b/src/managers/input/InputManager.cpp
@@ -761,7 +761,8 @@ void CInputManager::onMouseWheel(IPointer::SAxisEvent e) {
static auto PEMULATEDISCRETE = CConfigValue<Hyprlang::INT>("input:emulate_discrete_scroll");
static auto PFOLLOWMOUSE = CConfigValue<Hyprlang::INT>("input:follow_mouse");
- auto factor = (*PTOUCHPADSCROLLFACTOR <= 0.f || e.source == WL_POINTER_AXIS_SOURCE_FINGER ? *PTOUCHPADSCROLLFACTOR : *PINPUTSCROLLFACTOR);
+ const bool ISTOUCHPADSCROLL = *PTOUCHPADSCROLLFACTOR <= 0.f || e.source == WL_POINTER_AXIS_SOURCE_FINGER;
+ auto factor = ISTOUCHPADSCROLL ? *PTOUCHPADSCROLLFACTOR : *PINPUTSCROLLFACTOR;
const auto EMAP = std::unordered_map<std::string, std::any>{{"event", e}};
EMIT_HOOK_EVENT_CANCELLABLE("mouseAxis", EMAP);
@@ -803,6 +804,7 @@ void CInputManager::onMouseWheel(IPointer::SAxisEvent e) {
if (*PFOLLOWMOUSE == 1 && PCURRWINDOW && PWINDOW != PCURRWINDOW)
simulateMouseMovement();
}
+ factor = ISTOUCHPADSCROLL ? PWINDOW->getScrollTouchpad() : PWINDOW->getScrollMouse();
}
}