-
-
Notifications
You must be signed in to change notification settings - Fork 10.9k
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
Support smooth scrolling on notebook touchpads. #3369
Conversation
In bash, the variable is set using "export".
Document how to set environment variables from the terminal for bash, cmd and PowerShell.
// up is positive | ||
vscroll = CLAMP(event->preciseY, -1.0f, 1.0f); | ||
} else { | ||
hscroll = CLAMP(-event->x, -1, 1); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nowadays the horizontal scrolling is actually inverted, so negated x
and preciseX
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmmm, looks suspicious. See #966 (comment)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have seen that issue before, but this also happens to mouses with horizontal scrolling wheels.
Windows also has a touchpad scrolling direction setting, but whatever it was set, vertical scrolling is always correct and horizontal scrolling is always inverted.
I will test on a mac tomorrow.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Confirmed it's also inverted on macOS when using a mouse. My mac doesn't has touchpad so can't test that.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I won't be with my mac until Friday, will try that later.
Since SDL 2.0.18, the amount scrolled horizontally or vertically is exposed as a float (between 0 and 1). XX DO NOT MERGE (YET) XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX Remaining problem (?) before merging: the x and y value are clamped to [0; 1], so if on some platforms a scroll event could be triggered with a value greater than 1 or lower than -1, it is not forwarded correctly anymore (this is the case both for the int or float versions). XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX Refs <https://wiki.libsdl.org/SDL_MouseWheelEvent> Fixes #3363 <#3363> PR #3369 <#3369> Signed-off-by: Romain Vimont <[email protected]>
Since SDL 2.0.18, the amount scrolled horizontally or vertically is exposed as a float (between 0 and 1). Forward a precise value to the Android device when possible. Refs <https://wiki.libsdl.org/SDL_MouseWheelEvent> Fixes #3363 <#3363> PR #3369 <#3369> Signed-off-by: Romain Vimont <[email protected]>
Thank you 👍 (and sorry for the delay). I rebased on
I was first annoyed by the I could not test since on my computer, only -1 or +1 values are generated. Please review and test this branch: |
Since SDL 2.0.18, the amount scrolled horizontally or vertically is exposed as a float (between 0 and 1). Forward a precise value to the Android device when possible. Refs <https://wiki.libsdl.org/SDL_MouseWheelEvent> Fixes #3363 <#3363> PR #3369 <#3369> Signed-off-by: Romain Vimont <[email protected]>
I changed to encode as a signed integer (with a more natural two's complement):
I added the necessary util functions and unit tests beforehand, then adapted your commit to use them. Please review and test Thank you 😉 |
@yume-chan Did you have a change to test/review? (It's not urgent) |
Sorry, I'm still busy working on another project. I always have this on my todo list and will report back once that's finished. |
Since SDL 2.0.18, the amount scrolled horizontally or vertically is exposed as a float (between 0 and 1). Forward a precise value to the Android device when possible. Refs <https://wiki.libsdl.org/SDL_MouseWheelEvent> Fixes #3363 <#3363> PR #3369 <#3369> Signed-off-by: Romain Vimont <[email protected]>
I merged into |
This works great on my Mac, both with touchpad and mouse. The version should probably be bumped, because of the incompatible server/client.
(with the number varying for different runs) and then Also, had to change
|
@metayan Thanks for the verification! In addition, can you verify does horizontal scrolling works (not flipped) on both touchpad and mouse (if you have a mouse with horizonal scroll wheel)? You can open the browser app on your phone and pinch out to zoom in, then scroll horizontally.
It will, when the new version is released.
That's expected. The packet size changed, so after one mismatched packet, the whole stream becomes out of sync.
This looks unrelated to this PR, maybe you want to open a new issue for further investigation. |
It is "flipped" on the touchpad. I don't have a mouse with horizontal scroll wheel.
Might be an idea to bump it immediately when changing the protocol, so anyone building from source will notice the mismatch right away. Your choice, of course. ;)
Seems so. Will do. |
Fixes #3363
HID mode doesn't support this smooth scrolling, because sending fractional scrolling distance over standard HID mouse protocol seems complicated. I may investigate more in the future (plus horizontal scrolling support).
Only tested on Windows with both mouse and touchpad.