SDL icon indicating copy to clipboard operation
SDL copied to clipboard

hints: Change hints to be backed by Properties, add documentation.

Open icculus opened this issue 1 year ago • 1 comments

This makes the subsystem thread-safe, and cleans up the code a little.

icculus avatar May 26 '24 16:05 icculus

Obviously something broke on Windows, so I'll check that before this can be merged.

icculus avatar May 27 '24 03:05 icculus

@icculus, this is all fixed up! Okay to squash and merge?

slouken avatar Aug 03 '24 21:08 slouken

The following good for sdl2-compat? (Other SDL3 changes may need additional compat-side changes which I didn't look.)

diff --git a/src/sdl2_compat.c b/src/sdl2_compat.c
index 277b846..77d13eb 100644
--- a/src/sdl2_compat.c
+++ b/src/sdl2_compat.c
@@ -466,13 +466,13 @@ SDL2_to_SDL3_hint(const char *name)
 SDL_DECLSPEC SDL_bool SDLCALL
 SDL_SetHintWithPriority(const char *name, const char *value, SDL_HintPriority priority)
 {
-    return SDL3_SetHintWithPriority(SDL2_to_SDL3_hint(name), value, priority);
+    return SDL3_SetHintWithPriority(SDL2_to_SDL3_hint(name), value, priority) == 0;
 }
 
 SDL_DECLSPEC SDL_bool SDLCALL
 SDL_SetHint(const char *name, const char *value)
 {
-    return SDL3_SetHint(SDL2_to_SDL3_hint(name), value);
+    return SDL3_SetHint(SDL2_to_SDL3_hint(name), value) == 0;
 }
 
 SDL_DECLSPEC const char * SDLCALL
@@ -484,7 +484,7 @@ SDL_GetHint(const char *name)
 SDL_DECLSPEC SDL_bool SDLCALL
 SDL_ResetHint(const char *name)
 {
-    return SDL3_ResetHint(SDL2_to_SDL3_hint(name));
+    return SDL3_ResetHint(SDL2_to_SDL3_hint(name)) == 0;
 }
 
 SDL_DECLSPEC SDL_bool SDLCALL
diff --git a/src/sdl3_syms.h b/src/sdl3_syms.h
index 2075e6f..5afbf8d 100644
--- a/src/sdl3_syms.h
+++ b/src/sdl3_syms.h
@@ -193,8 +193,8 @@ SDL3_SYM_PASSTHROUGH(SDL_bool,HapticRumbleSupported,(SDL_Haptic *a),(a),return)
 SDL3_SYM_RENAMED(int,HapticRumbleInit,InitHapticRumble,(SDL_Haptic *a),(a),return)
 SDL3_SYM_RENAMED(int,HapticRumblePlay,PlayHapticRumble,(SDL_Haptic *a, float b, Uint32 c),(a,b,c),return)
 SDL3_SYM_RENAMED(int,HapticRumbleStop,StopHapticRumble,(SDL_Haptic *a),(a),return)
-SDL3_SYM(SDL_bool,SetHintWithPriority,(const char *a, const char *b, SDL_HintPriority c),(a,b,c),return)
-SDL3_SYM(SDL_bool,SetHint,(const char *a, const char *b),(a,b),return)
+SDL3_SYM(int,SetHintWithPriority,(const char *a, const char *b, SDL_HintPriority c),(a,b,c),return)
+SDL3_SYM(int,SetHint,(const char *a, const char *b),(a,b),return)
 SDL3_SYM(const char*,GetHint,(const char *a),(a),return)
 SDL3_SYM(int,AddHintCallback,(const char *a, SDL_HintCallback b, void *c),(a,b,c),)
 SDL3_SYM(void,DelHintCallback,(const char *a, SDL_HintCallback b, void *c),(a,b,c),)
@@ -727,7 +727,7 @@ SDL3_SYM_PASSTHROUGH(void,GUIDToString,(SDL_GUID a, char *b, int c),(a,b,c),)
 SDL3_SYM_RENAMED(SDL_GUID,GUIDFromString,StringToGUID,(const char *a),(a),return)
 SDL3_SYM_PASSTHROUGH(size_t,utf8strnlen,(const char *a, size_t b),(a,b),return)
 SDL3_SYM_PASSTHROUGH(void,ResetKeyboard,(void),(),)
-SDL3_SYM(SDL_bool,ResetHint,(const char *a),(a),return)
+SDL3_SYM(int,ResetHint,(const char *a),(a),return)
 SDL3_SYM_PASSTHROUGH(Uint16,crc16,(Uint16 a, const void *b, size_t c),(a,b,c),return)
 SDL3_SYM(int,GetWindowSizeInPixels,(SDL_Window *a, int *b, int *c),(a,b,c),return)
 SDL3_SYM_PASSTHROUGH(void,GetJoystickGUIDInfo,(SDL_GUID a, Uint16 *b, Uint16 *c, Uint16 *d, Uint16 *e),(a,b,c,d,e),)

sezero avatar Aug 05 '24 16:08 sezero

The following good for sdl2-compat? (Other SDL3 changes may need additional compat-side changes which I didn't look.)

Yep, that looks good.

slouken avatar Aug 05 '24 17:08 slouken

Yep, that looks good.

OK, applied and pushed.

sezero avatar Aug 05 '24 17:08 sezero