Skip to content

Conversation

@glempi
Copy link

@glempi glempi commented Nov 5, 2023

*fix using scroll delta instead axis code
*fix lost registering low res axis if it will be used *fix duplicate inverting direction of delta
*make scroll behavior more responsive
*fix and imprv logging

*fix using scroll delta instead axis code
*fix lost registering low res axis if it will be used
*fix duplicate inverting direction of delta
*make scroll behavior more responsive
*fix and imprv logging
@markmb88
Copy link

Seems to have fixed the issue where my MX Master 3's scroll wheel would suddenly become unresponsive. Thank you.

@FraCata00
Copy link

Sorry, is possible to merge this PR?
Seems it fix #427 and #370 and also issue for MX Master 2S (in my case)

if (!_input_axis.has_value())
return;


Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What are these blank new lines for? 🤔

Here, and in lines 96, 135, etc.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The God told me put this line here 🤣. Actually i don't have a plan to make stylish fixes after 3 years

Copy link
Author

@glempi glempi Jan 21, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

anyway without this PR wheel scrolling logic of logiops still is broken and do not work correct

Comment on lines +124 to +126
if (lowres_movement == 0) {
lowres_movement = hires_remainder > 0 ? 1 : -1;
}

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code style changes like these introduce unnecessary noise in the diff. I'd recommend removing them and keeping the diff focused on the actual behavior changes.

@glempi
Copy link
Author

glempi commented Jan 21, 2026

@PixlOne some reasons to merge this PR
https://github.com/copilot/share/4a7c03a2-0020-8437-b000-bc4c64eb602f

Detailed Changes in PR #413

This PR modifies 2 files in the src/logid/actions/gesture/ directory:


1. AxisGesture.cpp (+35/-10 lines)

Fix 1: Correct axis code usage in getLowResAxis() call

// BEFORE (line ~88): Incorrectly passing scroll delta value
int low_res_axis = InputDevice::getLowResAxis(axis);

// AFTER:  Correctly passing the input axis code
int low_res_axis = InputDevice::getLowResAxis(_input_axis.value());

Impact: The axis parameter is a delta value (movement amount), not an axis code. The function getLowResAxis() expects an axis code (like REL_WHEEL_HI_RES) to return its low-resolution counterpart (like REL_WHEEL). This was causing incorrect axis mapping.


Fix 2: Register low-res axis when needed

A new helper method registerAxis() was added:

void AxisGesture::registerAxis(uint axis) {
    _device->virtualInput()->registerAxis(axis);
    int low_res_axis = InputDevice::getLowResAxis(axis);
    if (low_res_axis != -1) {
        _device->virtualInput()->registerAxis(low_res_axis);
    }
}

Impact: Previously, only the high-resolution axis was registered. Now, if a low-res axis exists, it's also registered with the virtual input device. This fixes missing low-res scroll events.


Fix 3: Remove duplicate direction inversion

// REMOVED these lines: 
if (negative_multiplier)
    move_floor = -move_floor;

Impact: The direction was being inverted twice—once here and again later in the logic. Removing this prevents the scroll direction from being incorrectly flipped.


Fix 4: Make scroll more responsive

// BEFORE:  Required 60 units before triggering low-res event
if (abs(hires_remainder) >= 60) {

// AFTER: Triggers immediately with any movement
if (abs(hires_remainder) >= 1) {

Impact: The threshold was too high (60), causing noticeable lag before low-resolution scroll events fired. Changing to >= 1 makes scrolling feel more immediate.


Fix 5: Prevent wrong-direction low-res movements

New logic added to prevent low-res movements in the wrong direction:

if ((lowres_movement > 0 && negative_multiplier) ||
    (lowres_movement < 0 && !negative_multiplier))
{
    lowres_movement = 0;
}

Impact: Ensures low-resolution scroll events don't fire in the opposite direction of the actual scroll.


Fix 6: Improved logging

Added detailed debug logging:

// Added INFO log when axis is registered
logPrintf(INFO, "axis %d %s", _input_axis, axis. c_str());

// Fixed missing format argument
logPrintf(WARN, "Invalid axis %s.", axis.c_str());  // was missing axis. c_str()

// Added RAWREPORT logging for press events
logPrintf(RAWREPORT, "press %d %d\n", _axis, init_threshold);

// Added detailed RAWREPORT logging for move events
logPrintf(RAWREPORT, "move %ld [%.2f], l_mv:%d h_mv:%d code:%d/%d;"
       " axis %d/%d; new_axis %d; hires_rem %d th %d neg %d mv %.1f\n", ... );

2. AxisGesture.h (+3 lines)

Added the new protected helper method declaration:

protected:
    void registerAxis(uint axis);

Summary Table

Fix Issue Solution
1 Wrong value passed to getLowResAxis() Use _input_axis.value() instead of axis
2 Low-res axis not registered New registerAxis() method registers both axes
3 Direction inverted twice Removed redundant inversion
4 Scroll feels laggy Lowered threshold from 60 to 1
5 Wrong-direction events Added direction validation check
6 Poor debugging info Added comprehensive logging

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants