@@ -300,6 +300,9 @@ pub enum EventType {
300
300
ControllerDeviceAdded = SDL_EventType :: SDL_CONTROLLERDEVICEADDED as u32 ,
301
301
ControllerDeviceRemoved = SDL_EventType :: SDL_CONTROLLERDEVICEREMOVED as u32 ,
302
302
ControllerDeviceRemapped = SDL_EventType :: SDL_CONTROLLERDEVICEREMAPPED as u32 ,
303
+ ControllerTouchpadDown = SDL_EventType :: SDL_CONTROLLERTOUCHPADDOWN as u32 ,
304
+ ControllerTouchpadMotion = SDL_EventType :: SDL_CONTROLLERTOUCHPADMOTION as u32 ,
305
+ ControllerTouchpadUp = SDL_EventType :: SDL_CONTROLLERTOUCHPADUP as u32 ,
303
306
#[ cfg( feature = "hidapi" ) ]
304
307
ControllerSensorUpdated = SDL_EventType :: SDL_CONTROLLERSENSORUPDATE as u32 ,
305
308
@@ -371,6 +374,9 @@ impl TryFrom<u32> for EventType {
371
374
SDL_CONTROLLERDEVICEADDED => ControllerDeviceAdded ,
372
375
SDL_CONTROLLERDEVICEREMOVED => ControllerDeviceRemoved ,
373
376
SDL_CONTROLLERDEVICEREMAPPED => ControllerDeviceRemapped ,
377
+ SDL_CONTROLLERTOUCHPADDOWN => ControllerTouchpadDown ,
378
+ SDL_CONTROLLERTOUCHPADMOTION => ControllerTouchpadMotion ,
379
+ SDL_CONTROLLERTOUCHPADUP => ControllerTouchpadUp ,
374
380
#[ cfg( feature = "hidapi" ) ]
375
381
SDL_CONTROLLERSENSORUPDATE => ControllerSensorUpdated ,
376
382
@@ -746,6 +752,52 @@ pub enum Event {
746
752
which : u32 ,
747
753
} ,
748
754
755
+ ControllerTouchpadDown {
756
+ timestamp : u32 ,
757
+ /// The joystick instance id
758
+ which : u32 ,
759
+ /// The index of the touchpad
760
+ touchpad : u32 ,
761
+ /// The index of the finger on the touchpad
762
+ finger : u32 ,
763
+ /// Normalized in the range 0...1 with 0 being on the left
764
+ x : f32 ,
765
+ /// Normalized in the range 0...1 with 0 being at the top
766
+ y : f32 ,
767
+ /// Normalized in the range 0...1
768
+ pressure : f32 ,
769
+ } ,
770
+ ControllerTouchpadMotion {
771
+ timestamp : u32 ,
772
+ /// The joystick instance id
773
+ which : u32 ,
774
+ /// The index of the touchpad
775
+ touchpad : u32 ,
776
+ /// The index of the finger on the touchpad
777
+ finger : u32 ,
778
+ /// Normalized in the range 0...1 with 0 being on the left
779
+ x : f32 ,
780
+ /// Normalized in the range 0...1 with 0 being at the top
781
+ y : f32 ,
782
+ /// Normalized in the range 0...1
783
+ pressure : f32 ,
784
+ } ,
785
+ ControllerTouchpadUp {
786
+ timestamp : u32 ,
787
+ /// The joystick instance id
788
+ which : u32 ,
789
+ /// The index of the touchpad
790
+ touchpad : u32 ,
791
+ /// The index of the finger on the touchpad
792
+ finger : u32 ,
793
+ /// Normalized in the range 0...1 with 0 being on the left
794
+ x : f32 ,
795
+ /// Normalized in the range 0...1 with 0 being at the top
796
+ y : f32 ,
797
+ /// Normalized in the range 0...1
798
+ pressure : f32 ,
799
+ } ,
800
+
749
801
/// Triggered when the gyroscope or accelerometer is updated
750
802
#[ cfg( feature = "hidapi" ) ]
751
803
ControllerSensorUpdated {
@@ -1728,6 +1780,42 @@ impl Event {
1728
1780
which : event. which as u32 ,
1729
1781
}
1730
1782
}
1783
+ EventType :: ControllerTouchpadDown => {
1784
+ let event = raw. ctouchpad ;
1785
+ Event :: ControllerTouchpadDown {
1786
+ timestamp : event. timestamp ,
1787
+ which : event. which as u32 ,
1788
+ touchpad : event. touchpad as u32 ,
1789
+ finger : event. finger as u32 ,
1790
+ x : event. x ,
1791
+ y : event. y ,
1792
+ pressure : event. pressure ,
1793
+ }
1794
+ }
1795
+ EventType :: ControllerTouchpadMotion => {
1796
+ let event = raw. ctouchpad ;
1797
+ Event :: ControllerTouchpadMotion {
1798
+ timestamp : event. timestamp ,
1799
+ which : event. which as u32 ,
1800
+ touchpad : event. touchpad as u32 ,
1801
+ finger : event. finger as u32 ,
1802
+ x : event. x ,
1803
+ y : event. y ,
1804
+ pressure : event. pressure ,
1805
+ }
1806
+ }
1807
+ EventType :: ControllerTouchpadUp => {
1808
+ let event = raw. ctouchpad ;
1809
+ Event :: ControllerTouchpadUp {
1810
+ timestamp : event. timestamp ,
1811
+ which : event. which as u32 ,
1812
+ touchpad : event. touchpad as u32 ,
1813
+ finger : event. finger as u32 ,
1814
+ x : event. x ,
1815
+ y : event. y ,
1816
+ pressure : event. pressure ,
1817
+ }
1818
+ }
1731
1819
#[ cfg( feature = "hidapi" ) ]
1732
1820
EventType :: ControllerSensorUpdated => {
1733
1821
let event = raw. csensor ;
@@ -2077,6 +2165,9 @@ impl Event {
2077
2165
Self :: ControllerDeviceAdded { timestamp, .. } => timestamp,
2078
2166
Self :: ControllerDeviceRemoved { timestamp, .. } => timestamp,
2079
2167
Self :: ControllerDeviceRemapped { timestamp, .. } => timestamp,
2168
+ Self :: ControllerTouchpadDown { timestamp, .. } => timestamp,
2169
+ Self :: ControllerTouchpadMotion { timestamp, .. } => timestamp,
2170
+ Self :: ControllerTouchpadUp { timestamp, .. } => timestamp,
2080
2171
#[ cfg( feature = "hidapi" ) ]
2081
2172
Self :: ControllerSensorUpdated { timestamp, .. } => timestamp,
2082
2173
Self :: FingerDown { timestamp, .. } => timestamp,
0 commit comments