Skip to content

Commit

Permalink
Fix bug with key handling in sdl2
Browse files Browse the repository at this point in the history
  • Loading branch information
gridbugs committed Feb 27, 2024
1 parent d044c7e commit 8f6498c
Showing 1 changed file with 1 addition and 22 deletions.
23 changes: 1 addition & 22 deletions sdl2/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -143,31 +143,10 @@ impl Context {
Event::KeyDown {
keycode: Some(keycode),
keymod,
repeat,
..
} => {
if let Some(keyboard_input) = input::sdl2_to_chargrid(keycode, keymod) {
if repeat {
// repeated key inputs are just treated as key presses
Some(Input::Keyboard(keyboard_input))
} else {
// handle this here because we need to send both a keydown and keypress
if let Some(app::Exit) = on_input(
&mut component,
Input::Keyboard(keyboard_input),
&chargrid_frame_buffer,
) {
break 'mainloop;
}
if let Some(app::Exit) = on_input(
&mut component,
Input::Keyboard(keyboard_input),
&chargrid_frame_buffer,
) {
break 'mainloop;
}
None
}
Some(Input::Keyboard(keyboard_input))
} else {
None
}
Expand Down

0 comments on commit 8f6498c

Please sign in to comment.