Skip to content

Commit

Permalink
Add missing #[repr(C)] to SDL_Keysym
Browse files Browse the repository at this point in the history
This also reverts the change in 9604e85
which just hid the issue.
  • Loading branch information
Thinkofname authored and Cobrand committed Dec 23, 2016
1 parent a6d6718 commit 5a32976
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
1 change: 1 addition & 0 deletions sdl2-sys/src/keyboard.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ use sdl::SDL_bool;

// SDL_keyboard.h
#[derive(Copy, Clone)]
#[repr(C)]
pub struct SDL_Keysym {
pub scancode: SDL_Scancode,
pub sym: SDL_Keycode,
Expand Down
4 changes: 2 additions & 2 deletions src/sdl2/event.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1298,7 +1298,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_truncate(event.keysym._mod as SDL_Keymod),
keymod: keyboard::Mod::from_bits(event.keysym._mod as SDL_Keymod).unwrap(),
repeat: event.repeat != 0
}
}
Expand All @@ -1310,7 +1310,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_truncate(event.keysym._mod as SDL_Keymod),
keymod: keyboard::Mod::from_bits(event.keysym._mod as SDL_Keymod).unwrap(),
repeat: event.repeat != 0
}
}
Expand Down

0 comments on commit 5a32976

Please sign in to comment.