Skip to content

Commit 1b0da8f

Browse files
committed
fix compilation errors for which i32->u32
1 parent c0535bf commit 1b0da8f

File tree

1 file changed

+28
-28
lines changed

1 file changed

+28
-28
lines changed

src/sdl2/event.rs

+28-28
Original file line numberDiff line numberDiff line change
@@ -986,7 +986,7 @@ impl Event {
986986
let event = sys::SDL_JoyAxisEvent {
987987
type_: SDL_EventType::SDL_JOYAXISMOTION as u32,
988988
timestamp,
989-
which,
989+
which: which as i32,
990990
axis: axis_idx,
991991
value,
992992
padding1: 0,
@@ -1010,7 +1010,7 @@ impl Event {
10101010
let event = sys::SDL_JoyBallEvent {
10111011
type_: SDL_EventType::SDL_JOYBALLMOTION as u32,
10121012
timestamp,
1013-
which,
1013+
which: which as i32,
10141014
ball: ball_idx,
10151015
xrel,
10161016
yrel,
@@ -1034,7 +1034,7 @@ impl Event {
10341034
let event = sys::SDL_JoyHatEvent {
10351035
type_: SDL_EventType::SDL_JOYHATMOTION as u32,
10361036
timestamp,
1037-
which,
1037+
which: which as i32,
10381038
hat: hat_idx,
10391039
value: hatvalue,
10401040
padding1: 0,
@@ -1054,7 +1054,7 @@ impl Event {
10541054
let event = sys::SDL_JoyButtonEvent {
10551055
type_: SDL_EventType::SDL_JOYBUTTONDOWN as u32,
10561056
timestamp,
1057-
which,
1057+
which: which as i32,
10581058
button: button_idx,
10591059
state: sys::SDL_PRESSED as u8,
10601060
padding1: 0,
@@ -1075,7 +1075,7 @@ impl Event {
10751075
let event = sys::SDL_JoyButtonEvent {
10761076
type_: SDL_EventType::SDL_JOYBUTTONUP as u32,
10771077
timestamp,
1078-
which,
1078+
which: which as i32,
10791079
button: button_idx,
10801080
state: sys::SDL_RELEASED as u8,
10811081
padding1: 0,
@@ -1110,7 +1110,7 @@ impl Event {
11101110
let event = sys::SDL_JoyDeviceEvent {
11111111
type_: SDL_EventType::SDL_JOYDEVICEREMOVED as u32,
11121112
timestamp,
1113-
which,
1113+
which: which as i32,
11141114
};
11151115
unsafe {
11161116
ptr::copy(&event, ret.as_mut_ptr() as *mut sys::SDL_JoyDeviceEvent, 1);
@@ -1128,7 +1128,7 @@ impl Event {
11281128
let event = sys::SDL_ControllerAxisEvent {
11291129
type_: SDL_EventType::SDL_CONTROLLERAXISMOTION as u32,
11301130
timestamp,
1131-
which,
1131+
which: which as i32,
11321132
axis: axisval as u8,
11331133
value,
11341134
padding1: 0,
@@ -1150,7 +1150,7 @@ impl Event {
11501150
let event = sys::SDL_ControllerButtonEvent {
11511151
type_: SDL_EventType::SDL_CONTROLLERBUTTONDOWN as u32,
11521152
timestamp,
1153-
which,
1153+
which: which as i32,
11541154
// This conversion turns an i32 into a u8; signed-to-unsigned conversions
11551155
// are a bit of a code smell, but that appears to be how SDL defines it.
11561156
button: buttonval as u8,
@@ -1173,7 +1173,7 @@ impl Event {
11731173
let event = sys::SDL_ControllerButtonEvent {
11741174
type_: SDL_EventType::SDL_CONTROLLERBUTTONUP as u32,
11751175
timestamp,
1176-
which,
1176+
which: which as i32,
11771177
button: buttonval as u8,
11781178
state: sys::SDL_RELEASED as u8,
11791179
padding1: 0,
@@ -1208,7 +1208,7 @@ impl Event {
12081208
let event = sys::SDL_ControllerDeviceEvent {
12091209
type_: SDL_EventType::SDL_CONTROLLERDEVICEREMOVED as u32,
12101210
timestamp,
1211-
which,
1211+
which: which as i32,
12121212
};
12131213
unsafe {
12141214
ptr::copy(&event, ret.as_mut_ptr() as *mut sys::SDL_ControllerDeviceEvent, 1);
@@ -1224,7 +1224,7 @@ impl Event {
12241224
let event = sys::SDL_ControllerDeviceEvent {
12251225
type_: SDL_EventType::SDL_CONTROLLERDEVICEREMAPPED as u32,
12261226
timestamp,
1227-
which,
1227+
which: which as i32,
12281228
};
12291229
unsafe {
12301230
ptr::copy(&event, ret.as_mut_ptr() as *mut sys::SDL_ControllerDeviceEvent, 1);
@@ -1361,7 +1361,7 @@ impl Event {
13611361
Event::MouseMotion {
13621362
timestamp: event.timestamp,
13631363
window_id: event.windowID,
1364-
which: event.which,
1364+
which: event.which as u32,
13651365
mousestate: mouse::MouseState::from_sdl_state(event.state),
13661366
x: event.x,
13671367
y: event.y,
@@ -1375,7 +1375,7 @@ impl Event {
13751375
Event::MouseButtonDown {
13761376
timestamp: event.timestamp,
13771377
window_id: event.windowID,
1378-
which: event.which,
1378+
which: event.which as u32,
13791379
mouse_btn: mouse::MouseButton::from_ll(event.button),
13801380
clicks: event.clicks,
13811381
x: event.x,
@@ -1388,7 +1388,7 @@ impl Event {
13881388
Event::MouseButtonUp {
13891389
timestamp: event.timestamp,
13901390
window_id: event.windowID,
1391-
which: event.which,
1391+
which: event.which as u32,
13921392
mouse_btn: mouse::MouseButton::from_ll(event.button),
13931393
clicks: event.clicks,
13941394
x: event.x,
@@ -1401,7 +1401,7 @@ impl Event {
14011401
Event::MouseWheel {
14021402
timestamp: event.timestamp,
14031403
window_id: event.windowID,
1404-
which: event.which,
1404+
which: event.which as u32,
14051405
x: event.x,
14061406
y: event.y,
14071407
direction: mouse::MouseWheelDirection::from_ll(event.direction),
@@ -1412,7 +1412,7 @@ impl Event {
14121412
let event = raw.jaxis;
14131413
Event::JoyAxisMotion {
14141414
timestamp: event.timestamp,
1415-
which: event.which,
1415+
which: event.which as u32,
14161416
axis_idx: event.axis,
14171417
value: event.value
14181418
}
@@ -1421,7 +1421,7 @@ impl Event {
14211421
let event = raw.jball;
14221422
Event::JoyBallMotion {
14231423
timestamp: event.timestamp,
1424-
which: event.which,
1424+
which: event.which as u32,
14251425
ball_idx: event.ball,
14261426
xrel: event.xrel,
14271427
yrel: event.yrel
@@ -1431,7 +1431,7 @@ impl Event {
14311431
let event = raw.jhat;
14321432
Event::JoyHatMotion {
14331433
timestamp: event.timestamp,
1434-
which: event.which,
1434+
which: event.which as u32,
14351435
hat_idx: event.hat,
14361436
state: joystick::HatState::from_raw(event.value),
14371437
}
@@ -1440,30 +1440,30 @@ impl Event {
14401440
let event = raw.jbutton;
14411441
Event::JoyButtonDown {
14421442
timestamp: event.timestamp,
1443-
which: event.which,
1443+
which: event.which as u32,
14441444
button_idx: event.button
14451445
}
14461446
}
14471447
EventType::JoyButtonUp => {
14481448
let event = raw.jbutton;
14491449
Event::JoyButtonUp {
14501450
timestamp: event.timestamp,
1451-
which: event.which,
1451+
which: event.which as u32,
14521452
button_idx: event.button
14531453
}
14541454
}
14551455
EventType::JoyDeviceAdded => {
14561456
let event = raw.jdevice;
14571457
Event::JoyDeviceAdded {
14581458
timestamp: event.timestamp,
1459-
which: event.which as i32
1459+
which: event.which as u32,
14601460
}
14611461
}
14621462
EventType::JoyDeviceRemoved => {
14631463
let event = raw.jdevice;
14641464
Event::JoyDeviceRemoved {
14651465
timestamp: event.timestamp,
1466-
which: event.which
1466+
which: event.which as u32,
14671467
}
14681468
}
14691469

@@ -1473,7 +1473,7 @@ impl Event {
14731473

14741474
Event::ControllerAxisMotion {
14751475
timestamp: event.timestamp,
1476-
which: event.which,
1476+
which: event.which as u32,
14771477
axis,
14781478
value: event.value
14791479
}
@@ -1484,7 +1484,7 @@ impl Event {
14841484

14851485
Event::ControllerButtonDown {
14861486
timestamp: event.timestamp,
1487-
which: event.which,
1487+
which: event.which as u32,
14881488
button
14891489
}
14901490
}
@@ -1494,29 +1494,29 @@ impl Event {
14941494

14951495
Event::ControllerButtonUp {
14961496
timestamp: event.timestamp,
1497-
which: event.which,
1497+
which: event.which as u32,
14981498
button
14991499
}
15001500
}
15011501
EventType::ControllerDeviceAdded => {
15021502
let event = raw.cdevice;
15031503
Event::ControllerDeviceAdded {
15041504
timestamp: event.timestamp,
1505-
which: event.which as i32
1505+
which: event.which as u32,
15061506
}
15071507
}
15081508
EventType::ControllerDeviceRemoved => {
15091509
let event = raw.cdevice;
15101510
Event::ControllerDeviceRemoved {
15111511
timestamp: event.timestamp,
1512-
which: event.which
1512+
which: event.which as u32,
15131513
}
15141514
}
15151515
EventType::ControllerDeviceRemapped => {
15161516
let event = raw.cdevice;
15171517
Event::ControllerDeviceRemapped {
15181518
timestamp: event.timestamp,
1519-
which: event.which
1519+
which: event.which as u32,
15201520
}
15211521
}
15221522

0 commit comments

Comments
 (0)