SDL: Make sure we send update complete events for delayed guide buttons

From 8aee6908bbae5d57bc88d35b81c2d57a727dee95 Mon Sep 17 00:00:00 2001
From: Sam Lantinga <[EMAIL REDACTED]>
Date: Wed, 21 Jun 2023 18:42:25 -0700
Subject: [PATCH] Make sure we send update complete events for delayed guide
 buttons

---
 src/joystick/SDL_gamepad.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/src/joystick/SDL_gamepad.c b/src/joystick/SDL_gamepad.c
index 5e9dee5ea4a0..3db54cc586f8 100644
--- a/src/joystick/SDL_gamepad.c
+++ b/src/joystick/SDL_gamepad.c
@@ -3211,6 +3211,11 @@ void SDL_GamepadHandleDelayedGuideButton(SDL_Joystick *joystick)
     for (gamepad = SDL_gamepads; gamepad; gamepad = gamepad->next) {
         if (gamepad->joystick == joystick) {
             SDL_SendGamepadButton(0, gamepad, SDL_GAMEPAD_BUTTON_GUIDE, SDL_RELEASED);
+
+            /* Make sure we send an update complete event for this change */
+            if (!gamepad->joystick->update_complete) {
+                gamepad->joystick->update_complete = SDL_GetTicksNS();
+            }
             break;
         }
     }