summaryrefslogtreecommitdiff
path: root/src/managers/input/InputManager.cpp
diff options
context:
space:
mode:
authorAgent00Ming <107314235+Agent00Ming@users.noreply.github.com>2024-06-03 16:47:02 -0400
committerGitHub <noreply@github.com>2024-06-03 22:47:02 +0200
commitd0a224a4915b5a90555818ed3f9e49e1a61b7cdb (patch)
treed128a4d527f6602bba8fe34f500a1fce610ea446 /src/managers/input/InputManager.cpp
parent5517cc506b2754cb2485b1bf3e46918ee638ea6d (diff)
seat: discrete round away from zero + high res scrolling (#6317)
* Discrete scrolling round away from zero e.deltaDiscrete can be multiples of 30 instead of the usual 120 causing the rounded value to be 0 when too small causing erratic scrolling. * Send value120 alongside discrete Fixes sensitivity issues for clients that support value120 axis events
Diffstat (limited to 'src/managers/input/InputManager.cpp')
-rw-r--r--src/managers/input/InputManager.cpp6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/managers/input/InputManager.cpp b/src/managers/input/InputManager.cpp
index 5a7688cd..27d04699 100644
--- a/src/managers/input/InputManager.cpp
+++ b/src/managers/input/InputManager.cpp
@@ -1,6 +1,7 @@
#include "InputManager.hpp"
#include "../../Compositor.hpp"
#include "wlr/types/wlr_switch.h"
+#include <cstdint>
#include <ranges>
#include "../../config/ConfigValue.hpp"
#include "../../desktop/Window.hpp"
@@ -782,8 +783,9 @@ void CInputManager::onMouseWheel(IPointer::SAxisEvent e) {
}
}
}
-
- g_pSeatManager->sendPointerAxis(e.timeMs, e.axis, factor * e.delta, std::round(factor * e.deltaDiscrete / 120), e.source, WL_POINTER_AXIS_RELATIVE_DIRECTION_IDENTICAL);
+ double deltaDiscrete = factor * e.deltaDiscrete / std::abs(e.deltaDiscrete);
+ g_pSeatManager->sendPointerAxis(e.timeMs, e.axis, factor * e.delta, deltaDiscrete > 0 ? std::ceil(deltaDiscrete) : std::floor(deltaDiscrete),
+ std::round(factor * e.deltaDiscrete), e.source, WL_POINTER_AXIS_RELATIVE_DIRECTION_IDENTICAL);
}
Vector2D CInputManager::getMouseCoordsInternal() {