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

Fix for mouse wheel not working on Wayland #77

Closed
wants to merge 1 commit into from

Conversation

godrja
Copy link

@godrja godrja commented Feb 5, 2025

Current code was assuming that the mouse wheel events always come in increments of 120, thus ignoring everything that is less than that. On Wayland mouse wheel events send values of -1, 0, and +1, and therefore mouse wheel didn't work at all. This fix should function correctly on both Windows and Linux with Wayland. I don't have Windows so I haven't tested it so it would be nice if someone else could confirm that it still works there.

The code could also be potentially improved for Windows. On Windows Mouse.getEventDWheel() could return a value that should be interpreted as multiple mouse wheel movements in a single event.
https://learn.microsoft.com/en-us/dotnet/api/system.windows.forms.control.mousewheel?view=windowsdesktop-9.0#remarks

Current code was assuming that the mouse wheel events always come in
increments of 120, thus ignoring everything that is less than that.
On Wayland mouse wheel events send values of -1, 0, and +1, and therefore
mouse wheel didn't work at all. This fix should function correctly on
both Windows and Linux with Wayland.

The code could also be potentially improved for Windows. On Windows
Mouse.getEventDWheel() could return a value that should be interpreted as
multiple mouse wheel movements in a single event.
https://learn.microsoft.com/en-us/dotnet/api/system.windows.forms.control.mousewheel?view=windowsdesktop-9.0#remarks
@godrja godrja closed this Feb 8, 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

Successfully merging this pull request may close these issues.

1 participant