Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Swapping mouse scroll wheel actions causes lag to scrolling #184

Closed
playfriik opened this issue Nov 15, 2024 · 7 comments
Closed

Swapping mouse scroll wheel actions causes lag to scrolling #184

playfriik opened this issue Nov 15, 2024 · 7 comments

Comments

@playfriik
Copy link

playfriik commented Nov 15, 2024

Hi! First of all I want to thank you for such a polished software.

It has been very intutitive to configure and use to map my keyboard on Windows to be closely matching Mac keyboard layout.

I was thinking about swapping the mouse scroll wheel up and down actions with keymapper also, but this seems to be adding significant lag/delay to scroll actions when inverting/swapping the actions with keymapper.
It seems as if the original action doesn't get canceled because with my WheelUp >> WheelDown remap, I sometimes see it slightly scroll up.

@playfriik playfriik changed the title Swapping mouse scroll wheel actions causes lag? Swapping mouse scroll wheel actions causes lag to scrolling Nov 15, 2024
@houmain
Copy link
Owner

houmain commented Nov 16, 2024

Thank you very much for your kind words!

I also noticed this. But I do not know the reason yet.

@houmain
Copy link
Owner

houmain commented Nov 24, 2024

This should work now much better with the 4.9.1 release.

Unfortunately I noticed, that some applications (like Firefox, Edge, VSCode, Explorer) resist any mouse wheel mapping (buttons work!). I am afraid, there is nothing I can do about that. Fortunately there are ways to achieve that by other means.

@playfriik
Copy link
Author

playfriik commented Nov 24, 2024

Thank you for so quickly working on the issue!

It is surprising to hear that mouse wheel mapping didn't work for you in those applications as it is working for me. Could it be depending on the configuration? My configuration as a reference:

Alt                         >> Control
ButtonForward               >> Meta{Tab}
Control                     >> Meta
Meta                        >> AltLeft
PrintScreen                 >> AltRight
WheelDown                   >> WheelUp
WheelUp                     >> WheelDown
 
[stage]
 
[modifier = "Control Shift"]
ArrowLeft                   >> !Any Shift{Home}
ArrowRight                  >> !Any Shift{End}
 
[modifier = "Alt Shift"]
ArrowLeft                   >> !Any Control{Shift{ArrowLeft}}
ArrowRight                  >> !Any Control{Shift{ArrowRight}}
 
[default]
@forward-modifiers Control
 
Alt{ArrowLeft}              >> Control{ArrowLeft}
Alt{ArrowRight}             >> Control{ArrowRight}
Alt{IntlBackslash}          >> '|'
 
Control{ArrowLeft}          >> Home
Control{ArrowRight}         >> End

It definitely is better now, but unfortunately the scrolling sometimes still experiences a delay/lag. However I completely understand if this issue is not a high priority for you and I can go a head with another approach.

Edit: video of how it looks like: https://youtube.com/shorts/l2MOqi9Z9q0

Edit 2: another video demonstrating that not only the scrolling is delayed, but mouse input in general gets laggy: https://youtube.com/shorts/DlCFBNRkjV8

@playfriik
Copy link
Author

I have investigated it myself also and it seems like the SendInput method is "getting throttled" by Windows if gets executed too much. What's interesting is that there is significant difference when I move mouse around while scrolling (a lot more responsive) vs. keeping mouse still while scrolling (lagging almost immediately if scrolling rapidly).

The Interception driver seems to have basically native performance in this regard, but keymapper is not including mouse events when in "Interception driver mode"?

Also found an interesting post on Microsoft Learn Q&A, where one person had similar lag issue using SendInput (though for middle mouse button down/up events) and was seemingly able to solve it: https://learn.microsoft.com/en-us/answers/questions/255509/send-mouse-wheel-click-properly-(sendinput-mouseev

@houmain
Copy link
Owner

houmain commented Dec 2, 2024

Thanks for your investigations! I will think about it and try to further improve the performance.
But for now you might want to try the last commit, which adds the Interception driver support also for the mouse.

@playfriik
Copy link
Author

playfriik commented Dec 3, 2024

@houmain Thank you very much, I will try it out!

In the meantime I have also found out some new interesting things: for keyboard inputs the dwExtraInfo always has correct information and injected variable gets its value correctly on every single remap.

However, on mouse inputs it seems like the information on dwExtraInfo is very randomly (for example scrolling without moving mouse sometimes has it, sometimes don't) getting lost sometimes (while the remap itself is retained correctly), and the hiccup occurs only when the information has been "lost".

@houmain
Copy link
Owner

houmain commented Feb 14, 2025

I tried to improve this, but I am afraid there is no good solution on Windows.
Intercepting wheel events and sending other wheel events always resulted in jagged movement and audible beeps, even when accumulating events and sending only a fraction.
Even if that worked, there would still be no way to forward high-resolution wheel deltas. To get these, one has to listen to RAW input events, but these are only available when the event was not intercepted by the hook.

So, very likely the only way to get this working properly is by using the Interception driver.

@houmain houmain closed this as not planned Won't fix, can't repro, duplicate, stale Feb 14, 2025
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

No branches or pull requests

2 participants