winit
winit copied to clipboard
On macOS, holding shift while scrolling a three-button mouse results in horizontal scrolling...
... 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.
Can you share some debug prints of the problematic events?
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.
Hmm, I suppose this part of the API may be in need of some re-thinking. Although ... is the behavior the same for WindowEvent
s and DeviceEvent
s here?
Just double checked and yes, the behavior is identical with DeviceEvent::MouseScroll
s