-
Notifications
You must be signed in to change notification settings - Fork 891
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
Horizontal scrolling backwards on mac #1695
Comments
One thing which would help me debug, would be if someone running Wayland with PixelOffset scrolling (I think most modern trackpads will use PixelOffset on Linux?), could try my debug branch here: https://github.com/michaelkirk/winit/tree/mkirk/h-scroll Steps to help debug:
Then:
|
There's no |
Sorry, I meant to say PixelDelta, not PixelOffset. I've updated the issue to avoid confusing other people. e.g. you can see PixelDelta being used (e.g.) here: https://github.com/rust-windowing/winit/blob/master/src/platform_impl/macos/view.rs#L1009 |
Thanks for checking! That sounds consistent with macos - meaning that, compared to LineDelta's, the signs match for vertical scrolling, but are opposite for horizontal scrolling. ... that seems kind of wild, but maybe there's a reason for it that I don't understand. |
I could test X11's PixelDelta as well. I guess the no one was able to test LineDelta for Also, have you verified in your vms to which direction scrolling is done in some gui applications with horizontal scrolling? |
I'm pretty sure this is intended? macOS scrolling is the exact opposite of scrolling on other platforms with the touchpad. That should be the case for all applications. |
There is no PixelDelta in the X11 platform_impl. From what I can see everything for X11 is done with LineDelta.
Yeah - the VM is a potentially confounding factor, but it seems to be behaving as expected. For example swiping from right to left in firefox in the VM moves the scroll bar to the right (same as in native macos). This behavior is the same when launching the desktop in both X11 and Wayland modes. |
That doesn't seem to fit what I've described nor what kchibisov reported. It seems like the difference has to do with PixelDelta vs LineDelta, not linux vs mac. |
Also, to be clear @chrisduerr - I'm not simply talking about "natural scrolling" vs "reverse scrolling", which is a user configurable preference. |
Just fyi, swiping from right to left in firefox natively on a touch pad moves the scrollbar to the left, which is expected. on macOS you have natural scrolling by default, I'm afraid that your tests in a vm could be incorrect? Also, is vertical scrolling in a vm also the same as on macOS(means natural)? |
Heh - I was just digging into this a bit more. It seems that the "natural" scroll behavior is inherited by the VM. So... to get "reverse" (as opposed to "natural") scrolling I have to either configure "reverse" scrolling in my host (leaving my vm at "reverse"), or set both my vm and my host to "natural" which is like a double negation. 🙃 But still, though that's confusing, I think my question remains and is best exemplified by the fact that vertical scrolling behaves as expected, while horizontal (and only horizontal) is reversed when talking about units of PixelDelta vs LineDelta. Natural vs. Reverse scrolling should not affect that, as it affects both axes equally. Right? |
Could you disable natural scrolling in macOS and retest please? |
With default (Natural) scrolling on macos (host)
With Natural scrolling disabled on macos (host)Same results - but everything flipped from positive to negative.
So horizontal vs. vertical is still not symmetrical with what I was expecting.
Is swiping from bottom to top of the track pad positive or negative on Wayland+PixelDelta? As an aside, do you know how you're inducing PixelDelta as opposed to LineDelta on wayland? I'm only getting LineDelta on Wayland, but presumed it's because the VM is mapping the mouse input that way. |
I'm testing on a touchpad. So, from what I can see macOS needs
yes, we explicitly invert it to be like that. |
Sorry to be a pain - is it positive or is it negative? |
positive |
Excellent. That was the missing piece of information for me.
PR forthcoming! |
…orms. FIXES rust-windowing#1695 Note: This isn't just confusion around "natural" vs "reverse" scrolling. These were already behaving correctly for vertical scrolling. Only Horizontal scrolling was inverted. Unlike vertical scrolling, did not mirror winit's output for other platforms.
Thanks for your help @kchibisov. PR at #1696 Time spent researching and documenting was about 1000x more than the actual fix. 😅 |
In winit the swipe from left to right on touchpad should generate positive horizontal delta change, however on macOS it was the other way around without natural scrolling. This commit inverses the horizontal scrolling delta in 'MouseScrollDelta' events to match other platforms. Fixes #1695.
Thanks @kchibisov! |
My application has vertical scrolling working well, but horizontal scrolling is backwards for macos. I'm not 100% sure that this is a bug winit, but here's what I know:
There are two kinds of MouseScrollDelta: LineDelta and PixelDelta. Which one is used depends on some combination of the platform and device.
For vertical scrolling, the sign of macos's PixelDelta matches the sign of wayland and x11's LineDelta.
For horizontal scrolling, the sign of macos's PixelDelta is opposite the sign of wayland and x11's LineDelta.
More specifically:
macos (uses PixelDelta):
negative: swipe up, swipe left (scrollbar moves down, right, respectively - aka "natural scrolling")
positive: swipe down, swipe right (scrollbar moves up, left, respectively - aka "natural scrolling")
linux-x11 (via Parallels VM on same mac) (uses LineDelta):
negative: swipe up, swipe right
positive: swipe down swipe left
linux-wayland (via Parallels VM on same mac) (uses LineDelta):
negative: swipe up, swipe right
positive: swipe down swipe left
It seems like two possibilities:
-or-
* -1.0
the horizontal PixelDelta to be consistent with other platforms.The text was updated successfully, but these errors were encountered: