Skip to content

Commit

Permalink
Merge pull request Rust-SDL2#907 from Bastczuak/fix-type-for-which-in…
Browse files Browse the repository at this point in the history
…-event

-Changed the datatype for 'which' to i32 according to the official sd…
  • Loading branch information
Cobrand authored Sep 11, 2019
2 parents 744fb88 + 8d3c98c commit 3287926
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
3 changes: 3 additions & 0 deletions changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@ when upgrading from a version of rust-sdl2 to another.

### v0.32.3 (unreleased)

[PR #907](https://github.com/Rust-SDL2/rust-sdl2/pull/907)
Changed the data type to i32 for the `which` field for the events `ControllerDeviceAdded` and `JoyDeviceAdded`.

[PR #882](https://github.com/Rust-SDL2/rust-sdl2/pull/882)
Ignore unknown bits in `SDL_Keysym`'s `mod` field (key modifiers) when constructing `Event::KeyDown` and `Event::KeyUp`. Deprecate `sdl2::event::Event::unwrap_keymod`, which had been made public accidentally.

Expand Down
8 changes: 4 additions & 4 deletions src/sdl2/event.rs
Original file line number Diff line number Diff line change
Expand Up @@ -557,7 +557,7 @@ pub enum Event {
JoyDeviceAdded {
timestamp: u32,
/// The newly added joystick's `joystick_index`
which: u32
which: i32
},
JoyDeviceRemoved {
timestamp: u32,
Expand Down Expand Up @@ -589,7 +589,7 @@ pub enum Event {
ControllerDeviceAdded {
timestamp: u32,
/// The newly added controller's `joystick_index`
which: u32
which: i32
},
ControllerDeviceRemoved {
timestamp: u32,
Expand Down Expand Up @@ -1405,7 +1405,7 @@ impl Event {
let event = raw.jdevice;
Event::JoyDeviceAdded {
timestamp: event.timestamp,
which: event.which as u32
which: event.which as i32
}
}
EventType::JoyDeviceRemoved => {
Expand Down Expand Up @@ -1451,7 +1451,7 @@ impl Event {
let event = raw.cdevice;
Event::ControllerDeviceAdded {
timestamp: event.timestamp,
which: event.which as u32
which: event.which as i32
}
}
EventType::ControllerDeviceRemoved => {
Expand Down

0 comments on commit 3287926

Please sign in to comment.