winit icon indicating copy to clipboard operation
winit copied to clipboard

On macOS, holding shift while scrolling a three-button mouse results in horizontal scrolling...

Open fu5ha opened this issue 1 year ago • 4 comments

... which is usually the desired behavior (this is a macOS thing, not a winit thing), however it's inconvenient for things like games. I'm not sure what the best solution for this is. It would be really nice to be able to use some sort of "raw" flag which would disable this behavior, maybe by overriding the scroll event method or something? I spent a little bit of time looking into it, but these sort of low level macOS things are a bit over my head at the moment, especially when doing them from Rust 😅

Alternatively, it would maybe be possible to use some sort of device info query to detect when this should be overriden either by winit or in a client application, but I'm not sure how to turn a DeviceId into something I could use to query that info or vice-versa.

fu5ha avatar Jul 22 '22 12:07 fu5ha

Can you share some debug prints of the problematic events?

maroider avatar Jul 22 '22 12:07 maroider

DEBUG ark_client::window                       > MouseWheel { device_id: DeviceId(DeviceId), delta: LineDelta(0.0, -0.1000061), phase: Moved, modifiers: (empty) }
DEBUG ark_client::window                       > MouseWheel { device_id: DeviceId(DeviceId), delta: LineDelta(0.0, 0.1000061), phase: Moved, modifiers: (empty) }
DEBUG ark_client::window                       > MouseWheel { device_id: DeviceId(DeviceId), delta: LineDelta(0.0, -0.1000061), phase: Moved, modifiers: (empty) }
DEBUG ark_client::window                       > MouseWheel { device_id: DeviceId(DeviceId), delta: LineDelta(0.0, 0.1000061), phase: Moved, modifiers: (empty) }
DEBUG ark_client::window                       > MouseWheel { device_id: DeviceId(DeviceId), delta: LineDelta(0.0, -0.1000061), phase: Moved, modifiers: (empty) }
DEBUG ark_client::window                       > MouseWheel { device_id: DeviceId(DeviceId), delta: LineDelta(0.0, -0.1000061), phase: Moved, modifiers: (empty) }
DEBUG ark_client::window                       > MouseWheel { device_id: DeviceId(DeviceId), delta: LineDelta(0.0, -0.1000061), phase: Moved, modifiers: (empty) }
DEBUG ark_client::window                       > MouseWheel { device_id: DeviceId(DeviceId), delta: LineDelta(0.0, -0.1000061), phase: Moved, modifiers: (empty) }
DEBUG ark_client::window                       > MouseWheel { device_id: DeviceId(DeviceId), delta: LineDelta(0.0, -0.1000061), phase: Moved, modifiers: (empty) }
DEBUG ark_client::window                       > MouseWheel { device_id: DeviceId(DeviceId), delta: LineDelta(1.0, 0.0), phase: Moved, modifiers: SHIFT }
DEBUG ark_client::window                       > MouseWheel { device_id: DeviceId(DeviceId), delta: LineDelta(1.0, 0.0), phase: Moved, modifiers: SHIFT }
DEBUG ark_client::window                       > MouseWheel { device_id: DeviceId(DeviceId), delta: LineDelta(1.0, 0.0), phase: Moved, modifiers: SHIFT }
DEBUG ark_client::window                       > MouseWheel { device_id: DeviceId(DeviceId), delta: LineDelta(1.0, 0.0), phase: Moved, modifiers: SHIFT }
DEBUG ark_client::window                       > MouseWheel { device_id: DeviceId(DeviceId), delta: LineDelta(1.0, 0.0), phase: Moved, modifiers: SHIFT }
DEBUG ark_client::window                       > MouseWheel { device_id: DeviceId(DeviceId), delta: LineDelta(-1.0, 0.0), phase: Moved, modifiers: SHIFT }
DEBUG ark_client::window                       > MouseWheel { device_id: DeviceId(DeviceId), delta: LineDelta(-1.0, 0.0), phase: Moved, modifiers: SHIFT }
DEBUG ark_client::window                       > MouseWheel { device_id: DeviceId(DeviceId), delta: LineDelta(-1.0, 0.0), phase: Moved, modifiers: SHIFT }
DEBUG ark_client::window                       > MouseWheel { device_id: DeviceId(DeviceId), delta: LineDelta(-1.0, 0.0), phase: Moved, modifiers: SHIFT }
DEBUG ark_client::window                       > MouseWheel { device_id: DeviceId(DeviceId), delta: LineDelta(-1.0, 0.0), phase: Moved, modifiers: SHIFT }

I am scrolling vertically the same amount in all of these events, but when SHIFT is held the behavior is markedly different.

fu5ha avatar Jul 22 '22 12:07 fu5ha

Hmm, I suppose this part of the API may be in need of some re-thinking. Although ... is the behavior the same for WindowEvents and DeviceEvents here?

maroider avatar Jul 22 '22 12:07 maroider

Just double checked and yes, the behavior is identical with DeviceEvent::MouseScrolls

fu5ha avatar Jul 22 '22 12:07 fu5ha