@@ -538,15 +538,15 @@ pub enum Event {
538
538
JoyAxisMotion {
539
539
timestamp : u32 ,
540
540
/// The joystick's `id`
541
- which : i32 ,
541
+ which : u32 ,
542
542
axis_idx : u8 ,
543
543
value : i16
544
544
} ,
545
545
546
546
JoyBallMotion {
547
547
timestamp : u32 ,
548
548
/// The joystick's `id`
549
- which : i32 ,
549
+ which : u32 ,
550
550
ball_idx : u8 ,
551
551
xrel : i16 ,
552
552
yrel : i16
@@ -555,70 +555,70 @@ pub enum Event {
555
555
JoyHatMotion {
556
556
timestamp : u32 ,
557
557
/// The joystick's `id`
558
- which : i32 ,
558
+ which : u32 ,
559
559
hat_idx : u8 ,
560
560
state : HatState
561
561
} ,
562
562
563
563
JoyButtonDown {
564
564
timestamp : u32 ,
565
565
/// The joystick's `id`
566
- which : i32 ,
566
+ which : u32 ,
567
567
button_idx : u8
568
568
} ,
569
569
JoyButtonUp {
570
570
timestamp : u32 ,
571
571
/// The joystick's `id`
572
- which : i32 ,
572
+ which : u32 ,
573
573
button_idx : u8
574
574
} ,
575
575
576
576
JoyDeviceAdded {
577
577
timestamp : u32 ,
578
578
/// The newly added joystick's `joystick_index`
579
- which : i32
579
+ which : u32
580
580
} ,
581
581
JoyDeviceRemoved {
582
582
timestamp : u32 ,
583
583
/// The joystick's `id`
584
- which : i32
584
+ which : u32
585
585
} ,
586
586
587
587
ControllerAxisMotion {
588
588
timestamp : u32 ,
589
589
/// The controller's joystick `id`
590
- which : i32 ,
590
+ which : u32 ,
591
591
axis : Axis ,
592
592
value : i16
593
593
} ,
594
594
595
595
ControllerButtonDown {
596
596
timestamp : u32 ,
597
597
/// The controller's joystick `id`
598
- which : i32 ,
598
+ which : u32 ,
599
599
button : Button
600
600
} ,
601
601
ControllerButtonUp {
602
602
timestamp : u32 ,
603
603
/// The controller's joystick `id`
604
- which : i32 ,
604
+ which : u32 ,
605
605
button : Button
606
606
} ,
607
607
608
608
ControllerDeviceAdded {
609
609
timestamp : u32 ,
610
610
/// The newly added controller's `joystick_index`
611
- which : i32
611
+ which : u32
612
612
} ,
613
613
ControllerDeviceRemoved {
614
614
timestamp : u32 ,
615
615
/// The controller's joystick `id`
616
- which : i32
616
+ which : u32
617
617
} ,
618
618
ControllerDeviceRemapped {
619
619
timestamp : u32 ,
620
620
/// The controller's joystick `id`
621
- which : i32
621
+ which : u32
622
622
} ,
623
623
624
624
FingerDown {
@@ -985,7 +985,7 @@ impl Event {
985
985
let event = sys:: SDL_JoyAxisEvent {
986
986
type_ : SDL_EventType :: SDL_JOYAXISMOTION as u32 ,
987
987
timestamp,
988
- which,
988
+ which : which as i32 ,
989
989
axis : axis_idx,
990
990
value,
991
991
padding1 : 0 ,
@@ -1009,7 +1009,7 @@ impl Event {
1009
1009
let event = sys:: SDL_JoyBallEvent {
1010
1010
type_ : SDL_EventType :: SDL_JOYBALLMOTION as u32 ,
1011
1011
timestamp,
1012
- which,
1012
+ which : which as i32 ,
1013
1013
ball : ball_idx,
1014
1014
xrel,
1015
1015
yrel,
@@ -1033,7 +1033,7 @@ impl Event {
1033
1033
let event = sys:: SDL_JoyHatEvent {
1034
1034
type_ : SDL_EventType :: SDL_JOYHATMOTION as u32 ,
1035
1035
timestamp,
1036
- which,
1036
+ which : which as i32 ,
1037
1037
hat : hat_idx,
1038
1038
value : hatvalue,
1039
1039
padding1 : 0 ,
@@ -1053,7 +1053,7 @@ impl Event {
1053
1053
let event = sys:: SDL_JoyButtonEvent {
1054
1054
type_ : SDL_EventType :: SDL_JOYBUTTONDOWN as u32 ,
1055
1055
timestamp,
1056
- which,
1056
+ which : which as i32 ,
1057
1057
button : button_idx,
1058
1058
state : sys:: SDL_PRESSED as u8 ,
1059
1059
padding1 : 0 ,
@@ -1074,7 +1074,7 @@ impl Event {
1074
1074
let event = sys:: SDL_JoyButtonEvent {
1075
1075
type_ : SDL_EventType :: SDL_JOYBUTTONUP as u32 ,
1076
1076
timestamp,
1077
- which,
1077
+ which : which as i32 ,
1078
1078
button : button_idx,
1079
1079
state : sys:: SDL_RELEASED as u8 ,
1080
1080
padding1 : 0 ,
@@ -1109,7 +1109,7 @@ impl Event {
1109
1109
let event = sys:: SDL_JoyDeviceEvent {
1110
1110
type_ : SDL_EventType :: SDL_JOYDEVICEREMOVED as u32 ,
1111
1111
timestamp,
1112
- which,
1112
+ which : which as i32 ,
1113
1113
} ;
1114
1114
unsafe {
1115
1115
ptr:: copy ( & event, ret. as_mut_ptr ( ) as * mut sys:: SDL_JoyDeviceEvent , 1 ) ;
@@ -1127,7 +1127,7 @@ impl Event {
1127
1127
let event = sys:: SDL_ControllerAxisEvent {
1128
1128
type_ : SDL_EventType :: SDL_CONTROLLERAXISMOTION as u32 ,
1129
1129
timestamp,
1130
- which,
1130
+ which : which as i32 ,
1131
1131
axis : axisval as u8 ,
1132
1132
value,
1133
1133
padding1 : 0 ,
@@ -1149,7 +1149,7 @@ impl Event {
1149
1149
let event = sys:: SDL_ControllerButtonEvent {
1150
1150
type_ : SDL_EventType :: SDL_CONTROLLERBUTTONDOWN as u32 ,
1151
1151
timestamp,
1152
- which,
1152
+ which : which as i32 ,
1153
1153
// This conversion turns an i32 into a u8; signed-to-unsigned conversions
1154
1154
// are a bit of a code smell, but that appears to be how SDL defines it.
1155
1155
button : buttonval as u8 ,
@@ -1172,7 +1172,7 @@ impl Event {
1172
1172
let event = sys:: SDL_ControllerButtonEvent {
1173
1173
type_ : SDL_EventType :: SDL_CONTROLLERBUTTONUP as u32 ,
1174
1174
timestamp,
1175
- which,
1175
+ which : which as i32 ,
1176
1176
button : buttonval as u8 ,
1177
1177
state : sys:: SDL_RELEASED as u8 ,
1178
1178
padding1 : 0 ,
@@ -1207,7 +1207,7 @@ impl Event {
1207
1207
let event = sys:: SDL_ControllerDeviceEvent {
1208
1208
type_ : SDL_EventType :: SDL_CONTROLLERDEVICEREMOVED as u32 ,
1209
1209
timestamp,
1210
- which,
1210
+ which : which as i32 ,
1211
1211
} ;
1212
1212
unsafe {
1213
1213
ptr:: copy ( & event, ret. as_mut_ptr ( ) as * mut sys:: SDL_ControllerDeviceEvent , 1 ) ;
@@ -1223,7 +1223,7 @@ impl Event {
1223
1223
let event = sys:: SDL_ControllerDeviceEvent {
1224
1224
type_ : SDL_EventType :: SDL_CONTROLLERDEVICEREMAPPED as u32 ,
1225
1225
timestamp,
1226
- which,
1226
+ which : which as i32 ,
1227
1227
} ;
1228
1228
unsafe {
1229
1229
ptr:: copy ( & event, ret. as_mut_ptr ( ) as * mut sys:: SDL_ControllerDeviceEvent , 1 ) ;
@@ -1360,7 +1360,7 @@ impl Event {
1360
1360
Event :: MouseMotion {
1361
1361
timestamp : event. timestamp ,
1362
1362
window_id : event. windowID ,
1363
- which : event. which ,
1363
+ which : event. which as u32 ,
1364
1364
mousestate : mouse:: MouseState :: from_sdl_state ( event. state ) ,
1365
1365
x : event. x ,
1366
1366
y : event. y ,
@@ -1374,7 +1374,7 @@ impl Event {
1374
1374
Event :: MouseButtonDown {
1375
1375
timestamp : event. timestamp ,
1376
1376
window_id : event. windowID ,
1377
- which : event. which ,
1377
+ which : event. which as u32 ,
1378
1378
mouse_btn : mouse:: MouseButton :: from_ll ( event. button ) ,
1379
1379
clicks : event. clicks ,
1380
1380
x : event. x ,
@@ -1387,7 +1387,7 @@ impl Event {
1387
1387
Event :: MouseButtonUp {
1388
1388
timestamp : event. timestamp ,
1389
1389
window_id : event. windowID ,
1390
- which : event. which ,
1390
+ which : event. which as u32 ,
1391
1391
mouse_btn : mouse:: MouseButton :: from_ll ( event. button ) ,
1392
1392
clicks : event. clicks ,
1393
1393
x : event. x ,
@@ -1400,7 +1400,7 @@ impl Event {
1400
1400
Event :: MouseWheel {
1401
1401
timestamp : event. timestamp ,
1402
1402
window_id : event. windowID ,
1403
- which : event. which ,
1403
+ which : event. which as u32 ,
1404
1404
x : event. x ,
1405
1405
y : event. y ,
1406
1406
direction : mouse:: MouseWheelDirection :: from_ll ( event. direction ) ,
@@ -1411,7 +1411,7 @@ impl Event {
1411
1411
let event = raw. jaxis ;
1412
1412
Event :: JoyAxisMotion {
1413
1413
timestamp : event. timestamp ,
1414
- which : event. which ,
1414
+ which : event. which as u32 ,
1415
1415
axis_idx : event. axis ,
1416
1416
value : event. value
1417
1417
}
@@ -1420,7 +1420,7 @@ impl Event {
1420
1420
let event = raw. jball ;
1421
1421
Event :: JoyBallMotion {
1422
1422
timestamp : event. timestamp ,
1423
- which : event. which ,
1423
+ which : event. which as u32 ,
1424
1424
ball_idx : event. ball ,
1425
1425
xrel : event. xrel ,
1426
1426
yrel : event. yrel
@@ -1430,7 +1430,7 @@ impl Event {
1430
1430
let event = raw. jhat ;
1431
1431
Event :: JoyHatMotion {
1432
1432
timestamp : event. timestamp ,
1433
- which : event. which ,
1433
+ which : event. which as u32 ,
1434
1434
hat_idx : event. hat ,
1435
1435
state : joystick:: HatState :: from_raw ( event. value ) ,
1436
1436
}
@@ -1439,30 +1439,30 @@ impl Event {
1439
1439
let event = raw. jbutton ;
1440
1440
Event :: JoyButtonDown {
1441
1441
timestamp : event. timestamp ,
1442
- which : event. which ,
1442
+ which : event. which as u32 ,
1443
1443
button_idx : event. button
1444
1444
}
1445
1445
}
1446
1446
EventType :: JoyButtonUp => {
1447
1447
let event = raw. jbutton ;
1448
1448
Event :: JoyButtonUp {
1449
1449
timestamp : event. timestamp ,
1450
- which : event. which ,
1450
+ which : event. which as u32 ,
1451
1451
button_idx : event. button
1452
1452
}
1453
1453
}
1454
1454
EventType :: JoyDeviceAdded => {
1455
1455
let event = raw. jdevice ;
1456
1456
Event :: JoyDeviceAdded {
1457
1457
timestamp : event. timestamp ,
1458
- which : event. which as i32
1458
+ which : event. which as u32 ,
1459
1459
}
1460
1460
}
1461
1461
EventType :: JoyDeviceRemoved => {
1462
1462
let event = raw. jdevice ;
1463
1463
Event :: JoyDeviceRemoved {
1464
1464
timestamp : event. timestamp ,
1465
- which : event. which
1465
+ which : event. which as u32 ,
1466
1466
}
1467
1467
}
1468
1468
@@ -1472,7 +1472,7 @@ impl Event {
1472
1472
1473
1473
Event :: ControllerAxisMotion {
1474
1474
timestamp : event. timestamp ,
1475
- which : event. which ,
1475
+ which : event. which as u32 ,
1476
1476
axis,
1477
1477
value : event. value
1478
1478
}
@@ -1483,7 +1483,7 @@ impl Event {
1483
1483
1484
1484
Event :: ControllerButtonDown {
1485
1485
timestamp : event. timestamp ,
1486
- which : event. which ,
1486
+ which : event. which as u32 ,
1487
1487
button
1488
1488
}
1489
1489
}
@@ -1493,29 +1493,29 @@ impl Event {
1493
1493
1494
1494
Event :: ControllerButtonUp {
1495
1495
timestamp : event. timestamp ,
1496
- which : event. which ,
1496
+ which : event. which as u32 ,
1497
1497
button
1498
1498
}
1499
1499
}
1500
1500
EventType :: ControllerDeviceAdded => {
1501
1501
let event = raw. cdevice ;
1502
1502
Event :: ControllerDeviceAdded {
1503
1503
timestamp : event. timestamp ,
1504
- which : event. which as i32
1504
+ which : event. which as u32 ,
1505
1505
}
1506
1506
}
1507
1507
EventType :: ControllerDeviceRemoved => {
1508
1508
let event = raw. cdevice ;
1509
1509
Event :: ControllerDeviceRemoved {
1510
1510
timestamp : event. timestamp ,
1511
- which : event. which
1511
+ which : event. which as u32 ,
1512
1512
}
1513
1513
}
1514
1514
EventType :: ControllerDeviceRemapped => {
1515
1515
let event = raw. cdevice ;
1516
1516
Event :: ControllerDeviceRemapped {
1517
1517
timestamp : event. timestamp ,
1518
- which : event. which
1518
+ which : event. which as u32 ,
1519
1519
}
1520
1520
}
1521
1521
0 commit comments