From 439bb5377c4e081b83d729a0e7ecf8f337b09f6f Mon Sep 17 00:00:00 2001
From: Sam Lantinga <[EMAIL REDACTED]>
Date: Wed, 1 Jan 2025 09:03:24 -0800
Subject: [PATCH] Revert "Backed out Vita touch ID change for SDL2"
This reverts commit a326ebce61634bd1597698460d2d1ba0c8d3cd9f.
It turns out that 0 is an invalid touch ID for SDL2, per the documentation for SDL_GetTouchDevice()
(cherry picked from commit 5a25183b390fab9cb59804df4da4ff73832c7f16)
---
src/video/vita/SDL_vitatouch.c | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/src/video/vita/SDL_vitatouch.c b/src/video/vita/SDL_vitatouch.c
index b1b54335981f6..62d297716fde3 100644
--- a/src/video/vita/SDL_vitatouch.c
+++ b/src/video/vita/SDL_vitatouch.c
@@ -70,8 +70,8 @@ void VITA_InitTouch(void)
}
// Support passing both front and back touch devices in events
- SDL_AddTouch((SDL_TouchID)0, SDL_TOUCH_DEVICE_DIRECT, "Front");
- SDL_AddTouch((SDL_TouchID)1, SDL_TOUCH_DEVICE_INDIRECT_ABSOLUTE, "Back");
+ SDL_AddTouch((SDL_TouchID)1, SDL_TOUCH_DEVICE_DIRECT, "Front");
+ SDL_AddTouch((SDL_TouchID)2, SDL_TOUCH_DEVICE_INDIRECT_ABSOLUTE, "Back");
}
void VITA_QuitTouch(void)
@@ -123,7 +123,7 @@ void VITA_PollTouch(void)
// Skip if finger was already previously down
if (!finger_down) {
// Send an initial touch
- SDL_SendTouch((SDL_TouchID)port,
+ SDL_SendTouch((SDL_TouchID)(port + 1),
finger_id,
Vita_Window,
SDL_TRUE,
@@ -133,7 +133,7 @@ void VITA_PollTouch(void)
}
// Always send the motion
- SDL_SendTouchMotion((SDL_TouchID)port,
+ SDL_SendTouchMotion((SDL_TouchID)(port + 1),
finger_id,
Vita_Window,
x,
@@ -160,7 +160,7 @@ void VITA_PollTouch(void)
VITA_ConvertTouchXYToSDLXY(&x, &y, touch_old[port].report[i].x, touch_old[port].report[i].y, port);
finger_id = (SDL_FingerID)touch_old[port].report[i].id;
// Finger released from screen
- SDL_SendTouch((SDL_TouchID)port,
+ SDL_SendTouch((SDL_TouchID)(port + 1),
finger_id,
Vita_Window,
SDL_FALSE,