Skip to content

Commit 4ef336d

Browse files
authored
Fix windows builds with --features use-bindgen (#1512)
* fix windows builds with --features use-bindgen * fix linux builds with `--features use-bindgen` in a windows-compatible way
1 parent 0545cad commit 4ef336d

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/sdl2/keyboard/mod.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -191,7 +191,10 @@ impl KeyboardUtil {
191191

192192
#[doc(alias = "SDL_SetModState")]
193193
pub fn set_mod_state(&self, flags: Mod) {
194-
let arg = sys::SDL_Keymod(flags.bits() as u32);
194+
// Note: Clang (and therefore bindgen) generates different integer types
195+
// for C-style enums on different platforms. On Windows, the underlying
196+
// type is `i32`, while on Linux it is `u32`.
197+
let arg = sys::SDL_Keymod(flags.bits().into());
195198
unsafe {
196199
sys::SDL_SetModState(arg);
197200
}

0 commit comments

Comments
 (0)