SDL: Replace with SDL_SendKeyboardKeyAutoRelease

From bc3b98f3eda0856421d8c717be32c70f2f665ba9 Mon Sep 17 00:00:00 2001
From: Jaylon Gowie <[EMAIL REDACTED]>
Date: Sun, 25 Jul 2021 03:33:44 -0500
Subject: [PATCH] Replace with SDL_SendKeyboardKeyAutoRelease

---
 src/video/vita/SDL_vitavideo.c | 13 +++----------
 1 file changed, 3 insertions(+), 10 deletions(-)

diff --git a/src/video/vita/SDL_vitavideo.c b/src/video/vita/SDL_vitavideo.c
index ec96e86d3..0adf3b8a8 100644
--- a/src/video/vita/SDL_vitavideo.c
+++ b/src/video/vita/SDL_vitavideo.c
@@ -414,16 +414,10 @@ static void utf16_to_utf8(const uint16_t *src, uint8_t *dst) {
   *dst = '\0';
 }
 
-static SDL_bool reset_enter = SDL_FALSE;
 void VITA_PumpEvents(_THIS)
 {
     SDL_VideoData *videodata = (SDL_VideoData *)_this->driverdata;
 
-    // Little fix for adding proper enter key emulation
-    if (reset_enter == SDL_TRUE) {
-        SDL_SendKeyboardKey(SDL_RELEASED, SDL_SCANCODE_RETURN);
-        reset_enter = SDL_FALSE;
-    }
 
     VITA_PollTouch();
     VITA_PollKeyboard();
@@ -446,10 +440,8 @@ void VITA_PumpEvents(_THIS)
             SDL_SendKeyboardText((const char*)utf8_buffer);
 
             // Send enter key only on enter
-            if (result.button == SCE_IME_DIALOG_BUTTON_ENTER) {
-                SDL_SendKeyboardKey(SDL_PRESSED, SDL_SCANCODE_RETURN);
-                reset_enter = SDL_TRUE;
-            }
+            if (result.button == SCE_IME_DIALOG_BUTTON_ENTER)
+                SDL_SendKeyboardKeyAutoRelease(SDL_SCANCODE_RETURN);
 
             sceImeDialogTerm();
 
@@ -462,3 +454,4 @@ void VITA_PumpEvents(_THIS)
 #endif /* SDL_VIDEO_DRIVER_VITA */
 
 /* vi: set ts=4 sw=4 expandtab: */
+