Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion src/managers/PointerManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -935,10 +935,11 @@ void CPointerManager::attachPointer(SP<IPointer> pointer) {
PROTO::idle->onActivity();
});

listener->axis = pointer->m_pointerEvents.axis.listen([weak = WP<IPointer>(pointer)](const IPointer::SAxisEvent& event) {
listener->axis = pointer->m_pointerEvents.axis.listen([weak = WP<IPointer>(pointer)](const IPointer::SAxisEvent& event) {
g_pInputManager->onMouseWheel(event, weak.lock());
PROTO::idle->onActivity();
});
listener->frame = pointer->m_pointerEvents.frame.listen([] { g_pInputManager->onPointerFrame(); });

listener->swipeBegin = pointer->m_pointerEvents.swipeBegin.listen([](const IPointer::SSwipeBeginEvent& event) {
g_pInputManager->onSwipeBegin(event);
Expand Down
1 change: 1 addition & 0 deletions src/managers/PointerManager.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,7 @@ class CPointerManager {
CHyprSignalListener motionAbsolute;
CHyprSignalListener button;
CHyprSignalListener axis;
CHyprSignalListener frame;

CHyprSignalListener swipeBegin;
CHyprSignalListener swipeEnd;
Expand Down
16 changes: 16 additions & 0 deletions src/managers/input/InputManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}

Expand Down
2 changes: 2 additions & 0 deletions src/managers/input/InputManager.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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>);

Expand Down Expand Up @@ -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);
Expand Down
Loading