From 6fba3c6ad9fbb5cca590e36f9faad298a76b4253 Mon Sep 17 00:00:00 2001
From: Sam Lantinga <[EMAIL REDACTED]>
Date: Fri, 2 Aug 2024 21:17:56 -0700
Subject: [PATCH] Updated for latest SDL changes as of
978e5fc4f83867394d30973f7a74a2e420e59b01
---
src/sdl2_compat.c | 9 ++++++++-
src/sdl3_include_wrapper.h | 10 ++++++++++
src/sdl3_syms.h | 2 +-
3 files changed, 19 insertions(+), 2 deletions(-)
diff --git a/src/sdl2_compat.c b/src/sdl2_compat.c
index e8f3f2d..277b846 100644
--- a/src/sdl2_compat.c
+++ b/src/sdl2_compat.c
@@ -6797,10 +6797,17 @@ SDL_StartTextInput(void)
SDL_Window **windows = SDL3_GetWindows(NULL);
if (windows) {
int i;
+ SDL_PropertiesID props = SDL3_CreateProperties();
+
+ SDL3_SetNumberProperty(props, SDL_PROP_TEXTINPUT_TYPE_NUMBER, SDL_TEXTINPUT_TYPE_TEXT);
+ SDL3_SetNumberProperty(props, SDL_PROP_TEXTINPUT_CAPITALIZATION_NUMBER, SDL_CAPITALIZE_NONE);
+ SDL3_SetBooleanProperty(props, SDL_PROP_TEXTINPUT_AUTOCORRECT_BOOLEAN, SDL_FALSE);
for (i = 0; windows[i]; ++i) {
- SDL3_StartTextInput(windows[i]);
+ SDL3_StartTextInputWithProperties(windows[i], props);
}
+ SDL3_DestroyProperties(props);
+
SDL_free(windows);
}
}
diff --git a/src/sdl3_include_wrapper.h b/src/sdl3_include_wrapper.h
index cd3b069..af1ce9a 100644
--- a/src/sdl3_include_wrapper.h
+++ b/src/sdl3_include_wrapper.h
@@ -503,6 +503,7 @@
#define SDL_GetWindowBordersSize IGNORE_THIS_VERSION_OF_SDL_GetWindowBordersSize
#define SDL_GetWindowDisplayScale IGNORE_THIS_VERSION_OF_SDL_GetWindowDisplayScale
#define SDL_GetWindowFlags IGNORE_THIS_VERSION_OF_SDL_GetWindowFlags
+#define SDL_GetWindowFromEvent IGNORE_THIS_VERSION_OF_SDL_GetWindowFromEvent
#define SDL_GetWindowFromID IGNORE_THIS_VERSION_OF_SDL_GetWindowFromID
#define SDL_GetWindowFullscreenMode IGNORE_THIS_VERSION_OF_SDL_GetWindowFullscreenMode
#define SDL_GetWindowICCProfile IGNORE_THIS_VERSION_OF_SDL_GetWindowICCProfile
@@ -848,6 +849,7 @@
#define SDL_SignalCondition IGNORE_THIS_VERSION_OF_SDL_SignalCondition
#define SDL_SignalSemaphore IGNORE_THIS_VERSION_OF_SDL_SignalSemaphore
#define SDL_StartTextInput IGNORE_THIS_VERSION_OF_SDL_StartTextInput
+#define SDL_StartTextInputWithProperties IGNORE_THIS_VERSION_OF_SDL_StartTextInputWithProperties
#define SDL_StepUTF8 IGNORE_THIS_VERSION_OF_SDL_StepUTF8
#define SDL_StopHapticEffect IGNORE_THIS_VERSION_OF_SDL_StopHapticEffect
#define SDL_StopHapticEffects IGNORE_THIS_VERSION_OF_SDL_StopHapticEffects
@@ -3002,6 +3004,10 @@
#undef SDL_GetWindowFlags
#endif
+#ifdef SDL_GetWindowFromEvent
+#undef SDL_GetWindowFromEvent
+#endif
+
#ifdef SDL_GetWindowFromID
#undef SDL_GetWindowFromID
#endif
@@ -4382,6 +4388,10 @@
#undef SDL_StartTextInput
#endif
+#ifdef SDL_StartTextInputWithProperties
+#undef SDL_StartTextInputWithProperties
+#endif
+
#ifdef SDL_StepUTF8
#undef SDL_StepUTF8
#endif
diff --git a/src/sdl3_syms.h b/src/sdl3_syms.h
index 3e52346..2075e6f 100644
--- a/src/sdl3_syms.h
+++ b/src/sdl3_syms.h
@@ -222,7 +222,6 @@ SDL3_SYM(const char*,GetScancodeName,(SDL_Scancode a),(a),return)
SDL3_SYM(SDL_Scancode,GetScancodeFromName,(const char *a),(a),return)
SDL3_SYM(const char*,GetKeyName,(SDL_Keycode a),(a),return)
SDL3_SYM(SDL_Keycode,GetKeyFromName,(const char *a),(a),return)
-SDL3_SYM(int,StartTextInput,(SDL_Window *a),(a),return)
SDL3_SYM(SDL_bool,TextInputActive,(SDL_Window *a),(a),return)
SDL3_SYM(int,StopTextInput,(SDL_Window *a),(a),return)
SDL3_SYM(int,SetTextInputArea,(SDL_Window *a, const SDL_Rect *b, int c),(a,b,c),return)
@@ -843,6 +842,7 @@ SDL3_SYM(const SDL_PixelFormatDetails *,GetPixelFormatDetails,(SDL_PixelFormat a
SDL3_SYM(SDL_Surface *,ConvertSurfaceAndColorspace,(SDL_Surface *a, SDL_PixelFormat b, SDL_Palette *c, SDL_Colorspace d, SDL_PropertiesID e),(a,b,c,d,e),return)
SDL3_SYM(SDL_Palette *,CreateSurfacePalette,(SDL_Surface *a),(a),return)
SDL3_SYM(SDL_Palette *,GetSurfacePalette,(SDL_Surface *a),(a),return)
+SDL3_SYM(int,StartTextInputWithProperties,(SDL_Window *a, SDL_PropertiesID b),(a,b),return)
#undef SDL3_SYM
#undef SDL3_SYM_PASSTHROUGH