input: fix kinetic scroll (#13233)

This commit is contained in:
bea4dev 2026-02-10 23:51:51 +09:00 committed by GitHub
parent f16ebef003
commit 171ad7d338
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 21 additions and 1 deletions

View file

@ -952,6 +952,22 @@ void CInputManager::onMouseWheel(IPointer::SAxisEvent e, SP<IPointer> pointer) {
int32_t deltaDiscrete = std::abs(discrete) != 0 && std::abs(discrete) < 1 ? std::copysign(1, discrete) : std::round(discrete);
g_pSeatManager->sendPointerAxis(e.timeMs, e.axis, delta, deltaDiscrete, value120, e.source, WL_POINTER_AXIS_RELATIVE_DIRECTION_IDENTICAL);
const bool deferPointerFrame = e.source == WL_POINTER_AXIS_SOURCE_FINGER || e.source == WL_POINTER_AXIS_SOURCE_CONTINUOUS;
if (deferPointerFrame) {
m_pointerAxisFramePending = true;
return;
}
m_pointerAxisFramePending = false;
g_pSeatManager->sendPointerFrame();
}
void CInputManager::onPointerFrame() {
if (!m_pointerAxisFramePending)
return;
m_pointerAxisFramePending = false;
g_pSeatManager->sendPointerFrame();
}

View file

@ -91,6 +91,7 @@ class CInputManager {
void onMouseWarp(IPointer::SMotionAbsoluteEvent);
void onMouseButton(IPointer::SButtonEvent);
void onMouseWheel(IPointer::SAxisEvent, SP<IPointer> pointer = nullptr);
void onPointerFrame();
void onKeyboardKey(const IKeyboard::SKeyEvent&, SP<IKeyboard>);
void onKeyboardMod(SP<IKeyboard>);
@ -299,6 +300,7 @@ class CInputManager {
uint32_t lastEventTime = 0;
uint32_t accumulatedScroll = 0;
} m_scrollWheelState;
bool m_pointerAxisFramePending = false;
bool shareKeyFromAllKBs(uint32_t key, bool pressed);
uint32_t shareModsFromAllKBs(uint32_t depressed);