Skip to content

Commit

Permalink
Ignore extra SDL_Keymod bits instead of defaulting to "no mods"
Browse files Browse the repository at this point in the history
  • Loading branch information
kolen committed Apr 9, 2019
1 parent aefd78d commit 1c5c36b
Showing 1 changed file with 2 additions and 9 deletions.
11 changes: 2 additions & 9 deletions src/sdl2/event.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1278,7 +1278,7 @@ impl Event {
window_id: event.windowID,
keycode: Keycode::from_i32(event.keysym.sym as i32),
scancode: Scancode::from_i32(event.keysym.scancode as i32),
keymod: Event::unwrap_keymod(keyboard::Mod::from_bits(event.keysym.mod_)),
keymod: keyboard::Mod::from_bits_truncate(event.keysym.mod_),
repeat: event.repeat != 0
}
}
Expand All @@ -1290,7 +1290,7 @@ impl Event {
window_id: event.windowID,
keycode: Keycode::from_i32(event.keysym.sym as i32),
scancode: Scancode::from_i32(event.keysym.scancode as i32),
keymod: keyboard::Mod::from_bits(event.keysym.mod_).unwrap(),
keymod: keyboard::Mod::from_bits_truncate(event.keysym.mod_),
repeat: event.repeat != 0
}
}
Expand Down Expand Up @@ -1619,13 +1619,6 @@ impl Event {
}} // close unsafe & match
}

pub fn unwrap_keymod(keymod_option: Option<keyboard::Mod>) -> keyboard::Mod {
match keymod_option {
None => keyboard::Mod::empty(),
Some(x) => x,
}
}

pub fn is_user_event(&self) -> bool {
match *self {
Event::User { .. } => true,
Expand Down

0 comments on commit 1c5c36b

Please sign in to comment.