mirror of
https://github.com/hyprwm/Hyprland
synced 2024-11-29 16:26:00 +01:00
Merge pull request #801 from fufexan/scrollfactor
Add input:touchpad:scroll_factor
This commit is contained in:
commit
c4487534d2
2 changed files with 7 additions and 1 deletions
|
@ -146,6 +146,7 @@ void CConfigManager::setDefaultVars() {
|
||||||
configValues["input:touchpad:middle_button_emulation"].intValue = 0;
|
configValues["input:touchpad:middle_button_emulation"].intValue = 0;
|
||||||
configValues["input:touchpad:tap-to-click"].intValue = 1;
|
configValues["input:touchpad:tap-to-click"].intValue = 1;
|
||||||
configValues["input:touchpad:drag_lock"].intValue = 0;
|
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:pass_mouse_when_bound"].intValue = 0;
|
||||||
configValues["binds:scroll_event_delay"].intValue = 300;
|
configValues["binds:scroll_event_delay"].intValue = 300;
|
||||||
|
|
|
@ -435,12 +435,17 @@ void CInputManager::processMouseDownKill(wlr_pointer_button_event* e) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void CInputManager::onMouseWheel(wlr_pointer_axis_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);
|
bool passEvent = g_pKeybindManager->onAxisEvent(e);
|
||||||
|
|
||||||
wlr_idle_notify_activity(g_pCompositor->m_sWLRIdle, g_pCompositor->m_sSeat.seat);
|
wlr_idle_notify_activity(g_pCompositor->m_sWLRIdle, g_pCompositor->m_sSeat.seat);
|
||||||
|
|
||||||
if (passEvent) {
|
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);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue