SDL: Fixed bug #1650: X11 doesn't set KMOD_NUM and KMOD_CAPS to system state

From 6c56193a2ad679572ed92d4413f1b88899bb5afd Mon Sep 17 00:00:00 2001
From: Sylvain <[EMAIL REDACTED]>
Date: Thu, 24 Mar 2022 18:09:45 +0100
Subject: [PATCH] Fixed bug #1650: X11 doesn't set KMOD_NUM and KMOD_CAPS to
 system state

---
 src/video/x11/SDL_x11events.c   | 2 +-
 src/video/x11/SDL_x11events.h   | 1 +
 src/video/x11/SDL_x11keyboard.c | 2 ++
 3 files changed, 4 insertions(+), 1 deletion(-)

diff --git a/src/video/x11/SDL_x11events.c b/src/video/x11/SDL_x11events.c
index c1260215df9..186f37b05e6 100644
--- a/src/video/x11/SDL_x11events.c
+++ b/src/video/x11/SDL_x11events.c
@@ -380,7 +380,7 @@ X11_GetScrollLockModifierMask(_THIS)
     return num_mask;
 }
 
-static void
+void
 X11_ReconcileKeyboardState(_THIS)
 {
     SDL_VideoData *viddata = (SDL_VideoData *) _this->driverdata;
diff --git a/src/video/x11/SDL_x11events.h b/src/video/x11/SDL_x11events.h
index fc8a57ae2b5..de89110d001 100644
--- a/src/video/x11/SDL_x11events.h
+++ b/src/video/x11/SDL_x11events.h
@@ -27,6 +27,7 @@ extern void X11_PumpEvents(_THIS);
 extern int  X11_WaitEventTimeout(_THIS, int timeout);
 extern void X11_SendWakeupEvent(_THIS, SDL_Window *window);
 extern void X11_SuspendScreenSaver(_THIS);
+extern void X11_ReconcileKeyboardState(_THIS);
 
 #endif /* SDL_x11events_h_ */
 
diff --git a/src/video/x11/SDL_x11keyboard.c b/src/video/x11/SDL_x11keyboard.c
index c82570c6224..c84bcc7983f 100644
--- a/src/video/x11/SDL_x11keyboard.c
+++ b/src/video/x11/SDL_x11keyboard.c
@@ -409,6 +409,8 @@ X11_InitKeyboard(_THIS)
     SDL_IME_Init();
 #endif
 
+    X11_ReconcileKeyboardState(_this);
+
     return 0;
 }