From b9a88bbecba451de1d5a3a4f99534ed87e585b79 Mon Sep 17 00:00:00 2001 From: Sam Lantinga 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 68fd774c4..668d668de 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 162623e9d..fe06957c6 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 b7b131dcf..618100b9b 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 2188b9731..47adfb82d 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 947d501cf..41f362226 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 9a997487e..a10a1e706 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 61e1c8cea..762ed2745 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 3932d880d..6dd672e64 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 9751bed35..b54b1ab77 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 7bce9c381..527270314 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 46104649e..feac17db3 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 76f8233e3..41ce58eb5 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 710015983..368cbb024 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;