SDL: Removed SDL_TextInputShown()

From b9a88bbecba451de1d5a3a4f99534ed87e585b79 Mon Sep 17 00:00:00 2001
From: Sam Lantinga <[EMAIL REDACTED]>
Date: Mon, 25 Mar 2024 13:05:42 -0700
Subject: [PATCH] Removed SDL_TextInputShown()

This was only implemented on Windows and often confused with SDL_ScreenKeyboardShown()
---
 docs/README-migration.md                |  4 +++-
 include/SDL3/SDL_keyboard.h             |  9 ---------
 include/SDL3/SDL_oldnames.h             |  2 --
 src/dynapi/SDL_dynapi.sym               |  1 -
 src/dynapi/SDL_dynapi_overrides.h       |  1 -
 src/dynapi/SDL_dynapi_procs.h           |  1 -
 src/video/SDL_sysvideo.h                |  1 -
 src/video/SDL_video.c                   |  9 ---------
 src/video/gdk/SDL_gdktextinput.cpp      | 14 +-------------
 src/video/gdk/SDL_gdktextinput.h        |  1 -
 src/video/windows/SDL_windowskeyboard.c | 21 ---------------------
 src/video/windows/SDL_windowskeyboard.h |  1 -
 src/video/windows/SDL_windowsvideo.c    |  2 --
 13 files changed, 4 insertions(+), 63 deletions(-)

diff --git a/docs/README-migration.md b/docs/README-migration.md
index 68fd774c4b29a..668d668de2e68 100644
--- a/docs/README-migration.md
+++ b/docs/README-migration.md
@@ -861,7 +861,9 @@ Text input is no longer automatically enabled when initializing video, you shoul
 The following functions have been renamed:
 * SDL_IsScreenKeyboardShown() => SDL_ScreenKeyboardShown()
 * SDL_IsTextInputActive() => SDL_TextInputActive()
-* SDL_IsTextInputShown() => SDL_TextInputShown()
+
+The following functions have been removed:
+* SDL_IsTextInputShown()
 
 ## SDL_keycode.h
 
diff --git a/include/SDL3/SDL_keyboard.h b/include/SDL3/SDL_keyboard.h
index 162623e9da2ce..fe06957c6a01f 100644
--- a/include/SDL3/SDL_keyboard.h
+++ b/include/SDL3/SDL_keyboard.h
@@ -342,15 +342,6 @@ extern DECLSPEC void SDLCALL SDL_StopTextInput(void);
  */
 extern DECLSPEC void SDLCALL SDL_ClearComposition(void);
 
-/**
- * Returns if an IME Composite or Candidate window is currently shown.
- *
- * \returns SDL_TRUE if shown, else SDL_FALSE
- *
- * \since This function is available since SDL 3.0.0.
- */
-extern DECLSPEC SDL_bool SDLCALL SDL_TextInputShown(void);
-
 /**
  * Set the rectangle used to type Unicode text inputs.
  *
diff --git a/include/SDL3/SDL_oldnames.h b/include/SDL3/SDL_oldnames.h
index b7b131dcf431e..618100b9b7a56 100644
--- a/include/SDL3/SDL_oldnames.h
+++ b/include/SDL3/SDL_oldnames.h
@@ -339,7 +339,6 @@
 /* ##SDL_keyboard.h */
 #define SDL_IsScreenKeyboardShown SDL_ScreenKeyboardShown
 #define SDL_IsTextInputActive SDL_TextInputActive
-#define SDL_IsTextInputShown SDL_TextInputShown
 
 /* ##SDL_keycode.h */
 #define KMOD_ALT SDL_KMOD_ALT
@@ -840,7 +839,6 @@
 /* ##SDL_keyboard.h */
 #define SDL_IsScreenKeyboardShown SDL_IsScreenKeyboardShown_renamed_SDL_ScreenKeyboardShown
 #define SDL_IsTextInputActive SDL_IsTextInputActive_renamed_SDL_TextInputActive
-#define SDL_IsTextInputShown SDL_IsTextInputShown_renamed_SDL_TextInputShown
 
 /* ##SDL_keycode.h */
 #define KMOD_ALT KMOD_ALT_renamed_SDL_KMOD_ALT
diff --git a/src/dynapi/SDL_dynapi.sym b/src/dynapi/SDL_dynapi.sym
index 2188b9731ce7c..47adfb82d6083 100644
--- a/src/dynapi/SDL_dynapi.sym
+++ b/src/dynapi/SDL_dynapi.sym
@@ -789,7 +789,6 @@ SDL3_0.0.0 {
     SDL_SyncWindow;
     SDL_TellIO;
     SDL_TextInputActive;
-    SDL_TextInputShown;
     SDL_TimeFromWindows;
     SDL_TimeToDateTime;
     SDL_TimeToWindows;
diff --git a/src/dynapi/SDL_dynapi_overrides.h b/src/dynapi/SDL_dynapi_overrides.h
index 947d501cfc4c3..41f3622269eb1 100644
--- a/src/dynapi/SDL_dynapi_overrides.h
+++ b/src/dynapi/SDL_dynapi_overrides.h
@@ -813,7 +813,6 @@
 #define SDL_SyncWindow SDL_SyncWindow_REAL
 #define SDL_TellIO SDL_TellIO_REAL
 #define SDL_TextInputActive SDL_TextInputActive_REAL
-#define SDL_TextInputShown SDL_TextInputShown_REAL
 #define SDL_TimeFromWindows SDL_TimeFromWindows_REAL
 #define SDL_TimeToDateTime SDL_TimeToDateTime_REAL
 #define SDL_TimeToWindows SDL_TimeToWindows_REAL
diff --git a/src/dynapi/SDL_dynapi_procs.h b/src/dynapi/SDL_dynapi_procs.h
index 9a997487e8a39..a10a1e7063fc2 100644
--- a/src/dynapi/SDL_dynapi_procs.h
+++ b/src/dynapi/SDL_dynapi_procs.h
@@ -833,7 +833,6 @@ SDL_DYNAPI_PROC(SDL_bool,SDL_SurfaceHasRLE,(SDL_Surface *a),(a),return)
 SDL_DYNAPI_PROC(int,SDL_SyncWindow,(SDL_Window *a),(a),return)
 SDL_DYNAPI_PROC(Sint64,SDL_TellIO,(SDL_IOStream *a),(a),return)
 SDL_DYNAPI_PROC(SDL_bool,SDL_TextInputActive,(void),(),return)
-SDL_DYNAPI_PROC(SDL_bool,SDL_TextInputShown,(void),(),return)
 SDL_DYNAPI_PROC(SDL_Time,SDL_TimeFromWindows,(Uint32 a, Uint32 b),(a,b),return)
 SDL_DYNAPI_PROC(int,SDL_TimeToDateTime,(SDL_Time a, SDL_DateTime *b, SDL_bool c),(a,b,c),return)
 SDL_DYNAPI_PROC(void,SDL_TimeToWindows,(SDL_Time a, Uint32 *b, Uint32 *c),(a,b,c),)
diff --git a/src/video/SDL_sysvideo.h b/src/video/SDL_sysvideo.h
index 61e1c8ceaa444..762ed27457a14 100644
--- a/src/video/SDL_sysvideo.h
+++ b/src/video/SDL_sysvideo.h
@@ -308,7 +308,6 @@ struct SDL_VideoDevice
     void (*StopTextInput)(SDL_VideoDevice *_this);
     int (*SetTextInputRect)(SDL_VideoDevice *_this, const SDL_Rect *rect);
     void (*ClearComposition)(SDL_VideoDevice *_this);
-    SDL_bool (*IsTextInputShown)(SDL_VideoDevice *_this);
 
     /* Screen keyboard */
     SDL_bool (*HasScreenKeyboardSupport)(SDL_VideoDevice *_this);
diff --git a/src/video/SDL_video.c b/src/video/SDL_video.c
index 3932d880d9fc5..6dd672e64a18f 100644
--- a/src/video/SDL_video.c
+++ b/src/video/SDL_video.c
@@ -4793,15 +4793,6 @@ void SDL_ClearComposition(void)
     }
 }
 
-SDL_bool SDL_TextInputShown(void)
-{
-    if (_this && _this->IsTextInputShown) {
-        return _this->IsTextInputShown(_this);
-    }
-
-    return SDL_FALSE;
-}
-
 SDL_bool SDL_TextInputActive(void)
 {
     return _this && _this->text_input_active;
diff --git a/src/video/gdk/SDL_gdktextinput.cpp b/src/video/gdk/SDL_gdktextinput.cpp
index 9751bed357bfc..b54b1ab774672 100644
--- a/src/video/gdk/SDL_gdktextinput.cpp
+++ b/src/video/gdk/SDL_gdktextinput.cpp
@@ -217,17 +217,6 @@ void GDK_ClearComposition(SDL_VideoDevice *_this)
     /* See notice in GDK_StartTextInput */
 }
 
-SDL_bool GDK_IsTextInputShown(SDL_VideoDevice *_this)
-{
-    /*
-     * The XGameUiShowTextEntryAsync window
-     * does specify potential input candidates
-     * just below the text box, so technically
-     * this is true whenever the window is shown.
-     */
-    return (g_TextBlock != NULL);
-}
-
 SDL_bool GDK_HasScreenKeyboardSupport(SDL_VideoDevice *_this)
 {
     /* Currently always true for this input method */
@@ -287,8 +276,7 @@ void GDK_HideScreenKeyboard(SDL_VideoDevice *_this, SDL_Window *window)
 
 SDL_bool GDK_IsScreenKeyboardShown(SDL_VideoDevice *_this, SDL_Window *window)
 {
-    /* See notice in GDK_IsTextInputShown */
-    return GDK_IsTextInputShown(_this);
+    return (g_TextBlock != NULL);
 }
 
 #ifdef __cplusplus
diff --git a/src/video/gdk/SDL_gdktextinput.h b/src/video/gdk/SDL_gdktextinput.h
index 7bce9c38133eb..52727031438d3 100644
--- a/src/video/gdk/SDL_gdktextinput.h
+++ b/src/video/gdk/SDL_gdktextinput.h
@@ -36,7 +36,6 @@ void GDK_StartTextInput(SDL_VideoDevice *_this);
 void GDK_StopTextInput(SDL_VideoDevice *_this);
 int GDK_SetTextInputRect(SDL_VideoDevice *_this, const SDL_Rect *rect);
 void GDK_ClearComposition(SDL_VideoDevice *_this);
-SDL_bool GDK_IsTextInputShown(SDL_VideoDevice *_this);
 
 SDL_bool GDK_HasScreenKeyboardSupport(SDL_VideoDevice *_this);
 void GDK_ShowScreenKeyboard(SDL_VideoDevice *_this, SDL_Window *window);
diff --git a/src/video/windows/SDL_windowskeyboard.c b/src/video/windows/SDL_windowskeyboard.c
index 46104649e88e6..feac17db30d99 100644
--- a/src/video/windows/SDL_windowskeyboard.c
+++ b/src/video/windows/SDL_windowskeyboard.c
@@ -35,7 +35,6 @@ static int IME_Init(SDL_VideoData *videodata, HWND hwnd);
 static void IME_Enable(SDL_VideoData *videodata, HWND hwnd);
 static void IME_Disable(SDL_VideoData *videodata, HWND hwnd);
 static void IME_Quit(SDL_VideoData *videodata);
-static SDL_bool IME_IsTextInputShown(SDL_VideoData *videodata);
 #endif /* !SDL_DISABLE_WINDOWS_IME */
 
 #ifndef MAPVK_VK_TO_VSC
@@ -293,11 +292,6 @@ void WIN_ClearComposition(SDL_VideoDevice *_this)
 {
 }
 
-SDL_bool WIN_IsTextInputShown(SDL_VideoDevice *_this)
-{
-    return SDL_FALSE;
-}
-
 SDL_bool IME_HandleMessage(HWND hwnd, UINT msg, WPARAM wParam, LPARAM *lParam, SDL_VideoData *videodata)
 {
     return SDL_FALSE;
@@ -776,15 +770,6 @@ static void IME_ClearComposition(SDL_VideoData *videodata)
     SDL_SendEditingText("", 0, 0);
 }
 
-static SDL_bool IME_IsTextInputShown(SDL_VideoData *videodata)
-{
-    if (!videodata->ime_initialized || !videodata->ime_available || !videodata->ime_enabled) {
-        return SDL_FALSE;
-    }
-
-    return videodata->ime_uicontext != 0;
-}
-
 static void IME_GetCompositionString(SDL_VideoData *videodata, HIMC himc, DWORD string)
 {
     LONG length;
@@ -1733,12 +1718,6 @@ void IME_Present(SDL_VideoData *videodata)
     /* FIXME: Need to show the IME bitmap */
 }
 
-SDL_bool WIN_IsTextInputShown(SDL_VideoDevice *_this)
-{
-    SDL_VideoData *videodata = _this->driverdata;
-    return IME_IsTextInputShown(videodata);
-}
-
 void WIN_ClearComposition(SDL_VideoDevice *_this)
 {
     SDL_VideoData *videodata = _this->driverdata;
diff --git a/src/video/windows/SDL_windowskeyboard.h b/src/video/windows/SDL_windowskeyboard.h
index 76f8233e3085b..41ce58eb5d8eb 100644
--- a/src/video/windows/SDL_windowskeyboard.h
+++ b/src/video/windows/SDL_windowskeyboard.h
@@ -33,7 +33,6 @@ extern void WIN_StartTextInput(SDL_VideoDevice *_this);
 extern void WIN_StopTextInput(SDL_VideoDevice *_this);
 extern int WIN_SetTextInputRect(SDL_VideoDevice *_this, const SDL_Rect *rect);
 extern void WIN_ClearComposition(SDL_VideoDevice *_this);
-extern SDL_bool WIN_IsTextInputShown(SDL_VideoDevice *_this);
 
 extern SDL_bool IME_HandleMessage(HWND hwnd, UINT msg, WPARAM wParam, LPARAM *lParam, struct SDL_VideoData *videodata);
 
diff --git a/src/video/windows/SDL_windowsvideo.c b/src/video/windows/SDL_windowsvideo.c
index 7100159830eee..368cbb02485be 100644
--- a/src/video/windows/SDL_windowsvideo.c
+++ b/src/video/windows/SDL_windowsvideo.c
@@ -256,7 +256,6 @@ static SDL_VideoDevice *WIN_CreateDevice(void)
     device->StopTextInput = WIN_StopTextInput;
     device->SetTextInputRect = WIN_SetTextInputRect;
     device->ClearComposition = WIN_ClearComposition;
-    device->IsTextInputShown = WIN_IsTextInputShown;
 
     device->SetClipboardData = WIN_SetClipboardData;
     device->GetClipboardData = WIN_GetClipboardData;
@@ -270,7 +269,6 @@ static SDL_VideoDevice *WIN_CreateDevice(void)
     device->StopTextInput = GDK_StopTextInput;
     device->SetTextInputRect = GDK_SetTextInputRect;
     device->ClearComposition = GDK_ClearComposition;
-    device->IsTextInputShown = GDK_IsTextInputShown;
 
     device->HasScreenKeyboardSupport = GDK_HasScreenKeyboardSupport;
     device->ShowScreenKeyboard = GDK_ShowScreenKeyboard;