-
Notifications
You must be signed in to change notification settings - Fork 403
Keyboard input not captured on latest macOS system #1822
Copy link
Copy link
Closed
Description
I recently updated my macOS Catalina to 10.15.2. I wrote my code like:
use glium::*;
fn main() {
let mut event_loop = glutin::EventsLoop::new();
let wb = glutin::WindowBuilder::new();
let cb = glutin::ContextBuilder::new().with_depth_buffer(24);
let _display = glium::Display::new(wb, cb, &event_loop).unwrap();
event_loop.run_forever(|ev| match ev {
glutin::Event::WindowEvent { event, .. } => match event {
glutin::WindowEvent::CloseRequested => winit::ControlFlow::Break,
glutin::WindowEvent::KeyboardInput {
device_id, input: kin
} => {
println!("WindowEvent Key: {:?} DeviceId: {:?}", kin, device_id);
winit::ControlFlow::Continue
}
_ => winit::ControlFlow::Continue,
},
glutin::Event::DeviceEvent { event, device_id } => match event {
glutin::DeviceEvent::Key(kin) => {
println!("DeviceEvent Key: {:?} DeviceId: {:?}", kin, device_id);
winit::ControlFlow::Continue
},
_ => winit::ControlFlow::Continue
},
_ => winit::ControlFlow::Continue
});
}And there is a window shown as expected. When I try to press a key, I expect both WindowEvent and DeviceEvent could print an output.
However, only WindowEvent did. The whole output is like:
WindowEvent Key: KeyboardInput { scancode: 18, state: Pressed, virtual_keycode: Some(Key1), modifiers: ModifiersState { shift: false, ctrl: false, alt: false, logo: false } } DeviceId: DeviceId(DeviceId)
WindowEvent Key: KeyboardInput { scancode: 19, state: Pressed, virtual_keycode: Some(Key2), modifiers: ModifiersState { shift: false, ctrl: false, alt: false, logo: false } } DeviceId: DeviceId(DeviceId)
WindowEvent Key: KeyboardInput { scancode: 18, state: Released, virtual_keycode: Some(Key1), modifiers: ModifiersState { shift: false, ctrl: false, alt: false, logo: false } } DeviceId: DeviceId(DeviceId)
WindowEvent Key: KeyboardInput { scancode: 20, state: Pressed, virtual_keycode: Some(Key3), modifiers: ModifiersState { shift: false, ctrl: false, alt: false, logo: false } } DeviceId: DeviceId(DeviceId)
What happened? Should there also be a DeviceEvent output?
I used glium = "0.25.1".
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels