Skip to content

Commit

Permalink
Update PS Vita touchpad ID after it has changed in SDL2 v2.30.7 (#9307)
Browse files Browse the repository at this point in the history
  • Loading branch information
Districh-ru authored Dec 1, 2024
1 parent f3beb6f commit 2b4f5e3
Showing 1 changed file with 17 additions and 3 deletions.
20 changes: 17 additions & 3 deletions src/engine/localevent.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1034,9 +1034,23 @@ namespace EventProcessing
static void onTouchEvent( LocalEvent & eventHandler, const SDL_TouchFingerEvent & event )
{
#if defined( TARGET_PS_VITA )
if ( event.touchId != 0 ) {
// Ignore rear touchpad on PS Vita
return;
{
// PS Vita has two touchpads: front and rear. The ID of the front touchpad must match the value of
// 'SDL_TouchID' used in the 'SDL_AddTouch()' call in the 'VITA_InitTouch()' function in this SDL2
// source file: video/vita/SDL_vitatouch.c.
constexpr SDL_TouchID frontTouchpadDeviceID
{
#if SDL_VERSION_ATLEAST( 2, 30, 7 )
1
#else
0
#endif
};

// Use only front touchpad on PS Vita.
if ( event.touchId != frontTouchpadDeviceID ) {
return;
}
}
#endif

Expand Down

0 comments on commit 2b4f5e3

Please sign in to comment.