abstreet icon indicating copy to clipboard operation
abstreet copied to clipboard

Adapt to reversed horizontal scrolling in winit

Open michaelkirk opened this issue 2 years ago • 8 comments

https://github.com/rust-windowing/winit/pull/2105 reverses the direction of horizontal scrolling in winit for windows and mac platforms.

Since horizontal scrolling is already working the way we want on mac (and I'm assuming windows), we need to invert our own semantics.

The big mystery for me though, is that I'd expect this change to break horizontal scrolling for us on Linux, unless horizontal scrolling has been backwards for us on Linux all along...

@dabreegster - can you verify that this makes sense on Linux?

Also, do we have any native windows users?

michaelkirk avatar Jan 03 '22 21:01 michaelkirk

This should be changed as well, right?

Indeed! I didn't even know we had that feature.

michaelkirk avatar Jan 03 '22 21:01 michaelkirk

Thanks for taking charge on this one!

I'd expect this change to break horizontal scrolling for us on Linux

It does break. If I revert the change in panel.rs but keep the new winit, it's fine.

Also, do we have any native windows users?

@crschmidt, would you mind trying this out?

dabreegster avatar Jan 03 '22 22:01 dabreegster

It does break. If I revert the change in panel.rs but keep the new winit, it's fine.

Just to be sure - can you compare it to some horizontal scrolling in the egui example: https://emilk.github.io/egui/index.html

Open the "Code Example" widget, shrink it narrow so that the h-scroll bar appears.

Does the horizontal scrolling in that egui example behave the same or differently to what you experience after this PR?

michaelkirk avatar Jan 03 '22 22:01 michaelkirk

Does the horizontal scrolling in that egui example behave the same or differently to what you experience after this PR?

Good to clarify what "break" means! Differently. If I revert just the panel.rs change, then it matches the behavior of this egui demo

dabreegster avatar Jan 03 '22 22:01 dabreegster

Wild... so I'm still super confused.

Can you check with the winit mouse wheel demo from that PR?

https://github.com/rust-windowing/winit/pull/2105/files#diff-eb4fa6488df9bb4f580210196e306bc6538baae95cabc26569e7b89f62766a33

cargo run --example mouse_wheel

BTW, I had to apply this patch to get winit's example/mouse_wheel to run, I'm not sure if it's a aarch64 thing or what
--- a/examples/mouse_wheel.rs
+++ b/examples/mouse_wheel.rs
@@ -6,7 +6,9 @@ use winit::{
 };
 
 fn main() {
-    SimpleLogger::new().init().unwrap();
+    SimpleLogger::new()
+        .with_utc_timestamps()
+        .init().unwrap();

With your cursor over the window swipe right, down, left, up. The window should follow your movements - e.g. when you swipe right, the window should move to the right.

And also positive values should be logged when you swipe down or right.

Negative values should be logged when you swipe up or left.

michaelkirk avatar Jan 03 '22 23:01 michaelkirk

Can you check with the winit mouse wheel demo from that PR?

I'm not in a rush, but just wanted to make sure you knew this was directed at you @dabreegster

michaelkirk avatar Jan 12 '22 17:01 michaelkirk

It's in my TODO list, work stuff keeps knocking it loose -- let me promise "by tonight." Sorry for the delay...

dabreegster avatar Jan 12 '22 17:01 dabreegster

With that PR, here are my results:

  • swiping right: window right, positive delta
  • swiping left: window left, negative delta
  • swiping up: window down, positive delta
  • swiping down: window up, negative delta

So left/right behavior is correct, up/down is backwards. I toggled Ubuntu's "natural scroll" setting, but it didn't affect this demo

dabreegster avatar Jan 12 '22 22:01 dabreegster