diff options
| author | Vaxry <43317083+vaxerski@users.noreply.github.com> | 2022-10-06 21:26:11 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2022-10-06 21:26:11 +0100 |
| commit | c4487534d2230077ee6c61b248602effcbb4df45 (patch) | |
| tree | 8ccaa3e583180a03629683e8a02f89552006470e /src | |
| parent | b4a8efc1a76d4f4e6485fdf39796cb0eb2cf80fd (diff) | |
| parent | e4820d1c71add4945293e65be14198fd8c53dc3f (diff) | |
Merge pull request #801 from fufexan/scrollfactor
Add input:touchpad:scroll_factor
Diffstat (limited to 'src')
| -rw-r--r-- | src/config/ConfigManager.cpp | 1 | ||||
| -rw-r--r-- | src/managers/input/InputManager.cpp | 7 |
2 files changed, 7 insertions, 1 deletions
diff --git a/src/config/ConfigManager.cpp b/src/config/ConfigManager.cpp index da954cf9..1d8dbd2d 100644 --- a/src/config/ConfigManager.cpp +++ b/src/config/ConfigManager.cpp @@ -146,6 +146,7 @@ void CConfigManager::setDefaultVars() { configValues["input:touchpad:middle_button_emulation"].intValue = 0; configValues["input:touchpad:tap-to-click"].intValue = 1; configValues["input:touchpad:drag_lock"].intValue = 0; + configValues["input:touchpad:scroll_factor"].floatValue = 1.f; configValues["binds:pass_mouse_when_bound"].intValue = 0; configValues["binds:scroll_event_delay"].intValue = 300; diff --git a/src/managers/input/InputManager.cpp b/src/managers/input/InputManager.cpp index ae895833..6060a9cf 100644 --- a/src/managers/input/InputManager.cpp +++ b/src/managers/input/InputManager.cpp @@ -435,12 +435,17 @@ void CInputManager::processMouseDownKill(wlr_pointer_button_event* e) { } void CInputManager::onMouseWheel(wlr_pointer_axis_event* e) { + static auto *const PSCROLLFACTOR = &g_pConfigManager->getConfigValuePtr("input:touchpad:scroll_factor")->floatValue; + + auto factor = (*PSCROLLFACTOR <= 0.f || e->source != WLR_AXIS_SOURCE_FINGER ? 1.f : *PSCROLLFACTOR); + bool passEvent = g_pKeybindManager->onAxisEvent(e); wlr_idle_notify_activity(g_pCompositor->m_sWLRIdle, g_pCompositor->m_sSeat.seat); if (passEvent) { - wlr_seat_pointer_notify_axis(g_pCompositor->m_sSeat.seat, e->time_msec, e->orientation, e->delta, e->delta_discrete, e->source); + wlr_seat_pointer_notify_axis(g_pCompositor->m_sSeat.seat, e->time_msec, e->orientation, factor * e->delta, + std::round(factor * e->delta_discrete), e->source); } } |
