Split Input keyboard event by ButtonState
This commit is contained in:
parent
af95d3972e
commit
e139aae143
4 changed files with 44 additions and 28 deletions
|
|
@ -70,10 +70,24 @@ pub fn window_event(
|
|||
..
|
||||
},
|
||||
..
|
||||
} => Some(Event::Keyboard(keyboard::Event::Input {
|
||||
key_code: key_code(*virtual_keycode),
|
||||
state: button_state(*state),
|
||||
modifiers: modifiers_state(modifiers),
|
||||
} => Some(Event::Keyboard({
|
||||
let key_code = key_code(*virtual_keycode);
|
||||
let modifiers = modifiers_state(modifiers);
|
||||
|
||||
match state {
|
||||
winit::event::ElementState::Pressed => {
|
||||
keyboard::Event::KeyPressed {
|
||||
key_code,
|
||||
modifiers,
|
||||
}
|
||||
}
|
||||
winit::event::ElementState::Released => {
|
||||
keyboard::Event::KeyReleased {
|
||||
key_code,
|
||||
modifiers,
|
||||
}
|
||||
}
|
||||
}
|
||||
})),
|
||||
WindowEvent::HoveredFile(path) => {
|
||||
Some(Event::Window(window::Event::FileHovered(path.clone())))
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue