winit icon indicating copy to clipboard operation
winit copied to clipboard

Account for mouse wheel speed settings on Windows

Open Legend-Master opened this issue 8 months ago • 10 comments

  • [x] Tested on all platforms changed
  • [x] Added an entry to the changelog module if knowledge of this change could be valuable to users
  • [x] Updated documentation to reflect any user-facing changes, including notes of platform-specific behavior
  • [x] Created or updated an example program if it would help users understand this functionality

Fix WindowEvent::MouseWheel doesn't account for mouse wheel speed settings

Reference docs: https://learn.microsoft.com/en-us/windows/win32/inputdev/about-mouse-input#determining-the-number-of-scroll-lines Reference tao PR: https://github.com/tauri-apps/tao/pull/1119

Legend-Master avatar Jun 04 '25 07:06 Legend-Master

Is it something that should be done unconditionally.

For the context. We have in alacritty a setting to adjust that as well, and I'm pretty sure that it'll just start multiplying. Maybe that should be as an option, so users can opt out, and thus can deal with precise by line scrolling if they need to?

kchibisov avatar Jun 07 '25 07:06 kchibisov

I'm fine with making this optional, where do you think I should put the option at and do you think this should be opt-in or opt-out?

Legend-Master avatar Jun 07 '25 08:06 Legend-Master

I'm fine with making this optional, where do you think I should put the option at and do you think this should be opt-in or opt-out?

maybe a method on the ActiveEventLoop for windows to toggle the behavior?

kchibisov avatar Jun 08 '25 12:06 kchibisov

Since this can be toggled per window, should we put this in WindowExtWindows or go with a new trait ActiveEventLoopExtWindows?

Legend-Master avatar Jun 08 '25 14:06 Legend-Master

I'm not sure it really matters for per-window level if you can not focus more than one window at the time. Generally could be fine.

kchibisov avatar Jun 08 '25 23:06 kchibisov

I think there might be cases where only some windows will need to get the wheel data without the system settings, so have gone ahead and pushed it to WindowExtWindows

Legend-Master avatar Jun 09 '25 03:06 Legend-Master

No, I mean, only a single window can receive input at a time, so you can adjust the behavior on focus change.

kchibisov avatar Jun 09 '25 04:06 kchibisov

Yeah, I get what you meant, but that's a bit tedious to use, no? 🙃 (also I believe you can scroll on non focused windows with a system setting that is on by default)

Legend-Master avatar Jun 09 '25 04:06 Legend-Master

Yeah, I get what you meant, but that's a bit tedious to use, no? 🙃 (also I believe you can scroll on non focused windows with a system setting that is on by default)

I meant pointer focus here, it's a separate thing.

kchibisov avatar Jun 09 '25 04:06 kchibisov

I meant pointer focus here, it's a separate thing.

Ah, right right, makes sense then

I'd probably also add a window attributes method then.

Added

Legend-Master avatar Jun 09 '25 04:06 Legend-Master