-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Description
When I press and release the Shift key, the WindowEvent for the release has virtual_keycode None rather than Some(RShift) (and the same is true for the left shift).
The DeviceEvent is fine, so is the key press.
To reproduce:
- run
cargo run --example window - press and release the shift key
Expected:
The final line should read:
WindowEvent { window_id: WindowId(X(WindowId(127926274))), event: KeyboardInput { device_id: DeviceId(X(DeviceId(3))), input: KeyboardInput { scancode: 54, state: Released, virtual_keycode: Some(RShift), modifiers: ModifiersState { shift: true, ctrl: false, alt: false, logo: false } } } }
Actual:
WindowEvent { window_id: WindowId(X(WindowId(127926274))), event: KeyboardInput { device_id: DeviceId(X(DeviceId(3))), input: KeyboardInput { scancode: 54, state: Released, virtual_keycode: None, modifiers: ModifiersState { shift: true, ctrl: false, alt: false, logo: false } } } }
(look at the virtual_keycode)
I ran git bisect and it ended up with commit 52a78d6
Here's the output that illustrate this on my computer (running Fedora 26 with Wayland I believe as well as on another computer with Fedora 24 + X11).
$ cargo run --example window
Updating registry `https://github.com/rust-lang/crates.io-index`
Compiling winit v0.9.0 (file:///home/thomas/code/winit)
Finished dev [unoptimized + debuginfo] target(s) in 3.32 secs
Running `target/debug/examples/window`
WindowEvent { window_id: WindowId(X(WindowId(127926274))), event: Resized(1024, 768) }
WindowEvent { window_id: WindowId(X(WindowId(127926274))), event: Moved(10, 35) }
WindowEvent { window_id: WindowId(X(WindowId(127926274))), event: Moved(1518, 161) }
WindowEvent { window_id: WindowId(X(WindowId(127926274))), event: Refresh }
WindowEvent { window_id: WindowId(X(WindowId(127926274))), event: CursorEntered { device_id: DeviceId(X(DeviceId(2))) } }
WindowEvent { window_id: WindowId(X(WindowId(30064771203))), event: CursorMoved { device_id: DeviceId(X(DeviceId(2))), position: (865, 239) } }
WindowEvent { window_id: WindowId(X(WindowId(127926274))), event: Focused(true) }
WindowEvent { window_id: WindowId(X(WindowId(38654705795))), event: CursorMoved { device_id: DeviceId(X(DeviceId(3))), position: (865, 239) } }
DeviceEvent { device_id: DeviceId(X(DeviceId(13))), event: Key(KeyboardInput { scancode: 54, state: Pressed, virtual_keycode: Some(RShift), modifiers: ModifiersState { shift: false, ctrl: false, alt: false, logo: false } }) }
WindowEvent { window_id: WindowId(X(WindowId(127926274))), event: KeyboardInput { device_id: DeviceId(X(DeviceId(3))), input: KeyboardInput { scancode: 54, state: Pressed, virtual_keycode: Some(RShift), modifiers: ModifiersState { shift: false, ctrl: false, alt: false, logo: false } } } }
DeviceEvent { device_id: DeviceId(X(DeviceId(13))), event: Key(KeyboardInput { scancode: 54, state: Released, virtual_keycode: Some(RShift), modifiers: ModifiersState { shift: false, ctrl: false, alt: false, logo: false } }) }
WindowEvent { window_id: WindowId(X(WindowId(127926274))), event: KeyboardInput { device_id: DeviceId(X(DeviceId(3))), input: KeyboardInput { scancode: 54, state: Released, virtual_keycode: None, modifiers: ModifiersState { shift: true, ctrl: false, alt: false, logo: false } } } }