From 307e6f2ca659380b820ae465915b729a4ff5340a Mon Sep 17 00:00:00 2001 From: "Ryan C. Gordon" Date: Mon, 13 Jan 2025 02:29:24 -0500 Subject: [PATCH 001/340] emscripten: simulate mouse autocapture. This is just enough to delay MOUSE_LEAVE events until a drag ending outside the canvas is released, and make sure the MOUSE_UP event has the canvas's SDL_WindowID, which it wouldn't when mouse focus is was lost by this point. Fixes #10033. --- src/video/emscripten/SDL_emscriptenevents.c | 44 +++++++++++++++++---- src/video/emscripten/SDL_emscriptenvideo.h | 2 + 2 files changed, 38 insertions(+), 8 deletions(-) diff --git a/src/video/emscripten/SDL_emscriptenevents.c b/src/video/emscripten/SDL_emscriptenevents.c index 190c8b37f66f0..8084ed2fe3f82 100644 --- a/src/video/emscripten/SDL_emscriptenevents.c +++ b/src/video/emscripten/SDL_emscriptenevents.c @@ -314,8 +314,11 @@ static EM_BOOL Emscripten_HandleMouseButton(int eventType, const EmscriptenMouse return 0; } + const SDL_Mouse *mouse = SDL_GetMouse(); + SDL_assert(mouse != NULL); + if (eventType == EMSCRIPTEN_EVENT_MOUSEDOWN) { - if (SDL_GetMouse()->relative_mode && !window_data->has_pointer_lock) { + if (mouse->relative_mode && !window_data->has_pointer_lock) { emscripten_request_pointerlock(window_data->canvas_id, 0); // try to regrab lost pointer lock. } sdl_button_state = true; @@ -323,13 +326,30 @@ static EM_BOOL Emscripten_HandleMouseButton(int eventType, const EmscriptenMouse sdl_button_state = false; prevent_default = SDL_EventEnabled(SDL_EVENT_MOUSE_BUTTON_UP); } + SDL_SendMouseButton(0, window_data->window, SDL_DEFAULT_MOUSE_ID, sdl_button, sdl_button_state); - // Do not consume the event if the mouse is outside of the canvas. - emscripten_get_element_css_size(window_data->canvas_id, &css_w, &css_h); - if (mouseEvent->targetX < 0 || mouseEvent->targetX >= css_w || - mouseEvent->targetY < 0 || mouseEvent->targetY >= css_h) { - return 0; + // We have an imaginary mouse capture, because we need SDL to not drop our imaginary mouse focus when we leave the canvas. + if (mouse->auto_capture) { + if (SDL_GetMouseState(NULL, NULL) != 0) { + window_data->window->flags |= SDL_WINDOW_MOUSE_CAPTURE; + } else { + window_data->window->flags &= ~SDL_WINDOW_MOUSE_CAPTURE; + } + } + + if ((eventType == EMSCRIPTEN_EVENT_MOUSEUP) && window_data->mouse_focus_loss_pending) { + window_data->mouse_focus_loss_pending = (window_data->window->flags & SDL_WINDOW_MOUSE_CAPTURE) != 0; + if (!window_data->mouse_focus_loss_pending) { + SDL_SetMouseFocus(NULL); + } + } else { + // Do not consume the event if the mouse is outside of the canvas. + emscripten_get_element_css_size(window_data->canvas_id, &css_w, &css_h); + if (mouseEvent->targetX < 0 || mouseEvent->targetX >= css_w || + mouseEvent->targetY < 0 || mouseEvent->targetY >= css_h) { + return 0; + } } return prevent_default; @@ -352,8 +372,16 @@ static EM_BOOL Emscripten_HandleMouseFocus(int eventType, const EmscriptenMouseE SDL_SendMouseMotion(0, window_data->window, SDL_GLOBAL_MOUSE_ID, isPointerLocked, mx, my); } - SDL_SetMouseFocus(eventType == EMSCRIPTEN_EVENT_MOUSEENTER ? window_data->window : NULL); - return SDL_EventEnabled(SDL_EVENT_MOUSE_MOTION); + const bool isenter = (eventType == EMSCRIPTEN_EVENT_MOUSEENTER); + if (isenter && window_data->mouse_focus_loss_pending) { + window_data->mouse_focus_loss_pending = false; // just drop the state, but don't send the enter event. + } else if (!isenter && (window_data->window->flags & SDL_WINDOW_MOUSE_CAPTURE)) { + window_data->mouse_focus_loss_pending = true; // waiting on a mouse button to let go before we send the mouse focus update. + } else { + SDL_SetMouseFocus(isenter ? window_data->window : NULL); + } + + return SDL_EventEnabled(SDL_EVENT_MOUSE_MOTION); // !!! FIXME: should this be MOUSE_MOTION or something else? } static EM_BOOL Emscripten_HandleWheel(int eventType, const EmscriptenWheelEvent *wheelEvent, void *userData) diff --git a/src/video/emscripten/SDL_emscriptenvideo.h b/src/video/emscripten/SDL_emscriptenvideo.h index ccd02d891acd2..892d074475eeb 100644 --- a/src/video/emscripten/SDL_emscriptenvideo.h +++ b/src/video/emscripten/SDL_emscriptenvideo.h @@ -45,6 +45,8 @@ struct SDL_WindowData bool fullscreen_resize; bool has_pointer_lock; + + bool mouse_focus_loss_pending; }; bool Emscripten_ShouldSetSwapInterval(int interval); From 03a3c19c276d35126b752360ed050c606925652e Mon Sep 17 00:00:00 2001 From: mausimus <73635663+mausimus@users.noreply.github.com> Date: Mon, 13 Jan 2025 19:38:10 +0900 Subject: [PATCH 002/340] examples: use doubles to generate sine waves and avoid distortion --- examples/audio/01-simple-playback/simple-playback.c | 4 ++-- .../02-simple-playback-callback/simple-playback-callback.c | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/examples/audio/01-simple-playback/simple-playback.c b/examples/audio/01-simple-playback/simple-playback.c index ae6eabd041bca..a2b95bf0765ef 100644 --- a/examples/audio/01-simple-playback/simple-playback.c +++ b/examples/audio/01-simple-playback/simple-playback.c @@ -76,9 +76,9 @@ SDL_AppResult SDL_AppIterate(void *appstate) for (i = 0; i < SDL_arraysize(samples); i++) { /* You don't have to care about this math; we're just generating a simple sine wave as we go. https://en.wikipedia.org/wiki/Sine_wave */ - const float time = total_samples_generated / 8000.0f; + const double time = total_samples_generated / 8000.0; const int sine_freq = 500; /* run the wave at 500Hz */ - samples[i] = SDL_sinf(6.283185f * sine_freq * time); + samples[i] = (float)SDL_sin(6.283185 * sine_freq * time); total_samples_generated++; } diff --git a/examples/audio/02-simple-playback-callback/simple-playback-callback.c b/examples/audio/02-simple-playback-callback/simple-playback-callback.c index 47d5098d4af6c..f91aaa6ee2204 100644 --- a/examples/audio/02-simple-playback-callback/simple-playback-callback.c +++ b/examples/audio/02-simple-playback-callback/simple-playback-callback.c @@ -36,9 +36,9 @@ static void SDLCALL FeedTheAudioStreamMore(void *userdata, SDL_AudioStream *astr for (i = 0; i < total; i++) { /* You don't have to care about this math; we're just generating a simple sine wave as we go. https://en.wikipedia.org/wiki/Sine_wave */ - const float time = total_samples_generated / 8000.0f; + const double time = total_samples_generated / 8000.0; const int sine_freq = 500; /* run the wave at 500Hz */ - samples[i] = SDL_sinf(6.283185f * sine_freq * time); + samples[i] = (float)SDL_sin(6.283185 * sine_freq * time); total_samples_generated++; } From 611f132fd0f6034d23480c8d21974d055d30faa0 Mon Sep 17 00:00:00 2001 From: Sam Lantinga Date: Mon, 13 Jan 2025 07:37:50 -0800 Subject: [PATCH 003/340] Don't use a hint callback for SDL_HINT_ANDROID_ALLOW_RECREATE_ACTIVITY This was originally intended to make sure that nativeAllowRecreateActivity() could be called from another thread safely, but the hint system is now thread-safe, so we don't need to use a callback here. Fixes https://github.com/libsdl-org/SDL/issues/11938 --- src/core/android/SDL_android.c | 18 +----------------- 1 file changed, 1 insertion(+), 17 deletions(-) diff --git a/src/core/android/SDL_android.c b/src/core/android/SDL_android.c index ea70ae27751db..2026861f568de 100644 --- a/src/core/android/SDL_android.c +++ b/src/core/android/SDL_android.c @@ -404,9 +404,6 @@ static void Internal_Android_Destroy_AssetManager(void); static AAssetManager *asset_manager = NULL; static jobject javaAssetManagerRef = 0; -// Re-create activity hint -static SDL_AtomicInt bAllowRecreateActivity; - static SDL_Mutex *Android_ActivityMutex = NULL; static SDL_Mutex *Android_LifecycleMutex = NULL; static SDL_Semaphore *Android_LifecycleEventSem = NULL; @@ -564,7 +561,6 @@ JNIEXPORT jint JNICALL JNI_OnLoad(JavaVM *vm, void *reserved) register_methods(env, "org/libsdl/app/SDLAudioManager", SDLAudioManager_tab, SDL_arraysize(SDLAudioManager_tab)); register_methods(env, "org/libsdl/app/SDLControllerManager", SDLControllerManager_tab, SDL_arraysize(SDLControllerManager_tab)); register_methods(env, "org/libsdl/app/HIDDeviceManager", HIDDeviceManager_tab, SDL_arraysize(HIDDeviceManager_tab)); - SDL_SetAtomicInt(&bAllowRecreateActivity, false); return JNI_VERSION_1_4; } @@ -764,28 +760,16 @@ JNIEXPORT int JNICALL SDL_JAVA_INTERFACE(nativeCheckSDLThreadCounter)( return tmp; } -static void SDLCALL SDL_AllowRecreateActivityChanged(void *userdata, const char *name, const char *oldValue, const char *hint) -{ - if (SDL_GetStringBoolean(hint, false)) { - SDL_SetAtomicInt(&bAllowRecreateActivity, true); - } else { - SDL_SetAtomicInt(&bAllowRecreateActivity, false); - } -} - JNIEXPORT jboolean JNICALL SDL_JAVA_INTERFACE(nativeAllowRecreateActivity)( JNIEnv *env, jclass jcls) { - return SDL_GetAtomicInt(&bAllowRecreateActivity); + return SDL_GetHintBoolean(SDL_HINT_ANDROID_ALLOW_RECREATE_ACTIVITY, false); } JNIEXPORT void JNICALL SDL_JAVA_INTERFACE(nativeInitMainThread)( JNIEnv *env, jclass jcls) { __android_log_print(ANDROID_LOG_VERBOSE, "SDL", "nativeInitSDLThread() %d time", run_count); - if (run_count == 1) { - SDL_AddHintCallback(SDL_HINT_ANDROID_ALLOW_RECREATE_ACTIVITY, SDL_AllowRecreateActivityChanged, NULL); - } run_count += 1; // Save JNIEnv of SDLThread From b4562c024323bf01dffb497fc6dc9db3eca29233 Mon Sep 17 00:00:00 2001 From: Frank Praznik Date: Sat, 11 Jan 2025 14:07:05 -0500 Subject: [PATCH 004/340] cocoa: Add a hint to control menu visibility in fullscreen spaces windows Adds SDL_HINT_VIDEO_MAC_FULLSCREEN_MENU_VISIBILITY to control whether or not the menu can be accessed when the cursor is moved to the top of the screen when a window is in fullscreen spaces mode. The three values are true, false, and 'auto' (default), with auto resulting in a hidden menu if fullscreen was toggled programmatically, and the menu being accessible if fullscreen was toggled via the button on the window title bar, so the user has an easy way back out of fullscreen if the client app/game doesn't have a readily available option to toggle it. --- include/SDL3/SDL_hints.h | 17 +++++++ src/video/cocoa/SDL_cocoavideo.m | 1 + src/video/cocoa/SDL_cocoawindow.h | 3 ++ src/video/cocoa/SDL_cocoawindow.m | 78 ++++++++++++++++++++++++------- 4 files changed, 82 insertions(+), 17 deletions(-) diff --git a/include/SDL3/SDL_hints.h b/include/SDL3/SDL_hints.h index 622297c042812..de5b5b407a377 100644 --- a/include/SDL3/SDL_hints.h +++ b/include/SDL3/SDL_hints.h @@ -3330,6 +3330,23 @@ extern "C" { */ #define SDL_HINT_VIDEO_MAC_FULLSCREEN_SPACES "SDL_VIDEO_MAC_FULLSCREEN_SPACES" +/** + * A variable that specifies the menu visibility when a window is fullscreen in Spaces on macOS. + * + * The variable can be set to the following values: + * + * - "0": The menu will be hidden when the window is in a fullscreen space, and not accessible by moving the mouse to the top of the screen. + * - "1": The menu will be accessible when the window is in a fullscreen space. + * - "auto": The menu will be hidden if fullscreen mode was toggled on programmatically via `SDL_SetWindowFullscreen()`, + * and accessible if fullscreen was entered via the "fullscreen" button on the window + * title bar. (default) + * + * This hint can be set anytime. + * + * \since This hint is available since SDL 3.1.9. + */ +#define SDL_HINT_VIDEO_MAC_FULLSCREEN_MENU_VISIBILITY "SDL_VIDEO_MAC_FULLSCREEN_MENU_VISIBILITY" + /** * A variable controlling whether fullscreen windows are minimized when they * lose focus. diff --git a/src/video/cocoa/SDL_cocoavideo.m b/src/video/cocoa/SDL_cocoavideo.m index 6f25de1e6e1fb..7d595e1366ada 100644 --- a/src/video/cocoa/SDL_cocoavideo.m +++ b/src/video/cocoa/SDL_cocoavideo.m @@ -218,6 +218,7 @@ static bool Cocoa_VideoInit(SDL_VideoDevice *_this) data.allow_spaces = SDL_GetHintBoolean(SDL_HINT_VIDEO_MAC_FULLSCREEN_SPACES, true); data.trackpad_is_touch_only = SDL_GetHintBoolean(SDL_HINT_TRACKPAD_IS_TOUCH_ONLY, false); + SDL_AddHintCallback(SDL_HINT_VIDEO_MAC_FULLSCREEN_MENU_VISIBILITY, Cocoa_MenuVisibilityCallback, NULL); data.swaplock = SDL_CreateMutex(); if (!data.swaplock) { diff --git a/src/video/cocoa/SDL_cocoawindow.h b/src/video/cocoa/SDL_cocoawindow.h index fa46cbb37066f..af567b8af2899 100644 --- a/src/video/cocoa/SDL_cocoawindow.h +++ b/src/video/cocoa/SDL_cocoawindow.h @@ -142,6 +142,7 @@ typedef enum @property(nonatomic) NSView *sdlContentView; @property(nonatomic) NSMutableArray *nscontexts; @property(nonatomic) BOOL in_blocking_transition; +@property(nonatomic) BOOL fullscreen_space_requested; @property(nonatomic) BOOL was_zoomed; @property(nonatomic) NSInteger window_number; @property(nonatomic) NSInteger flash_request; @@ -192,4 +193,6 @@ extern bool Cocoa_SetWindowModal(SDL_VideoDevice *_this, SDL_Window *window, boo extern bool Cocoa_SetWindowParent(SDL_VideoDevice *_this, SDL_Window *window, SDL_Window *parent); extern bool Cocoa_SyncWindow(SDL_VideoDevice *_this, SDL_Window *window); +extern void Cocoa_MenuVisibilityCallback(void *userdata, const char *name, const char *oldValue, const char *newValue); + #endif // SDL_cocoawindow_h_ diff --git a/src/video/cocoa/SDL_cocoawindow.m b/src/video/cocoa/SDL_cocoawindow.m index 9ae7b16350612..01fdc7b422df4 100644 --- a/src/video/cocoa/SDL_cocoawindow.m +++ b/src/video/cocoa/SDL_cocoawindow.m @@ -404,6 +404,61 @@ static CGFloat SqDistanceToRect(const NSPoint *point, const NSRect *rect) return screen; } +bool Cocoa_IsWindowInFullscreenSpace(SDL_Window *window) +{ + @autoreleasepool { + SDL_CocoaWindowData *data = (__bridge SDL_CocoaWindowData *)window->internal; + + if ([data.listener isInFullscreenSpace]) { + return true; + } else { + return false; + } + } +} + +typedef enum CocoaMenuVisibility +{ + COCOA_MENU_VISIBILITY_AUTO = 0, + COCOA_MENU_VISIBILITY_NEVER, + COCOA_MENU_VISIBILITY_ALWAYS +} CocoaMenuVisibility; + +static CocoaMenuVisibility menu_visibility_hint = COCOA_MENU_VISIBILITY_AUTO; + +static void Cocoa_ToggleFullscreenSpaceMenuVisibility(SDL_Window *window) +{ + if (window && Cocoa_IsWindowInFullscreenSpace(window)) { + SDL_CocoaWindowData *data = (__bridge SDL_CocoaWindowData *)window->internal; + + // 'Auto' sets the menu to visible if fullscreen wasn't explicitly entered via SDL_SetWindowFullscreen(). + if ((menu_visibility_hint == COCOA_MENU_VISIBILITY_AUTO && !data.fullscreen_space_requested) || + menu_visibility_hint == COCOA_MENU_VISIBILITY_ALWAYS) { + [NSMenu setMenuBarVisible:YES]; + } else { + [NSMenu setMenuBarVisible:NO]; + } + } +} + +void Cocoa_MenuVisibilityCallback(void *userdata, const char *name, const char *oldValue, const char *newValue) +{ + if (newValue) { + if (*newValue == '0' || SDL_strcasecmp(newValue, "false") == 0) { + menu_visibility_hint = COCOA_MENU_VISIBILITY_NEVER; + } else if (*newValue == '1' || SDL_strcasecmp(newValue, "true") == 0) { + menu_visibility_hint = COCOA_MENU_VISIBILITY_ALWAYS; + } else { + menu_visibility_hint = COCOA_MENU_VISIBILITY_AUTO; + } + } else { + menu_visibility_hint = COCOA_MENU_VISIBILITY_AUTO; + } + + // Update the current menu visibility. + Cocoa_ToggleFullscreenSpaceMenuVisibility(SDL_GetKeyboardFocus()); +} + static NSScreen *ScreenForRect(const NSRect *rect) { NSPoint center = NSMakePoint(NSMidX(*rect), NSMidY(*rect)); @@ -1195,7 +1250,7 @@ - (void)windowDidBecomeKey:(NSNotification *)aNotification Cocoa_CheckClipboardUpdate(_data.videodata); if (isFullscreenSpace && !window->fullscreen_exclusive) { - [NSMenu setMenuBarVisible:NO]; + Cocoa_ToggleFullscreenSpaceMenuVisibility(window); } { const unsigned int newflags = [NSEvent modifierFlags] & NSEventModifierFlagCapsLock; @@ -1307,9 +1362,7 @@ - (void)windowDidEnterFullScreen:(NSNotification *)aNotification if ([self windowOperationIsPending:PENDING_OPERATION_LEAVE_FULLSCREEN]) { [self setFullscreenSpace:NO]; } else { - if (window->fullscreen_exclusive) { - [NSMenu setMenuBarVisible:NO]; - } + Cocoa_ToggleFullscreenSpaceMenuVisibility(window); /* Don't recurse back into UpdateFullscreenMode() if this was hit in * a blocking transition, as the caller is already waiting in @@ -1380,6 +1433,7 @@ - (void)windowDidExitFullScreen:(NSNotification *)aNotification NSWindow *nswindow = _data.nswindow; inFullscreenTransition = NO; + _data.fullscreen_space_requested = NO; /* As of macOS 10.15, the window decorations can go missing sometimes after certain fullscreen-desktop->exlusive-fullscreen->windowed mode flows @@ -3030,25 +3084,15 @@ void Cocoa_DestroyWindow(SDL_VideoDevice *_this, SDL_Window *window) } } -bool Cocoa_IsWindowInFullscreenSpace(SDL_Window *window) -{ - @autoreleasepool { - SDL_CocoaWindowData *data = (__bridge SDL_CocoaWindowData *)window->internal; - - if ([data.listener isInFullscreenSpace]) { - return true; - } else { - return false; - } - } -} - bool Cocoa_SetWindowFullscreenSpace(SDL_Window *window, bool state, bool blocking) { @autoreleasepool { bool succeeded = false; SDL_CocoaWindowData *data = (__bridge SDL_CocoaWindowData *)window->internal; + if (state) { + data.fullscreen_space_requested = YES; + } data.in_blocking_transition = blocking; if ([data.listener setFullscreenSpace:(state ? YES : NO)]) { if (blocking) { From 438075a83a92dcfb4890ee321d3f791047f427a5 Mon Sep 17 00:00:00 2001 From: SDL Wiki Bot Date: Mon, 13 Jan 2025 17:38:58 +0000 Subject: [PATCH 005/340] Sync SDL3 wiki -> header [ci skip] --- include/SDL3/SDL_hints.h | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/include/SDL3/SDL_hints.h b/include/SDL3/SDL_hints.h index de5b5b407a377..0a4bc48f7dae0 100644 --- a/include/SDL3/SDL_hints.h +++ b/include/SDL3/SDL_hints.h @@ -3331,15 +3331,19 @@ extern "C" { #define SDL_HINT_VIDEO_MAC_FULLSCREEN_SPACES "SDL_VIDEO_MAC_FULLSCREEN_SPACES" /** - * A variable that specifies the menu visibility when a window is fullscreen in Spaces on macOS. + * A variable that specifies the menu visibility when a window is fullscreen + * in Spaces on macOS. * * The variable can be set to the following values: * - * - "0": The menu will be hidden when the window is in a fullscreen space, and not accessible by moving the mouse to the top of the screen. - * - "1": The menu will be accessible when the window is in a fullscreen space. - * - "auto": The menu will be hidden if fullscreen mode was toggled on programmatically via `SDL_SetWindowFullscreen()`, - * and accessible if fullscreen was entered via the "fullscreen" button on the window - * title bar. (default) + * - "0": The menu will be hidden when the window is in a fullscreen space, + * and not accessible by moving the mouse to the top of the screen. + * - "1": The menu will be accessible when the window is in a fullscreen + * space. + * - "auto": The menu will be hidden if fullscreen mode was toggled on + * programmatically via `SDL_SetWindowFullscreen()`, and accessible if + * fullscreen was entered via the "fullscreen" button on the window title + * bar. (default) * * This hint can be set anytime. * From 66408308b83e8a9de4a68d99fe71b2d0991633b6 Mon Sep 17 00:00:00 2001 From: Sam Lantinga Date: Mon, 13 Jan 2025 09:49:03 -0800 Subject: [PATCH 006/340] Added documentation for mouse handling in relative mode Fixes https://github.com/libsdl-org/SDL/issues/11805 --- include/SDL3/SDL_mouse.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/include/SDL3/SDL_mouse.h b/include/SDL3/SDL_mouse.h index e6d09bfc061cc..0dfbbb6061ca1 100644 --- a/include/SDL3/SDL_mouse.h +++ b/include/SDL3/SDL_mouse.h @@ -359,6 +359,8 @@ extern SDL_DECLSPEC bool SDLCALL SDL_WarpMouseGlobal(float x, float y); * report continuous relative mouse motion even if the mouse is at the edge of * the window. * + * If you'd like to keep the mouse position fixed while in relative mode you can use SDL_SetWindowMouseRect(). If you'd like the cursor to be at a specific location when relative mode ends, you should use SDL_WarpMouseInWindow() before disabling relative mode. + * * This function will flush any pending mouse motion for this window. * * \param window the window to change. From 7d7a76c077552ebeb3b54e6dc98aba5df82ab973 Mon Sep 17 00:00:00 2001 From: SDL Wiki Bot Date: Mon, 13 Jan 2025 17:53:40 +0000 Subject: [PATCH 007/340] Sync SDL3 wiki -> header [ci skip] --- include/SDL3/SDL_mouse.h | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/include/SDL3/SDL_mouse.h b/include/SDL3/SDL_mouse.h index 0dfbbb6061ca1..d7b87fd881eef 100644 --- a/include/SDL3/SDL_mouse.h +++ b/include/SDL3/SDL_mouse.h @@ -359,7 +359,10 @@ extern SDL_DECLSPEC bool SDLCALL SDL_WarpMouseGlobal(float x, float y); * report continuous relative mouse motion even if the mouse is at the edge of * the window. * - * If you'd like to keep the mouse position fixed while in relative mode you can use SDL_SetWindowMouseRect(). If you'd like the cursor to be at a specific location when relative mode ends, you should use SDL_WarpMouseInWindow() before disabling relative mode. + * If you'd like to keep the mouse position fixed while in relative mode you + * can use SDL_SetWindowMouseRect(). If you'd like the cursor to be at a + * specific location when relative mode ends, you should use + * SDL_WarpMouseInWindow() before disabling relative mode. * * This function will flush any pending mouse motion for this window. * From e5a4f093632739160365d699b54e94c6772c6657 Mon Sep 17 00:00:00 2001 From: Sam Lantinga Date: Mon, 13 Jan 2025 10:22:10 -0800 Subject: [PATCH 008/340] Call SDL_UDEV_Quit() if we don't end up using it --- src/joystick/linux/SDL_sysjoystick.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/joystick/linux/SDL_sysjoystick.c b/src/joystick/linux/SDL_sysjoystick.c index fe8fca9c9d670..8fbaca99d024b 100644 --- a/src/joystick/linux/SDL_sysjoystick.c +++ b/src/joystick/linux/SDL_sysjoystick.c @@ -1036,6 +1036,10 @@ static bool LINUX_JoystickInit(void) "udev init failed, disabling udev integration"); enumeration_method = ENUMERATION_FALLBACK; } + } else { + if (udev_initialized) { + SDL_UDEV_Quit(); + } } #endif From 569de8490716a61860b0fcf0c0bd5e78fedc644d Mon Sep 17 00:00:00 2001 From: expikr <77922942+expikr@users.noreply.github.com> Date: Tue, 14 Jan 2025 00:58:06 +0800 Subject: [PATCH 009/340] better numerical precision for playback example --- examples/audio/01-simple-playback/simple-playback.c | 9 ++++----- .../simple-playback-callback.c | 9 ++++----- 2 files changed, 8 insertions(+), 10 deletions(-) diff --git a/examples/audio/01-simple-playback/simple-playback.c b/examples/audio/01-simple-playback/simple-playback.c index a2b95bf0765ef..0661de1d18c6a 100644 --- a/examples/audio/01-simple-playback/simple-playback.c +++ b/examples/audio/01-simple-playback/simple-playback.c @@ -73,12 +73,11 @@ SDL_AppResult SDL_AppIterate(void *appstate) static float samples[512]; /* this will feed 512 samples each frame until we get to our maximum. */ int i; + /* generate a 440Hz pure tone */ for (i = 0; i < SDL_arraysize(samples); i++) { - /* You don't have to care about this math; we're just generating a simple sine wave as we go. - https://en.wikipedia.org/wiki/Sine_wave */ - const double time = total_samples_generated / 8000.0; - const int sine_freq = 500; /* run the wave at 500Hz */ - samples[i] = (float)SDL_sin(6.283185 * sine_freq * time); + const int freq = 440; + const int phase = (total_samples_generated * freq) % 8000; + samples[i] = (float)SDL_sin(phase * 2 * SDL_PI_D / 8000.0); total_samples_generated++; } diff --git a/examples/audio/02-simple-playback-callback/simple-playback-callback.c b/examples/audio/02-simple-playback-callback/simple-playback-callback.c index f91aaa6ee2204..fe79ffecea088 100644 --- a/examples/audio/02-simple-playback-callback/simple-playback-callback.c +++ b/examples/audio/02-simple-playback-callback/simple-playback-callback.c @@ -33,12 +33,11 @@ static void SDLCALL FeedTheAudioStreamMore(void *userdata, SDL_AudioStream *astr const int total = SDL_min(additional_amount, SDL_arraysize(samples)); int i; + /* generate a 440Hz pure tone */ for (i = 0; i < total; i++) { - /* You don't have to care about this math; we're just generating a simple sine wave as we go. - https://en.wikipedia.org/wiki/Sine_wave */ - const double time = total_samples_generated / 8000.0; - const int sine_freq = 500; /* run the wave at 500Hz */ - samples[i] = (float)SDL_sin(6.283185 * sine_freq * time); + const int freq = 440; + const int phase = (total_samples_generated * freq) % 8000; + samples[i] = (float)SDL_sin(phase * 2 * SDL_PI_D / 8000.0); total_samples_generated++; } From 4bddf521dd6e367e4fa8f5c32c8877ecd36bd302 Mon Sep 17 00:00:00 2001 From: "Ryan C. Gordon" Date: Mon, 13 Jan 2025 14:14:30 -0500 Subject: [PATCH 010/340] emscripten: Override emscripten's fullscreen button with SDL's implementation. Fixes #6798. Fixes #7913. Fixes #9044. --- src/video/emscripten/SDL_emscriptenvideo.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/src/video/emscripten/SDL_emscriptenvideo.c b/src/video/emscripten/SDL_emscriptenvideo.c index 833af7eb0d2aa..413d96fc6089a 100644 --- a/src/video/emscripten/SDL_emscriptenvideo.c +++ b/src/video/emscripten/SDL_emscriptenvideo.c @@ -273,6 +273,11 @@ static void Emscripten_PumpEvents(SDL_VideoDevice *_this) } } +EMSCRIPTEN_KEEPALIVE void requestFullscreenThroughSDL(SDL_Window *window) +{ + SDL_SetWindowFullscreen(window, true); +} + static bool Emscripten_CreateWindow(SDL_VideoDevice *_this, SDL_Window *window, SDL_PropertiesID props) { SDL_WindowData *wdata; @@ -336,6 +341,13 @@ static bool Emscripten_CreateWindow(SDL_VideoDevice *_this, SDL_Window *window, Emscripten_RegisterEventHandlers(wdata); + // disable the emscripten "fullscreen" button. + MAIN_THREAD_EM_ASM({ + Module['requestFullscreen'] = function(lockPointer, resizeCanvas) { + _requestFullscreenThroughSDL($0); + }; + }, window); + // Window has been successfully created return true; } @@ -387,6 +399,9 @@ static void Emscripten_DestroyWindow(SDL_VideoDevice *_this, SDL_Window *window) SDL_free(window->internal); window->internal = NULL; } + + // just ignore clicks on the fullscreen button while there's no SDL window. + MAIN_THREAD_EM_ASM({ Module['requestFullscreen'] = function(lockPointer, resizeCanvas) {}; }); } static SDL_FullscreenResult Emscripten_SetWindowFullscreen(SDL_VideoDevice *_this, SDL_Window *window, SDL_VideoDisplay *display, SDL_FullscreenOp fullscreen) From efaf3739c6f7297cbd4fa491589514b22101d17a Mon Sep 17 00:00:00 2001 From: SDL Wiki Bot Date: Mon, 13 Jan 2025 19:42:26 +0000 Subject: [PATCH 011/340] Sync SDL3 wiki -> header [ci skip] --- include/SDL3/SDL_storage.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/include/SDL3/SDL_storage.h b/include/SDL3/SDL_storage.h index e5ef689f1c9e4..afe50cb1ddc53 100644 --- a/include/SDL3/SDL_storage.h +++ b/include/SDL3/SDL_storage.h @@ -112,8 +112,8 @@ * validated, so an error occurring elsewhere in the program may result in * missing/corrupted save data * - * When using, SDL_Storage, these types of problems are virtually impossible - * to trip over: + * When using SDL_Storage, these types of problems are virtually impossible to + * trip over: * * ```c * void ReadGameData(void) From 2b8fb0bdd471317309a9bfc0d2917ef54dcdaa6e Mon Sep 17 00:00:00 2001 From: "Ryan C. Gordon" Date: Mon, 13 Jan 2025 15:17:52 -0500 Subject: [PATCH 012/340] wikiheaders: Maybe fix perl warning. Reference Issue #11944. --- build-scripts/wikiheaders.pl | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/build-scripts/wikiheaders.pl b/build-scripts/wikiheaders.pl index 554b9903651e0..98591493b7cc5 100755 --- a/build-scripts/wikiheaders.pl +++ b/build-scripts/wikiheaders.pl @@ -2792,7 +2792,8 @@ sub generate_quickref { my $decl = $headerdecls{$sym}; my $str = ''; - $brief = "$brief"; + # the "$brief" makes sure this is a copy of the string, which is doing some weird reference thing otherwise. + $brief = defined $brief ? "$brief" : ''; $brief =~ s/\A[\s\n]*\= .*? \=\s*?\n+//ms; $brief =~ s/\A[\s\n]*\=\= .*? \=\=\s*?\n+//ms; $brief =~ s/\A(.*?\.) /$1\n/; # \brief should only be one sentence, delimited by a period+space. Split if necessary. From e10e42c814f4cadd615c13424ffe87ffa86687d6 Mon Sep 17 00:00:00 2001 From: SDL Wiki Bot Date: Mon, 13 Jan 2025 20:58:20 +0000 Subject: [PATCH 013/340] Sync SDL3 wiki -> header [ci skip] --- include/SDL3/SDL_asyncio.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/include/SDL3/SDL_asyncio.h b/include/SDL3/SDL_asyncio.h index ee13bf3ae681a..33124e93ff54c 100644 --- a/include/SDL3/SDL_asyncio.h +++ b/include/SDL3/SDL_asyncio.h @@ -67,14 +67,14 @@ * * ## Best Practices * - * Simple non-blocking i/o--for an app that just wants to pick up data + * Simple non-blocking I/O--for an app that just wants to pick up data * whenever it's ready without losing framerate waiting on disks to spin--can * use whatever pattern works well for the program. In this case, simply call * SDL_ReadAsyncIO, or maybe SDL_LoadFileAsync, as needed. Once a frame, call * SDL_GetAsyncIOResult to check for any completed tasks and deal with the * data as it arrives. * - * If two separate pieces of the same program need their own i/o, it is legal + * If two separate pieces of the same program need their own I/O, it is legal * for each to create their own queue. This will prevent either piece from * accidentally consuming the other's completed tasks. Each queue does require * some amount of resources, but it is not an overwhelming cost. Do not make a @@ -83,7 +83,7 @@ * were submitted, so it doesn't generally matter what order tasks are * started. * - * One async i/o queue can be shared by multiple threads, or one thread can + * One async I/O queue can be shared by multiple threads, or one thread can * have more than one queue, but the most efficient way--if ruthless * efficiency is the goal--is to have one queue per thread, with multiple * threads working in parallel, and attempt to keep each queue loaded with From 3766a394096793e721e890dd2a046c9359524843 Mon Sep 17 00:00:00 2001 From: "Ryan C. Gordon" Date: Mon, 13 Jan 2025 16:23:25 -0500 Subject: [PATCH 014/340] emscripten: double the audio buffer size. Some systems seem to not keep up with the smaller buffer. Reference Issue #11930. --- src/audio/emscripten/SDL_emscriptenaudio.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/audio/emscripten/SDL_emscriptenaudio.c b/src/audio/emscripten/SDL_emscriptenaudio.c index b60df7c174c1e..84ba63b0c4d30 100644 --- a/src/audio/emscripten/SDL_emscriptenaudio.c +++ b/src/audio/emscripten/SDL_emscriptenaudio.c @@ -190,7 +190,7 @@ static bool EMSCRIPTENAUDIO_OpenDevice(SDL_AudioDevice *device) // limit to native freq device->spec.freq = EM_ASM_INT({ return Module['SDL3'].audioContext.sampleRate; }); - device->sample_frames = SDL_GetDefaultSampleFramesFromFreq(device->spec.freq); + device->sample_frames = SDL_GetDefaultSampleFramesFromFreq(device->spec.freq) * 2; // double the buffer size, some browsers need more, and we'll just have to live with the latency. SDL_UpdatedAudioDeviceFormat(device); From 5e4a2974aac9b58bb8b342af280704b4761880d0 Mon Sep 17 00:00:00 2001 From: Sam Lantinga Date: Sun, 12 Jan 2025 16:07:50 -0800 Subject: [PATCH 015/340] Removed obsolete warnings about MIT licensed SIMD code We no longer use the code this was warning about --- CMakeLists.txt | 1 - cmake/macros.cmake | 18 ------------------ 2 files changed, 19 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index ad65570e27010..5d0f095f76d96 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -308,7 +308,6 @@ dep_option(SDL_SSE4_1 "Use SSE4.1 assembly routines" ON "SDL_ASSEMB dep_option(SDL_SSE4_2 "Use SSE4.2 assembly routines" ON "SDL_ASSEMBLY;SDL_CPU_X86 OR SDL_CPU_X64" OFF) dep_option(SDL_MMX "Use MMX assembly routines" ON "SDL_ASSEMBLY;SDL_CPU_X86 OR SDL_CPU_X64" OFF) dep_option(SDL_ALTIVEC "Use Altivec assembly routines" ON "SDL_ASSEMBLY;SDL_CPU_POWERPC32 OR SDL_CPU_POWERPC64" OFF) -dep_option(SDL_ARMSIMD "Use SIMD assembly blitters on ARM" OFF "SDL_ASSEMBLY;SDL_CPU_ARM32" OFF) dep_option(SDL_ARMNEON "Use NEON assembly routines" ON "SDL_ASSEMBLY;SDL_CPU_ARM32 OR SDL_CPU_ARM64" OFF) dep_option(SDL_LSX "Use LSX assembly routines" ON "SDL_ASSEMBLY;SDL_CPU_LOONGARCH64" OFF) dep_option(SDL_LASX "Use LASX assembly routines" ON "SDL_ASSEMBLY;SDL_CPU_LOONGARCH64" OFF) diff --git a/cmake/macros.cmake b/cmake/macros.cmake index 82dded49959fc..3885abaea28bd 100644 --- a/cmake/macros.cmake +++ b/cmake/macros.cmake @@ -376,24 +376,6 @@ function(SDL_PrintSummary) message(STATUS "") endif() - if(WARN_ABOUT_ARM_SIMD_ASM_MIT) - message(STATUS "SDL is being built with ARM SIMD optimizations, which") - message(STATUS "uses code licensed under the MIT license. If this is a") - message(STATUS "problem, please disable that code by rerunning CMake with:") - message(STATUS "") - message(STATUS " -DSDL_ARMSIMD=OFF") - message(STATUS "") - endif() - - if(WARN_ABOUT_ARM_NEON_ASM_MIT) - message(STATUS "SDL is being built with ARM NEON optimizations, which") - message(STATUS "uses code licensed under the MIT license. If this is a") - message(STATUS "problem, please disable that code by rerunning CMake with:") - message(STATUS "") - message(STATUS " -DSDL_ARMNEON=OFF") - message(STATUS "") - endif() - if(UNIX AND NOT (ANDROID OR APPLE OR EMSCRIPTEN OR HAIKU OR RISCOS)) if(NOT (HAVE_X11 OR HAVE_WAYLAND)) if(NOT SDL_UNIX_CONSOLE_BUILD) From 922b73195c22dba37bd4cf4daace1e58b36ee261 Mon Sep 17 00:00:00 2001 From: Sam Lantinga Date: Sun, 12 Jan 2025 16:28:46 -0800 Subject: [PATCH 016/340] Simplified the README --- README.md | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/README.md b/README.md index c4861c70d43ff..37ee236030646 100644 --- a/README.md +++ b/README.md @@ -1,16 +1,13 @@ -# Simple DirectMedia Layer (SDL) Version 3.0 +Simple DirectMedia Layer (SDL for short) is a cross-platform library +designed to make it easy to write multi-media software, such as games +and emulators. +You can find the latest release and additional documentation at: https://www.libsdl.org/ -Simple DirectMedia Layer is a cross-platform development library designed -to provide low level access to audio, keyboard, mouse, joystick, and graphics -hardware. It is used by video playback software, emulators, and popular games -including Valve's award winning catalog and many Humble Bundle games. - -More extensive documentation is available in the docs directory, starting -with [README.md](docs/README.md). If you are migrating to SDL 3.0 from SDL 2.0, -the changes are extensively documented in [README-migration.md](docs/README-migration.md). +This library is distributed under the terms of the zlib license, +available in the file LICENSE.txt. Enjoy! From 41d48db4aea1749e852c9693d123ec57ec3c8b74 Mon Sep 17 00:00:00 2001 From: Sam Lantinga Date: Sun, 12 Jan 2025 16:29:24 -0800 Subject: [PATCH 017/340] Removed the runtime README The main README is suitable for inclusion in redistributable archives and we'll have custom installation instructions for each platform. --- README-SDL.txt | 13 ------------- 1 file changed, 13 deletions(-) delete mode 100644 README-SDL.txt diff --git a/README-SDL.txt b/README-SDL.txt deleted file mode 100644 index 8d92955a9e425..0000000000000 --- a/README-SDL.txt +++ /dev/null @@ -1,13 +0,0 @@ - -Please distribute this file with the SDL runtime environment: - -The Simple DirectMedia Layer (SDL for short) is a cross-platform library -designed to make it easy to write multi-media software, such as games -and emulators. - -The Simple DirectMedia Layer library source code is available from: -https://www.libsdl.org/ - -This library is distributed under the terms of the zlib license: -http://www.zlib.net/zlib_license.html - From 2ad0f1e1fe012859e140d8c344c71747f9a21c81 Mon Sep 17 00:00:00 2001 From: Sam Lantinga Date: Sun, 12 Jan 2025 16:47:37 -0800 Subject: [PATCH 018/340] Updated the credits for SDL 3.0 --- CREDITS.md | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/CREDITS.md b/CREDITS.md index 370bcec0ffe9c..55105a88e5db7 100644 --- a/CREDITS.md +++ b/CREDITS.md @@ -4,6 +4,10 @@ Thanks to everyone who made this possible, including: - Cliff Matthews, for giving me a reason to start this project. :) -- Executor rocks! *grin* - Ryan Gordon for helping everybody out and keeping the dream alive. :) +- Frank Praznik for his Wayland support and general windowing development. +- Ozkan Sezer for sanity checks and make sure the i's are dotted and t's are crossed. +- Anonymous Maarten for CMake support and build system development. +- Evan Hemsley, Caleb Cornett, and Ethan Lee for SDL GPU development. - Gabriel Jacobo for his work on the Android port and generally helping out all around. - Philipp Wiesemann for his attention to detail reviewing the entire SDL code base and proposes patches. - Andreas Schiffler for his dedication to unit tests, Visual Studio projects, and managing the Google Summer of Code. @@ -24,7 +28,7 @@ Thanks to everyone who made this possible, including: - Holmes Futrell for his port of SDL to the iPhone and iPod Touch during the Google Summer of Code 2008. - Jon Atkins for SDL_image, SDL_mixer and SDL_net documentation. -- Everybody at Loki Software, Inc. for their great contributions! +- Everybody at Loki Software, Inc. and Valve Corporation for their great contributions! And a big hand to everyone else who has contributed over the years. From b08d0458117760ab92d3bd9212b3a3d1b3f56358 Mon Sep 17 00:00:00 2001 From: Sam Lantinga Date: Sun, 12 Jan 2025 16:51:04 -0800 Subject: [PATCH 019/340] Added a Discord link to BUGS.txt --- BUGS.txt | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/BUGS.txt b/BUGS.txt index b1463e777578a..e5b8f28f0b8a4 100644 --- a/BUGS.txt +++ b/BUGS.txt @@ -11,6 +11,9 @@ You may also find help at the SDL forums/mailing list: https://discourse.libsdl.org/ -Bug reports are welcome here, but we really appreciate if you use the issue - tracker, as bugs discussed on the mailing list may be forgotten or missed. +or on Discord: + + https://discord.com/invite/BwpFGBWsv8 + +Bug reports are welcome here, but we really appreciate if you use the issue tracker, as bugs discussed on the mailing list or Discord may be forgotten or missed. From 670db4d248d93963ef9d7e7c84daeaaa7e5ed36b Mon Sep 17 00:00:00 2001 From: Sam Lantinga Date: Sun, 12 Jan 2025 16:56:04 -0800 Subject: [PATCH 020/340] Made the README links in INSTALL.md markdown links --- INSTALL.md | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/INSTALL.md b/INSTALL.md index c9f6278a405e3..2c5677a44ada4 100644 --- a/INSTALL.md +++ b/INSTALL.md @@ -2,7 +2,7 @@ ## Windows with Visual Studio: -Read ./docs/README-visualc.md +Read [README-visualc.md](docs/README-visualc.md) ## Windows building with mingw-w64 for x86: @@ -18,7 +18,7 @@ Run: `cmake -S . -B build -DCMAKE_TOOLCHAIN_FILE=build-scripts/cmake-toolchain-m ## macOS with Xcode: -Read docs/README-macos.md +Read [README-macos.md](docs/README-macos.md) ## macOS from the command line: @@ -34,15 +34,15 @@ Run: `cmake -S . -B build && cmake --build build --parallel $(nproc) && cmake -- ## Android: -Read docs/README-android.md +Read [README-android.md](docs/README-android.md) ## iOS: -Read docs/README-ios.md +Read [README-ios.md](docs/README-ios.md) ## Using CMake: -Read docs/README-cmake.md +Read [README-cmake.md](docs/README-cmake.md) # Example code From 96414fa56a4c3e1e2b9d81a611365e1260013e7f Mon Sep 17 00:00:00 2001 From: Sam Lantinga Date: Sun, 12 Jan 2025 17:46:43 -0800 Subject: [PATCH 021/340] Removed obsolete Raspberry Pi documentation --- docs/README-raspberrypi.md | 188 ------------------------------------- docs/README.md | 1 - 2 files changed, 189 deletions(-) delete mode 100644 docs/README-raspberrypi.md diff --git a/docs/README-raspberrypi.md b/docs/README-raspberrypi.md deleted file mode 100644 index ba34f47b1fea0..0000000000000 --- a/docs/README-raspberrypi.md +++ /dev/null @@ -1,188 +0,0 @@ -Raspberry Pi -============ - -Requirements: - -Raspberry Pi OS (other Linux distros may work as well). - -In modern times, the Raspberry Pi works mostly like any other Linux device: -for video, you can use X11, Wayland, or KMSDRM. For audio, you can use ALSA, -PulseAudio, or PipeWire, etc. OpenGL, OpenGL ES, and Vulkan are known to work. - -There is a video backend in SDL called "rpi" that uses a deprecated Broadcom -interface (named "dispmanx") to draw directly to the console without X11. -Newer Raspberry Pi OS releases don't support this (and work fine with our -"kmsdrm" backend for the same purposes, a standard Linux interface). Don't -panic if you can't use this backend, or CMake says it can't find libraries it -needs for this. - -SDL has, in past times, worked on the original Raspberry Pi and the RPi 2, but -these devices are no longer targets we actively test; if they broke, please -report bugs or send patches! - -The Raspberry Pi 3 and later (in 32-bit and 64-bit mode) are still known to -work well at the time of this writing. The Raspberry Pi Zero and Zero 2 are -also known to work well. - - -## Documentation Out Of Date - -The rest of this document is likely out of date; a lot has changed in recent -years in both SDL and the Raspberry Pi universe, and this document has not -been updated to reflect those details. Take the rest of this information with -a grain of salt! - - - -NEON ----- - -If your Pi has NEON support, make sure you add -mfpu=neon to your CFLAGS so -that SDL will select some otherwise-disabled highly-optimized code. The -original Pi and Pi Zero units don't have NEON; everything from the Pi2/PiZero2 -and later do. - - -Cross compiling from x86 Linux ------------------------------- - -To cross compile SDL for Raspbian from your desktop machine, you'll need a -Raspbian system root and the cross compilation tools. We'll assume these tools -will be placed in /opt/rpi-tools - - sudo git clone --depth 1 https://github.com/raspberrypi/tools /opt/rpi-tools - -You'll also need a Raspbian binary image. -Get it from: http://downloads.raspberrypi.org/raspbian_latest -After unzipping, you'll get file with a name like: "-wheezy-raspbian.img" -Let's assume the sysroot will be built in /opt/rpi-sysroot. - - export SYSROOT=/opt/rpi-sysroot - sudo kpartx -a -v .img - sudo mount -o loop /dev/mapper/loop0p2 /mnt - sudo cp -r /mnt $SYSROOT - sudo apt-get install qemu binfmt-support qemu-user-static - sudo cp /usr/bin/qemu-arm-static $SYSROOT/usr/bin - sudo mount --bind /dev $SYSROOT/dev - sudo mount --bind /proc $SYSROOT/proc - sudo mount --bind /sys $SYSROOT/sys - -Now, before chrooting into the ARM sysroot, you'll need to apply a workaround, -edit $SYSROOT/etc/ld.so.preload and comment out all lines in it. - - sudo chroot $SYSROOT - apt-get install libudev-dev libasound2-dev libdbus-1-dev libraspberrypi0 libraspberrypi-bin libraspberrypi-dev libx11-dev libxext-dev libxrandr-dev libxcursor-dev libxi-dev libxss-dev - exit - sudo umount $SYSROOT/dev - sudo umount $SYSROOT/proc - sudo umount $SYSROOT/sys - sudo umount /mnt - -There's one more fix required, as the libdl.so symlink uses an absolute path -which doesn't quite work in our setup. - - sudo rm -rf $SYSROOT/usr/lib/arm-linux-gnueabihf/libdl.so - sudo ln -s ../../../lib/arm-linux-gnueabihf/libdl.so.2 $SYSROOT/usr/lib/arm-linux-gnueabihf/libdl.so - -The final step is compiling SDL itself. - - export CC="/opt/rpi-tools/arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian/bin/arm-linux-gnueabihf-gcc --sysroot=$SYSROOT -I$SYSROOT/opt/vc/include -I$SYSROOT/usr/include -I$SYSROOT/opt/vc/include/interface/vcos/pthreads -I$SYSROOT/opt/vc/include/interface/vmcs_host/linux" - cd - mkdir -p build;cd build - LDFLAGS="-L$SYSROOT/opt/vc/lib" ../configure --with-sysroot=$SYSROOT --host=arm-raspberry-linux-gnueabihf --prefix=$PWD/rpi-sdl3-installed --disable-pulseaudio --disable-esd - make - make install - -To be able to deploy this to /usr/local in the Raspbian system you need to fix up a few paths: - - perl -w -pi -e "s#$PWD/rpi-sdl3-installed#/usr/local#g;" ./rpi-sdl3-installed/lib/libSDL3.la ./rpi-sdl3-installed/lib/pkgconfig/sdl3.pc - -Apps don't work or poor video/audio performance ------------------------------------------------ - -If you get sound problems, buffer underruns, etc, run "sudo rpi-update" to -update the RPi's firmware. Note that doing so will fix these problems, but it -will also render the CMA - Dynamic Memory Split functionality useless. - -Also, by default the Raspbian distro configures the GPU RAM at 64MB, this is too -low in general, specially if a 1080p TV is hooked up. - -See here how to configure this setting: http://elinux.org/RPiconfig - -Using a fixed gpu_mem=128 is the best option (specially if you updated the -firmware, using CMA probably won't work, at least it's the current case). - -No input --------- - -Make sure you belong to the "input" group. - - sudo usermod -aG input `whoami` - -No HDMI Audio -------------- - -If you notice that ALSA works but there's no audio over HDMI, try adding: - - hdmi_drive=2 - -to your config.txt file and reboot. - -Reference: http://www.raspberrypi.org/phpBB3/viewtopic.php?t=5062 - -Text Input API support ----------------------- - -The Text Input API is supported, with translation of scan codes done via the -kernel symbol tables. For this to work, SDL needs access to a valid console. -If you notice there's no SDL_EVENT_TEXT_INPUT message being emitted, double check that -your app has read access to one of the following: - -* /proc/self/fd/0 -* /dev/tty -* /dev/tty[0...6] -* /dev/vc/0 -* /dev/console - -This is usually not a problem if you run from the physical terminal (as opposed -to running from a pseudo terminal, such as via SSH). If running from a PTS, a -quick workaround is to run your app as root or add yourself to the tty group, -then re-login to the system. - - sudo usermod -aG tty `whoami` - -The keyboard layout used by SDL is the same as the one the kernel uses. -To configure the layout on Raspbian: - - sudo dpkg-reconfigure keyboard-configuration - -To configure the locale, which controls which keys are interpreted as letters, -this determining the CAPS LOCK behavior: - - sudo dpkg-reconfigure locales - - -OpenGL problems ---------------- - -If you have desktop OpenGL headers installed at build time in your RPi or cross -compilation environment, support for it will be built in. However, the chipset -does not actually have support for it, which causes issues in certain SDL apps -since the presence of OpenGL support supersedes the ES/ES2 variants. -The workaround is to disable OpenGL at configuration time: - - ./configure --disable-video-opengl - -Or if the application uses the Render functions, you can use the SDL_RENDER_DRIVER -environment variable: - - export SDL_RENDER_DRIVER=opengles2 - -Notes ------ - -* When launching apps remotely (via SSH), SDL can prevent local keystrokes from - leaking into the console only if it has root privileges. Launching apps locally - does not suffer from this issue. - - diff --git a/docs/README.md b/docs/README.md index 812d3ce65dd27..18c1d89b9f5c4 100644 --- a/docs/README.md +++ b/docs/README.md @@ -45,7 +45,6 @@ More documentation and FAQs are available online at [the wiki](http://wiki.libsd - [PS2](README-ps2.md) - [PSP](README-psp.md) - [PSVita](README-vita.md) -- [Raspberry Pi](README-raspberrypi.md) - [RISC OS](README-riscos.md) - [Windows GDK](README-gdk.md) - [Windows](README-windows.md) From 86b46c678ce37eb6204dc029cd7ea4f482bbc3f5 Mon Sep 17 00:00:00 2001 From: Sam Lantinga Date: Sun, 12 Jan 2025 17:50:19 -0800 Subject: [PATCH 022/340] Removed README-git.md We're fully hosted on GitHub, no need for additional explanation. --- docs/README-git.md | 16 ---------------- 1 file changed, 16 deletions(-) delete mode 100644 docs/README-git.md diff --git a/docs/README-git.md b/docs/README-git.md deleted file mode 100644 index aa0aa40547477..0000000000000 --- a/docs/README-git.md +++ /dev/null @@ -1,16 +0,0 @@ -git -========= - -The latest development version of SDL is available via git. -Git allows you to get up-to-the-minute fixes and enhancements; -as a developer works on a source tree, you can use "git" to mirror that -source tree instead of waiting for an official release. Please look -at the Git website ( https://git-scm.com/ ) for more -information on using git, where you can also download software for -macOS, Windows, and Unix systems. - - git clone https://github.com/libsdl-org/SDL - -There is a web interface to the Git repository at: - http://github.com/libsdl-org/SDL/ - From 995a6a03335c3aff37466cec2ca4a0aab478b054 Mon Sep 17 00:00:00 2001 From: Sam Lantinga Date: Sun, 12 Jan 2025 17:52:21 -0800 Subject: [PATCH 023/340] Minor readability improvement for README-contributing.md --- docs/README-contributing.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/README-contributing.md b/docs/README-contributing.md index e6435f787d0e3..02a37bf756620 100644 --- a/docs/README-contributing.md +++ b/docs/README-contributing.md @@ -57,7 +57,7 @@ If you had already forked the repository, you may update it from the web page us Code formatting is done using a custom `.clang-format` file, you can learn more about how to run it [here](https://clang.llvm.org/docs/ClangFormat.html). -Some legacy code may not be formatted, as such avoid formatting the whole file at once and only format around your changes. +Some legacy code may not be formatted, so please avoid formatting the whole file at once and only format around your changes. For your commit message to be properly displayed on GitHub, it should contain: From 584c1d57918ba67d974b9ca134f1166f47b8da8a Mon Sep 17 00:00:00 2001 From: Sam Lantinga Date: Sun, 12 Jan 2025 18:00:31 -0800 Subject: [PATCH 024/340] Tweaking the README --- docs/README.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/docs/README.md b/docs/README.md index 18c1d89b9f5c4..26937d76a802b 100644 --- a/docs/README.md +++ b/docs/README.md @@ -19,18 +19,17 @@ in the file "LICENSE.txt". Information on building SDL with CMake is available in [README-cmake.md](README-cmake.md) The best way to learn how to use SDL is to check out the header files in -the "include" subdirectory and the programs in the "test" subdirectory. +the "include" subdirectory and the programs in the "examples" subdirectory. The header files and test programs are well commented and always up to date. Information on reporting bugs and contributing is available in [README-contributing.md](README-contributing.md) More documentation and FAQs are available online at [the wiki](http://wiki.libsdl.org/) -- [High DPI Support](README-highdpi.md) -- [main()](README-main-functions.md) -- [Porting information](README-porting.md) - [Migrating from SDL 2.0](README-migration.md) - [Supported Platforms](README-platforms.md) +- [main()](README-main-functions.md) +- [High DPI Support](README-highdpi.md) - [Touch](README-touch.md) - [Versions](README-versions.md) - [Visual Studio](README-visualc.md) @@ -48,6 +47,7 @@ More documentation and FAQs are available online at [the wiki](http://wiki.libsd - [RISC OS](README-riscos.md) - [Windows GDK](README-gdk.md) - [Windows](README-windows.md) +- [Porting information](README-porting.md) If you need help with the library, or just want to discuss SDL related issues, you can join the [SDL Discourse](https://discourse.libsdl.org/), From 55e094f7acd594909a5e9afaf1358d09c8b9e8e3 Mon Sep 17 00:00:00 2001 From: Sam Lantinga Date: Sun, 12 Jan 2025 18:32:58 -0800 Subject: [PATCH 025/340] Updated INSTALL.md with simple intro breadcrumbs --- INSTALL.md | 64 ++++++++++++++++++++++-------------------------------- README.md | 5 ++++- 2 files changed, 30 insertions(+), 39 deletions(-) diff --git a/INSTALL.md b/INSTALL.md index 2c5677a44ada4..72bf3c3adc955 100644 --- a/INSTALL.md +++ b/INSTALL.md @@ -1,72 +1,60 @@ -# To compile and install SDL: +# To build and use SDL: -## Windows with Visual Studio: +## Using CMake -Read [README-visualc.md](docs/README-visualc.md) +Read [BUILD-cmake.md](docs/BUILD-cmake.md) and [INTRO-cmake.md](docs/INTRO-cmake.md) -## Windows building with mingw-w64 for x86: +## Using Visual Studio on Windows -Read [README-windows.md](docs/README-windows.md) for more information on building with MinGW64. +Read [BUILD-visualstudio.md](docs/BUILD-visualstudio.md) and [INTRO-visualstudio.md](docs/INTRO-visualstudio.md) -Run: `cmake -S . -B build -DCMAKE_TOOLCHAIN_FILE=build-scripts/cmake-toolchain-mingw64-i686.cmake && cmake --build build && cmake --install build` +## Using Xcode on Apple platforms -## Windows building with mingw-w64 for x64: +Read [BUILD-xcode.md](docs/BUILD-xcode.md) and [INTRO-xcode.md](docs/INTRO-xcode.md) -Read [README-windows.md](docs/README-windows.md). - -Run: `cmake -S . -B build -DCMAKE_TOOLCHAIN_FILE=build-scripts/cmake-toolchain-mingw64-x86_64.cmake && cmake --build build && cmake --install build` - -## macOS with Xcode: - -Read [README-macos.md](docs/README-macos.md) +## Android: -## macOS from the command line: +Read [BUILD-android.md](docs/BUILD-android.md) and [INTRO-android.md](docs/INTRO-android.md) -Run: `cmake -S . -B build && cmake --build build && cmake --install build` +## Emscripten: -### macOS for universal architecture: +Read [BUILD-emscripten.md](docs/BUILD-emscripten.md) and [INTRO-emscripten.md](docs/INTRO-emscripten.md) -Run: `cmake -S . -B build -DCMAKE_OSX_ARCHITECTURES="x86_64;arm64" && cmake --build build && cmake --install build` +## Other environments: -## Linux and other UNIX systems: +SDL is also usable in other build environments. The basic steps are to use CMake to build the library and then use the headers and library that you built in your project. You can search online to see if anyone has specific steps for your environment. -Run: `cmake -S . -B build && cmake --build build --parallel $(nproc) && cmake --install build` +# Documentation -## Android: +An API reference, tutorials, and additional documentation is available at: -Read [README-android.md](docs/README-android.md) +https://wiki.libsdl.org/SDL3 -## iOS: +# Example code -Read [README-ios.md](docs/README-ios.md) +There are simple example programs in the examples directory, and you can view them online at: -## Using CMake: +https://examples.libsdl.org/SDL3 -Read [README-cmake.md](docs/README-cmake.md) +# Discussions -# Example code +## Discord -Look at the example programs in ./examples, and check out the online -documentation at https://wiki.libsdl.org/SDL3/ +You can join the official Discord server at: -# Discussion +https://discord.com/invite/BwpFGBWsv8 ## Forums/mailing lists -Join the SDL developer discussions, sign up on +You can join SDL development discussions at: https://discourse.libsdl.org/ -and go to the development forum - -https://discourse.libsdl.org/c/sdl-development/6 - -Once you sign up, you can use the forum through the website, or as a mailing -list from your email client. +Once you sign up, you can use the forum through the website or as a mailing list from your email client. ## Announcement list -Sign up for the announcement list through the web interface: +You can sign up for the low traffic announcement list at: https://www.libsdl.org/mailing-list.php diff --git a/README.md b/README.md index 37ee236030646..fd143d869300d 100644 --- a/README.md +++ b/README.md @@ -6,8 +6,11 @@ and emulators. You can find the latest release and additional documentation at: https://www.libsdl.org/ +Installation instructions and a quick introduction is available in +[INSTALL.md](INSTALL.md) + This library is distributed under the terms of the zlib license, -available in the file LICENSE.txt. +available in [LICENSE.txt](LICENSE.txt). Enjoy! From b6b9390444a21999d4e2aac5df3479f72133fb00 Mon Sep 17 00:00:00 2001 From: Sam Lantinga Date: Sun, 12 Jan 2025 18:45:50 -0800 Subject: [PATCH 026/340] Simplified INSTALL.md --- INSTALL.md | 31 ++++++++----------------------- 1 file changed, 8 insertions(+), 23 deletions(-) diff --git a/INSTALL.md b/INSTALL.md index 72bf3c3adc955..52e044156c651 100644 --- a/INSTALL.md +++ b/INSTALL.md @@ -1,28 +1,13 @@ # To build and use SDL: -## Using CMake - -Read [BUILD-cmake.md](docs/BUILD-cmake.md) and [INTRO-cmake.md](docs/INTRO-cmake.md) - -## Using Visual Studio on Windows - -Read [BUILD-visualstudio.md](docs/BUILD-visualstudio.md) and [INTRO-visualstudio.md](docs/INTRO-visualstudio.md) - -## Using Xcode on Apple platforms - -Read [BUILD-xcode.md](docs/BUILD-xcode.md) and [INTRO-xcode.md](docs/INTRO-xcode.md) - -## Android: - -Read [BUILD-android.md](docs/BUILD-android.md) and [INTRO-android.md](docs/INTRO-android.md) - -## Emscripten: - -Read [BUILD-emscripten.md](docs/BUILD-emscripten.md) and [INTRO-emscripten.md](docs/INTRO-emscripten.md) - -## Other environments: - -SDL is also usable in other build environments. The basic steps are to use CMake to build the library and then use the headers and library that you built in your project. You can search online to see if anyone has specific steps for your environment. +SDL supports a number of development environments: +- [CMake](docs/INTRO-cmake.md) +- [Visual Studio on Windows](docs/INTRO-visualstudio.md) +- [Xcode on Apple platforms](docs/INTRO-xcode.md) +- [Android](docs/INTRO-android.md) +- [Emscripten for web](docs/INTRO-emscripten.md) + +SDL is also usable in other environments. The basic steps are to use CMake to build the library and then use the headers and library that you built in your project. You can search online to see if anyone has specific steps for your setup. # Documentation From 7d2a1c5f8fb5d21a6c82b0e281cefa23272aa802 Mon Sep 17 00:00:00 2001 From: Sam Lantinga Date: Sun, 12 Jan 2025 18:49:13 -0800 Subject: [PATCH 027/340] Mention the tests in INSTALL.md --- INSTALL.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/INSTALL.md b/INSTALL.md index 52e044156c651..f04c4bed528bd 100644 --- a/INSTALL.md +++ b/INSTALL.md @@ -21,6 +21,8 @@ There are simple example programs in the examples directory, and you can view th https://examples.libsdl.org/SDL3 +More in-depth test programs are available in the tests directory and can be built by adding `-DSDL_TESTS=ON` to the CMake command line when building SDL. + # Discussions ## Discord From 191b9d5021a1d44e2a233fe1e4df89340fa65a4c Mon Sep 17 00:00:00 2001 From: Sam Lantinga Date: Mon, 13 Jan 2025 12:15:33 -0800 Subject: [PATCH 028/340] Added INTRO-cmake.md --- docs/INTRO-cmake.md | 48 +++++++++++++++++++++++++++++++++++++ docs/hello.c | 58 +++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 106 insertions(+) create mode 100644 docs/INTRO-cmake.md create mode 100644 docs/hello.c diff --git a/docs/INTRO-cmake.md b/docs/INTRO-cmake.md new file mode 100644 index 0000000000000..074f61fe9d33e --- /dev/null +++ b/docs/INTRO-cmake.md @@ -0,0 +1,48 @@ + +# Introduction to SDL with CMake + +The easiest way to use SDL is to include it as a subproject in your project. + +We'll start by creating a simple project to build and run [hello.c](hello.c) + +Create the file CMakeLists.txt +```cmake +cmake_minimum_required(VERSION 3.16) +project(hello) + +# set the output directory for built objects. +# This makes sure that the dynamic library goes into the build directory automatically. +set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/$") +set(CMAKE_LIBRARY_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/$") + +# This assumes the SDL source is available in vendored/SDL +add_subdirectory(vendored/SDL EXCLUDE_FROM_ALL) + +# Create your game executable target as usual +add_executable(hello WIN32 hello.c) + +# Link to the actual SDL3 library. +target_link_libraries(hello PRIVATE SDL3::SDL3) +``` + +Build: +```sh +cmake . +cmake --build . +``` + +Run: +- On Windows the executable is in the Debug directory: +```sh +./Debug/hello +``` +- On other platforms the executable is in the current directory: +```sh +./hello +``` + +A more complete example is available at: + +https://github.com/Ravbug/sdl3-sample + +Additional information and troubleshooting is available in [README-cmake.md](README-cmake.md) diff --git a/docs/hello.c b/docs/hello.c new file mode 100644 index 0000000000000..1962dd80d574e --- /dev/null +++ b/docs/hello.c @@ -0,0 +1,58 @@ +/* + Copyright (C) 1997-2025 Sam Lantinga + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely. +*/ +#include +#include + +int main(int argc, char *argv[]) +{ + SDL_Window *window = NULL; + SDL_Renderer *renderer = NULL; + const char *message = "Hello World!"; + int w = 0, h = 0; + float x, y; + bool done = false; + + /* Create the window */ + if (!SDL_CreateWindowAndRenderer("Hello World", 0, 0, SDL_WINDOW_FULLSCREEN, &window, &renderer)) { + SDL_Log("Couldn't create window and renderer: %s\n", SDL_GetError()); + return 1; + } + + while (!done) { + SDL_Event event; + + /* Handle events */ + while (SDL_PollEvent(&event)) { + if (event.type == SDL_EVENT_KEY_DOWN || + event.type == SDL_EVENT_MOUSE_BUTTON_DOWN || + event.type == SDL_EVENT_QUIT) { + done = true; + } + } + + /* Center the message */ + SDL_GetWindowSize(window, &w, &h); + x = (float)(w - SDL_DEBUG_TEXT_FONT_CHARACTER_SIZE * SDL_strlen(message)) / 2; + y = (float)(h - SDL_DEBUG_TEXT_FONT_CHARACTER_SIZE) / 2; + + /* Draw the message */ + SDL_SetRenderDrawColor(renderer, 0, 0, 0, 255); + SDL_RenderClear(renderer); + SDL_SetRenderDrawColor(renderer, 255, 255, 255, 255); + SDL_RenderDebugText(renderer, x, y, message); + SDL_RenderPresent(renderer); + } + SDL_Quit(); + + return 0; +} + From 1b30a01b444fd9192cf0ebc52e52cdb973620b1f Mon Sep 17 00:00:00 2001 From: Sam Lantinga Date: Mon, 13 Jan 2025 13:25:24 -0800 Subject: [PATCH 029/340] Added INTRO-visualstudio.md Also removed out of date Visual C++ documentation --- docs/INTRO-visualstudio.md | 15 +++++ docs/README-visualc.md | 113 ------------------------------------- docs/README.md | 1 - 3 files changed, 15 insertions(+), 114 deletions(-) create mode 100644 docs/INTRO-visualstudio.md delete mode 100644 docs/README-visualc.md diff --git a/docs/INTRO-visualstudio.md b/docs/INTRO-visualstudio.md new file mode 100644 index 0000000000000..31a16e0a0a4e7 --- /dev/null +++ b/docs/INTRO-visualstudio.md @@ -0,0 +1,15 @@ + +# Introduction to SDL with Visual Studio + +The easiest way to use SDL is to include it as a subproject in your project. + +We'll start by creating a simple project to build and run [hello.c](hello.c) + +- Create a new project in Visual Studio, using the C++ Empty Project template +- Add hello.c to the Source Files +- Right click the solution, select add an existing project, navigate to VisualC/SDL and add SDL.vcxproj +- Select your main project and go to Project -> Project Dependencies and select SDL3 +- Select your main project and go to Project -> Properties, set the filter at the top to "All Configurations" and "All Platforms", select VC++ Directories and add the SDL include directory to "Include Directories" +- Select your main project and go to Project -> Add Reference and select SDL3 +- Build and run! + diff --git a/docs/README-visualc.md b/docs/README-visualc.md deleted file mode 100644 index 4849da4fc1b6f..0000000000000 --- a/docs/README-visualc.md +++ /dev/null @@ -1,113 +0,0 @@ -Using SDL with Microsoft Visual C++ -=================================== - -#### by Lion Kimbro with additions by James Turk - -You can either use the precompiled libraries from the [SDL](https://www.libsdl.org/download.php) web site, or you can build SDL -yourself. - -### Building SDL - -0. To build SDL, your machine must, at a minimum, have the DirectX9.0c SDK installed. It may or may not be retrievable from -the [Microsoft](https://www.microsoft.com) website, so you might need to locate it [online](https://duckduckgo.com/?q=directx9.0c+sdk+download&t=h_&ia=web). -_Editor's note: I've been able to successfully build SDL using Visual Studio 2019 **without** the DX9.0c SDK_ - -1. Open the Visual Studio solution file at `./VisualC/SDL.sln`. - -2. Your IDE will likely prompt you to upgrade this solution file to whatever later version of the IDE you're using. In the `Retarget Projects` dialog, -all of the affected project files should be checked allowing you to use the latest `Windows SDK Version` you have installed, along with -the `Platform Toolset`. - -If you choose *NOT* to upgrade to use the latest `Windows SDK Version` or `Platform Toolset`, then you'll need the `Visual Studio 2010 Platform Toolset`. - -3. Build the `.dll` and `.lib` files by right clicking on each project in turn (Projects are listed in the _Workspace_ -panel in the _FileView_ tab), and selecting `Build`. - -You may get a few warnings, but you should not get any errors. - -Later, we will refer to the following `.lib` and `.dll` files that have just been generated: - -- `./VisualC/Win32/Debug/SDL3.dll` or `./VisualC/Win32/Release/SDL3.dll` -- `./VisualC/Win32/Debug/SDL3.lib` or `./VisualC/Win32/Release/SDL3.lib` - -_Note for the `x64` versions, just replace `Win32` in the path with `x64`_ - -### Creating a Project with SDL - -- Create a project as a `Win32 Application`. - -- Create a C++ file for your project. - -- Set the C runtime to `Multi-threaded DLL` in the menu: - `Project|Settings|C/C++ tab|Code Generation|Runtime Library `. - -- Add the SDL `include` directory to your list of includes in the menu: - `Project|Settings|C/C++ tab|Preprocessor|Additional include directories ` - -*VC7 Specific: Instead of doing this, I find it easier to add the -include and library directories to the list that VC7 keeps. Do this by -selecting Tools|Options|Projects|VC++ Directories and under the "Show -Directories For:" dropbox select "Include Files", and click the "New -Directory Icon" and add the [SDLROOT]\\include directory (e.g. If you -installed to c:\\SDL\\ add c:\\SDL\\include). Proceed to change the -dropbox selection to "Library Files" and add [SDLROOT]\\lib.* - -The "include directory" I am referring to is the `./include` folder. - -Now we're going to use the files that we had created earlier in the *Build SDL* step. - -Copy the following file into your Project directory: - -- `SDL3.dll` - -Add the following file to your project (It is not necessary to copy it to your project directory): - -- `SDL3.lib` - -To add them to your project, right click on your project, and select -`Add files to project`. - -**Instead of adding the files to your project, it is more desirable to add them to the linker options: Project|Properties|Linker|Command Line -and type the names of the libraries to link with in the "Additional Options:" box. Note: This must be done for each build configuration -(e.g. Release,Debug).** - -### Hello SDL - -Here's a sample SDL snippet to verify everything is setup in your IDE: - -```c -#include -#include // only include this one in the source file with main()! - -int main( int argc, char* argv[] ) -{ - const int WIDTH = 640; - const int HEIGHT = 480; - SDL_Window* window = NULL; - SDL_Renderer* renderer = NULL; - - SDL_Init(SDL_INIT_VIDEO); - window = SDL_CreateWindow("Hello SDL", WIDTH, HEIGHT, 0); - renderer = SDL_CreateRenderer(window, NULL); - - SDL_DestroyRenderer(renderer); - SDL_DestroyWindow(window); - SDL_Quit(); - return 0; -} -``` - -### That's it! - -I hope that this document has helped you get through the most difficult part of using the SDL: installing it. -Suggestions for improvements should be posted to the [Github Issues](https://github.com/libsdl-org/SDL/issues). - -### Credits - -Thanks to [Paulus Esterhazy](mailto:pesterhazy@gmx.net), for the work on VC++ port. - -This document was originally called "VisualC.txt", and was written by [Sam Lantinga](mailto:slouken@libsdl.org). - -Later, it was converted to HTML and expanded into the document that you see today by [Lion Kimbro](mailto:snowlion@sprynet.com). - -Minor Fixes and Visual C++ 7 Information (in italic) was added by [James Turk](mailto:james@conceptofzero.net) diff --git a/docs/README.md b/docs/README.md index 26937d76a802b..922fe64bbc662 100644 --- a/docs/README.md +++ b/docs/README.md @@ -32,7 +32,6 @@ More documentation and FAQs are available online at [the wiki](http://wiki.libsd - [High DPI Support](README-highdpi.md) - [Touch](README-touch.md) - [Versions](README-versions.md) -- [Visual Studio](README-visualc.md) - [Android](README-android.md) - [Emscripten](README-emscripten.md) From e4e76ac72e4041617b8434672ea11d5c1f020cc3 Mon Sep 17 00:00:00 2001 From: Sam Lantinga Date: Mon, 13 Jan 2025 13:50:02 -0800 Subject: [PATCH 030/340] Added INTRO-xcode.md --- docs/INTRO-xcode.md | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 docs/INTRO-xcode.md diff --git a/docs/INTRO-xcode.md b/docs/INTRO-xcode.md new file mode 100644 index 0000000000000..5f0a62aba8963 --- /dev/null +++ b/docs/INTRO-xcode.md @@ -0,0 +1,16 @@ + +# Introduction to SDL with Xcode + +The easiest way to use SDL is to include it as a subproject in your project. + +We'll start by creating a simple project to build and run [hello.c](hello.c) + +- Create a new project in Xcode, using the App template and selecting Objective C as the language +- Remove the .h and .m files that were automatically added to the project +- Remove the main storyboard that was automatically added to the project +- On iOS projects, select the project, select the main target, select the Info tab, look for "Custom iOS Target Properties", and remove "Main storyboard base file name" and "Application Scene Manifest" +- Right click the project and select "Add Files to [project]", navigate to the SDL docs directory and add the file hello.c +- Right click the project and select "Add Files to [project]", navigate to the SDL Xcode/SDL directory and add SDL.xcodeproj +- Select the project, select the main target, select the General tab, look for "Frameworks, Libaries, and Embedded Content", and add SDL3.framework +- Build and run! + From 6bc7e88ca61709abaf1f266cb1ea8ab8dd983223 Mon Sep 17 00:00:00 2001 From: Sam Lantinga Date: Mon, 13 Jan 2025 14:35:52 -0800 Subject: [PATCH 031/340] Added INTRO-androidstudio.md --- INSTALL.md | 2 +- docs/INTRO-androidstudio.md | 13 +++++++++++++ 2 files changed, 14 insertions(+), 1 deletion(-) create mode 100644 docs/INTRO-androidstudio.md diff --git a/INSTALL.md b/INSTALL.md index f04c4bed528bd..b33c211192bdb 100644 --- a/INSTALL.md +++ b/INSTALL.md @@ -4,7 +4,7 @@ SDL supports a number of development environments: - [CMake](docs/INTRO-cmake.md) - [Visual Studio on Windows](docs/INTRO-visualstudio.md) - [Xcode on Apple platforms](docs/INTRO-xcode.md) -- [Android](docs/INTRO-android.md) +- [Android Studio](docs/INTRO-androidstudio.md) - [Emscripten for web](docs/INTRO-emscripten.md) SDL is also usable in other environments. The basic steps are to use CMake to build the library and then use the headers and library that you built in your project. You can search online to see if anyone has specific steps for your setup. diff --git a/docs/INTRO-androidstudio.md b/docs/INTRO-androidstudio.md new file mode 100644 index 0000000000000..10cfcad9cb998 --- /dev/null +++ b/docs/INTRO-androidstudio.md @@ -0,0 +1,13 @@ + +# Introduction to SDL with Android Studio + +We'll start by creating a simple project to build and run [hello.c](hello.c) + +- Use our handy script to create a template project: +```sh +./build-scripts/create-android-project.py org.libsdl.hello docs/hello.c +``` +- Run Android Studio and open the newly created build/org.libsdl.hello directory +- Build and run! + +Additional information and troubleshooting is available in [README-android.md](README-android.md) From 21b433536ae7748dbcb31a6a801c1c36d8ab4fec Mon Sep 17 00:00:00 2001 From: Sam Lantinga Date: Mon, 13 Jan 2025 14:42:36 -0800 Subject: [PATCH 032/340] Scale up the text for large displays --- docs/hello.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/docs/hello.c b/docs/hello.c index 1962dd80d574e..f513d9318abc0 100644 --- a/docs/hello.c +++ b/docs/hello.c @@ -19,6 +19,7 @@ int main(int argc, char *argv[]) const char *message = "Hello World!"; int w = 0, h = 0; float x, y; + const float scale = 4.0f; bool done = false; /* Create the window */ @@ -39,10 +40,11 @@ int main(int argc, char *argv[]) } } - /* Center the message */ - SDL_GetWindowSize(window, &w, &h); - x = (float)(w - SDL_DEBUG_TEXT_FONT_CHARACTER_SIZE * SDL_strlen(message)) / 2; - y = (float)(h - SDL_DEBUG_TEXT_FONT_CHARACTER_SIZE) / 2; + /* Center the message and scale it up */ + SDL_GetRenderOutputSize(renderer, &w, &h); + SDL_SetRenderScale(renderer, scale, scale); + x = ((w / scale) - SDL_DEBUG_TEXT_FONT_CHARACTER_SIZE * SDL_strlen(message)) / 2; + y = ((h / scale) - SDL_DEBUG_TEXT_FONT_CHARACTER_SIZE) / 2; /* Draw the message */ SDL_SetRenderDrawColor(renderer, 0, 0, 0, 255); From 0eaa8c6d81a693c1ef57bc27ae4fac03c40735b9 Mon Sep 17 00:00:00 2001 From: Sam Lantinga Date: Mon, 13 Jan 2025 15:49:47 -0800 Subject: [PATCH 033/340] Added INTRO-emscripten.md --- docs/INTRO-emscripten.md | 38 +++++++++++++++++++ docs/README-emscripten.md | 6 +-- docs/hello.c | 80 +++++++++++++++++++++------------------ 3 files changed, 85 insertions(+), 39 deletions(-) create mode 100644 docs/INTRO-emscripten.md diff --git a/docs/INTRO-emscripten.md b/docs/INTRO-emscripten.md new file mode 100644 index 0000000000000..89831248cc823 --- /dev/null +++ b/docs/INTRO-emscripten.md @@ -0,0 +1,38 @@ + +# Introduction to SDL with Emscripten + +First, you should have the Emscripten SDK installed from: + +https://emscripten.org/docs/getting_started/downloads.html + +We'll start by creating a simple project to build and run [hello.c](hello.c) + +## Building SDL + +Once you have a command line interface with the Emscripten SDK set up and you've changed directory to the SDL directory, you can build SDL like this: + +```sh +mkdir hello +cd hello +emcmake cmake .. +emmake make +``` + +## Building your app + +In this case we'll just run a simple command to compile our source with the SDL library we just built: +```sh +emcc -o index.html ../docs/hello.c -I../include -L. -lSDL3 +``` + +## Running your app + +You can now run your app by pointing a webserver at your build directory and connecting a web browser to it. + +## More information + +A more complete example is available at: + +https://github.com/Ravbug/sdl3-sample + +Additional information and troubleshooting is available in [README-emscripten.md](README-emscripten.md) diff --git a/docs/README-emscripten.md b/docs/README-emscripten.md index 6bf1cacca8e86..2b8146893a94a 100644 --- a/docs/README-emscripten.md +++ b/docs/README-emscripten.md @@ -239,13 +239,13 @@ If you want to build with thread support, something like this works: ```bash mkdir build cd build -emcmake cmake -DSDL_THREADS=On .. +emcmake cmake -DSDL_THREADS=ON .. # you can also do `emcmake cmake -G Ninja ..` and then use `ninja` instead of this command. emmake make -j4 ``` -To build the tests, add `-DSDL_TESTS=On` to the `emcmake cmake` command line. -To build the examples, add `-DSDL_EXAMPLES=On` to the `emcmake cmake` command line. +To build the tests, add `-DSDL_TESTS=ON` to the `emcmake cmake` command line. +To build the examples, add `-DSDL_EXAMPLES=ON` to the `emcmake cmake` command line. ## Building your app diff --git a/docs/hello.c b/docs/hello.c index f513d9318abc0..74a04bc246aa1 100644 --- a/docs/hello.c +++ b/docs/hello.c @@ -9,52 +9,60 @@ including commercial applications, and to alter it and redistribute it freely. */ +#define SDL_MAIN_USE_CALLBACKS 1 /* use the callbacks instead of main() */ #include #include -int main(int argc, char *argv[]) +static SDL_Window *window = NULL; +static SDL_Renderer *renderer = NULL; + +/* This function runs once at startup. */ +SDL_AppResult SDL_AppInit(void **appstate, int argc, char *argv[]) +{ + /* Create the window */ + if (!SDL_CreateWindowAndRenderer("Hello World", 800, 600, SDL_WINDOW_FULLSCREEN, &window, &renderer)) { + SDL_Log("Couldn't create window and renderer: %s\n", SDL_GetError()); + return SDL_APP_FAILURE; + } + return SDL_APP_CONTINUE; +} + +/* This function runs when a new event (mouse input, keypresses, etc) occurs. */ +SDL_AppResult SDL_AppEvent(void *appstate, SDL_Event *event) +{ + if (event->type == SDL_EVENT_KEY_DOWN || + event->type == SDL_EVENT_QUIT) { + return SDL_APP_SUCCESS; /* end the program, reporting success to the OS. */ + } + return SDL_APP_CONTINUE; +} + +/* This function runs once per frame, and is the heart of the program. */ +SDL_AppResult SDL_AppIterate(void *appstate) { - SDL_Window *window = NULL; - SDL_Renderer *renderer = NULL; const char *message = "Hello World!"; int w = 0, h = 0; float x, y; const float scale = 4.0f; - bool done = false; - /* Create the window */ - if (!SDL_CreateWindowAndRenderer("Hello World", 0, 0, SDL_WINDOW_FULLSCREEN, &window, &renderer)) { - SDL_Log("Couldn't create window and renderer: %s\n", SDL_GetError()); - return 1; - } + /* Center the message and scale it up */ + SDL_GetRenderOutputSize(renderer, &w, &h); + SDL_SetRenderScale(renderer, scale, scale); + x = ((w / scale) - SDL_DEBUG_TEXT_FONT_CHARACTER_SIZE * SDL_strlen(message)) / 2; + y = ((h / scale) - SDL_DEBUG_TEXT_FONT_CHARACTER_SIZE) / 2; - while (!done) { - SDL_Event event; - - /* Handle events */ - while (SDL_PollEvent(&event)) { - if (event.type == SDL_EVENT_KEY_DOWN || - event.type == SDL_EVENT_MOUSE_BUTTON_DOWN || - event.type == SDL_EVENT_QUIT) { - done = true; - } - } - - /* Center the message and scale it up */ - SDL_GetRenderOutputSize(renderer, &w, &h); - SDL_SetRenderScale(renderer, scale, scale); - x = ((w / scale) - SDL_DEBUG_TEXT_FONT_CHARACTER_SIZE * SDL_strlen(message)) / 2; - y = ((h / scale) - SDL_DEBUG_TEXT_FONT_CHARACTER_SIZE) / 2; - - /* Draw the message */ - SDL_SetRenderDrawColor(renderer, 0, 0, 0, 255); - SDL_RenderClear(renderer); - SDL_SetRenderDrawColor(renderer, 255, 255, 255, 255); - SDL_RenderDebugText(renderer, x, y, message); - SDL_RenderPresent(renderer); - } - SDL_Quit(); + /* Draw the message */ + SDL_SetRenderDrawColor(renderer, 0, 0, 0, 255); + SDL_RenderClear(renderer); + SDL_SetRenderDrawColor(renderer, 255, 255, 255, 255); + SDL_RenderDebugText(renderer, x, y, message); + SDL_RenderPresent(renderer); + + return SDL_APP_CONTINUE; +} - return 0; +/* This function runs once at shutdown. */ +void SDL_AppQuit(void *appstate, SDL_AppResult result) +{ } From f731741eadbe06d618d6a9bbdb41c2ee98b8178d Mon Sep 17 00:00:00 2001 From: SDL Wiki Bot Date: Tue, 14 Jan 2025 00:44:57 +0000 Subject: [PATCH 034/340] Sync SDL3 wiki -> header [ci skip] --- docs/README-git.md | 16 ++++ docs/README-raspberrypi.md | 188 +++++++++++++++++++++++++++++++++++++ docs/README-visualc.md | 113 ++++++++++++++++++++++ 3 files changed, 317 insertions(+) create mode 100644 docs/README-git.md create mode 100644 docs/README-raspberrypi.md create mode 100644 docs/README-visualc.md diff --git a/docs/README-git.md b/docs/README-git.md new file mode 100644 index 0000000000000..aa0aa40547477 --- /dev/null +++ b/docs/README-git.md @@ -0,0 +1,16 @@ +git +========= + +The latest development version of SDL is available via git. +Git allows you to get up-to-the-minute fixes and enhancements; +as a developer works on a source tree, you can use "git" to mirror that +source tree instead of waiting for an official release. Please look +at the Git website ( https://git-scm.com/ ) for more +information on using git, where you can also download software for +macOS, Windows, and Unix systems. + + git clone https://github.com/libsdl-org/SDL + +There is a web interface to the Git repository at: + http://github.com/libsdl-org/SDL/ + diff --git a/docs/README-raspberrypi.md b/docs/README-raspberrypi.md new file mode 100644 index 0000000000000..ba34f47b1fea0 --- /dev/null +++ b/docs/README-raspberrypi.md @@ -0,0 +1,188 @@ +Raspberry Pi +============ + +Requirements: + +Raspberry Pi OS (other Linux distros may work as well). + +In modern times, the Raspberry Pi works mostly like any other Linux device: +for video, you can use X11, Wayland, or KMSDRM. For audio, you can use ALSA, +PulseAudio, or PipeWire, etc. OpenGL, OpenGL ES, and Vulkan are known to work. + +There is a video backend in SDL called "rpi" that uses a deprecated Broadcom +interface (named "dispmanx") to draw directly to the console without X11. +Newer Raspberry Pi OS releases don't support this (and work fine with our +"kmsdrm" backend for the same purposes, a standard Linux interface). Don't +panic if you can't use this backend, or CMake says it can't find libraries it +needs for this. + +SDL has, in past times, worked on the original Raspberry Pi and the RPi 2, but +these devices are no longer targets we actively test; if they broke, please +report bugs or send patches! + +The Raspberry Pi 3 and later (in 32-bit and 64-bit mode) are still known to +work well at the time of this writing. The Raspberry Pi Zero and Zero 2 are +also known to work well. + + +## Documentation Out Of Date + +The rest of this document is likely out of date; a lot has changed in recent +years in both SDL and the Raspberry Pi universe, and this document has not +been updated to reflect those details. Take the rest of this information with +a grain of salt! + + + +NEON +---- + +If your Pi has NEON support, make sure you add -mfpu=neon to your CFLAGS so +that SDL will select some otherwise-disabled highly-optimized code. The +original Pi and Pi Zero units don't have NEON; everything from the Pi2/PiZero2 +and later do. + + +Cross compiling from x86 Linux +------------------------------ + +To cross compile SDL for Raspbian from your desktop machine, you'll need a +Raspbian system root and the cross compilation tools. We'll assume these tools +will be placed in /opt/rpi-tools + + sudo git clone --depth 1 https://github.com/raspberrypi/tools /opt/rpi-tools + +You'll also need a Raspbian binary image. +Get it from: http://downloads.raspberrypi.org/raspbian_latest +After unzipping, you'll get file with a name like: "-wheezy-raspbian.img" +Let's assume the sysroot will be built in /opt/rpi-sysroot. + + export SYSROOT=/opt/rpi-sysroot + sudo kpartx -a -v .img + sudo mount -o loop /dev/mapper/loop0p2 /mnt + sudo cp -r /mnt $SYSROOT + sudo apt-get install qemu binfmt-support qemu-user-static + sudo cp /usr/bin/qemu-arm-static $SYSROOT/usr/bin + sudo mount --bind /dev $SYSROOT/dev + sudo mount --bind /proc $SYSROOT/proc + sudo mount --bind /sys $SYSROOT/sys + +Now, before chrooting into the ARM sysroot, you'll need to apply a workaround, +edit $SYSROOT/etc/ld.so.preload and comment out all lines in it. + + sudo chroot $SYSROOT + apt-get install libudev-dev libasound2-dev libdbus-1-dev libraspberrypi0 libraspberrypi-bin libraspberrypi-dev libx11-dev libxext-dev libxrandr-dev libxcursor-dev libxi-dev libxss-dev + exit + sudo umount $SYSROOT/dev + sudo umount $SYSROOT/proc + sudo umount $SYSROOT/sys + sudo umount /mnt + +There's one more fix required, as the libdl.so symlink uses an absolute path +which doesn't quite work in our setup. + + sudo rm -rf $SYSROOT/usr/lib/arm-linux-gnueabihf/libdl.so + sudo ln -s ../../../lib/arm-linux-gnueabihf/libdl.so.2 $SYSROOT/usr/lib/arm-linux-gnueabihf/libdl.so + +The final step is compiling SDL itself. + + export CC="/opt/rpi-tools/arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian/bin/arm-linux-gnueabihf-gcc --sysroot=$SYSROOT -I$SYSROOT/opt/vc/include -I$SYSROOT/usr/include -I$SYSROOT/opt/vc/include/interface/vcos/pthreads -I$SYSROOT/opt/vc/include/interface/vmcs_host/linux" + cd + mkdir -p build;cd build + LDFLAGS="-L$SYSROOT/opt/vc/lib" ../configure --with-sysroot=$SYSROOT --host=arm-raspberry-linux-gnueabihf --prefix=$PWD/rpi-sdl3-installed --disable-pulseaudio --disable-esd + make + make install + +To be able to deploy this to /usr/local in the Raspbian system you need to fix up a few paths: + + perl -w -pi -e "s#$PWD/rpi-sdl3-installed#/usr/local#g;" ./rpi-sdl3-installed/lib/libSDL3.la ./rpi-sdl3-installed/lib/pkgconfig/sdl3.pc + +Apps don't work or poor video/audio performance +----------------------------------------------- + +If you get sound problems, buffer underruns, etc, run "sudo rpi-update" to +update the RPi's firmware. Note that doing so will fix these problems, but it +will also render the CMA - Dynamic Memory Split functionality useless. + +Also, by default the Raspbian distro configures the GPU RAM at 64MB, this is too +low in general, specially if a 1080p TV is hooked up. + +See here how to configure this setting: http://elinux.org/RPiconfig + +Using a fixed gpu_mem=128 is the best option (specially if you updated the +firmware, using CMA probably won't work, at least it's the current case). + +No input +-------- + +Make sure you belong to the "input" group. + + sudo usermod -aG input `whoami` + +No HDMI Audio +------------- + +If you notice that ALSA works but there's no audio over HDMI, try adding: + + hdmi_drive=2 + +to your config.txt file and reboot. + +Reference: http://www.raspberrypi.org/phpBB3/viewtopic.php?t=5062 + +Text Input API support +---------------------- + +The Text Input API is supported, with translation of scan codes done via the +kernel symbol tables. For this to work, SDL needs access to a valid console. +If you notice there's no SDL_EVENT_TEXT_INPUT message being emitted, double check that +your app has read access to one of the following: + +* /proc/self/fd/0 +* /dev/tty +* /dev/tty[0...6] +* /dev/vc/0 +* /dev/console + +This is usually not a problem if you run from the physical terminal (as opposed +to running from a pseudo terminal, such as via SSH). If running from a PTS, a +quick workaround is to run your app as root or add yourself to the tty group, +then re-login to the system. + + sudo usermod -aG tty `whoami` + +The keyboard layout used by SDL is the same as the one the kernel uses. +To configure the layout on Raspbian: + + sudo dpkg-reconfigure keyboard-configuration + +To configure the locale, which controls which keys are interpreted as letters, +this determining the CAPS LOCK behavior: + + sudo dpkg-reconfigure locales + + +OpenGL problems +--------------- + +If you have desktop OpenGL headers installed at build time in your RPi or cross +compilation environment, support for it will be built in. However, the chipset +does not actually have support for it, which causes issues in certain SDL apps +since the presence of OpenGL support supersedes the ES/ES2 variants. +The workaround is to disable OpenGL at configuration time: + + ./configure --disable-video-opengl + +Or if the application uses the Render functions, you can use the SDL_RENDER_DRIVER +environment variable: + + export SDL_RENDER_DRIVER=opengles2 + +Notes +----- + +* When launching apps remotely (via SSH), SDL can prevent local keystrokes from + leaking into the console only if it has root privileges. Launching apps locally + does not suffer from this issue. + + diff --git a/docs/README-visualc.md b/docs/README-visualc.md new file mode 100644 index 0000000000000..4849da4fc1b6f --- /dev/null +++ b/docs/README-visualc.md @@ -0,0 +1,113 @@ +Using SDL with Microsoft Visual C++ +=================================== + +#### by Lion Kimbro with additions by James Turk + +You can either use the precompiled libraries from the [SDL](https://www.libsdl.org/download.php) web site, or you can build SDL +yourself. + +### Building SDL + +0. To build SDL, your machine must, at a minimum, have the DirectX9.0c SDK installed. It may or may not be retrievable from +the [Microsoft](https://www.microsoft.com) website, so you might need to locate it [online](https://duckduckgo.com/?q=directx9.0c+sdk+download&t=h_&ia=web). +_Editor's note: I've been able to successfully build SDL using Visual Studio 2019 **without** the DX9.0c SDK_ + +1. Open the Visual Studio solution file at `./VisualC/SDL.sln`. + +2. Your IDE will likely prompt you to upgrade this solution file to whatever later version of the IDE you're using. In the `Retarget Projects` dialog, +all of the affected project files should be checked allowing you to use the latest `Windows SDK Version` you have installed, along with +the `Platform Toolset`. + +If you choose *NOT* to upgrade to use the latest `Windows SDK Version` or `Platform Toolset`, then you'll need the `Visual Studio 2010 Platform Toolset`. + +3. Build the `.dll` and `.lib` files by right clicking on each project in turn (Projects are listed in the _Workspace_ +panel in the _FileView_ tab), and selecting `Build`. + +You may get a few warnings, but you should not get any errors. + +Later, we will refer to the following `.lib` and `.dll` files that have just been generated: + +- `./VisualC/Win32/Debug/SDL3.dll` or `./VisualC/Win32/Release/SDL3.dll` +- `./VisualC/Win32/Debug/SDL3.lib` or `./VisualC/Win32/Release/SDL3.lib` + +_Note for the `x64` versions, just replace `Win32` in the path with `x64`_ + +### Creating a Project with SDL + +- Create a project as a `Win32 Application`. + +- Create a C++ file for your project. + +- Set the C runtime to `Multi-threaded DLL` in the menu: + `Project|Settings|C/C++ tab|Code Generation|Runtime Library `. + +- Add the SDL `include` directory to your list of includes in the menu: + `Project|Settings|C/C++ tab|Preprocessor|Additional include directories ` + +*VC7 Specific: Instead of doing this, I find it easier to add the +include and library directories to the list that VC7 keeps. Do this by +selecting Tools|Options|Projects|VC++ Directories and under the "Show +Directories For:" dropbox select "Include Files", and click the "New +Directory Icon" and add the [SDLROOT]\\include directory (e.g. If you +installed to c:\\SDL\\ add c:\\SDL\\include). Proceed to change the +dropbox selection to "Library Files" and add [SDLROOT]\\lib.* + +The "include directory" I am referring to is the `./include` folder. + +Now we're going to use the files that we had created earlier in the *Build SDL* step. + +Copy the following file into your Project directory: + +- `SDL3.dll` + +Add the following file to your project (It is not necessary to copy it to your project directory): + +- `SDL3.lib` + +To add them to your project, right click on your project, and select +`Add files to project`. + +**Instead of adding the files to your project, it is more desirable to add them to the linker options: Project|Properties|Linker|Command Line +and type the names of the libraries to link with in the "Additional Options:" box. Note: This must be done for each build configuration +(e.g. Release,Debug).** + +### Hello SDL + +Here's a sample SDL snippet to verify everything is setup in your IDE: + +```c +#include +#include // only include this one in the source file with main()! + +int main( int argc, char* argv[] ) +{ + const int WIDTH = 640; + const int HEIGHT = 480; + SDL_Window* window = NULL; + SDL_Renderer* renderer = NULL; + + SDL_Init(SDL_INIT_VIDEO); + window = SDL_CreateWindow("Hello SDL", WIDTH, HEIGHT, 0); + renderer = SDL_CreateRenderer(window, NULL); + + SDL_DestroyRenderer(renderer); + SDL_DestroyWindow(window); + SDL_Quit(); + return 0; +} +``` + +### That's it! + +I hope that this document has helped you get through the most difficult part of using the SDL: installing it. +Suggestions for improvements should be posted to the [Github Issues](https://github.com/libsdl-org/SDL/issues). + +### Credits + +Thanks to [Paulus Esterhazy](mailto:pesterhazy@gmx.net), for the work on VC++ port. + +This document was originally called "VisualC.txt", and was written by [Sam Lantinga](mailto:slouken@libsdl.org). + +Later, it was converted to HTML and expanded into the document that you see today by [Lion Kimbro](mailto:snowlion@sprynet.com). + +Minor Fixes and Visual C++ 7 Information (in italic) was added by [James Turk](mailto:james@conceptofzero.net) From d28e953222b9cb9b6b17c97e59ab9075626aba19 Mon Sep 17 00:00:00 2001 From: Sam Lantinga Date: Mon, 13 Jan 2025 17:15:44 -0800 Subject: [PATCH 035/340] Added thread safety documentation for SDL_iostream.h Fixes https://github.com/libsdl-org/SDL/issues/11942 --- include/SDL3/SDL_iostream.h | 96 +++++++++++++++++++++++++++++++++++++ 1 file changed, 96 insertions(+) diff --git a/include/SDL3/SDL_iostream.h b/include/SDL3/SDL_iostream.h index ca2bf275bab19..a38225b758af5 100644 --- a/include/SDL3/SDL_iostream.h +++ b/include/SDL3/SDL_iostream.h @@ -262,6 +262,8 @@ typedef struct SDL_IOStream SDL_IOStream; * * \since This function is available since SDL 3.1.3. * + * \threadsafety This function is not thread safe. + * * \sa SDL_CloseIO * \sa SDL_FlushIO * \sa SDL_ReadIO @@ -305,6 +307,8 @@ extern SDL_DECLSPEC SDL_IOStream * SDLCALL SDL_IOFromFile(const char *file, cons * * \since This function is available since SDL 3.1.3. * + * \threadsafety It is safe to call this function from any thread. + * * \sa SDL_IOFromConstMem * \sa SDL_CloseIO * \sa SDL_FlushIO @@ -349,6 +353,8 @@ extern SDL_DECLSPEC SDL_IOStream * SDLCALL SDL_IOFromMem(void *mem, size_t size) * * \since This function is available since SDL 3.1.3. * + * \threadsafety It is safe to call this function from any thread. + * * \sa SDL_IOFromMem * \sa SDL_CloseIO * \sa SDL_ReadIO @@ -377,6 +383,8 @@ extern SDL_DECLSPEC SDL_IOStream * SDLCALL SDL_IOFromConstMem(const void *mem, s * * \since This function is available since SDL 3.1.3. * + * \threadsafety It is safe to call this function from any thread. + * * \sa SDL_CloseIO * \sa SDL_ReadIO * \sa SDL_SeekIO @@ -410,6 +418,8 @@ extern SDL_DECLSPEC SDL_IOStream * SDLCALL SDL_IOFromDynamicMem(void); * * \since This function is available since SDL 3.1.3. * + * \threadsafety It is safe to call this function from any thread. + * * \sa SDL_CloseIO * \sa SDL_INIT_INTERFACE * \sa SDL_IOFromConstMem @@ -444,6 +454,8 @@ extern SDL_DECLSPEC SDL_IOStream * SDLCALL SDL_OpenIO(const SDL_IOStreamInterfac * * \since This function is available since SDL 3.1.3. * + * \threadsafety This function is not thread safe. + * * \sa SDL_OpenIO */ extern SDL_DECLSPEC bool SDLCALL SDL_CloseIO(SDL_IOStream *context); @@ -456,6 +468,8 @@ extern SDL_DECLSPEC bool SDLCALL SDL_CloseIO(SDL_IOStream *context); * SDL_GetError() for more information. * * \since This function is available since SDL 3.1.3. + * + * \threadsafety This function is not thread safe. */ extern SDL_DECLSPEC SDL_PropertiesID SDLCALL SDL_GetIOProperties(SDL_IOStream *context); @@ -477,6 +491,8 @@ extern SDL_DECLSPEC SDL_PropertiesID SDLCALL SDL_GetIOProperties(SDL_IOStream *c * another thread is operating on the same SDL_IOStream. * * \since This function is available since SDL 3.1.3. + * + * \threadsafety This function is not thread safe. */ extern SDL_DECLSPEC SDL_IOStatus SDLCALL SDL_GetIOStatus(SDL_IOStream *context); @@ -489,6 +505,8 @@ extern SDL_DECLSPEC SDL_IOStatus SDLCALL SDL_GetIOStatus(SDL_IOStream *context); * information. * * \since This function is available since SDL 3.1.3. + * + * \threadsafety This function is not thread safe. */ extern SDL_DECLSPEC Sint64 SDLCALL SDL_GetIOSize(SDL_IOStream *context); @@ -515,6 +533,8 @@ extern SDL_DECLSPEC Sint64 SDLCALL SDL_GetIOSize(SDL_IOStream *context); * * \since This function is available since SDL 3.1.3. * + * \threadsafety This function is not thread safe. + * * \sa SDL_TellIO */ extern SDL_DECLSPEC Sint64 SDLCALL SDL_SeekIO(SDL_IOStream *context, Sint64 offset, SDL_IOWhence whence); @@ -533,6 +553,8 @@ extern SDL_DECLSPEC Sint64 SDLCALL SDL_SeekIO(SDL_IOStream *context, Sint64 offs * * \since This function is available since SDL 3.1.3. * + * \threadsafety This function is not thread safe. + * * \sa SDL_SeekIO */ extern SDL_DECLSPEC Sint64 SDLCALL SDL_TellIO(SDL_IOStream *context); @@ -556,6 +578,8 @@ extern SDL_DECLSPEC Sint64 SDLCALL SDL_TellIO(SDL_IOStream *context); * * \since This function is available since SDL 3.1.3. * + * \threadsafety This function is not thread safe. + * * \sa SDL_WriteIO * \sa SDL_GetIOStatus */ @@ -583,6 +607,8 @@ extern SDL_DECLSPEC size_t SDLCALL SDL_ReadIO(SDL_IOStream *context, void *ptr, * * \since This function is available since SDL 3.1.3. * + * \threadsafety This function is not thread safe. + * * \sa SDL_IOprintf * \sa SDL_ReadIO * \sa SDL_SeekIO @@ -605,6 +631,8 @@ extern SDL_DECLSPEC size_t SDLCALL SDL_WriteIO(SDL_IOStream *context, const void * * \since This function is available since SDL 3.1.3. * + * \threadsafety This function is not thread safe. + * * \sa SDL_IOvprintf * \sa SDL_WriteIO */ @@ -623,6 +651,8 @@ extern SDL_DECLSPEC size_t SDLCALL SDL_IOprintf(SDL_IOStream *context, SDL_PRINT * * \since This function is available since SDL 3.1.3. * + * \threadsafety This function is not thread safe. + * * \sa SDL_IOprintf * \sa SDL_WriteIO */ @@ -641,6 +671,8 @@ extern SDL_DECLSPEC size_t SDLCALL SDL_IOvprintf(SDL_IOStream *context, SDL_PRIN * * \since This function is available since SDL 3.1.3. * + * \threadsafety This function is not thread safe. + * * \sa SDL_OpenIO * \sa SDL_WriteIO */ @@ -665,6 +697,8 @@ extern SDL_DECLSPEC bool SDLCALL SDL_FlushIO(SDL_IOStream *context); * * \since This function is available since SDL 3.1.3. * + * \threadsafety This function is not thread safe. + * * \sa SDL_LoadFile * \sa SDL_SaveFile_IO */ @@ -686,6 +720,8 @@ extern SDL_DECLSPEC void * SDLCALL SDL_LoadFile_IO(SDL_IOStream *src, size_t *da * * \since This function is available since SDL 3.1.3. * + * \threadsafety This function is not thread safe. + * * \sa SDL_LoadFile_IO * \sa SDL_SaveFile */ @@ -705,6 +741,8 @@ extern SDL_DECLSPEC void * SDLCALL SDL_LoadFile(const char *file, size_t *datasi * * \since This function is available since SDL 3.1.8. * + * \threadsafety This function is not thread safe. + * * \sa SDL_SaveFile * \sa SDL_LoadFile_IO */ @@ -722,6 +760,8 @@ extern SDL_DECLSPEC bool SDLCALL SDL_SaveFile_IO(SDL_IOStream *src, const void * * * \since This function is available since SDL 3.1.8. * + * \threadsafety This function is not thread safe. + * * \sa SDL_SaveFile_IO * \sa SDL_LoadFile */ @@ -748,6 +788,8 @@ extern SDL_DECLSPEC bool SDLCALL SDL_SaveFile(const char *file, const void *data * for more information. * * \since This function is available since SDL 3.1.3. + * + * \threadsafety This function is not thread safe. */ extern SDL_DECLSPEC bool SDLCALL SDL_ReadU8(SDL_IOStream *src, Uint8 *value); @@ -765,6 +807,8 @@ extern SDL_DECLSPEC bool SDLCALL SDL_ReadU8(SDL_IOStream *src, Uint8 *value); * information. * * \since This function is available since SDL 3.1.3. + * + * \threadsafety This function is not thread safe. */ extern SDL_DECLSPEC bool SDLCALL SDL_ReadS8(SDL_IOStream *src, Sint8 *value); @@ -786,6 +830,8 @@ extern SDL_DECLSPEC bool SDLCALL SDL_ReadS8(SDL_IOStream *src, Sint8 *value); * for more information. * * \since This function is available since SDL 3.1.3. + * + * \threadsafety This function is not thread safe. */ extern SDL_DECLSPEC bool SDLCALL SDL_ReadU16LE(SDL_IOStream *src, Uint16 *value); @@ -807,6 +853,8 @@ extern SDL_DECLSPEC bool SDLCALL SDL_ReadU16LE(SDL_IOStream *src, Uint16 *value) * for more information. * * \since This function is available since SDL 3.1.3. + * + * \threadsafety This function is not thread safe. */ extern SDL_DECLSPEC bool SDLCALL SDL_ReadS16LE(SDL_IOStream *src, Sint16 *value); @@ -828,6 +876,8 @@ extern SDL_DECLSPEC bool SDLCALL SDL_ReadS16LE(SDL_IOStream *src, Sint16 *value) * for more information. * * \since This function is available since SDL 3.1.3. + * + * \threadsafety This function is not thread safe. */ extern SDL_DECLSPEC bool SDLCALL SDL_ReadU16BE(SDL_IOStream *src, Uint16 *value); @@ -849,6 +899,8 @@ extern SDL_DECLSPEC bool SDLCALL SDL_ReadU16BE(SDL_IOStream *src, Uint16 *value) * for more information. * * \since This function is available since SDL 3.1.3. + * + * \threadsafety This function is not thread safe. */ extern SDL_DECLSPEC bool SDLCALL SDL_ReadS16BE(SDL_IOStream *src, Sint16 *value); @@ -870,6 +922,8 @@ extern SDL_DECLSPEC bool SDLCALL SDL_ReadS16BE(SDL_IOStream *src, Sint16 *value) * for more information. * * \since This function is available since SDL 3.1.3. + * + * \threadsafety This function is not thread safe. */ extern SDL_DECLSPEC bool SDLCALL SDL_ReadU32LE(SDL_IOStream *src, Uint32 *value); @@ -891,6 +945,8 @@ extern SDL_DECLSPEC bool SDLCALL SDL_ReadU32LE(SDL_IOStream *src, Uint32 *value) * for more information. * * \since This function is available since SDL 3.1.3. + * + * \threadsafety This function is not thread safe. */ extern SDL_DECLSPEC bool SDLCALL SDL_ReadS32LE(SDL_IOStream *src, Sint32 *value); @@ -912,6 +968,8 @@ extern SDL_DECLSPEC bool SDLCALL SDL_ReadS32LE(SDL_IOStream *src, Sint32 *value) * for more information. * * \since This function is available since SDL 3.1.3. + * + * \threadsafety This function is not thread safe. */ extern SDL_DECLSPEC bool SDLCALL SDL_ReadU32BE(SDL_IOStream *src, Uint32 *value); @@ -933,6 +991,8 @@ extern SDL_DECLSPEC bool SDLCALL SDL_ReadU32BE(SDL_IOStream *src, Uint32 *value) * for more information. * * \since This function is available since SDL 3.1.3. + * + * \threadsafety This function is not thread safe. */ extern SDL_DECLSPEC bool SDLCALL SDL_ReadS32BE(SDL_IOStream *src, Sint32 *value); @@ -954,6 +1014,8 @@ extern SDL_DECLSPEC bool SDLCALL SDL_ReadS32BE(SDL_IOStream *src, Sint32 *value) * for more information. * * \since This function is available since SDL 3.1.3. + * + * \threadsafety This function is not thread safe. */ extern SDL_DECLSPEC bool SDLCALL SDL_ReadU64LE(SDL_IOStream *src, Uint64 *value); @@ -975,6 +1037,8 @@ extern SDL_DECLSPEC bool SDLCALL SDL_ReadU64LE(SDL_IOStream *src, Uint64 *value) * for more information. * * \since This function is available since SDL 3.1.3. + * + * \threadsafety This function is not thread safe. */ extern SDL_DECLSPEC bool SDLCALL SDL_ReadS64LE(SDL_IOStream *src, Sint64 *value); @@ -996,6 +1060,8 @@ extern SDL_DECLSPEC bool SDLCALL SDL_ReadS64LE(SDL_IOStream *src, Sint64 *value) * for more information. * * \since This function is available since SDL 3.1.3. + * + * \threadsafety This function is not thread safe. */ extern SDL_DECLSPEC bool SDLCALL SDL_ReadU64BE(SDL_IOStream *src, Uint64 *value); @@ -1017,6 +1083,8 @@ extern SDL_DECLSPEC bool SDLCALL SDL_ReadU64BE(SDL_IOStream *src, Uint64 *value) * for more information. * * \since This function is available since SDL 3.1.3. + * + * \threadsafety This function is not thread safe. */ extern SDL_DECLSPEC bool SDLCALL SDL_ReadS64BE(SDL_IOStream *src, Sint64 *value); /* @} *//* Read endian functions */ @@ -1037,6 +1105,8 @@ extern SDL_DECLSPEC bool SDLCALL SDL_ReadS64BE(SDL_IOStream *src, Sint64 *value) * for more information. * * \since This function is available since SDL 3.1.3. + * + * \threadsafety This function is not thread safe. */ extern SDL_DECLSPEC bool SDLCALL SDL_WriteU8(SDL_IOStream *dst, Uint8 value); @@ -1049,6 +1119,8 @@ extern SDL_DECLSPEC bool SDLCALL SDL_WriteU8(SDL_IOStream *dst, Uint8 value); * for more information. * * \since This function is available since SDL 3.1.3. + * + * \threadsafety This function is not thread safe. */ extern SDL_DECLSPEC bool SDLCALL SDL_WriteS8(SDL_IOStream *dst, Sint8 value); @@ -1066,6 +1138,8 @@ extern SDL_DECLSPEC bool SDLCALL SDL_WriteS8(SDL_IOStream *dst, Sint8 value); * for more information. * * \since This function is available since SDL 3.1.3. + * + * \threadsafety This function is not thread safe. */ extern SDL_DECLSPEC bool SDLCALL SDL_WriteU16LE(SDL_IOStream *dst, Uint16 value); @@ -1083,6 +1157,8 @@ extern SDL_DECLSPEC bool SDLCALL SDL_WriteU16LE(SDL_IOStream *dst, Uint16 value) * for more information. * * \since This function is available since SDL 3.1.3. + * + * \threadsafety This function is not thread safe. */ extern SDL_DECLSPEC bool SDLCALL SDL_WriteS16LE(SDL_IOStream *dst, Sint16 value); @@ -1099,6 +1175,8 @@ extern SDL_DECLSPEC bool SDLCALL SDL_WriteS16LE(SDL_IOStream *dst, Sint16 value) * for more information. * * \since This function is available since SDL 3.1.3. + * + * \threadsafety This function is not thread safe. */ extern SDL_DECLSPEC bool SDLCALL SDL_WriteU16BE(SDL_IOStream *dst, Uint16 value); @@ -1115,6 +1193,8 @@ extern SDL_DECLSPEC bool SDLCALL SDL_WriteU16BE(SDL_IOStream *dst, Uint16 value) * for more information. * * \since This function is available since SDL 3.1.3. + * + * \threadsafety This function is not thread safe. */ extern SDL_DECLSPEC bool SDLCALL SDL_WriteS16BE(SDL_IOStream *dst, Sint16 value); @@ -1132,6 +1212,8 @@ extern SDL_DECLSPEC bool SDLCALL SDL_WriteS16BE(SDL_IOStream *dst, Sint16 value) * for more information. * * \since This function is available since SDL 3.1.3. + * + * \threadsafety This function is not thread safe. */ extern SDL_DECLSPEC bool SDLCALL SDL_WriteU32LE(SDL_IOStream *dst, Uint32 value); @@ -1149,6 +1231,8 @@ extern SDL_DECLSPEC bool SDLCALL SDL_WriteU32LE(SDL_IOStream *dst, Uint32 value) * for more information. * * \since This function is available since SDL 3.1.3. + * + * \threadsafety This function is not thread safe. */ extern SDL_DECLSPEC bool SDLCALL SDL_WriteS32LE(SDL_IOStream *dst, Sint32 value); @@ -1165,6 +1249,8 @@ extern SDL_DECLSPEC bool SDLCALL SDL_WriteS32LE(SDL_IOStream *dst, Sint32 value) * for more information. * * \since This function is available since SDL 3.1.3. + * + * \threadsafety This function is not thread safe. */ extern SDL_DECLSPEC bool SDLCALL SDL_WriteU32BE(SDL_IOStream *dst, Uint32 value); @@ -1181,6 +1267,8 @@ extern SDL_DECLSPEC bool SDLCALL SDL_WriteU32BE(SDL_IOStream *dst, Uint32 value) * for more information. * * \since This function is available since SDL 3.1.3. + * + * \threadsafety This function is not thread safe. */ extern SDL_DECLSPEC bool SDLCALL SDL_WriteS32BE(SDL_IOStream *dst, Sint32 value); @@ -1198,6 +1286,8 @@ extern SDL_DECLSPEC bool SDLCALL SDL_WriteS32BE(SDL_IOStream *dst, Sint32 value) * for more information. * * \since This function is available since SDL 3.1.3. + * + * \threadsafety This function is not thread safe. */ extern SDL_DECLSPEC bool SDLCALL SDL_WriteU64LE(SDL_IOStream *dst, Uint64 value); @@ -1215,6 +1305,8 @@ extern SDL_DECLSPEC bool SDLCALL SDL_WriteU64LE(SDL_IOStream *dst, Uint64 value) * for more information. * * \since This function is available since SDL 3.1.3. + * + * \threadsafety This function is not thread safe. */ extern SDL_DECLSPEC bool SDLCALL SDL_WriteS64LE(SDL_IOStream *dst, Sint64 value); @@ -1231,6 +1323,8 @@ extern SDL_DECLSPEC bool SDLCALL SDL_WriteS64LE(SDL_IOStream *dst, Sint64 value) * for more information. * * \since This function is available since SDL 3.1.3. + * + * \threadsafety This function is not thread safe. */ extern SDL_DECLSPEC bool SDLCALL SDL_WriteU64BE(SDL_IOStream *dst, Uint64 value); @@ -1247,6 +1341,8 @@ extern SDL_DECLSPEC bool SDLCALL SDL_WriteU64BE(SDL_IOStream *dst, Uint64 value) * for more information. * * \since This function is available since SDL 3.1.3. + * + * \threadsafety This function is not thread safe. */ extern SDL_DECLSPEC bool SDLCALL SDL_WriteS64BE(SDL_IOStream *dst, Sint64 value); From a2b0ddcca641d756abd9b12ab275239c2144515d Mon Sep 17 00:00:00 2001 From: SDL Wiki Bot Date: Tue, 14 Jan 2025 01:19:09 +0000 Subject: [PATCH 036/340] Sync SDL3 wiki -> header [ci skip] --- include/SDL3/SDL_iostream.h | 193 ++++++++++++++++++------------------ 1 file changed, 95 insertions(+), 98 deletions(-) diff --git a/include/SDL3/SDL_iostream.h b/include/SDL3/SDL_iostream.h index a38225b758af5..a45a12d01ccb9 100644 --- a/include/SDL3/SDL_iostream.h +++ b/include/SDL3/SDL_iostream.h @@ -260,10 +260,10 @@ typedef struct SDL_IOStream SDL_IOStream; * \returns a pointer to the SDL_IOStream structure that is created or NULL on * failure; call SDL_GetError() for more information. * - * \since This function is available since SDL 3.1.3. - * * \threadsafety This function is not thread safe. * + * \since This function is available since SDL 3.1.3. + * * \sa SDL_CloseIO * \sa SDL_FlushIO * \sa SDL_ReadIO @@ -305,10 +305,10 @@ extern SDL_DECLSPEC SDL_IOStream * SDLCALL SDL_IOFromFile(const char *file, cons * \returns a pointer to a new SDL_IOStream structure or NULL on failure; call * SDL_GetError() for more information. * - * \since This function is available since SDL 3.1.3. - * * \threadsafety It is safe to call this function from any thread. * + * \since This function is available since SDL 3.1.3. + * * \sa SDL_IOFromConstMem * \sa SDL_CloseIO * \sa SDL_FlushIO @@ -351,10 +351,10 @@ extern SDL_DECLSPEC SDL_IOStream * SDLCALL SDL_IOFromMem(void *mem, size_t size) * \returns a pointer to a new SDL_IOStream structure or NULL on failure; call * SDL_GetError() for more information. * - * \since This function is available since SDL 3.1.3. - * * \threadsafety It is safe to call this function from any thread. * + * \since This function is available since SDL 3.1.3. + * * \sa SDL_IOFromMem * \sa SDL_CloseIO * \sa SDL_ReadIO @@ -381,10 +381,10 @@ extern SDL_DECLSPEC SDL_IOStream * SDLCALL SDL_IOFromConstMem(const void *mem, s * \returns a pointer to a new SDL_IOStream structure or NULL on failure; call * SDL_GetError() for more information. * - * \since This function is available since SDL 3.1.3. - * * \threadsafety It is safe to call this function from any thread. * + * \since This function is available since SDL 3.1.3. + * * \sa SDL_CloseIO * \sa SDL_ReadIO * \sa SDL_SeekIO @@ -416,10 +416,10 @@ extern SDL_DECLSPEC SDL_IOStream * SDLCALL SDL_IOFromDynamicMem(void); * \returns a pointer to the allocated memory on success or NULL on failure; * call SDL_GetError() for more information. * - * \since This function is available since SDL 3.1.3. - * * \threadsafety It is safe to call this function from any thread. * + * \since This function is available since SDL 3.1.3. + * * \sa SDL_CloseIO * \sa SDL_INIT_INTERFACE * \sa SDL_IOFromConstMem @@ -452,10 +452,10 @@ extern SDL_DECLSPEC SDL_IOStream * SDLCALL SDL_OpenIO(const SDL_IOStreamInterfac * \returns true on success or false on failure; call SDL_GetError() for more * information. * - * \since This function is available since SDL 3.1.3. - * * \threadsafety This function is not thread safe. * + * \since This function is available since SDL 3.1.3. + * * \sa SDL_OpenIO */ extern SDL_DECLSPEC bool SDLCALL SDL_CloseIO(SDL_IOStream *context); @@ -467,9 +467,9 @@ extern SDL_DECLSPEC bool SDLCALL SDL_CloseIO(SDL_IOStream *context); * \returns a valid property ID on success or 0 on failure; call * SDL_GetError() for more information. * - * \since This function is available since SDL 3.1.3. - * * \threadsafety This function is not thread safe. + * + * \since This function is available since SDL 3.1.3. */ extern SDL_DECLSPEC SDL_PropertiesID SDLCALL SDL_GetIOProperties(SDL_IOStream *context); @@ -487,12 +487,9 @@ extern SDL_DECLSPEC SDL_PropertiesID SDLCALL SDL_GetIOProperties(SDL_IOStream *c * \param context the SDL_IOStream to query. * \returns an SDL_IOStatus enum with the current state. * - * \threadsafety This function should not be called at the same time that - * another thread is operating on the same SDL_IOStream. + * \threadsafety This function is not thread safe. * * \since This function is available since SDL 3.1.3. - * - * \threadsafety This function is not thread safe. */ extern SDL_DECLSPEC SDL_IOStatus SDLCALL SDL_GetIOStatus(SDL_IOStream *context); @@ -504,9 +501,9 @@ extern SDL_DECLSPEC SDL_IOStatus SDLCALL SDL_GetIOStatus(SDL_IOStream *context); * negative error code on failure; call SDL_GetError() for more * information. * - * \since This function is available since SDL 3.1.3. - * * \threadsafety This function is not thread safe. + * + * \since This function is available since SDL 3.1.3. */ extern SDL_DECLSPEC Sint64 SDLCALL SDL_GetIOSize(SDL_IOStream *context); @@ -531,10 +528,10 @@ extern SDL_DECLSPEC Sint64 SDLCALL SDL_GetIOSize(SDL_IOStream *context); * \returns the final offset in the data stream after the seek or -1 on * failure; call SDL_GetError() for more information. * - * \since This function is available since SDL 3.1.3. - * * \threadsafety This function is not thread safe. * + * \since This function is available since SDL 3.1.3. + * * \sa SDL_TellIO */ extern SDL_DECLSPEC Sint64 SDLCALL SDL_SeekIO(SDL_IOStream *context, Sint64 offset, SDL_IOWhence whence); @@ -551,10 +548,10 @@ extern SDL_DECLSPEC Sint64 SDLCALL SDL_SeekIO(SDL_IOStream *context, Sint64 offs * \returns the current offset in the stream, or -1 if the information can not * be determined. * - * \since This function is available since SDL 3.1.3. - * * \threadsafety This function is not thread safe. * + * \since This function is available since SDL 3.1.3. + * * \sa SDL_SeekIO */ extern SDL_DECLSPEC Sint64 SDLCALL SDL_TellIO(SDL_IOStream *context); @@ -576,10 +573,10 @@ extern SDL_DECLSPEC Sint64 SDLCALL SDL_TellIO(SDL_IOStream *context); * \returns the number of bytes read, or 0 on end of file or other failure; * call SDL_GetError() for more information. * - * \since This function is available since SDL 3.1.3. - * * \threadsafety This function is not thread safe. * + * \since This function is available since SDL 3.1.3. + * * \sa SDL_WriteIO * \sa SDL_GetIOStatus */ @@ -605,10 +602,10 @@ extern SDL_DECLSPEC size_t SDLCALL SDL_ReadIO(SDL_IOStream *context, void *ptr, * \returns the number of bytes written, which will be less than `size` on * failure; call SDL_GetError() for more information. * - * \since This function is available since SDL 3.1.3. - * * \threadsafety This function is not thread safe. * + * \since This function is available since SDL 3.1.3. + * * \sa SDL_IOprintf * \sa SDL_ReadIO * \sa SDL_SeekIO @@ -629,10 +626,10 @@ extern SDL_DECLSPEC size_t SDLCALL SDL_WriteIO(SDL_IOStream *context, const void * \returns the number of bytes written or 0 on failure; call SDL_GetError() * for more information. * - * \since This function is available since SDL 3.1.3. - * * \threadsafety This function is not thread safe. * + * \since This function is available since SDL 3.1.3. + * * \sa SDL_IOvprintf * \sa SDL_WriteIO */ @@ -649,10 +646,10 @@ extern SDL_DECLSPEC size_t SDLCALL SDL_IOprintf(SDL_IOStream *context, SDL_PRINT * \returns the number of bytes written or 0 on failure; call SDL_GetError() * for more information. * - * \since This function is available since SDL 3.1.3. - * * \threadsafety This function is not thread safe. * + * \since This function is available since SDL 3.1.3. + * * \sa SDL_IOprintf * \sa SDL_WriteIO */ @@ -669,10 +666,10 @@ extern SDL_DECLSPEC size_t SDLCALL SDL_IOvprintf(SDL_IOStream *context, SDL_PRIN * \returns true on success or false on failure; call SDL_GetError() for more * information. * - * \since This function is available since SDL 3.1.3. - * * \threadsafety This function is not thread safe. * + * \since This function is available since SDL 3.1.3. + * * \sa SDL_OpenIO * \sa SDL_WriteIO */ @@ -695,10 +692,10 @@ extern SDL_DECLSPEC bool SDLCALL SDL_FlushIO(SDL_IOStream *context); * \returns the data or NULL on failure; call SDL_GetError() for more * information. * - * \since This function is available since SDL 3.1.3. - * * \threadsafety This function is not thread safe. * + * \since This function is available since SDL 3.1.3. + * * \sa SDL_LoadFile * \sa SDL_SaveFile_IO */ @@ -718,10 +715,10 @@ extern SDL_DECLSPEC void * SDLCALL SDL_LoadFile_IO(SDL_IOStream *src, size_t *da * \returns the data or NULL on failure; call SDL_GetError() for more * information. * - * \since This function is available since SDL 3.1.3. - * * \threadsafety This function is not thread safe. * + * \since This function is available since SDL 3.1.3. + * * \sa SDL_LoadFile_IO * \sa SDL_SaveFile */ @@ -739,10 +736,10 @@ extern SDL_DECLSPEC void * SDLCALL SDL_LoadFile(const char *file, size_t *datasi * \returns true on success or false on failure; call SDL_GetError() for more * information. * - * \since This function is available since SDL 3.1.8. - * * \threadsafety This function is not thread safe. * + * \since This function is available since SDL 3.1.8. + * * \sa SDL_SaveFile * \sa SDL_LoadFile_IO */ @@ -758,10 +755,10 @@ extern SDL_DECLSPEC bool SDLCALL SDL_SaveFile_IO(SDL_IOStream *src, const void * * \returns true on success or false on failure; call SDL_GetError() for more * information. * - * \since This function is available since SDL 3.1.8. - * * \threadsafety This function is not thread safe. * + * \since This function is available since SDL 3.1.8. + * * \sa SDL_SaveFile_IO * \sa SDL_LoadFile */ @@ -787,9 +784,9 @@ extern SDL_DECLSPEC bool SDLCALL SDL_SaveFile(const char *file, const void *data * \returns true on success or false on failure or EOF; call SDL_GetError() * for more information. * - * \since This function is available since SDL 3.1.3. - * * \threadsafety This function is not thread safe. + * + * \since This function is available since SDL 3.1.3. */ extern SDL_DECLSPEC bool SDLCALL SDL_ReadU8(SDL_IOStream *src, Uint8 *value); @@ -806,9 +803,9 @@ extern SDL_DECLSPEC bool SDLCALL SDL_ReadU8(SDL_IOStream *src, Uint8 *value); * \returns true on success or false on failure; call SDL_GetError() for more * information. * - * \since This function is available since SDL 3.1.3. - * * \threadsafety This function is not thread safe. + * + * \since This function is available since SDL 3.1.3. */ extern SDL_DECLSPEC bool SDLCALL SDL_ReadS8(SDL_IOStream *src, Sint8 *value); @@ -829,9 +826,9 @@ extern SDL_DECLSPEC bool SDLCALL SDL_ReadS8(SDL_IOStream *src, Sint8 *value); * \returns true on successful write or false on failure; call SDL_GetError() * for more information. * - * \since This function is available since SDL 3.1.3. - * * \threadsafety This function is not thread safe. + * + * \since This function is available since SDL 3.1.3. */ extern SDL_DECLSPEC bool SDLCALL SDL_ReadU16LE(SDL_IOStream *src, Uint16 *value); @@ -852,9 +849,9 @@ extern SDL_DECLSPEC bool SDLCALL SDL_ReadU16LE(SDL_IOStream *src, Uint16 *value) * \returns true on successful write or false on failure; call SDL_GetError() * for more information. * - * \since This function is available since SDL 3.1.3. - * * \threadsafety This function is not thread safe. + * + * \since This function is available since SDL 3.1.3. */ extern SDL_DECLSPEC bool SDLCALL SDL_ReadS16LE(SDL_IOStream *src, Sint16 *value); @@ -875,9 +872,9 @@ extern SDL_DECLSPEC bool SDLCALL SDL_ReadS16LE(SDL_IOStream *src, Sint16 *value) * \returns true on successful write or false on failure; call SDL_GetError() * for more information. * - * \since This function is available since SDL 3.1.3. - * * \threadsafety This function is not thread safe. + * + * \since This function is available since SDL 3.1.3. */ extern SDL_DECLSPEC bool SDLCALL SDL_ReadU16BE(SDL_IOStream *src, Uint16 *value); @@ -898,9 +895,9 @@ extern SDL_DECLSPEC bool SDLCALL SDL_ReadU16BE(SDL_IOStream *src, Uint16 *value) * \returns true on successful write or false on failure; call SDL_GetError() * for more information. * - * \since This function is available since SDL 3.1.3. - * * \threadsafety This function is not thread safe. + * + * \since This function is available since SDL 3.1.3. */ extern SDL_DECLSPEC bool SDLCALL SDL_ReadS16BE(SDL_IOStream *src, Sint16 *value); @@ -921,9 +918,9 @@ extern SDL_DECLSPEC bool SDLCALL SDL_ReadS16BE(SDL_IOStream *src, Sint16 *value) * \returns true on successful write or false on failure; call SDL_GetError() * for more information. * - * \since This function is available since SDL 3.1.3. - * * \threadsafety This function is not thread safe. + * + * \since This function is available since SDL 3.1.3. */ extern SDL_DECLSPEC bool SDLCALL SDL_ReadU32LE(SDL_IOStream *src, Uint32 *value); @@ -944,9 +941,9 @@ extern SDL_DECLSPEC bool SDLCALL SDL_ReadU32LE(SDL_IOStream *src, Uint32 *value) * \returns true on successful write or false on failure; call SDL_GetError() * for more information. * - * \since This function is available since SDL 3.1.3. - * * \threadsafety This function is not thread safe. + * + * \since This function is available since SDL 3.1.3. */ extern SDL_DECLSPEC bool SDLCALL SDL_ReadS32LE(SDL_IOStream *src, Sint32 *value); @@ -967,9 +964,9 @@ extern SDL_DECLSPEC bool SDLCALL SDL_ReadS32LE(SDL_IOStream *src, Sint32 *value) * \returns true on successful write or false on failure; call SDL_GetError() * for more information. * - * \since This function is available since SDL 3.1.3. - * * \threadsafety This function is not thread safe. + * + * \since This function is available since SDL 3.1.3. */ extern SDL_DECLSPEC bool SDLCALL SDL_ReadU32BE(SDL_IOStream *src, Uint32 *value); @@ -990,9 +987,9 @@ extern SDL_DECLSPEC bool SDLCALL SDL_ReadU32BE(SDL_IOStream *src, Uint32 *value) * \returns true on successful write or false on failure; call SDL_GetError() * for more information. * - * \since This function is available since SDL 3.1.3. - * * \threadsafety This function is not thread safe. + * + * \since This function is available since SDL 3.1.3. */ extern SDL_DECLSPEC bool SDLCALL SDL_ReadS32BE(SDL_IOStream *src, Sint32 *value); @@ -1013,9 +1010,9 @@ extern SDL_DECLSPEC bool SDLCALL SDL_ReadS32BE(SDL_IOStream *src, Sint32 *value) * \returns true on successful write or false on failure; call SDL_GetError() * for more information. * - * \since This function is available since SDL 3.1.3. - * * \threadsafety This function is not thread safe. + * + * \since This function is available since SDL 3.1.3. */ extern SDL_DECLSPEC bool SDLCALL SDL_ReadU64LE(SDL_IOStream *src, Uint64 *value); @@ -1036,9 +1033,9 @@ extern SDL_DECLSPEC bool SDLCALL SDL_ReadU64LE(SDL_IOStream *src, Uint64 *value) * \returns true on successful write or false on failure; call SDL_GetError() * for more information. * - * \since This function is available since SDL 3.1.3. - * * \threadsafety This function is not thread safe. + * + * \since This function is available since SDL 3.1.3. */ extern SDL_DECLSPEC bool SDLCALL SDL_ReadS64LE(SDL_IOStream *src, Sint64 *value); @@ -1059,9 +1056,9 @@ extern SDL_DECLSPEC bool SDLCALL SDL_ReadS64LE(SDL_IOStream *src, Sint64 *value) * \returns true on successful write or false on failure; call SDL_GetError() * for more information. * - * \since This function is available since SDL 3.1.3. - * * \threadsafety This function is not thread safe. + * + * \since This function is available since SDL 3.1.3. */ extern SDL_DECLSPEC bool SDLCALL SDL_ReadU64BE(SDL_IOStream *src, Uint64 *value); @@ -1082,9 +1079,9 @@ extern SDL_DECLSPEC bool SDLCALL SDL_ReadU64BE(SDL_IOStream *src, Uint64 *value) * \returns true on successful write or false on failure; call SDL_GetError() * for more information. * - * \since This function is available since SDL 3.1.3. - * * \threadsafety This function is not thread safe. + * + * \since This function is available since SDL 3.1.3. */ extern SDL_DECLSPEC bool SDLCALL SDL_ReadS64BE(SDL_IOStream *src, Sint64 *value); /* @} *//* Read endian functions */ @@ -1104,9 +1101,9 @@ extern SDL_DECLSPEC bool SDLCALL SDL_ReadS64BE(SDL_IOStream *src, Sint64 *value) * \returns true on successful write or false on failure; call SDL_GetError() * for more information. * - * \since This function is available since SDL 3.1.3. - * * \threadsafety This function is not thread safe. + * + * \since This function is available since SDL 3.1.3. */ extern SDL_DECLSPEC bool SDLCALL SDL_WriteU8(SDL_IOStream *dst, Uint8 value); @@ -1118,9 +1115,9 @@ extern SDL_DECLSPEC bool SDLCALL SDL_WriteU8(SDL_IOStream *dst, Uint8 value); * \returns true on successful write or false on failure; call SDL_GetError() * for more information. * - * \since This function is available since SDL 3.1.3. - * * \threadsafety This function is not thread safe. + * + * \since This function is available since SDL 3.1.3. */ extern SDL_DECLSPEC bool SDLCALL SDL_WriteS8(SDL_IOStream *dst, Sint8 value); @@ -1137,9 +1134,9 @@ extern SDL_DECLSPEC bool SDLCALL SDL_WriteS8(SDL_IOStream *dst, Sint8 value); * \returns true on successful write or false on failure; call SDL_GetError() * for more information. * - * \since This function is available since SDL 3.1.3. - * * \threadsafety This function is not thread safe. + * + * \since This function is available since SDL 3.1.3. */ extern SDL_DECLSPEC bool SDLCALL SDL_WriteU16LE(SDL_IOStream *dst, Uint16 value); @@ -1156,9 +1153,9 @@ extern SDL_DECLSPEC bool SDLCALL SDL_WriteU16LE(SDL_IOStream *dst, Uint16 value) * \returns true on successful write or false on failure; call SDL_GetError() * for more information. * - * \since This function is available since SDL 3.1.3. - * * \threadsafety This function is not thread safe. + * + * \since This function is available since SDL 3.1.3. */ extern SDL_DECLSPEC bool SDLCALL SDL_WriteS16LE(SDL_IOStream *dst, Sint16 value); @@ -1174,9 +1171,9 @@ extern SDL_DECLSPEC bool SDLCALL SDL_WriteS16LE(SDL_IOStream *dst, Sint16 value) * \returns true on successful write or false on failure; call SDL_GetError() * for more information. * - * \since This function is available since SDL 3.1.3. - * * \threadsafety This function is not thread safe. + * + * \since This function is available since SDL 3.1.3. */ extern SDL_DECLSPEC bool SDLCALL SDL_WriteU16BE(SDL_IOStream *dst, Uint16 value); @@ -1192,9 +1189,9 @@ extern SDL_DECLSPEC bool SDLCALL SDL_WriteU16BE(SDL_IOStream *dst, Uint16 value) * \returns true on successful write or false on failure; call SDL_GetError() * for more information. * - * \since This function is available since SDL 3.1.3. - * * \threadsafety This function is not thread safe. + * + * \since This function is available since SDL 3.1.3. */ extern SDL_DECLSPEC bool SDLCALL SDL_WriteS16BE(SDL_IOStream *dst, Sint16 value); @@ -1211,9 +1208,9 @@ extern SDL_DECLSPEC bool SDLCALL SDL_WriteS16BE(SDL_IOStream *dst, Sint16 value) * \returns true on successful write or false on failure; call SDL_GetError() * for more information. * - * \since This function is available since SDL 3.1.3. - * * \threadsafety This function is not thread safe. + * + * \since This function is available since SDL 3.1.3. */ extern SDL_DECLSPEC bool SDLCALL SDL_WriteU32LE(SDL_IOStream *dst, Uint32 value); @@ -1230,9 +1227,9 @@ extern SDL_DECLSPEC bool SDLCALL SDL_WriteU32LE(SDL_IOStream *dst, Uint32 value) * \returns true on successful write or false on failure; call SDL_GetError() * for more information. * - * \since This function is available since SDL 3.1.3. - * * \threadsafety This function is not thread safe. + * + * \since This function is available since SDL 3.1.3. */ extern SDL_DECLSPEC bool SDLCALL SDL_WriteS32LE(SDL_IOStream *dst, Sint32 value); @@ -1248,9 +1245,9 @@ extern SDL_DECLSPEC bool SDLCALL SDL_WriteS32LE(SDL_IOStream *dst, Sint32 value) * \returns true on successful write or false on failure; call SDL_GetError() * for more information. * - * \since This function is available since SDL 3.1.3. - * * \threadsafety This function is not thread safe. + * + * \since This function is available since SDL 3.1.3. */ extern SDL_DECLSPEC bool SDLCALL SDL_WriteU32BE(SDL_IOStream *dst, Uint32 value); @@ -1266,9 +1263,9 @@ extern SDL_DECLSPEC bool SDLCALL SDL_WriteU32BE(SDL_IOStream *dst, Uint32 value) * \returns true on successful write or false on failure; call SDL_GetError() * for more information. * - * \since This function is available since SDL 3.1.3. - * * \threadsafety This function is not thread safe. + * + * \since This function is available since SDL 3.1.3. */ extern SDL_DECLSPEC bool SDLCALL SDL_WriteS32BE(SDL_IOStream *dst, Sint32 value); @@ -1285,9 +1282,9 @@ extern SDL_DECLSPEC bool SDLCALL SDL_WriteS32BE(SDL_IOStream *dst, Sint32 value) * \returns true on successful write or false on failure; call SDL_GetError() * for more information. * - * \since This function is available since SDL 3.1.3. - * * \threadsafety This function is not thread safe. + * + * \since This function is available since SDL 3.1.3. */ extern SDL_DECLSPEC bool SDLCALL SDL_WriteU64LE(SDL_IOStream *dst, Uint64 value); @@ -1304,9 +1301,9 @@ extern SDL_DECLSPEC bool SDLCALL SDL_WriteU64LE(SDL_IOStream *dst, Uint64 value) * \returns true on successful write or false on failure; call SDL_GetError() * for more information. * - * \since This function is available since SDL 3.1.3. - * * \threadsafety This function is not thread safe. + * + * \since This function is available since SDL 3.1.3. */ extern SDL_DECLSPEC bool SDLCALL SDL_WriteS64LE(SDL_IOStream *dst, Sint64 value); @@ -1322,9 +1319,9 @@ extern SDL_DECLSPEC bool SDLCALL SDL_WriteS64LE(SDL_IOStream *dst, Sint64 value) * \returns true on successful write or false on failure; call SDL_GetError() * for more information. * - * \since This function is available since SDL 3.1.3. - * * \threadsafety This function is not thread safe. + * + * \since This function is available since SDL 3.1.3. */ extern SDL_DECLSPEC bool SDLCALL SDL_WriteU64BE(SDL_IOStream *dst, Uint64 value); @@ -1340,9 +1337,9 @@ extern SDL_DECLSPEC bool SDLCALL SDL_WriteU64BE(SDL_IOStream *dst, Uint64 value) * \returns true on successful write or false on failure; call SDL_GetError() * for more information. * - * \since This function is available since SDL 3.1.3. - * * \threadsafety This function is not thread safe. + * + * \since This function is available since SDL 3.1.3. */ extern SDL_DECLSPEC bool SDLCALL SDL_WriteS64BE(SDL_IOStream *dst, Sint64 value); From fb6df933848fdda0f204dd51925b42593ed177c6 Mon Sep 17 00:00:00 2001 From: Evan Hemsley <2342303+thatcosmonaut@users.noreply.github.com> Date: Mon, 13 Jan 2025 17:29:08 -0800 Subject: [PATCH 037/340] GPU: Add name properties to resources (#11946) --- include/SDL3/SDL_gpu.h | 56 ++++- src/gpu/SDL_gpu.c | 10 +- src/gpu/SDL_sysgpu.h | 6 +- src/gpu/d3d12/SDL_gpu_d3d12.c | 392 ++++++++++++++++---------------- src/gpu/metal/SDL_gpu_metal.m | 103 ++++++--- src/gpu/vulkan/SDL_gpu_vulkan.c | 165 ++++++++++---- test/testgpu_spinning_cube.c | 10 +- 7 files changed, 441 insertions(+), 301 deletions(-) diff --git a/include/SDL3/SDL_gpu.h b/include/SDL3/SDL_gpu.h index b0a9cdf204dab..2db3a720c9cb3 100644 --- a/include/SDL3/SDL_gpu.h +++ b/include/SDL3/SDL_gpu.h @@ -334,7 +334,6 @@ typedef struct SDL_GPUDevice SDL_GPUDevice; * \since This struct is available since SDL 3.1.3 * * \sa SDL_CreateGPUBuffer - * \sa SDL_SetGPUBufferName * \sa SDL_UploadToGPUBuffer * \sa SDL_DownloadFromGPUBuffer * \sa SDL_CopyGPUBufferToBuffer @@ -374,7 +373,6 @@ typedef struct SDL_GPUTransferBuffer SDL_GPUTransferBuffer; * \since This struct is available since SDL 3.1.3 * * \sa SDL_CreateGPUTexture - * \sa SDL_SetGPUTextureName * \sa SDL_UploadToGPUTexture * \sa SDL_DownloadFromGPUTexture * \sa SDL_CopyGPUTextureToTexture @@ -2247,6 +2245,10 @@ extern SDL_DECLSPEC SDL_GPUShaderFormat SDLCALL SDL_GetGPUShaderFormats(SDL_GPUD * - [[texture]]: Sampled textures, followed by read-only storage textures, * followed by read-write storage textures * + * There are optional properties that can be provided through `props`. These are the supported properties: + * + * - `SDL_PROP_GPU_COMPUTEPIPELINE_CREATE_NAME_STRING`: a name that can be displayed in debugging tools. + * * \param device a GPU Context. * \param createinfo a struct describing the state of the compute pipeline to * create. @@ -2262,9 +2264,15 @@ extern SDL_DECLSPEC SDL_GPUComputePipeline *SDLCALL SDL_CreateGPUComputePipeline SDL_GPUDevice *device, const SDL_GPUComputePipelineCreateInfo *createinfo); +#define SDL_PROP_GPU_COMPUTEPIPELINE_CREATE_NAME_STRING "SDL.gpu.computepipeline.create.name" + /** * Creates a pipeline object to be used in a graphics workflow. * + * There are optional properties that can be provided through `props`. These are the supported properties: + * + * - `SDL_PROP_GPU_GRAPHICSPIPELINE_CREATE_NAME_STRING`: a name that can be displayed in debugging tools. + * * \param device a GPU Context. * \param createinfo a struct describing the state of the graphics pipeline to * create. @@ -2281,10 +2289,16 @@ extern SDL_DECLSPEC SDL_GPUGraphicsPipeline *SDLCALL SDL_CreateGPUGraphicsPipeli SDL_GPUDevice *device, const SDL_GPUGraphicsPipelineCreateInfo *createinfo); +#define SDL_PROP_GPU_GRAPHICSPIPELINE_CREATE_NAME_STRING "SDL.gpu.graphicspipeline.create.name" + /** * Creates a sampler object to be used when binding textures in a graphics * workflow. * + * There are optional properties that can be provided through `props`. These are the supported properties: + * + * - `SDL_PROP_GPU_SAMPLER_CREATE_NAME_STRING`: a name that can be displayed in debugging tools. + * * \param device a GPU Context. * \param createinfo a struct describing the state of the sampler to create. * \returns a sampler object on success, or NULL on failure; call @@ -2300,6 +2314,8 @@ extern SDL_DECLSPEC SDL_GPUSampler *SDLCALL SDL_CreateGPUSampler( SDL_GPUDevice *device, const SDL_GPUSamplerCreateInfo *createinfo); +#define SDL_PROP_GPU_SAMPLER_CREATE_NAME_STRING "SDL.gpu.sampler.create.name" + /** * Creates a shader to be used when creating a graphics pipeline. * @@ -2357,6 +2373,10 @@ extern SDL_DECLSPEC SDL_GPUSampler *SDLCALL SDL_CreateGPUSampler( * SDL_PROP_GPU_DEVICE_CREATE_D3D12_SEMANTIC_NAME_STRING with * SDL_CreateGPUDeviceWithProperties(). * + * There are optional properties that can be provided through `props`. These are the supported properties: + * + * - `SDL_PROP_GPU_SHADER_CREATE_NAME_STRING`: a name that can be displayed in debugging tools. + * * \param device a GPU Context. * \param createinfo a struct describing the state of the shader to create. * \returns a shader object on success, or NULL on failure; call @@ -2371,6 +2391,8 @@ extern SDL_DECLSPEC SDL_GPUShader *SDLCALL SDL_CreateGPUShader( SDL_GPUDevice *device, const SDL_GPUShaderCreateInfo *createinfo); +#define SDL_PROP_GPU_SHADER_CREATE_NAME_STRING "SDL.gpu.shader.create.name" + /** * Creates a texture object to be used in graphics or compute workflows. * @@ -2408,6 +2430,7 @@ extern SDL_DECLSPEC SDL_GPUShader *SDLCALL SDL_CreateGPUShader( * - `SDL_PROP_GPU_CREATETEXTURE_D3D12_CLEAR_STENCIL_UINT8`: (Direct3D 12 * only) if the texture usage is SDL_GPU_TEXTUREUSAGE_DEPTH_STENCIL_TARGET, * clear the texture to a stencil of this value. Defaults to zero. + * - `SDL_PROP_GPU_TEXTURE_CREATE_NAME_STRING`: a name that can be displayed in debugging tools. * * \param device a GPU Context. * \param createinfo a struct describing the state of the texture to create. @@ -2437,7 +2460,7 @@ extern SDL_DECLSPEC SDL_GPUTexture *SDLCALL SDL_CreateGPUTexture( #define SDL_PROP_GPU_CREATETEXTURE_D3D12_CLEAR_A_FLOAT "SDL.gpu.createtexture.d3d12.clear.a" #define SDL_PROP_GPU_CREATETEXTURE_D3D12_CLEAR_DEPTH_FLOAT "SDL.gpu.createtexture.d3d12.clear.depth" #define SDL_PROP_GPU_CREATETEXTURE_D3D12_CLEAR_STENCIL_UINT8 "SDL.gpu.createtexture.d3d12.clear.stencil" - +#define SDL_PROP_GPU_TEXTURE_CREATE_NAME_STRING "SDL.gpu.texture.create.name" /** * Creates a buffer object to be used in graphics or compute workflows. @@ -2453,6 +2476,10 @@ extern SDL_DECLSPEC SDL_GPUTexture *SDLCALL SDL_CreateGPUTexture( * [this blog post](https://moonside.games/posts/sdl-gpu-concepts-cycling/) * . * + * There are optional properties that can be provided through `props`. These are the supported properties: + * + * - `SDL_PROP_GPU_BUFFER_CREATE_NAME_STRING`: a name that can be displayed in debugging tools. + * * \param device a GPU Context. * \param createinfo a struct describing the state of the buffer to create. * \returns a buffer object on success, or NULL on failure; call @@ -2460,7 +2487,6 @@ extern SDL_DECLSPEC SDL_GPUTexture *SDLCALL SDL_CreateGPUTexture( * * \since This function is available since SDL 3.1.3. * - * \sa SDL_SetGPUBufferName * \sa SDL_UploadToGPUBuffer * \sa SDL_DownloadFromGPUBuffer * \sa SDL_CopyGPUBufferToBuffer @@ -2478,6 +2504,8 @@ extern SDL_DECLSPEC SDL_GPUBuffer *SDLCALL SDL_CreateGPUBuffer( SDL_GPUDevice *device, const SDL_GPUBufferCreateInfo *createinfo); +#define SDL_PROP_GPU_BUFFER_CREATE_NAME_STRING "SDL.gpu.buffer.create.name" + /** * Creates a transfer buffer to be used when uploading to or downloading from * graphics resources. @@ -2485,6 +2513,10 @@ extern SDL_DECLSPEC SDL_GPUBuffer *SDLCALL SDL_CreateGPUBuffer( * Download buffers can be particularly expensive to create, so it is good * practice to reuse them if data will be downloaded regularly. * + * There are optional properties that can be provided through `props`. These are the supported properties: + * + * - `SDL_PROP_GPU_TRANSFERBUFFER_CREATE_NAME_STRING`: a name that can be displayed in debugging tools. + * * \param device a GPU Context. * \param createinfo a struct describing the state of the transfer buffer to * create. @@ -2503,21 +2535,24 @@ extern SDL_DECLSPEC SDL_GPUTransferBuffer *SDLCALL SDL_CreateGPUTransferBuffer( SDL_GPUDevice *device, const SDL_GPUTransferBufferCreateInfo *createinfo); +#define SDL_PROP_GPU_TRANSFERBUFFER_CREATE_NAME_STRING "SDL.gpu.transferbuffer.create.name" + /* Debug Naming */ /** * Sets an arbitrary string constant to label a buffer. * - * Useful for debugging. + * You should use SDL_PROP_GPU_BUFFER_CREATE_NAME_STRING with SDL_CreateGPUBuffer instead of this function to avoid thread safety issues. * * \param device a GPU Context. * \param buffer a buffer to attach the name to. * \param text a UTF-8 string constant to mark as the name of the buffer. * - * \threadsafety This function is not thread safe, you must synchronize calls - * to this function. + * \threadsafety This function is not thread safe, you must make sure the buffer is not simultaneously used by any other thread. * * \since This function is available since SDL 3.1.3. + * + * \sa SDL_CreateGPUBuffer */ extern SDL_DECLSPEC void SDLCALL SDL_SetGPUBufferName( SDL_GPUDevice *device, @@ -2527,16 +2562,17 @@ extern SDL_DECLSPEC void SDLCALL SDL_SetGPUBufferName( /** * Sets an arbitrary string constant to label a texture. * - * Useful for debugging. + * You should use SDL_PROP_GPU_TEXTURE_CREATE_NAME_STRING with SDL_CreateGPUTexture instead of this function to avoid thread safety issues. * * \param device a GPU Context. * \param texture a texture to attach the name to. * \param text a UTF-8 string constant to mark as the name of the texture. * - * \threadsafety This function is not thread safe, you must synchronize calls - * to this function. + * \threadsafety This function is not thread safe, you must make sure the texture is not simultaneously used by any other thread. * * \since This function is available since SDL 3.1.3. + * + * \sa SDL_CreateGPUTexture */ extern SDL_DECLSPEC void SDLCALL SDL_SetGPUTextureName( SDL_GPUDevice *device, diff --git a/src/gpu/SDL_gpu.c b/src/gpu/SDL_gpu.c index e24ad9b680c82..34905cea2ce36 100644 --- a/src/gpu/SDL_gpu.c +++ b/src/gpu/SDL_gpu.c @@ -1055,10 +1055,13 @@ SDL_GPUBuffer *SDL_CreateGPUBuffer( return NULL; } + const char *debugName = SDL_GetStringProperty(createinfo->props, SDL_PROP_GPU_BUFFER_CREATE_NAME_STRING, NULL); + return device->CreateBuffer( device->driverData, createinfo->usage, - createinfo->size); + createinfo->size, + debugName); } SDL_GPUTransferBuffer *SDL_CreateGPUTransferBuffer( @@ -1071,10 +1074,13 @@ SDL_GPUTransferBuffer *SDL_CreateGPUTransferBuffer( return NULL; } + const char *debugName = SDL_GetStringProperty(createinfo->props, SDL_PROP_GPU_TRANSFERBUFFER_CREATE_NAME_STRING, NULL); + return device->CreateTransferBuffer( device->driverData, createinfo->usage, - createinfo->size); + createinfo->size, + debugName); } // Debug Naming diff --git a/src/gpu/SDL_sysgpu.h b/src/gpu/SDL_sysgpu.h index 85bad24434a4b..98f4be9f8574e 100644 --- a/src/gpu/SDL_sysgpu.h +++ b/src/gpu/SDL_sysgpu.h @@ -474,12 +474,14 @@ struct SDL_GPUDevice SDL_GPUBuffer *(*CreateBuffer)( SDL_GPURenderer *driverData, SDL_GPUBufferUsageFlags usageFlags, - Uint32 size); + Uint32 size, + const char *debugName); SDL_GPUTransferBuffer *(*CreateTransferBuffer)( SDL_GPURenderer *driverData, SDL_GPUTransferBufferUsage usage, - Uint32 size); + Uint32 size, + const char *debugName); // Debug Naming diff --git a/src/gpu/d3d12/SDL_gpu_d3d12.c b/src/gpu/d3d12/SDL_gpu_d3d12.c index c613e29bc7805..39c8b62b6be67 100644 --- a/src/gpu/d3d12/SDL_gpu_d3d12.c +++ b/src/gpu/d3d12/SDL_gpu_d3d12.c @@ -160,7 +160,6 @@ static const IID D3D_IID_IDXGIDebug = { 0x119e7452, 0xde9e, 0x40fe, { 0x88, 0x06 static const IID D3D_IID_IDXGIInfoQueue = { 0xd67441c7, 0x672a, 0x476f, { 0x9e, 0x82, 0xcd, 0x55, 0xb4, 0x49, 0x49, 0xce } }; #endif static const GUID D3D_IID_DXGI_DEBUG_ALL = { 0xe48ae283, 0xda80, 0x490b, { 0x87, 0xe6, 0x43, 0xe9, 0xa9, 0xcf, 0xda, 0x08 } }; -static const GUID D3D_IID_D3DDebugObjectName = { 0x429b8c22, 0x9188, 0x4b0c, { 0x87, 0x42, 0xac, 0xb0, 0xbf, 0x85, 0xc2, 0x00 } }; static const IID D3D_IID_ID3D12Device = { 0x189819f1, 0x1db6, 0x4b57, { 0xbe, 0x54, 0x18, 0x21, 0x33, 0x9b, 0x85, 0xf7 } }; static const IID D3D_IID_ID3D12CommandQueue = { 0x0ec870a6, 0x5d7e, 0x4c22, { 0x8c, 0xfc, 0x5b, 0xaa, 0xe0, 0x76, 0x16, 0xed } }; @@ -1177,22 +1176,6 @@ static void D3D12_INTERNAL_SetError( SDL_SetError("%s! Error Code: %s " HRESULT_FMT, msg, wszMsgBuff, res); } -// Debug Naming - -static void D3D12_INTERNAL_SetResourceName( - D3D12Renderer *renderer, - ID3D12Resource *resource, - const char *text) -{ - if (renderer->debug_mode) { - ID3D12DeviceChild_SetPrivateData( - resource, - D3D_GUID(D3D_IID_D3DDebugObjectName), - (UINT)SDL_strlen(text), - text); - } -} - // Release / Cleanup static void D3D12_INTERNAL_ReleaseStagingDescriptorHandle( @@ -1952,6 +1935,127 @@ static void D3D12_INTERNAL_TrackComputePipeline( #undef TRACK_RESOURCE +// Debug Naming + +static void D3D12_INTERNAL_SetPipelineStateName( + D3D12Renderer *renderer, + ID3D12PipelineState *pipelineState, + const char *text +) { + if (renderer->debug_mode && text != NULL) { + WCHAR *wchar_text = WIN_UTF8ToStringW(text); + ID3D12PipelineState_SetName( + pipelineState, + wchar_text); + SDL_free(wchar_text); + } +} + +static void D3D12_INTERNAL_SetResourceName( + D3D12Renderer *renderer, + ID3D12Resource *resource, + const char *text +) { + if (renderer->debug_mode && text != NULL) { + WCHAR *wchar_text = WIN_UTF8ToStringW(text); + ID3D12Resource_SetName( + resource, + wchar_text); + SDL_free(wchar_text); + } +} + +static void D3D12_SetBufferName( + SDL_GPURenderer *driverData, + SDL_GPUBuffer *buffer, + const char *text) +{ + D3D12Renderer *renderer = (D3D12Renderer *)driverData; + D3D12BufferContainer *container = (D3D12BufferContainer *)buffer; + + if (renderer->debug_mode && text != NULL) { + if (container->debugName != NULL) { + SDL_free(container->debugName); + } + + container->debugName = SDL_strdup(text); + + for (Uint32 i = 0; i < container->bufferCount; i += 1) { + D3D12_INTERNAL_SetResourceName( + renderer, + container->buffers[i]->handle, + text); + } + } +} + +static void D3D12_SetTextureName( + SDL_GPURenderer *driverData, + SDL_GPUTexture *texture, + const char *text) +{ + D3D12Renderer *renderer = (D3D12Renderer *)driverData; + D3D12TextureContainer *container = (D3D12TextureContainer *)texture; + + if (renderer->debug_mode && text != NULL) { + if (container->debugName != NULL) { + SDL_free(container->debugName); + } + + container->debugName = SDL_strdup(text); + + for (Uint32 i = 0; i < container->textureCount; i += 1) { + D3D12_INTERNAL_SetResourceName( + renderer, + container->textures[i]->resource, + text); + } + } +} + +/* These debug functions are all marked as "for internal usage only" + * on D3D12... works on renderdoc! + */ + +static void D3D12_InsertDebugLabel( + SDL_GPUCommandBuffer *commandBuffer, + const char *text) +{ + D3D12CommandBuffer *d3d12CommandBuffer = (D3D12CommandBuffer *)commandBuffer; + WCHAR *wchar_text = WIN_UTF8ToStringW(text); + + ID3D12GraphicsCommandList_SetMarker( + d3d12CommandBuffer->graphicsCommandList, + 0, + wchar_text, + (UINT)SDL_wcslen(wchar_text)); + + SDL_free(wchar_text); +} + +static void D3D12_PushDebugGroup( + SDL_GPUCommandBuffer *commandBuffer, + const char *name) +{ + D3D12CommandBuffer *d3d12CommandBuffer = (D3D12CommandBuffer *)commandBuffer; + WCHAR *wchar_text = WIN_UTF8ToStringW(name); + + ID3D12GraphicsCommandList_BeginEvent( + d3d12CommandBuffer->graphicsCommandList, + 0, + wchar_text, + (UINT)SDL_wcslen(wchar_text)); + + SDL_free(wchar_text); +} + +static void D3D12_PopDebugGroup( + SDL_GPUCommandBuffer *commandBuffer) +{ + D3D12CommandBuffer *d3d12CommandBuffer = (D3D12CommandBuffer *)commandBuffer; + ID3D12GraphicsCommandList_EndEvent(d3d12CommandBuffer->graphicsCommandList); +} + // State Creation static D3D12DescriptorHeap *D3D12_INTERNAL_CreateDescriptorHeap( @@ -2681,6 +2785,13 @@ static SDL_GPUComputePipeline *D3D12_CreateComputePipeline( computePipeline->numUniformBuffers = createinfo->num_uniform_buffers; SDL_SetAtomicInt(&computePipeline->referenceCount, 0); + if (renderer->debug_mode && SDL_HasProperty(createinfo->props, SDL_PROP_GPU_COMPUTEPIPELINE_CREATE_NAME_STRING)) { + D3D12_INTERNAL_SetPipelineStateName( + renderer, + computePipeline->pipelineState, + SDL_GetStringProperty(createinfo->props, SDL_PROP_GPU_COMPUTEPIPELINE_CREATE_NAME_STRING, NULL)); + } + return (SDL_GPUComputePipeline *)computePipeline; } @@ -2965,6 +3076,14 @@ static SDL_GPUGraphicsPipeline *D3D12_CreateGraphicsPipeline( pipeline->fragmentUniformBufferCount = fragShader->numUniformBuffers; SDL_SetAtomicInt(&pipeline->referenceCount, 0); + + if (renderer->debug_mode && SDL_HasProperty(createinfo->props, SDL_PROP_GPU_GRAPHICSPIPELINE_CREATE_NAME_STRING)) { + D3D12_INTERNAL_SetPipelineStateName( + renderer, + pipeline->pipelineState, + SDL_GetStringProperty(createinfo->props, SDL_PROP_GPU_GRAPHICSPIPELINE_CREATE_NAME_STRING, NULL)); + } + return (SDL_GPUGraphicsPipeline *)pipeline; } @@ -3010,6 +3129,9 @@ static SDL_GPUSampler *D3D12_CreateSampler( sampler->createInfo = *createinfo; SDL_SetAtomicInt(&sampler->referenceCount, 0); + + // Ignore name property because it is not applicable to D3D12. + return (SDL_GPUSampler *)sampler; } @@ -3047,13 +3169,16 @@ static SDL_GPUShader *D3D12_CreateShader( shader->bytecode = bytecode; shader->bytecodeSize = bytecodeSize; + // Ignore name property because it is not applicable to D3D12. + return (SDL_GPUShader *)shader; } static D3D12Texture *D3D12_INTERNAL_CreateTexture( D3D12Renderer *renderer, const SDL_GPUTextureCreateInfo *createinfo, - bool isSwapchainTexture) + bool isSwapchainTexture, + const char *debugName) { D3D12Texture *texture; ID3D12Resource *handle; @@ -3340,6 +3465,11 @@ static D3D12Texture *D3D12_INTERNAL_CreateTexture( } } + D3D12_INTERNAL_SetResourceName( + renderer, + texture->resource, + debugName); + return texture; } @@ -3352,7 +3482,11 @@ static SDL_GPUTexture *D3D12_CreateTexture( return NULL; } + // Copy properties so we don't lose information when the client destroys them container->header.info = *createinfo; + container->header.info.props = SDL_CreateProperties(); + SDL_CopyProperties(createinfo->props, container->header.info.props); + container->textureCapacity = 1; container->textureCount = 1; container->textures = (D3D12Texture **)SDL_calloc( @@ -3364,12 +3498,17 @@ static SDL_GPUTexture *D3D12_CreateTexture( } container->debugName = NULL; + if (SDL_HasProperty(createinfo->props, SDL_PROP_GPU_TEXTURE_CREATE_NAME_STRING)) { + container->debugName = SDL_strdup(SDL_GetStringProperty(createinfo->props, SDL_PROP_GPU_TEXTURE_CREATE_NAME_STRING, NULL)); + } + container->canBeCycled = true; D3D12Texture *texture = D3D12_INTERNAL_CreateTexture( (D3D12Renderer *)driverData, createinfo, - false); + false, + container->debugName); if (!texture) { SDL_free(container->textures); @@ -3390,7 +3529,8 @@ static D3D12Buffer *D3D12_INTERNAL_CreateBuffer( D3D12Renderer *renderer, SDL_GPUBufferUsageFlags usageFlags, Uint32 size, - D3D12BufferType type) + D3D12BufferType type, + const char *debugName) { D3D12Buffer *buffer; ID3D12Resource *handle; @@ -3579,6 +3719,12 @@ static D3D12Buffer *D3D12_INTERNAL_CreateBuffer( buffer->transitioned = initialState != D3D12_RESOURCE_STATE_COMMON; SDL_SetAtomicInt(&buffer->referenceCount, 0); + + D3D12_INTERNAL_SetResourceName( + renderer, + buffer->handle, + debugName); + return buffer; } @@ -3586,7 +3732,8 @@ static D3D12BufferContainer *D3D12_INTERNAL_CreateBufferContainer( D3D12Renderer *renderer, SDL_GPUBufferUsageFlags usageFlags, Uint32 size, - D3D12BufferType type) + D3D12BufferType type, + const char *debugName) { D3D12BufferContainer *container; D3D12Buffer *buffer; @@ -3614,7 +3761,8 @@ static D3D12BufferContainer *D3D12_INTERNAL_CreateBufferContainer( renderer, usageFlags, size, - type); + type, + debugName); if (buffer == NULL) { SDL_free(container->buffers); @@ -3627,190 +3775,39 @@ static D3D12BufferContainer *D3D12_INTERNAL_CreateBufferContainer( buffer->container = container; buffer->containerIndex = 0; + if (debugName != NULL) { + container->debugName = SDL_strdup(debugName); + } + return container; } static SDL_GPUBuffer *D3D12_CreateBuffer( SDL_GPURenderer *driverData, SDL_GPUBufferUsageFlags usageFlags, - Uint32 size) + Uint32 size, + const char *debugName) { return (SDL_GPUBuffer *)D3D12_INTERNAL_CreateBufferContainer( (D3D12Renderer *)driverData, usageFlags, size, - D3D12_BUFFER_TYPE_GPU); + D3D12_BUFFER_TYPE_GPU, + debugName); } static SDL_GPUTransferBuffer *D3D12_CreateTransferBuffer( SDL_GPURenderer *driverData, SDL_GPUTransferBufferUsage usage, - Uint32 size) + Uint32 size, + const char *debugName) { return (SDL_GPUTransferBuffer *)D3D12_INTERNAL_CreateBufferContainer( (D3D12Renderer *)driverData, 0, size, - usage == SDL_GPU_TRANSFERBUFFERUSAGE_UPLOAD ? D3D12_BUFFER_TYPE_UPLOAD : D3D12_BUFFER_TYPE_DOWNLOAD); -} - -// Debug Naming - -static void D3D12_SetBufferName( - SDL_GPURenderer *driverData, - SDL_GPUBuffer *buffer, - const char *text) -{ - D3D12Renderer *renderer = (D3D12Renderer *)driverData; - D3D12BufferContainer *container = (D3D12BufferContainer *)buffer; - size_t textLength = SDL_strlen(text) + 1; - - if (renderer->debug_mode) { - container->debugName = (char *)SDL_realloc( - container->debugName, - textLength); - - SDL_utf8strlcpy( - container->debugName, - text, - textLength); - - for (Uint32 i = 0; i < container->bufferCount; i += 1) { - D3D12_INTERNAL_SetResourceName( - renderer, - container->buffers[i]->handle, - text); - } - } -} - -static void D3D12_SetTextureName( - SDL_GPURenderer *driverData, - SDL_GPUTexture *texture, - const char *text) -{ - D3D12Renderer *renderer = (D3D12Renderer *)driverData; - D3D12TextureContainer *container = (D3D12TextureContainer *)texture; - size_t textLength = SDL_strlen(text) + 1; - - if (renderer->debug_mode) { - container->debugName = (char *)SDL_realloc( - container->debugName, - textLength); - - SDL_utf8strlcpy( - container->debugName, - text, - textLength); - - for (Uint32 i = 0; i < container->textureCount; i += 1) { - D3D12_INTERNAL_SetResourceName( - renderer, - container->textures[i]->resource, - text); - } - } -} - -/* These debug functions are all marked as "for internal usage only" - * on D3D12... works on renderdoc! - */ - -static bool D3D12_INTERNAL_StrToWStr( - D3D12Renderer *renderer, - const char *str, - wchar_t *wstr, - size_t wstrSize, - Uint32 *outSize) -{ - size_t inlen, result; - size_t outBytesLeft = wstrSize; - *outSize = 0; - - if (renderer->iconv == NULL) { - renderer->iconv = SDL_iconv_open("WCHAR_T", "UTF-8"); - SDL_assert(renderer->iconv); - } - - // Convert... - inlen = SDL_strlen(str) + 1; - result = SDL_iconv( - renderer->iconv, - &str, - &inlen, - (char **)&wstr, - &outBytesLeft); - - - // Check... - switch (result) { - case SDL_ICONV_ERROR: - case SDL_ICONV_E2BIG: - case SDL_ICONV_EILSEQ: - case SDL_ICONV_EINVAL: - SDL_LogWarn(SDL_LOG_CATEGORY_GPU, "Failed to convert string to wchar_t!"); - return false; - default: - break; - } - - *outSize = (Uint32)(wstrSize - outBytesLeft); - return true; -} - -static void D3D12_InsertDebugLabel( - SDL_GPUCommandBuffer *commandBuffer, - const char *text) -{ - D3D12CommandBuffer *d3d12CommandBuffer = (D3D12CommandBuffer *)commandBuffer; - wchar_t wstr[256]; - Uint32 convSize; - - if (!D3D12_INTERNAL_StrToWStr( - d3d12CommandBuffer->renderer, - text, - wstr, - sizeof(wstr), - &convSize)) { - return; - } - - ID3D12GraphicsCommandList_SetMarker( - d3d12CommandBuffer->graphicsCommandList, - 0, - wstr, - convSize); -} - -static void D3D12_PushDebugGroup( - SDL_GPUCommandBuffer *commandBuffer, - const char *name) -{ - D3D12CommandBuffer *d3d12CommandBuffer = (D3D12CommandBuffer *)commandBuffer; - wchar_t wstr[256]; - Uint32 convSize; - - if (!D3D12_INTERNAL_StrToWStr( - d3d12CommandBuffer->renderer, - name, - wstr, - sizeof(wstr), - &convSize)) { - return; - } - - ID3D12GraphicsCommandList_BeginEvent( - d3d12CommandBuffer->graphicsCommandList, - 0, - wstr, - convSize); -} - -static void D3D12_PopDebugGroup( - SDL_GPUCommandBuffer *commandBuffer) -{ - D3D12CommandBuffer *d3d12CommandBuffer = (D3D12CommandBuffer *)commandBuffer; - ID3D12GraphicsCommandList_EndEvent(d3d12CommandBuffer->graphicsCommandList); + usage == SDL_GPU_TRANSFERBUFFERUSAGE_UPLOAD ? D3D12_BUFFER_TYPE_UPLOAD : D3D12_BUFFER_TYPE_DOWNLOAD, + debugName); } // Disposal @@ -4028,7 +4025,8 @@ static void D3D12_INTERNAL_CycleActiveTexture( texture = D3D12_INTERNAL_CreateTexture( renderer, &container->header.info, - false); + false, + container->debugName); if (!texture) { return; @@ -4047,13 +4045,6 @@ static void D3D12_INTERNAL_CycleActiveTexture( container->textureCount += 1; container->activeTexture = texture; - - if (renderer->debug_mode && container->debugName != NULL) { - D3D12_INTERNAL_SetResourceName( - renderer, - container->activeTexture->resource, - container->debugName); - } } static D3D12TextureSubresource *D3D12_INTERNAL_PrepareTextureSubresourceForWrite( @@ -4109,7 +4100,8 @@ static void D3D12_INTERNAL_CycleActiveBuffer( renderer, container->usage, container->size, - container->type); + container->type, + container->debugName); if (!buffer) { return; @@ -4383,7 +4375,8 @@ static D3D12UniformBuffer *D3D12_INTERNAL_AcquireUniformBufferFromPool( renderer, 0, UNIFORM_BUFFER_SIZE, - D3D12_BUFFER_TYPE_UNIFORM); + D3D12_BUFFER_TYPE_UNIFORM, + NULL); if (!uniformBuffer->buffer) { SDL_UnlockMutex(renderer->acquireUniformBufferLock); return NULL; @@ -5762,7 +5755,8 @@ static void D3D12_UploadToTexture( d3d12CommandBuffer->renderer, 0, alignedRowPitch * destination->h * destination->d, - D3D12_BUFFER_TYPE_UPLOAD); + D3D12_BUFFER_TYPE_UPLOAD, + NULL); if (!temporaryBuffer) { return; @@ -5808,7 +5802,8 @@ static void D3D12_UploadToTexture( d3d12CommandBuffer->renderer, 0, alignedRowPitch * destination->h * destination->d, - D3D12_BUFFER_TYPE_UPLOAD); + D3D12_BUFFER_TYPE_UPLOAD, + NULL); if (!temporaryBuffer) { return; @@ -6091,7 +6086,8 @@ static void D3D12_DownloadFromTexture( d3d12CommandBuffer->renderer, 0, alignedRowPitch * rowsPerSlice * source->d, - D3D12_BUFFER_TYPE_DOWNLOAD); + D3D12_BUFFER_TYPE_DOWNLOAD, + NULL); if (!textureDownload->temporaryBuffer) { SDL_free(textureDownload); diff --git a/src/gpu/metal/SDL_gpu_metal.m b/src/gpu/metal/SDL_gpu_metal.m index f87e9fcfcab83..411a29b29a941 100644 --- a/src/gpu/metal/SDL_gpu_metal.m +++ b/src/gpu/metal/SDL_gpu_metal.m @@ -1043,7 +1043,15 @@ static void METAL_ReleaseGraphicsPipeline( return NULL; } - handle = [renderer->device newComputePipelineStateWithFunction:libraryFunction.function error:&error]; + MTLComputePipelineDescriptor *descriptor = [MTLComputePipelineDescriptor new]; + descriptor.computeFunction = libraryFunction.function; + + if (renderer->debugMode && SDL_HasProperty(createinfo->props, SDL_PROP_GPU_COMPUTEPIPELINE_CREATE_NAME_STRING)) { + const char *name = SDL_GetStringProperty(createinfo->props, SDL_PROP_GPU_COMPUTEPIPELINE_CREATE_NAME_STRING, NULL); + descriptor.label = @(name); + } + + handle = [renderer->device newComputePipelineStateWithDescriptor:descriptor options:MTLPipelineOptionNone reflection: nil error:&error]; if (error != NULL) { SET_ERROR_AND_RETURN("Creating compute pipeline failed: %s", [[error description] UTF8String], NULL); } @@ -1183,6 +1191,11 @@ static void METAL_ReleaseGraphicsPipeline( pipelineDescriptor.vertexDescriptor = vertexDescriptor; } + if (renderer->debugMode && SDL_HasProperty(createinfo->props, SDL_PROP_GPU_GRAPHICSPIPELINE_CREATE_NAME_STRING)) { + const char *name = SDL_GetStringProperty(createinfo->props, SDL_PROP_GPU_GRAPHICSPIPELINE_CREATE_NAME_STRING, NULL); + pipelineDescriptor.label = @(name); + } + // Create the graphics pipeline pipelineState = [renderer->device newRenderPipelineStateWithDescriptor:pipelineDescriptor error:&error]; @@ -1222,17 +1235,13 @@ static void METAL_SetBufferName( @autoreleasepool { MetalRenderer *renderer = (MetalRenderer *)driverData; MetalBufferContainer *container = (MetalBufferContainer *)buffer; - size_t textLength = SDL_strlen(text) + 1; - if (renderer->debugMode) { - container->debugName = SDL_realloc( - container->debugName, - textLength); + if (renderer->debugMode && text != NULL) { + if (container->debugName != NULL) { + SDL_free(container->debugName); + } - SDL_utf8strlcpy( - container->debugName, - text, - textLength); + container->debugName = SDL_strdup(text); for (Uint32 i = 0; i < container->bufferCount; i += 1) { container->buffers[i]->handle.label = @(text); @@ -1249,17 +1258,13 @@ static void METAL_SetTextureName( @autoreleasepool { MetalRenderer *renderer = (MetalRenderer *)driverData; MetalTextureContainer *container = (MetalTextureContainer *)texture; - size_t textLength = SDL_strlen(text) + 1; - if (renderer->debugMode) { - container->debugName = SDL_realloc( - container->debugName, - textLength); + if (renderer->debugMode && text != NULL) { + if (container->debugName != NULL) { + SDL_free(container->debugName); + } - SDL_utf8strlcpy( - container->debugName, - text, - textLength); + container->debugName = SDL_strdup(text); for (Uint32 i = 0; i < container->textureCount; i += 1) { container->textures[i]->handle.label = @(text); @@ -1357,6 +1362,11 @@ static void METAL_PopDebugGroup( samplerDesc.maxAnisotropy = (NSUInteger)((createinfo->enable_anisotropy) ? createinfo->max_anisotropy : 1); samplerDesc.compareFunction = (createinfo->enable_compare) ? SDLToMetal_CompareOp[createinfo->compare_op] : MTLCompareFunctionAlways; + if (renderer->debugMode && SDL_HasProperty(createinfo->props, SDL_PROP_GPU_SAMPLER_CREATE_NAME_STRING)) { + const char *name = SDL_GetStringProperty(createinfo->props, SDL_PROP_GPU_SAMPLER_CREATE_NAME_STRING, NULL); + samplerDesc.label = @(name); + } + sampler = [renderer->device newSamplerStateWithDescriptor:samplerDesc]; if (sampler == NULL) { SET_STRING_ERROR_AND_RETURN("Failed to create sampler", NULL); @@ -1457,6 +1467,11 @@ static void METAL_PopDebugGroup( metalTexture = (MetalTexture *)SDL_calloc(1, sizeof(MetalTexture)); metalTexture->handle = texture; SDL_SetAtomicInt(&metalTexture->referenceCount, 0); + + if (renderer->debugMode && SDL_HasProperty(createinfo->props, SDL_PROP_GPU_TEXTURE_CREATE_NAME_STRING)) { + metalTexture->handle.label = @(SDL_GetStringProperty(createinfo->props, SDL_PROP_GPU_TEXTURE_CREATE_NAME_STRING, NULL)); + } + return metalTexture; } @@ -1491,7 +1506,12 @@ static bool METAL_SupportsSampleCount( container = SDL_calloc(1, sizeof(MetalTextureContainer)); container->canBeCycled = 1; + + // Copy properties so we don't lose information when the client destroys them container->header.info = *createinfo; + container->header.info.props = SDL_CreateProperties(); + SDL_CopyProperties(createinfo->props, container->header.info.props); + container->activeTexture = texture; container->textureCapacity = 1; container->textureCount = 1; @@ -1500,6 +1520,10 @@ static bool METAL_SupportsSampleCount( container->textures[0] = texture; container->debugName = NULL; + if (SDL_HasProperty(createinfo->props, SDL_PROP_GPU_TEXTURE_CREATE_NAME_STRING)) { + container->debugName = SDL_strdup(SDL_GetStringProperty(createinfo->props, SDL_PROP_GPU_TEXTURE_CREATE_NAME_STRING, NULL)); + } + return (SDL_GPUTexture *)container; } } @@ -1534,10 +1558,6 @@ static bool METAL_SupportsSampleCount( container->textureCount += 1; container->activeTexture = container->textures[container->textureCount - 1]; - - if (renderer->debugMode && container->debugName != NULL) { - container->activeTexture->handle.label = @(container->debugName); - } } return container->activeTexture; @@ -1547,7 +1567,8 @@ static bool METAL_SupportsSampleCount( static MetalBuffer *METAL_INTERNAL_CreateBuffer( MetalRenderer *renderer, Uint32 size, - MTLResourceOptions resourceOptions) + MTLResourceOptions resourceOptions, + const char *debugName) { id bufferHandle; MetalBuffer *metalBuffer; @@ -1565,6 +1586,10 @@ static bool METAL_SupportsSampleCount( metalBuffer->handle = bufferHandle; SDL_SetAtomicInt(&metalBuffer->referenceCount, 0); + if (debugName != NULL) { + metalBuffer->handle.label = @(debugName); + } + return metalBuffer; } @@ -1573,7 +1598,8 @@ static bool METAL_SupportsSampleCount( MetalRenderer *renderer, Uint32 size, bool isPrivate, - bool isWriteOnly) + bool isWriteOnly, + const char *debugName) { MetalBufferContainer *container = SDL_calloc(1, sizeof(MetalBufferContainer)); MTLResourceOptions resourceOptions; @@ -1586,6 +1612,9 @@ static bool METAL_SupportsSampleCount( container->isPrivate = isPrivate; container->isWriteOnly = isWriteOnly; container->debugName = NULL; + if (container->debugName != NULL) { + container->debugName = SDL_strdup(debugName); + } if (isPrivate) { resourceOptions = MTLResourceStorageModePrivate; @@ -1600,7 +1629,9 @@ static bool METAL_SupportsSampleCount( container->buffers[0] = METAL_INTERNAL_CreateBuffer( renderer, size, - resourceOptions); + resourceOptions, + debugName); + container->activeBuffer = container->buffers[0]; return container; @@ -1609,28 +1640,32 @@ static bool METAL_SupportsSampleCount( static SDL_GPUBuffer *METAL_CreateBuffer( SDL_GPURenderer *driverData, SDL_GPUBufferUsageFlags usage, - Uint32 size) + Uint32 size, + const char *debugName) { @autoreleasepool { return (SDL_GPUBuffer *)METAL_INTERNAL_CreateBufferContainer( (MetalRenderer *)driverData, size, true, - false); + false, + debugName); } } static SDL_GPUTransferBuffer *METAL_CreateTransferBuffer( SDL_GPURenderer *driverData, SDL_GPUTransferBufferUsage usage, - Uint32 size) + Uint32 size, + const char *debugName) { @autoreleasepool { return (SDL_GPUTransferBuffer *)METAL_INTERNAL_CreateBufferContainer( (MetalRenderer *)driverData, size, false, - usage == SDL_GPU_TRANSFERBUFFERUSAGE_UPLOAD); + usage == SDL_GPU_TRANSFERBUFFERUSAGE_UPLOAD, + debugName); } } @@ -1694,14 +1729,11 @@ static bool METAL_SupportsSampleCount( container->buffers[container->bufferCount] = METAL_INTERNAL_CreateBuffer( renderer, container->size, - resourceOptions); + resourceOptions, + container->debugName); container->bufferCount += 1; container->activeBuffer = container->buffers[container->bufferCount - 1]; - - if (renderer->debugMode && container->debugName != NULL) { - container->activeBuffer->handle.label = @(container->debugName); - } } return container->activeBuffer; @@ -4386,6 +4418,7 @@ static void METAL_INTERNAL_DestroyBlitResources( } #ifdef SDL_PLATFORM_MACOS + hasHardwareSupport = true; if (@available(macOS 10.15, *)) { hasHardwareSupport = [device supportsFamily:MTLGPUFamilyMac2]; } else if (@available(macOS 10.14, *)) { diff --git a/src/gpu/vulkan/SDL_gpu_vulkan.c b/src/gpu/vulkan/SDL_gpu_vulkan.c index d04e89ec684f4..0037006320e8e 100644 --- a/src/gpu/vulkan/SDL_gpu_vulkan.c +++ b/src/gpu/vulkan/SDL_gpu_vulkan.c @@ -4069,7 +4069,8 @@ static VulkanBuffer *VULKAN_INTERNAL_CreateBuffer( VkDeviceSize size, SDL_GPUBufferUsageFlags usageFlags, VulkanBufferType type, - bool dedicated) + bool dedicated, + const char *debugName) { VulkanBuffer *buffer; VkResult vulkanResult; @@ -4155,6 +4156,19 @@ static VulkanBuffer *VULKAN_INTERNAL_CreateBuffer( SDL_SetAtomicInt(&buffer->referenceCount, 0); + if (renderer->debugMode && renderer->supportsDebugUtils && debugName != NULL) { + VkDebugUtilsObjectNameInfoEXT nameInfo; + nameInfo.sType = VK_STRUCTURE_TYPE_DEBUG_UTILS_OBJECT_NAME_INFO_EXT; + nameInfo.pNext = NULL; + nameInfo.pObjectName = debugName; + nameInfo.objectType = VK_OBJECT_TYPE_BUFFER; + nameInfo.objectHandle = (uint64_t)buffer->buffer; + + renderer->vkSetDebugUtilsObjectNameEXT( + renderer->logicalDevice, + &nameInfo); + } + return buffer; } @@ -4163,7 +4177,8 @@ static VulkanBufferContainer *VULKAN_INTERNAL_CreateBufferContainer( VkDeviceSize size, SDL_GPUBufferUsageFlags usageFlags, VulkanBufferType type, - bool dedicated) + bool dedicated, + const char *debugName) { VulkanBufferContainer *bufferContainer; VulkanBuffer *buffer; @@ -4173,7 +4188,8 @@ static VulkanBufferContainer *VULKAN_INTERNAL_CreateBufferContainer( size, usageFlags, type, - dedicated); + dedicated, + debugName); if (buffer == NULL) { return NULL; @@ -4193,6 +4209,10 @@ static VulkanBufferContainer *VULKAN_INTERNAL_CreateBufferContainer( bufferContainer->dedicated = dedicated; bufferContainer->debugName = NULL; + if (debugName != NULL) { + bufferContainer->debugName = SDL_strdup(debugName); + } + return bufferContainer; } @@ -5763,6 +5783,20 @@ static VulkanTexture *VULKAN_INTERNAL_CreateTexture( } } + // Set debug name if applicable + if (renderer->debugMode && renderer->supportsDebugUtils && SDL_HasProperty(createinfo->props, SDL_PROP_GPU_TEXTURE_CREATE_NAME_STRING)) { + VkDebugUtilsObjectNameInfoEXT nameInfo; + nameInfo.sType = VK_STRUCTURE_TYPE_DEBUG_UTILS_OBJECT_NAME_INFO_EXT; + nameInfo.pNext = NULL; + nameInfo.pObjectName = SDL_GetStringProperty(createinfo->props, SDL_PROP_GPU_TEXTURE_CREATE_NAME_STRING, NULL); + nameInfo.objectType = VK_OBJECT_TYPE_IMAGE; + nameInfo.objectHandle = (uint64_t)texture->image; + + renderer->vkSetDebugUtilsObjectNameEXT( + renderer->logicalDevice, + &nameInfo); + } + // Let's transition to the default barrier state, because for some reason Vulkan doesn't let us do that with initialLayout. VulkanCommandBuffer *barrierCommandBuffer = (VulkanCommandBuffer *)VULKAN_AcquireCommandBuffer((SDL_GPURenderer *)renderer); VULKAN_INTERNAL_TextureTransitionToDefaultUsage( @@ -5797,7 +5831,8 @@ static void VULKAN_INTERNAL_CycleActiveBuffer( container->activeBuffer->size, container->activeBuffer->usage, container->activeBuffer->type, - container->dedicated); + container->dedicated, + container->debugName); if (!buffer) { return; @@ -5816,13 +5851,6 @@ static void VULKAN_INTERNAL_CycleActiveBuffer( container->bufferCount += 1; container->activeBuffer = buffer; - - if (renderer->debugMode && renderer->supportsDebugUtils && container->debugName != NULL) { - VULKAN_INTERNAL_SetBufferName( - renderer, - container->activeBuffer, - container->debugName); - } } static void VULKAN_INTERNAL_CycleActiveTexture( @@ -5863,13 +5891,6 @@ static void VULKAN_INTERNAL_CycleActiveTexture( container->textureCount += 1; container->activeTexture = texture; - - if (renderer->debugMode && renderer->supportsDebugUtils && container->debugName != NULL) { - VULKAN_INTERNAL_SetTextureName( - renderer, - container->activeTexture, - container->debugName); - } } static VulkanBuffer *VULKAN_INTERNAL_PrepareBufferForWrite( @@ -6485,6 +6506,19 @@ static SDL_GPUGraphicsPipeline *VULKAN_CreateGraphicsPipeline( SDL_SetAtomicInt(&graphicsPipeline->referenceCount, 0); + if (renderer->debugMode && renderer->supportsDebugUtils && SDL_HasProperty(createinfo->props, SDL_PROP_GPU_GRAPHICSPIPELINE_CREATE_NAME_STRING)) { + VkDebugUtilsObjectNameInfoEXT nameInfo; + nameInfo.sType = VK_STRUCTURE_TYPE_DEBUG_UTILS_OBJECT_NAME_INFO_EXT; + nameInfo.pNext = NULL; + nameInfo.pObjectName = SDL_GetStringProperty(createinfo->props, SDL_PROP_GPU_GRAPHICSPIPELINE_CREATE_NAME_STRING, NULL); + nameInfo.objectType = VK_OBJECT_TYPE_PIPELINE; + nameInfo.objectHandle = (uint64_t)graphicsPipeline->pipeline; + + renderer->vkSetDebugUtilsObjectNameEXT( + renderer->logicalDevice, + &nameInfo); + } + return (SDL_GPUGraphicsPipeline *)graphicsPipeline; } @@ -6566,6 +6600,19 @@ static SDL_GPUComputePipeline *VULKAN_CreateComputePipeline( SDL_SetAtomicInt(&vulkanComputePipeline->referenceCount, 0); + if (renderer->debugMode && renderer->supportsDebugUtils && SDL_HasProperty(createinfo->props, SDL_PROP_GPU_COMPUTEPIPELINE_CREATE_NAME_STRING)) { + VkDebugUtilsObjectNameInfoEXT nameInfo; + nameInfo.sType = VK_STRUCTURE_TYPE_DEBUG_UTILS_OBJECT_NAME_INFO_EXT; + nameInfo.pNext = NULL; + nameInfo.pObjectName = SDL_GetStringProperty(createinfo->props, SDL_PROP_GPU_COMPUTEPIPELINE_CREATE_NAME_STRING, NULL); + nameInfo.objectType = VK_OBJECT_TYPE_PIPELINE; + nameInfo.objectHandle = (uint64_t)vulkanComputePipeline->pipeline; + + renderer->vkSetDebugUtilsObjectNameEXT( + renderer->logicalDevice, + &nameInfo); + } + return (SDL_GPUComputePipeline *)vulkanComputePipeline; } @@ -6610,6 +6657,19 @@ static SDL_GPUSampler *VULKAN_CreateSampler( SDL_SetAtomicInt(&vulkanSampler->referenceCount, 0); + if (renderer->debugMode && renderer->supportsDebugUtils && SDL_HasProperty(createinfo->props, SDL_PROP_GPU_SAMPLER_CREATE_NAME_STRING)) { + VkDebugUtilsObjectNameInfoEXT nameInfo; + nameInfo.sType = VK_STRUCTURE_TYPE_DEBUG_UTILS_OBJECT_NAME_INFO_EXT; + nameInfo.pNext = NULL; + nameInfo.pObjectName = SDL_GetStringProperty(createinfo->props, SDL_PROP_GPU_SAMPLER_CREATE_NAME_STRING, NULL); + nameInfo.objectType = VK_OBJECT_TYPE_SAMPLER; + nameInfo.objectHandle = (uint64_t)vulkanSampler->sampler; + + renderer->vkSetDebugUtilsObjectNameEXT( + renderer->logicalDevice, + &nameInfo); + } + return (SDL_GPUSampler *)vulkanSampler; } @@ -6653,6 +6713,19 @@ static SDL_GPUShader *VULKAN_CreateShader( SDL_SetAtomicInt(&vulkanShader->referenceCount, 0); + if (renderer->debugMode && SDL_HasProperty(createinfo->props, SDL_PROP_GPU_SHADER_CREATE_NAME_STRING)) { + VkDebugUtilsObjectNameInfoEXT nameInfo; + nameInfo.sType = VK_STRUCTURE_TYPE_DEBUG_UTILS_OBJECT_NAME_INFO_EXT; + nameInfo.pNext = NULL; + nameInfo.pObjectName = SDL_GetStringProperty(createinfo->props, SDL_PROP_GPU_SHADER_CREATE_NAME_STRING, NULL); + nameInfo.objectType = VK_OBJECT_TYPE_SHADER_MODULE; + nameInfo.objectHandle = (uint64_t)vulkanShader->shaderModule; + + renderer->vkSetDebugUtilsObjectNameEXT( + renderer->logicalDevice, + &nameInfo); + } + return (SDL_GPUShader *)vulkanShader; } @@ -6684,7 +6757,12 @@ static SDL_GPUTexture *VULKAN_CreateTexture( } container = SDL_malloc(sizeof(VulkanTextureContainer)); + + // Copy properties so we don't lose information when the client destroys them container->header.info = *createinfo; + container->header.info.props = SDL_CreateProperties(); + SDL_CopyProperties(createinfo->props, container->header.info.props); + container->canBeCycled = true; container->activeTexture = texture; container->textureCapacity = 1; @@ -6694,6 +6772,10 @@ static SDL_GPUTexture *VULKAN_CreateTexture( container->textures[0] = container->activeTexture; container->debugName = NULL; + if (SDL_HasProperty(createinfo->props, SDL_PROP_GPU_TEXTURE_CREATE_NAME_STRING)) { + container->debugName = SDL_strdup(SDL_GetStringProperty(createinfo->props, SDL_PROP_GPU_TEXTURE_CREATE_NAME_STRING, NULL)); + } + texture->container = container; texture->containerIndex = 0; @@ -6703,14 +6785,16 @@ static SDL_GPUTexture *VULKAN_CreateTexture( static SDL_GPUBuffer *VULKAN_CreateBuffer( SDL_GPURenderer *driverData, SDL_GPUBufferUsageFlags usageFlags, - Uint32 size) + Uint32 size, + const char *debugName) { return (SDL_GPUBuffer *)VULKAN_INTERNAL_CreateBufferContainer( (VulkanRenderer *)driverData, (VkDeviceSize)size, usageFlags, VULKAN_BUFFER_TYPE_GPU, - false); + false, + debugName); } static VulkanUniformBuffer *VULKAN_INTERNAL_CreateUniformBuffer( @@ -6724,7 +6808,8 @@ static VulkanUniformBuffer *VULKAN_INTERNAL_CreateUniformBuffer( (VkDeviceSize)size, 0, VULKAN_BUFFER_TYPE_UNIFORM, - false); + false, + NULL); uniformBuffer->drawOffset = 0; uniformBuffer->writeOffset = 0; @@ -6736,7 +6821,8 @@ static VulkanUniformBuffer *VULKAN_INTERNAL_CreateUniformBuffer( static SDL_GPUTransferBuffer *VULKAN_CreateTransferBuffer( SDL_GPURenderer *driverData, SDL_GPUTransferBufferUsage usage, - Uint32 size) + Uint32 size, + const char *debugName) { // We use dedicated allocations for download buffers to avoid an issue // where a defrag is triggered after submitting a download but before @@ -6746,7 +6832,8 @@ static SDL_GPUTransferBuffer *VULKAN_CreateTransferBuffer( (VkDeviceSize)size, 0, VULKAN_BUFFER_TYPE_TRANSFER, - usage == SDL_GPU_TRANSFERBUFFERUSAGE_DOWNLOAD); + usage == SDL_GPU_TRANSFERBUFFERUSAGE_DOWNLOAD, + debugName); } static void VULKAN_INTERNAL_ReleaseTexture( @@ -9908,9 +9995,9 @@ static bool VULKAN_WaitAndAcquireSwapchainTexture( Uint32 *swapchain_texture_height ) { return VULKAN_INTERNAL_AcquireSwapchainTexture( - true, - command_buffer, - window, + true, + command_buffer, + window, swapchain_texture, swapchain_texture_width, swapchain_texture_height); @@ -10565,24 +10652,14 @@ static bool VULKAN_INTERNAL_DefragmentMemory( currentRegion->vulkanBuffer->size, currentRegion->vulkanBuffer->usage, currentRegion->vulkanBuffer->type, - false); + false, + currentRegion->vulkanBuffer->container != NULL ? currentRegion->vulkanBuffer->container->debugName : NULL); if (newBuffer == NULL) { SDL_UnlockMutex(renderer->allocatorLock); return false; } - if ( - renderer->debugMode && - renderer->supportsDebugUtils && - currentRegion->vulkanBuffer->container != NULL && - currentRegion->vulkanBuffer->container->debugName != NULL) { - VULKAN_INTERNAL_SetBufferName( - renderer, - newBuffer, - currentRegion->vulkanBuffer->container->debugName); - } - // Copy buffer contents if necessary if ( currentRegion->vulkanBuffer->type == VULKAN_BUFFER_TYPE_GPU && currentRegion->vulkanBuffer->transitioned) { @@ -10648,18 +10725,6 @@ static bool VULKAN_INTERNAL_DefragmentMemory( srcSubresource = ¤tRegion->vulkanTexture->subresources[subresourceIndex]; dstSubresource = &newTexture->subresources[subresourceIndex]; - // Set debug name if it exists - if ( - renderer->debugMode && - renderer->supportsDebugUtils && - srcSubresource->parent->container != NULL && - srcSubresource->parent->container->debugName != NULL) { - VULKAN_INTERNAL_SetTextureName( - renderer, - currentRegion->vulkanTexture, - srcSubresource->parent->container->debugName); - } - VULKAN_INTERNAL_TextureSubresourceTransitionFromDefaultUsage( renderer, commandBuffer, diff --git a/test/testgpu_spinning_cube.c b/test/testgpu_spinning_cube.c index 90e71bbc8e127..ff9ece8138ca3 100644 --- a/test/testgpu_spinning_cube.c +++ b/test/testgpu_spinning_cube.c @@ -538,23 +538,25 @@ init_render_state(int msaa) buffer_desc.usage = SDL_GPU_BUFFERUSAGE_VERTEX; buffer_desc.size = sizeof(vertex_data); - buffer_desc.props = 0; + buffer_desc.props = SDL_CreateProperties(); + SDL_SetStringProperty(buffer_desc.props, SDL_PROP_GPU_BUFFER_CREATE_NAME_STRING, "космонавт"); render_state.buf_vertex = SDL_CreateGPUBuffer( gpu_device, &buffer_desc ); CHECK_CREATE(render_state.buf_vertex, "Static vertex buffer") - - SDL_SetGPUBufferName(gpu_device, render_state.buf_vertex, "космонавт"); + SDL_DestroyProperties(buffer_desc.props); transfer_buffer_desc.usage = SDL_GPU_TRANSFERBUFFERUSAGE_UPLOAD; transfer_buffer_desc.size = sizeof(vertex_data); - transfer_buffer_desc.props = 0; + transfer_buffer_desc.props = SDL_CreateProperties(); + SDL_SetStringProperty(transfer_buffer_desc.props, SDL_PROP_GPU_TRANSFERBUFFER_CREATE_NAME_STRING, "Transfer Buffer"); buf_transfer = SDL_CreateGPUTransferBuffer( gpu_device, &transfer_buffer_desc ); CHECK_CREATE(buf_transfer, "Vertex transfer buffer") + SDL_DestroyProperties(transfer_buffer_desc.props); /* We just need to upload the static data once. */ map = SDL_MapGPUTransferBuffer(gpu_device, buf_transfer, false); From 7098e525d0902e869aafe3dcc6c57088c90b18e1 Mon Sep 17 00:00:00 2001 From: SDL Wiki Bot Date: Tue, 14 Jan 2025 01:30:53 +0000 Subject: [PATCH 038/340] Sync SDL3 wiki -> header [ci skip] --- include/SDL3/SDL_gpu.h | 52 ++++++++++++++++++++++++++++-------------- 1 file changed, 35 insertions(+), 17 deletions(-) diff --git a/include/SDL3/SDL_gpu.h b/include/SDL3/SDL_gpu.h index 2db3a720c9cb3..f0f847b05605b 100644 --- a/include/SDL3/SDL_gpu.h +++ b/include/SDL3/SDL_gpu.h @@ -2245,9 +2245,11 @@ extern SDL_DECLSPEC SDL_GPUShaderFormat SDLCALL SDL_GetGPUShaderFormats(SDL_GPUD * - [[texture]]: Sampled textures, followed by read-only storage textures, * followed by read-write storage textures * - * There are optional properties that can be provided through `props`. These are the supported properties: + * There are optional properties that can be provided through `props`. These + * are the supported properties: * - * - `SDL_PROP_GPU_COMPUTEPIPELINE_CREATE_NAME_STRING`: a name that can be displayed in debugging tools. + * - `SDL_PROP_GPU_COMPUTEPIPELINE_CREATE_NAME_STRING`: a name that can be + * displayed in debugging tools. * * \param device a GPU Context. * \param createinfo a struct describing the state of the compute pipeline to @@ -2269,9 +2271,11 @@ extern SDL_DECLSPEC SDL_GPUComputePipeline *SDLCALL SDL_CreateGPUComputePipeline /** * Creates a pipeline object to be used in a graphics workflow. * - * There are optional properties that can be provided through `props`. These are the supported properties: + * There are optional properties that can be provided through `props`. These + * are the supported properties: * - * - `SDL_PROP_GPU_GRAPHICSPIPELINE_CREATE_NAME_STRING`: a name that can be displayed in debugging tools. + * - `SDL_PROP_GPU_GRAPHICSPIPELINE_CREATE_NAME_STRING`: a name that can be + * displayed in debugging tools. * * \param device a GPU Context. * \param createinfo a struct describing the state of the graphics pipeline to @@ -2295,9 +2299,11 @@ extern SDL_DECLSPEC SDL_GPUGraphicsPipeline *SDLCALL SDL_CreateGPUGraphicsPipeli * Creates a sampler object to be used when binding textures in a graphics * workflow. * - * There are optional properties that can be provided through `props`. These are the supported properties: + * There are optional properties that can be provided through `props`. These + * are the supported properties: * - * - `SDL_PROP_GPU_SAMPLER_CREATE_NAME_STRING`: a name that can be displayed in debugging tools. + * - `SDL_PROP_GPU_SAMPLER_CREATE_NAME_STRING`: a name that can be displayed + * in debugging tools. * * \param device a GPU Context. * \param createinfo a struct describing the state of the sampler to create. @@ -2373,9 +2379,11 @@ extern SDL_DECLSPEC SDL_GPUSampler *SDLCALL SDL_CreateGPUSampler( * SDL_PROP_GPU_DEVICE_CREATE_D3D12_SEMANTIC_NAME_STRING with * SDL_CreateGPUDeviceWithProperties(). * - * There are optional properties that can be provided through `props`. These are the supported properties: + * There are optional properties that can be provided through `props`. These + * are the supported properties: * - * - `SDL_PROP_GPU_SHADER_CREATE_NAME_STRING`: a name that can be displayed in debugging tools. + * - `SDL_PROP_GPU_SHADER_CREATE_NAME_STRING`: a name that can be displayed in + * debugging tools. * * \param device a GPU Context. * \param createinfo a struct describing the state of the shader to create. @@ -2430,7 +2438,8 @@ extern SDL_DECLSPEC SDL_GPUShader *SDLCALL SDL_CreateGPUShader( * - `SDL_PROP_GPU_CREATETEXTURE_D3D12_CLEAR_STENCIL_UINT8`: (Direct3D 12 * only) if the texture usage is SDL_GPU_TEXTUREUSAGE_DEPTH_STENCIL_TARGET, * clear the texture to a stencil of this value. Defaults to zero. - * - `SDL_PROP_GPU_TEXTURE_CREATE_NAME_STRING`: a name that can be displayed in debugging tools. + * - `SDL_PROP_GPU_TEXTURE_CREATE_NAME_STRING`: a name that can be displayed + * in debugging tools. * * \param device a GPU Context. * \param createinfo a struct describing the state of the texture to create. @@ -2476,9 +2485,11 @@ extern SDL_DECLSPEC SDL_GPUTexture *SDLCALL SDL_CreateGPUTexture( * [this blog post](https://moonside.games/posts/sdl-gpu-concepts-cycling/) * . * - * There are optional properties that can be provided through `props`. These are the supported properties: + * There are optional properties that can be provided through `props`. These + * are the supported properties: * - * - `SDL_PROP_GPU_BUFFER_CREATE_NAME_STRING`: a name that can be displayed in debugging tools. + * - `SDL_PROP_GPU_BUFFER_CREATE_NAME_STRING`: a name that can be displayed in + * debugging tools. * * \param device a GPU Context. * \param createinfo a struct describing the state of the buffer to create. @@ -2513,9 +2524,11 @@ extern SDL_DECLSPEC SDL_GPUBuffer *SDLCALL SDL_CreateGPUBuffer( * Download buffers can be particularly expensive to create, so it is good * practice to reuse them if data will be downloaded regularly. * - * There are optional properties that can be provided through `props`. These are the supported properties: + * There are optional properties that can be provided through `props`. These + * are the supported properties: * - * - `SDL_PROP_GPU_TRANSFERBUFFER_CREATE_NAME_STRING`: a name that can be displayed in debugging tools. + * - `SDL_PROP_GPU_TRANSFERBUFFER_CREATE_NAME_STRING`: a name that can be + * displayed in debugging tools. * * \param device a GPU Context. * \param createinfo a struct describing the state of the transfer buffer to @@ -2542,13 +2555,15 @@ extern SDL_DECLSPEC SDL_GPUTransferBuffer *SDLCALL SDL_CreateGPUTransferBuffer( /** * Sets an arbitrary string constant to label a buffer. * - * You should use SDL_PROP_GPU_BUFFER_CREATE_NAME_STRING with SDL_CreateGPUBuffer instead of this function to avoid thread safety issues. + * You should use SDL_PROP_GPU_BUFFER_CREATE_NAME_STRING with + * SDL_CreateGPUBuffer instead of this function to avoid thread safety issues. * * \param device a GPU Context. * \param buffer a buffer to attach the name to. * \param text a UTF-8 string constant to mark as the name of the buffer. * - * \threadsafety This function is not thread safe, you must make sure the buffer is not simultaneously used by any other thread. + * \threadsafety This function is not thread safe, you must make sure the + * buffer is not simultaneously used by any other thread. * * \since This function is available since SDL 3.1.3. * @@ -2562,13 +2577,16 @@ extern SDL_DECLSPEC void SDLCALL SDL_SetGPUBufferName( /** * Sets an arbitrary string constant to label a texture. * - * You should use SDL_PROP_GPU_TEXTURE_CREATE_NAME_STRING with SDL_CreateGPUTexture instead of this function to avoid thread safety issues. + * You should use SDL_PROP_GPU_TEXTURE_CREATE_NAME_STRING with + * SDL_CreateGPUTexture instead of this function to avoid thread safety + * issues. * * \param device a GPU Context. * \param texture a texture to attach the name to. * \param text a UTF-8 string constant to mark as the name of the texture. * - * \threadsafety This function is not thread safe, you must make sure the texture is not simultaneously used by any other thread. + * \threadsafety This function is not thread safe, you must make sure the + * texture is not simultaneously used by any other thread. * * \since This function is available since SDL 3.1.3. * From d590e1f12247dc1de78b1512e6125b91e9588d7f Mon Sep 17 00:00:00 2001 From: cosmonaut Date: Mon, 13 Jan 2025 17:06:35 -0800 Subject: [PATCH 039/340] GPU: Align D3D12 clear properties to naming convention --- include/SDL3/SDL_gpu.h | 26 +++++++++++++------------- src/gpu/d3d12/SDL_gpu_d3d12.c | 12 ++++++------ 2 files changed, 19 insertions(+), 19 deletions(-) diff --git a/include/SDL3/SDL_gpu.h b/include/SDL3/SDL_gpu.h index f0f847b05605b..0ccd552072947 100644 --- a/include/SDL3/SDL_gpu.h +++ b/include/SDL3/SDL_gpu.h @@ -2420,22 +2420,22 @@ extern SDL_DECLSPEC SDL_GPUShader *SDLCALL SDL_CreateGPUShader( * - `SDL_PROP_PROCESS_CREATE_ARGS_POINTER`: an array of strings containing * the program to run, any arguments, and a NULL pointer, e.g. const char * *args[] = { "myprogram", "argument", NULL }. This is a required property. - * - `SDL_PROP_GPU_CREATETEXTURE_D3D12_CLEAR_R_FLOAT`: (Direct3D 12 only) if + * - `SDL_PROP_GPU_TEXTURE_CREATE_D3D12_CLEAR_R_FLOAT`: (Direct3D 12 only) if * the texture usage is SDL_GPU_TEXTUREUSAGE_COLOR_TARGET, clear the texture * to a color with this red intensity. Defaults to zero. - * - `SDL_PROP_GPU_CREATETEXTURE_D3D12_CLEAR_G_FLOAT`: (Direct3D 12 only) if + * - `SDL_PROP_GPU_TEXTURE_CREATE_D3D12_CLEAR_G_FLOAT`: (Direct3D 12 only) if * the texture usage is SDL_GPU_TEXTUREUSAGE_COLOR_TARGET, clear the texture * to a color with this green intensity. Defaults to zero. - * - `SDL_PROP_GPU_CREATETEXTURE_D3D12_CLEAR_B_FLOAT`: (Direct3D 12 only) if + * - `SDL_PROP_GPU_TEXTURE_CREATE_D3D12_CLEAR_B_FLOAT`: (Direct3D 12 only) if * the texture usage is SDL_GPU_TEXTUREUSAGE_COLOR_TARGET, clear the texture * to a color with this blue intensity. Defaults to zero. - * - `SDL_PROP_GPU_CREATETEXTURE_D3D12_CLEAR_A_FLOAT`: (Direct3D 12 only) if + * - `SDL_PROP_GPU_TEXTURE_CREATE_D3D12_CLEAR_A_FLOAT`: (Direct3D 12 only) if * the texture usage is SDL_GPU_TEXTUREUSAGE_COLOR_TARGET, clear the texture * to a color with this alpha intensity. Defaults to zero. - * - `SDL_PROP_GPU_CREATETEXTURE_D3D12_CLEAR_DEPTH_FLOAT`: (Direct3D 12 only) + * - `SDL_PROP_GPU_TEXTURE_CREATE_D3D12_CLEAR_DEPTH_FLOAT`: (Direct3D 12 only) * if the texture usage is SDL_GPU_TEXTUREUSAGE_DEPTH_STENCIL_TARGET, clear * the texture to a depth of this value. Defaults to zero. - * - `SDL_PROP_GPU_CREATETEXTURE_D3D12_CLEAR_STENCIL_UINT8`: (Direct3D 12 + * - `SDL_PROP_GPU_TEXTURE_CREATE_D3D12_CLEAR_STENCIL_UINT8`: (Direct3D 12 * only) if the texture usage is SDL_GPU_TEXTUREUSAGE_DEPTH_STENCIL_TARGET, * clear the texture to a stencil of this value. Defaults to zero. * - `SDL_PROP_GPU_TEXTURE_CREATE_NAME_STRING`: a name that can be displayed @@ -2463,13 +2463,13 @@ extern SDL_DECLSPEC SDL_GPUTexture *SDLCALL SDL_CreateGPUTexture( SDL_GPUDevice *device, const SDL_GPUTextureCreateInfo *createinfo); -#define SDL_PROP_GPU_CREATETEXTURE_D3D12_CLEAR_R_FLOAT "SDL.gpu.createtexture.d3d12.clear.r" -#define SDL_PROP_GPU_CREATETEXTURE_D3D12_CLEAR_G_FLOAT "SDL.gpu.createtexture.d3d12.clear.g" -#define SDL_PROP_GPU_CREATETEXTURE_D3D12_CLEAR_B_FLOAT "SDL.gpu.createtexture.d3d12.clear.b" -#define SDL_PROP_GPU_CREATETEXTURE_D3D12_CLEAR_A_FLOAT "SDL.gpu.createtexture.d3d12.clear.a" -#define SDL_PROP_GPU_CREATETEXTURE_D3D12_CLEAR_DEPTH_FLOAT "SDL.gpu.createtexture.d3d12.clear.depth" -#define SDL_PROP_GPU_CREATETEXTURE_D3D12_CLEAR_STENCIL_UINT8 "SDL.gpu.createtexture.d3d12.clear.stencil" -#define SDL_PROP_GPU_TEXTURE_CREATE_NAME_STRING "SDL.gpu.texture.create.name" +#define SDL_PROP_GPU_TEXTURE_CREATE_D3D12_CLEAR_R_FLOAT "SDL.gpu.texture.create.d3d12.clear.r" +#define SDL_PROP_GPU_TEXTURE_CREATE_D3D12_CLEAR_G_FLOAT "SDL.gpu.texture.create.d3d12.clear.g" +#define SDL_PROP_GPU_TEXTURE_CREATE_D3D12_CLEAR_B_FLOAT "SDL.gpu.texture.create.d3d12.clear.b" +#define SDL_PROP_GPU_TEXTURE_CREATE_D3D12_CLEAR_A_FLOAT "SDL.gpu.texture.create.d3d12.clear.a" +#define SDL_PROP_GPU_TEXTURE_CREATE_D3D12_CLEAR_DEPTH_FLOAT "SDL.gpu.texture.create.d3d12.clear.depth" +#define SDL_PROP_GPU_TEXTURE_CREATE_D3D12_CLEAR_STENCIL_UINT8 "SDL.gpu.texture.create.d3d12.clear.stencil" +#define SDL_PROP_GPU_TEXTURE_CREATE_NAME_STRING "SDL.gpu.texture.create.name" /** * Creates a buffer object to be used in graphics or compute workflows. diff --git a/src/gpu/d3d12/SDL_gpu_d3d12.c b/src/gpu/d3d12/SDL_gpu_d3d12.c index 39c8b62b6be67..1ea3734555497 100644 --- a/src/gpu/d3d12/SDL_gpu_d3d12.c +++ b/src/gpu/d3d12/SDL_gpu_d3d12.c @@ -3209,17 +3209,17 @@ static D3D12Texture *D3D12_INTERNAL_CreateTexture( if (createinfo->usage & SDL_GPU_TEXTUREUSAGE_COLOR_TARGET) { resourceFlags |= D3D12_RESOURCE_FLAG_ALLOW_RENDER_TARGET; useClearValue = true; - clearValue.Color[0] = SDL_GetFloatProperty(createinfo->props, SDL_PROP_GPU_CREATETEXTURE_D3D12_CLEAR_R_FLOAT, 0); - clearValue.Color[1] = SDL_GetFloatProperty(createinfo->props, SDL_PROP_GPU_CREATETEXTURE_D3D12_CLEAR_G_FLOAT, 0); - clearValue.Color[2] = SDL_GetFloatProperty(createinfo->props, SDL_PROP_GPU_CREATETEXTURE_D3D12_CLEAR_B_FLOAT, 0); - clearValue.Color[3] = SDL_GetFloatProperty(createinfo->props, SDL_PROP_GPU_CREATETEXTURE_D3D12_CLEAR_A_FLOAT, 0); + clearValue.Color[0] = SDL_GetFloatProperty(createinfo->props, SDL_PROP_GPU_TEXTURE_CREATE_D3D12_CLEAR_R_FLOAT, 0); + clearValue.Color[1] = SDL_GetFloatProperty(createinfo->props, SDL_PROP_GPU_TEXTURE_CREATE_D3D12_CLEAR_G_FLOAT, 0); + clearValue.Color[2] = SDL_GetFloatProperty(createinfo->props, SDL_PROP_GPU_TEXTURE_CREATE_D3D12_CLEAR_B_FLOAT, 0); + clearValue.Color[3] = SDL_GetFloatProperty(createinfo->props, SDL_PROP_GPU_TEXTURE_CREATE_D3D12_CLEAR_A_FLOAT, 0); } if (createinfo->usage & SDL_GPU_TEXTUREUSAGE_DEPTH_STENCIL_TARGET) { resourceFlags |= D3D12_RESOURCE_FLAG_ALLOW_DEPTH_STENCIL; useClearValue = true; - clearValue.DepthStencil.Depth = SDL_GetFloatProperty(createinfo->props, SDL_PROP_GPU_CREATETEXTURE_D3D12_CLEAR_DEPTH_FLOAT, 0); - clearValue.DepthStencil.Stencil = (UINT8)SDL_GetNumberProperty(createinfo->props, SDL_PROP_GPU_CREATETEXTURE_D3D12_CLEAR_STENCIL_UINT8, 0); + clearValue.DepthStencil.Depth = SDL_GetFloatProperty(createinfo->props, SDL_PROP_GPU_TEXTURE_CREATE_D3D12_CLEAR_DEPTH_FLOAT, 0); + clearValue.DepthStencil.Stencil = (UINT8)SDL_GetNumberProperty(createinfo->props, SDL_PROP_GPU_TEXTURE_CREATE_D3D12_CLEAR_STENCIL_UINT8, 0); format = SDLToD3D12_DepthFormat[createinfo->format]; } From 5d079c9a26f4f5def6f40abb3283e29a063366c4 Mon Sep 17 00:00:00 2001 From: cosmonaut Date: Mon, 13 Jan 2025 17:46:31 -0800 Subject: [PATCH 040/340] GPU: Remove bogus property from header docs --- include/SDL3/SDL_gpu.h | 3 --- 1 file changed, 3 deletions(-) diff --git a/include/SDL3/SDL_gpu.h b/include/SDL3/SDL_gpu.h index 0ccd552072947..f451c0cb6567c 100644 --- a/include/SDL3/SDL_gpu.h +++ b/include/SDL3/SDL_gpu.h @@ -2417,9 +2417,6 @@ extern SDL_DECLSPEC SDL_GPUShader *SDLCALL SDL_CreateGPUShader( * There are optional properties that can be provided through * SDL_GPUTextureCreateInfo's `props`. These are the supported properties: * - * - `SDL_PROP_PROCESS_CREATE_ARGS_POINTER`: an array of strings containing - * the program to run, any arguments, and a NULL pointer, e.g. const char - * *args[] = { "myprogram", "argument", NULL }. This is a required property. * - `SDL_PROP_GPU_TEXTURE_CREATE_D3D12_CLEAR_R_FLOAT`: (Direct3D 12 only) if * the texture usage is SDL_GPU_TEXTUREUSAGE_COLOR_TARGET, clear the texture * to a color with this red intensity. Defaults to zero. From 5815372206089ee59f4d9aebc562823f69763cf7 Mon Sep 17 00:00:00 2001 From: Ozkan Sezer Date: Tue, 14 Jan 2025 04:27:37 +0300 Subject: [PATCH 041/340] minor update to mingw-w64 build instructions. --- docs/README-windows.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/docs/README-windows.md b/docs/README-windows.md index ff94ecf0ffb92..1e6d464cbf913 100644 --- a/docs/README-windows.md +++ b/docs/README-windows.md @@ -18,7 +18,9 @@ Details are here: https://github.com/libsdl-org/SDL/issues/5186 ## MinGW-w64 compiler support -SDL can be built with MinGW-w64 and CMake. First, you need to install and set up the MSYS2 environment, which provides the MinGW-w64 toolchain. Install MSYS2, typically to `C:\msys64`, and follow the instructions on the MSYS2 wiki to use the MinGW-w64 shell to update all components in the MSYS2 environment. This generally amounts to running `pacman -Syuu` from the mingw64 shell, but refer to MSYS2's documentation for more details. Once the MSYS2 environment has been updated, install the x86_64 MinGW toolchain from the mingw64 shell with the command `pacman -S mingw-w64-x86_64-toolchain`. (You can additionally install `mingw-w64-i686-toolchain` if you intend to build 32-bit binaries as well. The remainder of this section assumes you only want to build 64-bit binaries.) +SDL can be built with MinGW-w64 and CMake. Minimum tested MinGW-w64 version is 8.0.3. + +On a Windows host, you first need to install and set up the MSYS2 environment, which provides the MinGW-w64 toolchain. Install MSYS2, typically to `C:\msys64`, and follow the instructions on the MSYS2 wiki to use the MinGW-w64 shell to update all components in the MSYS2 environment. This generally amounts to running `pacman -Syuu` from the mingw64 shell, but refer to MSYS2's documentation for more details. Once the MSYS2 environment has been updated, install the x86_64 MinGW toolchain from the mingw64 shell with the command `pacman -S mingw-w64-x86_64-toolchain`. (You can additionally install `mingw-w64-i686-toolchain` if you intend to build 32-bit binaries as well. The remainder of this section assumes you only want to build 64-bit binaries.) To build and install SDL, you can use PowerShell or any CMake-compatible IDE. First, install CMake, Ninja, and Git. These tools can be installed using any number of tools, such as the MSYS2's `pacman`, `winget`, `Chocolatey`, or by manually downloading and running the installers. Clone SDL to an appropriate location with `git` and run the following commands from the root of the cloned repository: From 0aa319e4f985abf6370f404bbaf5dbce6754b6be Mon Sep 17 00:00:00 2001 From: Scrooge86x <53798834+Scrooge86x@users.noreply.github.com> Date: Tue, 14 Jan 2025 01:56:52 +0100 Subject: [PATCH 042/340] Added support for custom tray icon on Windows via SDL hints. SDL_CreateTray now respects SDL_HINT_WINDOWS_INTRESOURCE_ICON_SMALL and SDL_HINT_WINDOWS_INTRESOURCE_ICON hints and uses the specified icon as the tray icon. --- src/tray/windows/SDL_tray.c | 30 ++++++++++++++++++++++++++---- 1 file changed, 26 insertions(+), 4 deletions(-) diff --git a/src/tray/windows/SDL_tray.c b/src/tray/windows/SDL_tray.c index c73a1d5510fd1..526c19004ef18 100644 --- a/src/tray/windows/SDL_tray.c +++ b/src/tray/windows/SDL_tray.c @@ -187,6 +187,28 @@ static wchar_t *escape_label(const char *in) return out; } +static HICON load_default_icon() +{ + HINSTANCE hInstance = GetModuleHandle(NULL); + if (!hInstance) { + return LoadIcon(NULL, IDI_APPLICATION); + } + + const char *hint = SDL_GetHint(SDL_HINT_WINDOWS_INTRESOURCE_ICON_SMALL); + if (hint && *hint) { + HICON icon = LoadIcon(hInstance, MAKEINTRESOURCE(SDL_atoi(hint))); + return icon ? icon : LoadIcon(NULL, IDI_APPLICATION); + } + + hint = SDL_GetHint(SDL_HINT_WINDOWS_INTRESOURCE_ICON); + if (hint && *hint) { + HICON icon = LoadIcon(hInstance, MAKEINTRESOURCE(SDL_atoi(hint))); + return icon ? icon : LoadIcon(NULL, IDI_APPLICATION); + } + + return LoadIcon(NULL, IDI_APPLICATION); +} + SDL_Tray *SDL_CreateTray(SDL_Surface *icon, const char *tooltip) { SDL_Tray *tray = (SDL_Tray *)SDL_malloc(sizeof(*tray)); @@ -216,12 +238,12 @@ SDL_Tray *SDL_CreateTray(SDL_Surface *icon, const char *tooltip) tray->nid.hIcon = CreateIconFromSurface(icon); if (!tray->nid.hIcon) { - tray->nid.hIcon = LoadIcon(NULL, IDI_APPLICATION); + tray->nid.hIcon = load_default_icon(); } tray->icon = tray->nid.hIcon; } else { - tray->nid.hIcon = LoadIcon(NULL, IDI_APPLICATION); + tray->nid.hIcon = load_default_icon(); tray->icon = tray->nid.hIcon; } @@ -245,12 +267,12 @@ void SDL_SetTrayIcon(SDL_Tray *tray, SDL_Surface *icon) tray->nid.hIcon = CreateIconFromSurface(icon); if (!tray->nid.hIcon) { - tray->nid.hIcon = LoadIcon(NULL, IDI_APPLICATION); + tray->nid.hIcon = load_default_icon(); } tray->icon = tray->nid.hIcon; } else { - tray->nid.hIcon = LoadIcon(NULL, IDI_APPLICATION); + tray->nid.hIcon = load_default_icon(); tray->icon = tray->nid.hIcon; } From 417ed7f35f14f10c5a8e9dc4a053425f64595f3c Mon Sep 17 00:00:00 2001 From: Maia <66437537+maia-s@users.noreply.github.com> Date: Tue, 14 Jan 2025 18:19:24 +0100 Subject: [PATCH 043/340] Fix references in docs --- include/SDL3/SDL_events.h | 2 +- include/SDL3/SDL_tray.h | 10 +++++----- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/include/SDL3/SDL_events.h b/include/SDL3/SDL_events.h index 1cde3811ee8cc..5dff127a9a3c8 100644 --- a/include/SDL3/SDL_events.h +++ b/include/SDL3/SDL_events.h @@ -38,7 +38,7 @@ * at all). * * There is other forms of control, too: SDL_PeepEvents() has more - * functionality at the cost of more complexity, and SDL_WaitEvents() can + * functionality at the cost of more complexity, and SDL_WaitEvent() can * block the process until something interesting happens, which might be * beneficial for certain types of programs on low-power hardware. One may * also call SDL_AddEventWatch() to set a callback when new events arrive. diff --git a/include/SDL3/SDL_tray.h b/include/SDL3/SDL_tray.h index 9830b966c32cb..1bfd3d419fc31 100644 --- a/include/SDL3/SDL_tray.h +++ b/include/SDL3/SDL_tray.h @@ -204,7 +204,7 @@ extern SDL_DECLSPEC SDL_TrayMenu *SDLCALL SDL_GetTrayMenu(SDL_Tray *tray); /** * Gets a previously created tray entry submenu. * - * You should have called SDL_CreateTraySubenu() on the entry object. This + * You should have called SDL_CreateTraySubmenu() on the entry object. This * function allows you to fetch it again later. * * This function does the same thing as SDL_GetTrayMenu(), except that it @@ -317,7 +317,7 @@ extern SDL_DECLSPEC const char *SDLCALL SDL_GetTrayEntryLabel(SDL_TrayEntry *ent * The entry must have been created with the SDL_TRAYENTRY_CHECKBOX flag. * * \param entry the entry to be updated. - * \param checked SDL_TRUE if the entry should be checked; SDL_FALSE + * \param checked true if the entry should be checked; false * otherwise. * * \since This function is available since SDL 3.1.8. @@ -334,7 +334,7 @@ extern SDL_DECLSPEC void SDLCALL SDL_SetTrayEntryChecked(SDL_TrayEntry *entry, b * The entry must have been created with the SDL_TRAYENTRY_CHECKBOX flag. * * \param entry the entry to be read. - * \returns SDL_TRUE if the entry is checked; SDL_FALSE otherwise. + * \returns true if the entry is checked; false otherwise. * * \since This function is available since SDL 3.1.8. * @@ -348,7 +348,7 @@ extern SDL_DECLSPEC bool SDLCALL SDL_GetTrayEntryChecked(SDL_TrayEntry *entry); * Sets whether or not an entry is enabled. * * \param entry the entry to be updated. - * \param enabled SDL_TRUE if the entry should be enabled; SDL_FALSE + * \param enabled true if the entry should be enabled; false * otherwise. * * \since This function is available since SDL 3.1.8. @@ -363,7 +363,7 @@ extern SDL_DECLSPEC void SDLCALL SDL_SetTrayEntryEnabled(SDL_TrayEntry *entry, b * Gets whether or not an entry is enabled. * * \param entry the entry to be read. - * \returns SDL_TRUE if the entry is enabled; SDL_FALSE otherwise. + * \returns true if the entry is enabled; false otherwise. * * \since This function is available since SDL 3.1.8. * From 31dd4fe81fcccbfed6b679dfaa8c0d1bf18c6a79 Mon Sep 17 00:00:00 2001 From: SDL Wiki Bot Date: Tue, 14 Jan 2025 17:58:27 +0000 Subject: [PATCH 044/340] Sync SDL3 wiki -> header [ci skip] --- include/SDL3/SDL_events.h | 8 ++++---- include/SDL3/SDL_tray.h | 6 ++---- 2 files changed, 6 insertions(+), 8 deletions(-) diff --git a/include/SDL3/SDL_events.h b/include/SDL3/SDL_events.h index 5dff127a9a3c8..55d417ef597ec 100644 --- a/include/SDL3/SDL_events.h +++ b/include/SDL3/SDL_events.h @@ -38,10 +38,10 @@ * at all). * * There is other forms of control, too: SDL_PeepEvents() has more - * functionality at the cost of more complexity, and SDL_WaitEvent() can - * block the process until something interesting happens, which might be - * beneficial for certain types of programs on low-power hardware. One may - * also call SDL_AddEventWatch() to set a callback when new events arrive. + * functionality at the cost of more complexity, and SDL_WaitEvent() can block + * the process until something interesting happens, which might be beneficial + * for certain types of programs on low-power hardware. One may also call + * SDL_AddEventWatch() to set a callback when new events arrive. * * The app is free to generate their own events, too: SDL_PushEvent allows the * app to put events onto the queue for later retrieval; SDL_RegisterEvents diff --git a/include/SDL3/SDL_tray.h b/include/SDL3/SDL_tray.h index 1bfd3d419fc31..8d1cac498472c 100644 --- a/include/SDL3/SDL_tray.h +++ b/include/SDL3/SDL_tray.h @@ -317,8 +317,7 @@ extern SDL_DECLSPEC const char *SDLCALL SDL_GetTrayEntryLabel(SDL_TrayEntry *ent * The entry must have been created with the SDL_TRAYENTRY_CHECKBOX flag. * * \param entry the entry to be updated. - * \param checked true if the entry should be checked; false - * otherwise. + * \param checked true if the entry should be checked; false otherwise. * * \since This function is available since SDL 3.1.8. * @@ -348,8 +347,7 @@ extern SDL_DECLSPEC bool SDLCALL SDL_GetTrayEntryChecked(SDL_TrayEntry *entry); * Sets whether or not an entry is enabled. * * \param entry the entry to be updated. - * \param enabled true if the entry should be enabled; false - * otherwise. + * \param enabled true if the entry should be enabled; false otherwise. * * \since This function is available since SDL 3.1.8. * From 4294c0683611bc6cca4e0c5c7fe44e69a841dc0b Mon Sep 17 00:00:00 2001 From: cosmonaut Date: Tue, 14 Jan 2025 10:16:20 -0800 Subject: [PATCH 045/340] GPU: Check texture format support in pipeline creation --- src/gpu/SDL_gpu.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/gpu/SDL_gpu.c b/src/gpu/SDL_gpu.c index 34905cea2ce36..b3148c27d771e 100644 --- a/src/gpu/SDL_gpu.c +++ b/src/gpu/SDL_gpu.c @@ -801,6 +801,10 @@ SDL_GPUGraphicsPipeline *SDL_CreateGPUGraphicsPipeline( SDL_assert_release(!"Color target formats cannot be a depth format!"); return NULL; } + if (!SDL_GPUTextureSupportsFormat(device, graphicsPipelineCreateInfo->target_info.color_target_descriptions[i].format, SDL_GPU_TEXTURETYPE_2D, SDL_GPU_TEXTUREUSAGE_COLOR_TARGET)) { + SDL_assert_release(!"Format is not supported for color targets on this device!"); + return NULL; + } if (graphicsPipelineCreateInfo->target_info.color_target_descriptions[i].blend_state.enable_blend) { const SDL_GPUColorTargetBlendState *blend_state = &graphicsPipelineCreateInfo->target_info.color_target_descriptions[i].blend_state; CHECK_BLENDFACTOR_ENUM_INVALID(blend_state->src_color_blendfactor, NULL) @@ -817,6 +821,10 @@ SDL_GPUGraphicsPipeline *SDL_CreateGPUGraphicsPipeline( SDL_assert_release(!"Depth-stencil target format must be a depth format!"); return NULL; } + if (!SDL_GPUTextureSupportsFormat(device, graphicsPipelineCreateInfo->target_info.depth_stencil_format, SDL_GPU_TEXTURETYPE_2D, SDL_GPU_TEXTUREUSAGE_DEPTH_STENCIL_TARGET)) { + SDL_assert_release(!"Format is not supported for depth targets on this device!"); + return NULL; + } } if (graphicsPipelineCreateInfo->vertex_input_state.num_vertex_buffers > 0 && graphicsPipelineCreateInfo->vertex_input_state.vertex_buffer_descriptions == NULL) { SDL_assert_release(!"Vertex buffer descriptions array pointer cannot be NULL!"); From 8feb21a1d1aaf4c2169238d4c1abd6785a9cde74 Mon Sep 17 00:00:00 2001 From: Sam Lantinga Date: Mon, 13 Jan 2025 16:54:37 -0800 Subject: [PATCH 046/340] Updated README-cmake.md with build instructions for several platforms --- docs/INTRO-cmake.md | 12 ++++++----- docs/README-cmake.md | 47 ++++++++++++++++++++++++++++---------------- 2 files changed, 37 insertions(+), 22 deletions(-) diff --git a/docs/INTRO-cmake.md b/docs/INTRO-cmake.md index 074f61fe9d33e..e6ccace390d84 100644 --- a/docs/INTRO-cmake.md +++ b/docs/INTRO-cmake.md @@ -27,17 +27,19 @@ target_link_libraries(hello PRIVATE SDL3::SDL3) Build: ```sh -cmake . -cmake --build . +cmake -S . -B build +cmake --build build ``` Run: -- On Windows the executable is in the Debug directory: +- On Windows the executable is in the build Debug directory: ```sh -./Debug/hello +cd build/Debug +./hello ``` -- On other platforms the executable is in the current directory: +- On other platforms the executable is in the build directory: ```sh +cd build ./hello ``` diff --git a/docs/README-cmake.md b/docs/README-cmake.md index 6dac209b81410..5b2ebef739774 100644 --- a/docs/README-cmake.md +++ b/docs/README-cmake.md @@ -6,7 +6,7 @@ The CMake build system is supported on the following platforms: * FreeBSD * Linux -* Microsoft Visual C +* Microsoft Visual Studio * MinGW and Msys * macOS, iOS, tvOS, and visionOS with support for XCode * Android @@ -20,42 +20,55 @@ The CMake build system is supported on the following platforms: * QNX 7.x/8.x * RiscOS -## Building SDL +## Building SDL on Windows -Assuming the source tree of SDL is located at `~/sdl`, -this will configure and build SDL in the `~/build` directory: +Assuming you're in the SDL source directory, building and installing to C:/SDL can be done with: ```sh -cmake -S ~/sdl -B ~/build -cmake --build ~/build +cmake -S . -B build +cmake --build build --config RelWithDebInfo +cmake --install build --config RelWithDebInfo --prefix C:/SDL ``` -Installation can be done using: +## Building SDL on UNIX + +SDL will build with very few dependencies, but for full functionality you should install the packages detailed in [README-linux.md](README-linux.md). + +Assuming you're in the SDL source directory, building and installing to /usr/local can be done with: ```sh -cmake --install ~/build --prefix /usr/local # '--install' requires CMake 3.15, or newer +cmake -S . -B build +cmake --build build +sudo cmake --install build --prefix /usr/local ``` -This will install SDL to /usr/local. +## Building SDL on macOS + +Assuming you're in the SDL source directory, building and installing to ~/SDL can be done with: +```sh +cmake -S . -B build -DSDL_FRAMEWORK=ON -DCMAKE_OSX_ARCHITECTURES="arm64;x86_64" +cmake --build build +cmake --install build --prefix ~/SDL +``` -### Building SDL tests +## Building SDL tests You can build the SDL test programs by adding `-DSDL_TESTS=ON` to the first cmake command above: ```sh -cmake -S ~/sdl -B ~/build -DSDL_TEST_LIBRARY=ON -DSDL_TESTS=ON +cmake -S . -B build -DSDL_TESTS=ON ``` -and then building normally. In this example, the test programs will be built and can be run from `~/build/tests/`. +and then building normally. The test programs will be built and can be run from `build/test/`. -### Building SDL examples +## Building SDL examples You can build the SDL example programs by adding `-DSDL_EXAMPLES=ON` to the first cmake command above: ```sh -cmake -S ~/sdl -B ~/build -DSDL_EXAMPLES=ON +cmake -S . -B build -DSDL_EXAMPLES=ON ``` -and then building normally. In this example, the example programs will be built and can be run from `~/build/examples/`. +and then building normally. The example programs will be built and can be run from `build/examples/`. ## Including SDL in your project SDL can be included in your project in 2 major ways: -- using a system SDL library, provided by your (*nix) distribution or a package manager +- using a system SDL library, provided by your (UNIX) distribution or a package manager - using a vendored SDL library: this is SDL copied or symlinked in a subfolder. The following CMake script supports both, depending on the value of `MYGAME_VENDORED`. @@ -181,7 +194,7 @@ Only shared frameworks are supported, no static ones. #### Platforms -Use `-DCMAKE_PLATFORM_NAME=` to configure the platform. CMake can target only one platform at a time. +Use `-DCMAKE_SYSTEM_NAME=` to configure the platform. CMake can target only one platform at a time. | Apple platform | `CMAKE_SYSTEM_NAME` value | |-----------------|---------------------------| From 8f8af918badfd07a24d078293e8a61f45175257f Mon Sep 17 00:00:00 2001 From: Sam Lantinga Date: Tue, 14 Jan 2025 07:29:46 -0800 Subject: [PATCH 047/340] Removed CMakeLists.txt example that says you shouldn't use it --- docs/README-cmake.md | 111 ------------------------------------------- 1 file changed, 111 deletions(-) diff --git a/docs/README-cmake.md b/docs/README-cmake.md index 5b2ebef739774..2c29020314bb6 100644 --- a/docs/README-cmake.md +++ b/docs/README-cmake.md @@ -363,114 +363,3 @@ However, by default CMake builds static libraries as non-relocatable. Configuring SDL with `-DCMAKE_POSITION_INDEPENDENT_CODE=ON` will result in a static `libSDL3.a` library which you can link against to create a shared library. -## Help, it doesn't work! - -Below, a SDL3 CMake project can be found that builds 99.9% of time (assuming you have internet connectivity). -When you have a problem with building or using SDL, please modify it until it reproduces your issue. - -```cmake -cmake_minimum_required(VERSION 3.16) -project(sdl_issue) - -# !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -# !!!!!! !!!!!! -# !!!!!! This CMake script is not using "CMake best practices". !!!!!! -# !!!!!! Don't use it in your project. !!!!!! -# !!!!!! !!!!!! -# !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! - -# 1. Try system SDL3 package first -find_package(SDL3 QUIET) -if(SDL3_FOUND) - message(STATUS "Using SDL3 via find_package") -endif() - -# 2. Try using a vendored SDL library -if(NOT SDL3_FOUND AND EXISTS "${CMAKE_CURRENT_LIST_DIR}/SDL/CMakeLists.txt") - add_subdirectory(SDL EXCLUDE_FROM_ALL) - message(STATUS "Using SDL3 via add_subdirectory") - set(SDL3_FOUND TRUE) -endif() - -# 3. Download SDL, and use that. -if(NOT SDL3_FOUND) - include(FetchContent) - set(SDL_SHARED TRUE CACHE BOOL "Build a SDL shared library (if available)") - set(SDL_STATIC TRUE CACHE BOOL "Build a SDL static library (if available)") - FetchContent_Declare( - SDL - GIT_REPOSITORY https://github.com/libsdl-org/SDL.git - GIT_TAG main # Replace this with a particular git tag or git hash - GIT_SHALLOW TRUE - GIT_PROGRESS TRUE - ) - message(STATUS "Using SDL3 via FetchContent") - FetchContent_MakeAvailable(SDL) - set_property(DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/_deps/sdl-src" PROPERTY EXCLUDE_FROM_ALL TRUE) -endif() - -file(WRITE main.c [===========================================[ -/** - * Modify this source such that it reproduces your problem. - */ - -/* START of source modifications */ - -#include -/* - * SDL3/SDL_main.h is explicitly not included such that a terminal window would appear on Windows. - */ - -int main(int argc, char *argv[]) { - (void)argc; - (void)argv; - - if (!SDL_Init(SDL_INIT_VIDEO)) { - SDL_Log("SDL_Init failed (%s)", SDL_GetError()); - return 1; - } - - SDL_Window *window = NULL; - SDL_Renderer *renderer = NULL; - - if (!SDL_CreateWindowAndRenderer("SDL issue", 640, 480, 0, &window, &renderer)) { - SDL_Log("SDL_CreateWindowAndRenderer failed (%s)", SDL_GetError()); - SDL_Quit(); - return 1; - } - - while (1) { - int finished = 0; - SDL_Event event; - while (SDL_PollEvent(&event)) { - if (event.type == SDL_EVENT_QUIT) { - finished = 1; - break; - } - } - if (finished) { - break; - } - - SDL_SetRenderDrawColor(renderer, 80, 80, 80, SDL_ALPHA_OPAQUE); - SDL_RenderClear(renderer); - SDL_RenderPresent(renderer); - } - - SDL_DestroyRenderer(renderer); - SDL_DestroyWindow(window); - - SDL_Quit(); - return 0; -} - -/* END of source modifications */ - -]===========================================]) - -add_executable(sdl_issue main.c) - -target_link_libraries(sdl_issue PRIVATE SDL3::SDL3) -# target_link_libraries(sdl_issue PRIVATE SDL3::SDL3-shared) -# target_link_libraries(sdl_issue PRIVATE SDL3::SDL3-static) -``` From cdde6dd7bb182a430f82c5e059122b350df7f1dd Mon Sep 17 00:00:00 2001 From: Sam Lantinga Date: Tue, 14 Jan 2025 09:19:39 -0800 Subject: [PATCH 048/340] Bumped deployment requirements for Apple platforms We require at least Xcode 12.2 and macOS SDK 11 to build. We support deploying to macOS 10.13, iOS 11.0, and tvOS 11.0. This cleans up the code significantly --- .github/workflows/create-test-plan.py | 8 +- .github/workflows/release.yml | 12 +- Xcode/SDL/SDL.xcodeproj/project.pbxproj | 12 +- docs/README-ios.md | 9 +- docs/README-macos.md | 9 +- src/SDL_internal.h | 11 + src/audio/coreaudio/SDL_coreaudio.m | 35 +- src/dialog/cocoa/SDL_cocoadialog.m | 6 +- src/gpu/metal/SDL_gpu_metal.m | 24 +- src/hidapi/ios/hid.m | 12 +- src/joystick/apple/SDL_mfijoystick.m | 444 +++++++--------------- src/misc/ios/SDL_sysurl.m | 8 +- src/render/metal/SDL_render_metal.m | 98 ++--- src/video/cocoa/SDL_cocoaclipboard.m | 4 - src/video/cocoa/SDL_cocoaevents.m | 4 - src/video/cocoa/SDL_cocoamodes.m | 8 - src/video/cocoa/SDL_cocoavideo.h | 58 --- src/video/cocoa/SDL_cocoavideo.m | 4 +- src/video/cocoa/SDL_cocoawindow.m | 40 +- src/video/uikit/SDL_uikitappdelegate.m | 22 -- src/video/uikit/SDL_uikitevents.m | 39 -- src/video/uikit/SDL_uikitmodes.m | 7 +- src/video/uikit/SDL_uikitpen.h | 2 +- src/video/uikit/SDL_uikitpen.m | 2 +- src/video/uikit/SDL_uikitvideo.m | 9 +- src/video/uikit/SDL_uikitview.h | 6 +- src/video/uikit/SDL_uikitview.m | 68 +--- src/video/uikit/SDL_uikitviewcontroller.m | 38 +- src/video/uikit/SDL_uikitwindow.m | 8 +- 29 files changed, 266 insertions(+), 741 deletions(-) diff --git a/.github/workflows/create-test-plan.py b/.github/workflows/create-test-plan.py index 3ae5cabfec78e..860355dbc4882 100755 --- a/.github/workflows/create-test-plan.py +++ b/.github/workflows/create-test-plan.py @@ -469,7 +469,7 @@ def spec_to_job(spec: JobSpec, key: str, trackmem_symbol_names: bool) -> JobDeta job.cmake_arguments.extend([ "-DCMAKE_SYSTEM_NAME=iOS", "-DCMAKE_OSX_ARCHITECTURES=\"arm64\"", - "-DCMAKE_OSX_DEPLOYMENT_TARGET=9.0", + "-DCMAKE_OSX_DEPLOYMENT_TARGET=11.0", ]) case SdlPlatform.Tvos: if spec.xcode: @@ -477,7 +477,7 @@ def spec_to_job(spec: JobSpec, key: str, trackmem_symbol_names: bool) -> JobDeta job.cmake_arguments.extend([ "-DCMAKE_SYSTEM_NAME=tvOS", "-DCMAKE_OSX_ARCHITECTURES=\"arm64\"", - "-DCMAKE_OSX_DEPLOYMENT_TARGET=9.0", + "-DCMAKE_OSX_DEPLOYMENT_TARGET=11.0", ]) case SdlPlatform.MacOS: if spec.apple_framework: @@ -486,7 +486,7 @@ def spec_to_job(spec: JobSpec, key: str, trackmem_symbol_names: bool) -> JobDeta job.test_pkg_config = False job.cmake_arguments.extend(( "'-DCMAKE_OSX_ARCHITECTURES=x86_64;arm64'", - "-DCMAKE_OSX_DEPLOYMENT_TARGET=10.11", + "-DCMAKE_OSX_DEPLOYMENT_TARGET=10.13", "-DSDL_FRAMEWORK=ON", )) job.shared_lib = SharedLibType.FRAMEWORK @@ -494,7 +494,7 @@ def spec_to_job(spec: JobSpec, key: str, trackmem_symbol_names: bool) -> JobDeta job.clang_tidy = True job.cmake_arguments.extend(( "-DCMAKE_OSX_ARCHITECTURES=arm64", - "-DCMAKE_OSX_DEPLOYMENT_TARGET=10.11", + "-DCMAKE_OSX_DEPLOYMENT_TARGET=10.13", "-DCLANG_TIDY_BINARY=$(brew --prefix llvm)/bin/clang-tidy", )) job.shared_lib = SharedLibType.DYLIB diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 7b541fa789104..64199c7c6237b 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -163,7 +163,7 @@ jobs: -DCMAKE_PREFIX_PATH="${{ steps.mount.outputs.mount_point }}" \ -DCMAKE_SYSTEM_NAME=Darwin \ -DCMAKE_OSX_ARCHITECTURES="arm64;x86_64" \ - -DCMAKE_OSX_DEPLOYMENT_TARGET=10.11 \ + -DCMAKE_OSX_DEPLOYMENT_TARGET=10.13 \ -Werror=dev \ -B build_darwin cmake --build build_darwin --config Release --verbose @@ -175,7 +175,7 @@ jobs: -DCMAKE_PREFIX_PATH="${{ steps.mount.outputs.mount_point }}/SDL3.xcframework/macos-arm64_x86_64" \ -DCMAKE_SYSTEM_NAME=Darwin \ -DCMAKE_OSX_ARCHITECTURES="arm64;x86_64" \ - -DCMAKE_OSX_DEPLOYMENT_TARGET=10.11 \ + -DCMAKE_OSX_DEPLOYMENT_TARGET=10.13 \ -Werror=dev \ -B build_darwin_2 cmake --build build_darwin --config Release --verbose @@ -188,7 +188,7 @@ jobs: -DCMAKE_PREFIX_PATH="${{ steps.mount.outputs.mount_point }}" \ -DCMAKE_SYSTEM_NAME=iOS \ -DCMAKE_OSX_ARCHITECTURES="arm64" \ - -DCMAKE_OSX_DEPLOYMENT_TARGET=9.0 \ + -DCMAKE_OSX_DEPLOYMENT_TARGET=11.0 \ -Werror=dev \ -B build_ios cmake --build build_ios --config Release --verbose @@ -201,7 +201,7 @@ jobs: -DCMAKE_PREFIX_PATH="${{ steps.mount.outputs.mount_point }}" \ -DCMAKE_SYSTEM_NAME=tvOS \ -DCMAKE_OSX_ARCHITECTURES="arm64" \ - -DCMAKE_OSX_DEPLOYMENT_TARGET=9.0 \ + -DCMAKE_OSX_DEPLOYMENT_TARGET=11.0 \ -Werror=dev \ -B build_tvos cmake --build build_tvos --config Release --verbose @@ -217,7 +217,7 @@ jobs: -DCMAKE_SYSTEM_NAME=iOS \ -DCMAKE_OSX_ARCHITECTURES="arm64;x86_64" \ -DCMAKE_OSX_SYSROOT="${sysroot}" \ - -DCMAKE_OSX_DEPLOYMENT_TARGET=9.0 \ + -DCMAKE_OSX_DEPLOYMENT_TARGET=11.0 \ -Werror=dev \ -B build_ios_simulator cmake --build build_ios_simulator --config Release --verbose @@ -233,7 +233,7 @@ jobs: -DCMAKE_SYSTEM_NAME=tvOS \ -DCMAKE_OSX_ARCHITECTURES="arm64;x86_64" \ -DCMAKE_OSX_SYSROOT="${sysroot}" \ - -DCMAKE_OSX_DEPLOYMENT_TARGET=9.0 \ + -DCMAKE_OSX_DEPLOYMENT_TARGET=11.0 \ -Werror=dev \ -B build_tvos_simulator cmake --build build_tvos_simulator --config Release --verbose diff --git a/Xcode/SDL/SDL.xcodeproj/project.pbxproj b/Xcode/SDL/SDL.xcodeproj/project.pbxproj index bc8b15e01b77e..cd52392b6b388 100644 --- a/Xcode/SDL/SDL.xcodeproj/project.pbxproj +++ b/Xcode/SDL/SDL.xcodeproj/project.pbxproj @@ -3073,7 +3073,7 @@ /usr/X11R6/include, ); INFOPLIST_FILE = "Info-Framework.plist"; - IPHONEOS_DEPLOYMENT_TARGET = 9.0; + IPHONEOS_DEPLOYMENT_TARGET = 11.0; LD_RUNPATH_SEARCH_PATHS = ( "$(inherited)", "@executable_path/Frameworks", @@ -3083,7 +3083,7 @@ "@executable_path/../Frameworks", "@loader_path/Frameworks", ); - MACOSX_DEPLOYMENT_TARGET = 10.11; + MACOSX_DEPLOYMENT_TARGET = 10.13; MARKETING_VERSION = 3.1.9; OTHER_LDFLAGS = "$(CONFIG_FRAMEWORK_LDFLAGS)"; PRODUCT_BUNDLE_IDENTIFIER = org.libsdl.SDL3; @@ -3091,7 +3091,7 @@ STRIP_STYLE = "non-global"; SUPPORTED_PLATFORMS = "xrsimulator xros macosx iphonesimulator iphoneos appletvsimulator appletvos"; SUPPORTS_MACCATALYST = YES; - TVOS_DEPLOYMENT_TARGET = 9.0; + TVOS_DEPLOYMENT_TARGET = 11.0; XROS_DEPLOYMENT_TARGET = 1.0; }; name = Release; @@ -3134,7 +3134,7 @@ /usr/X11R6/include, ); INFOPLIST_FILE = "Info-Framework.plist"; - IPHONEOS_DEPLOYMENT_TARGET = 9.0; + IPHONEOS_DEPLOYMENT_TARGET = 11.0; LD_RUNPATH_SEARCH_PATHS = ( "$(inherited)", "@executable_path/Frameworks", @@ -3144,7 +3144,7 @@ "@executable_path/../Frameworks", "@loader_path/Frameworks", ); - MACOSX_DEPLOYMENT_TARGET = 10.11; + MACOSX_DEPLOYMENT_TARGET = 10.13; MARKETING_VERSION = 3.1.9; ONLY_ACTIVE_ARCH = YES; OTHER_LDFLAGS = "$(CONFIG_FRAMEWORK_LDFLAGS)"; @@ -3153,7 +3153,7 @@ STRIP_INSTALLED_PRODUCT = NO; SUPPORTED_PLATFORMS = "xrsimulator xros macosx iphonesimulator iphoneos appletvsimulator appletvos"; SUPPORTS_MACCATALYST = YES; - TVOS_DEPLOYMENT_TARGET = 9.0; + TVOS_DEPLOYMENT_TARGET = 11.0; XROS_DEPLOYMENT_TARGET = 1.0; }; name = Debug; diff --git a/docs/README-ios.md b/docs/README-ios.md index 51e1d76c996a8..dbd70f5a702f4 100644 --- a/docs/README-ios.md +++ b/docs/README-ios.md @@ -1,10 +1,10 @@ iOS ====== -Building the Simple DirectMedia Layer for iOS 9.0+ +Building the Simple DirectMedia Layer for iOS 11.0+ ============================================================================== -Requirements: macOS 10.9 or later and the iOS 9.0 or newer SDK. +Please note that building SDL requires at least Xcode 12.2 and the iOS 14.2 SDK. Instructions: @@ -185,9 +185,6 @@ Windows: Textures: The optimal texture formats on iOS are SDL_PIXELFORMAT_ABGR8888, SDL_PIXELFORMAT_ABGR8888, SDL_PIXELFORMAT_XBGR8888, and SDL_PIXELFORMAT_RGB24 pixel formats. -Loading Shared Objects: - This is disabled by default since it seems to break the terms of the iOS SDK agreement for iOS versions prior to iOS 8. It can be re-enabled in SDL_config_ios.h. - Notes -- CoreBluetooth.framework ============================================================================== @@ -249,7 +246,7 @@ Note that if you are using main callbacks instead of a standard C main() functio Deploying to older versions of iOS ============================================================================== -SDL supports deploying to older versions of iOS than are supported by the latest version of Xcode, all the way back to iOS 8.0 +SDL supports deploying to older versions of iOS than are supported by the latest version of Xcode, all the way back to iOS 11.0 In order to do that you need to download an older version of Xcode: https://developer.apple.com/download/more/?name=Xcode diff --git a/docs/README-macos.md b/docs/README-macos.md index d2f22c7f47c62..fb0639b66eda5 100644 --- a/docs/README-macos.md +++ b/docs/README-macos.md @@ -13,7 +13,7 @@ To build SDL using the command line, use the CMake build script: ```bash mkdir build cd build -cmake .. -DCMAKE_OSX_DEPLOYMENT_TARGET=10.11 +cmake .. -DCMAKE_OSX_DEPLOYMENT_TARGET=10.13 cmake --build . sudo cmake --install . ``` @@ -25,15 +25,12 @@ You can also build SDL as a Universal library (a single binary for both ```bash mkdir build cd build -cmake .. "-DCMAKE_OSX_ARCHITECTURES=arm64;x86_64" -DCMAKE_OSX_DEPLOYMENT_TARGET=10.11 +cmake .. "-DCMAKE_OSX_ARCHITECTURES=arm64;x86_64" -DCMAKE_OSX_DEPLOYMENT_TARGET=10.13 cmake --build . sudo cmake --install . ``` -Please note that building SDL requires at least Xcode 12.2 and the 11.0 SDK. -PowerPC support for macOS has been officially dropped as of SDL 2.0.2. -32-bit Intel and macOS 10.8 runtime support has been officially dropped as -of SDL 2.24.0. +Please note that building SDL requires at least Xcode 12.2 and the macOS 11.0 SDK. To use the library once it's built, you essential have two possibilities: use the traditional autoconf/automake/make method, or use Xcode. diff --git a/src/SDL_internal.h b/src/SDL_internal.h index e3910cf500000..ac018f9b28abb 100644 --- a/src/SDL_internal.h +++ b/src/SDL_internal.h @@ -78,7 +78,18 @@ #ifndef _DARWIN_C_SOURCE #define _DARWIN_C_SOURCE 1 // for memset_pattern4() #endif +#include + +#ifndef __IPHONE_OS_VERSION_MAX_ALLOWED +#define __IPHONE_OS_VERSION_MAX_ALLOWED 0 +#endif +#ifndef __APPLETV_OS_VERSION_MAX_ALLOWED +#define __APPLETV_OS_VERSION_MAX_ALLOWED 0 +#endif +#ifndef __MAC_OS_X_VERSION_MAX_ALLOWED +#define __MAC_OS_X_VERSION_MAX_ALLOWED 0 #endif +#endif // SDL_PLATFORM_APPLE #ifdef HAVE_SYS_TYPES_H #include diff --git a/src/audio/coreaudio/SDL_coreaudio.m b/src/audio/coreaudio/SDL_coreaudio.m index 6760fdbd06ae0..d518d883cdf26 100644 --- a/src/audio/coreaudio/SDL_coreaudio.m +++ b/src/audio/coreaudio/SDL_coreaudio.m @@ -467,31 +467,16 @@ static bool UpdateAudioSession(SDL_AudioDevice *device, bool open, bool allow_pl options |= AVAudioSessionCategoryOptionDuckOthers; } - if ([session respondsToSelector:@selector(setCategory:mode:options:error:)]) { - if (![session.category isEqualToString:category] || session.categoryOptions != options) { - // Stop the current session so we don't interrupt other application audio - PauseAudioDevices(); - [session setActive:NO error:nil]; - session_active = false; - - if (![session setCategory:category mode:mode options:options error:&err]) { - NSString *desc = err.description; - SDL_SetError("Could not set Audio Session category: %s", desc.UTF8String); - return false; - } - } - } else { - if (![session.category isEqualToString:category]) { - // Stop the current session so we don't interrupt other application audio - PauseAudioDevices(); - [session setActive:NO error:nil]; - session_active = false; - - if (![session setCategory:category error:&err]) { - NSString *desc = err.description; - SDL_SetError("Could not set Audio Session category: %s", desc.UTF8String); - return false; - } + if (![session.category isEqualToString:category] || session.categoryOptions != options) { + // Stop the current session so we don't interrupt other application audio + PauseAudioDevices(); + [session setActive:NO error:nil]; + session_active = false; + + if (![session setCategory:category mode:mode options:options error:&err]) { + NSString *desc = err.description; + SDL_SetError("Could not set Audio Session category: %s", desc.UTF8String); + return false; } } diff --git a/src/dialog/cocoa/SDL_cocoadialog.m b/src/dialog/cocoa/SDL_cocoadialog.m index aac7fd02fd337..fb9c5ad88f77b 100644 --- a/src/dialog/cocoa/SDL_cocoadialog.m +++ b/src/dialog/cocoa/SDL_cocoadialog.m @@ -146,8 +146,7 @@ void SDL_SYS_ShowFileDialogWithProperties(SDL_FileDialogType type, SDL_DialogFil if (w) { // [dialog beginWithCompletionHandler:^(NSInteger result) { [dialog beginSheetModalForWindow:w completionHandler:^(NSInteger result) { - // NSModalResponseOK for >= 10.13 - if (result == NSFileHandlingPanelOKButton) { + if (result == NSModalResponseOK) { if (dialog_as_open) { NSArray* urls = [dialog_as_open URLs]; const char *files[[urls count] + 1]; @@ -166,8 +165,7 @@ void SDL_SYS_ShowFileDialogWithProperties(SDL_FileDialogType type, SDL_DialogFil } }]; } else { - // NSModalResponseOK for >= 10.10 - if ([dialog runModal] == NSOKButton) { + if ([dialog runModal] == NSModalResponseOK) { if (dialog_as_open) { NSArray* urls = [dialog_as_open URLs]; const char *files[[urls count] + 1]; diff --git a/src/gpu/metal/SDL_gpu_metal.m b/src/gpu/metal/SDL_gpu_metal.m index 411a29b29a941..ac712d52fa90b 100644 --- a/src/gpu/metal/SDL_gpu_metal.m +++ b/src/gpu/metal/SDL_gpu_metal.m @@ -386,11 +386,7 @@ static MTLTextureType SDLToMetal_TextureType(SDL_GPUTextureType textureType, boo case SDL_GPU_TEXTURETYPE_CUBE: return MTLTextureTypeCube; case SDL_GPU_TEXTURETYPE_CUBE_ARRAY: - if (@available(iOS 11.0, tvOS 11.0, *)) { - return MTLTextureTypeCubeArray; - } else { - return MTLTextureType2D; // FIXME: I guess...? - } + return MTLTextureTypeCubeArray; default: return MTLTextureType2D; } @@ -1289,10 +1285,8 @@ static void METAL_InsertDebugLabel( [metalCommandBuffer->computeEncoder insertDebugSignpost:label]; } else { // Metal doesn't have insertDebugSignpost for command buffers... - if (@available(macOS 10.13, iOS 11.0, tvOS 11.0, *)) { - [metalCommandBuffer->handle pushDebugGroup:label]; - [metalCommandBuffer->handle popDebugGroup]; - } + [metalCommandBuffer->handle pushDebugGroup:label]; + [metalCommandBuffer->handle popDebugGroup]; } } } @@ -1312,9 +1306,7 @@ static void METAL_PushDebugGroup( } else if (metalCommandBuffer->computeEncoder) { [metalCommandBuffer->computeEncoder pushDebugGroup:label]; } else { - if (@available(macOS 10.13, iOS 11.0, tvOS 11.0, *)) { - [metalCommandBuffer->handle pushDebugGroup:label]; - } + [metalCommandBuffer->handle pushDebugGroup:label]; } } } @@ -1332,9 +1324,7 @@ static void METAL_PopDebugGroup( } else if (metalCommandBuffer->computeEncoder) { [metalCommandBuffer->computeEncoder popDebugGroup]; } else { - if (@available(macOS 10.13, iOS 11.0, tvOS 11.0, *)) { - [metalCommandBuffer->handle popDebugGroup]; - } + [metalCommandBuffer->handle popDebugGroup]; } } } @@ -2418,9 +2408,7 @@ static void METAL_BindGraphicsPipeline( [metalCommandBuffer->renderEncoder setTriangleFillMode:SDLToMetal_PolygonMode[metalGraphicsPipeline->rasterizerState.fill_mode]]; [metalCommandBuffer->renderEncoder setCullMode:SDLToMetal_CullMode[metalGraphicsPipeline->rasterizerState.cull_mode]]; [metalCommandBuffer->renderEncoder setFrontFacingWinding:SDLToMetal_FrontFace[metalGraphicsPipeline->rasterizerState.front_face]]; - if (@available(iOS 11.0, tvOS 11.0, *)) { - [metalCommandBuffer->renderEncoder setDepthClipMode:SDLToMetal_DepthClipMode(metalGraphicsPipeline->rasterizerState.enable_depth_clip)]; - } + [metalCommandBuffer->renderEncoder setDepthClipMode:SDLToMetal_DepthClipMode(metalGraphicsPipeline->rasterizerState.enable_depth_clip)]; [metalCommandBuffer->renderEncoder setDepthBias:((rast->enable_depth_bias) ? rast->depth_bias_constant_factor : 0) slopeScale:((rast->enable_depth_bias) ? rast->depth_bias_slope_factor : 0) diff --git a/src/hidapi/ios/hid.m b/src/hidapi/ios/hid.m index b6f8037304cb7..29e0782094cfb 100644 --- a/src/hidapi/ios/hid.m +++ b/src/hidapi/ios/hid.m @@ -398,7 +398,7 @@ - (void)centralManagerDidUpdateState:(CBCentralManager *)central { switch ( central.state ) { - case CBCentralManagerStatePoweredOn: + case CBManagerStatePoweredOn: { NSLog( @"CoreBluetooth BLE hardware is powered on and ready" ); @@ -418,23 +418,23 @@ - (void)centralManagerDidUpdateState:(CBCentralManager *)central break; } - case CBCentralManagerStatePoweredOff: + case CBManagerStatePoweredOff: NSLog( @"CoreBluetooth BLE hardware is powered off" ); break; - case CBCentralManagerStateUnauthorized: + case CBManagerStateUnauthorized: NSLog( @"CoreBluetooth BLE state is unauthorized" ); break; - case CBCentralManagerStateUnknown: + case CBManagerStateUnknown: NSLog( @"CoreBluetooth BLE state is unknown" ); break; - case CBCentralManagerStateUnsupported: + case CBManagerStateUnsupported: NSLog( @"CoreBluetooth BLE hardware is unsupported on this platform" ); break; - case CBCentralManagerStateResetting: + case CBManagerStateResetting: NSLog( @"CoreBluetooth BLE manager is resetting" ); break; } diff --git a/src/joystick/apple/SDL_mfijoystick.m b/src/joystick/apple/SDL_mfijoystick.m index c1863830cd981..c224bb2f4f5f6 100644 --- a/src/joystick/apple/SDL_mfijoystick.m +++ b/src/joystick/apple/SDL_mfijoystick.m @@ -48,66 +48,18 @@ static id connectObserver = nil; static id disconnectObserver = nil; -#include #include -#ifndef __IPHONE_OS_VERSION_MAX_ALLOWED -#define __IPHONE_OS_VERSION_MAX_ALLOWED 0 -#endif - -#ifndef __APPLETV_OS_VERSION_MAX_ALLOWED -#define __APPLETV_OS_VERSION_MAX_ALLOWED 0 -#endif - -#ifndef __MAC_OS_VERSION_MAX_ALLOWED -#define __MAC_OS_VERSION_MAX_ALLOWED 0 -#endif - /* remove compilation warnings for strict builds by defining these selectors, even though * they are only ever used indirectly through objc_msgSend */ @interface GCController (SDL) -#if defined(SDL_PLATFORM_MACOS) && (__MAC_OS_X_VERSION_MAX_ALLOWED <= 101600) -+ (BOOL)supportsHIDDevice:(IOHIDDeviceRef)device; -#endif -#if !((__IPHONE_OS_VERSION_MAX_ALLOWED >= 130000) || (__APPLETV_OS_VERSION_MAX_ALLOWED >= 130000) || (__MAC_OS_VERSION_MAX_ALLOWED >= 1500000)) -@property(nonatomic, readonly) NSString *productCategory; -#endif #if !((__IPHONE_OS_VERSION_MAX_ALLOWED >= 140500) || (__APPLETV_OS_VERSION_MAX_ALLOWED >= 140500) || (__MAC_OS_X_VERSION_MAX_ALLOWED >= 110300)) @property(class, nonatomic, readwrite) BOOL shouldMonitorBackgroundEvents; #endif @end -@interface GCExtendedGamepad (SDL) -#if !((__IPHONE_OS_VERSION_MAX_ALLOWED >= 121000) || (__APPLETV_OS_VERSION_MAX_ALLOWED >= 121000) || (__MAC_OS_VERSION_MAX_ALLOWED >= 1401000)) -@property(nonatomic, readonly, nullable) GCControllerButtonInput *leftThumbstickButton; -@property(nonatomic, readonly, nullable) GCControllerButtonInput *rightThumbstickButton; -#endif -#if !((__IPHONE_OS_VERSION_MAX_ALLOWED >= 130000) || (__APPLETV_OS_VERSION_MAX_ALLOWED >= 130000) || (__MAC_OS_VERSION_MAX_ALLOWED >= 1500000)) -@property(nonatomic, readonly) GCControllerButtonInput *buttonMenu; -@property(nonatomic, readonly, nullable) GCControllerButtonInput *buttonOptions; -#endif -#if !((__IPHONE_OS_VERSION_MAX_ALLOWED >= 140000) || (__APPLETV_OS_VERSION_MAX_ALLOWED >= 140000) || (__MAC_OS_VERSION_MAX_ALLOWED > 1500000)) -@property(nonatomic, readonly, nullable) GCControllerButtonInput *buttonHome; -#endif -@end -@interface GCMicroGamepad (SDL) -#if !((__IPHONE_OS_VERSION_MAX_ALLOWED >= 130000) || (__APPLETV_OS_VERSION_MAX_ALLOWED >= 130000) || (__MAC_OS_VERSION_MAX_ALLOWED >= 1500000)) -@property(nonatomic, readonly) GCControllerButtonInput *buttonMenu; -#endif -@end - -#if (__IPHONE_OS_VERSION_MAX_ALLOWED >= 140000) || (__APPLETV_OS_VERSION_MAX_ALLOWED >= 140000) || (__MAC_OS_VERSION_MAX_ALLOWED > 1500000) || (__MAC_OS_X_VERSION_MAX_ALLOWED > 101600) -#define ENABLE_MFI_BATTERY -#define ENABLE_MFI_RUMBLE -#define ENABLE_MFI_LIGHT -#define ENABLE_MFI_SENSORS -#define ENABLE_MFI_SYSTEM_GESTURE_STATE -#define ENABLE_PHYSICAL_INPUT_PROFILE -#endif -#ifdef ENABLE_MFI_RUMBLE #import -#endif #endif // SDL_JOYSTICK_MFI @@ -234,7 +186,6 @@ static void CheckControllerSiriRemote(GCController *controller, int *is_siri_rem *is_siri_remote = 0; } -#ifdef ENABLE_PHYSICAL_INPUT_PROFILE static bool ElementAlreadyHandled(SDL_JoystickDeviceItem *device, NSString *element, NSDictionary *elements) { if ([element isEqualToString:@"Left Thumbstick Left"] || @@ -333,7 +284,6 @@ static bool ElementAlreadyHandled(SDL_JoystickDeviceItem *device, NSString *elem } return false; } -#endif // ENABLE_PHYSICAL_INPUT_PROFILE static bool IOS_AddMFIJoystickDevice(SDL_JoystickDeviceItem *device, GCController *controller) { @@ -366,7 +316,6 @@ static bool IOS_AddMFIJoystickDevice(SDL_JoystickDeviceItem *device, GCControlle NSLog(@"Product name: %@\n", controller.vendorName); NSLog(@"Product category: %@\n", controller.productCategory); NSLog(@"Elements available:\n"); -#ifdef ENABLE_PHYSICAL_INPUT_PROFILE if (@available(macOS 10.16, iOS 14.0, tvOS 14.0, *)) { NSDictionary *elements = controller.physicalInputProfile.elements; for (id key in controller.physicalInputProfile.buttons) { @@ -379,8 +328,7 @@ static bool IOS_AddMFIJoystickDevice(SDL_JoystickDeviceItem *device, GCControlle NSLog(@"\tHat: %@\n", key); } } -#endif -#endif +#endif // DEBUG_CONTROLLER_PROFILE device->is_xbox = IsControllerXbox(controller); device->is_ps4 = IsControllerPS4(controller); @@ -416,7 +364,6 @@ static bool IOS_AddMFIJoystickDevice(SDL_JoystickDeviceItem *device, GCControlle return false; } -#ifdef ENABLE_PHYSICAL_INPUT_PROFILE if (@available(macOS 10.16, iOS 14.0, tvOS 14.0, *)) { if (controller.physicalInputProfile.buttons[GCInputDualShockTouchpadButton] != nil) { device->has_dualshock_touchpad = TRUE; @@ -428,7 +375,6 @@ static bool IOS_AddMFIJoystickDevice(SDL_JoystickDeviceItem *device, GCControlle device->has_xbox_share_button = TRUE; } } -#endif // ENABLE_PHYSICAL_INPUT_PROFILE if (device->is_backbone_one) { vendor = USB_VENDOR_BACKBONE; @@ -473,20 +419,14 @@ static bool IOS_AddMFIJoystickDevice(SDL_JoystickDeviceItem *device, GCControlle } else if (device->is_switch_joyconR) { vendor = USB_VENDOR_NINTENDO; product = USB_PRODUCT_NINTENDO_SWITCH_JOYCON_RIGHT; -#ifdef ENABLE_PHYSICAL_INPUT_PROFILE } else if (@available(macOS 10.16, iOS 14.0, tvOS 14.0, *)) { vendor = USB_VENDOR_APPLE; product = 4; subtype = 4; -#endif } else if (controller.extendedGamepad) { vendor = USB_VENDOR_APPLE; product = 1; subtype = 1; - } else if (controller.gamepad) { - vendor = USB_VENDOR_APPLE; - product = 2; - subtype = 2; #ifdef SDL_PLATFORM_TVOS } else if (controller.microGamepad) { vendor = USB_VENDOR_APPLE; @@ -502,7 +442,6 @@ static bool IOS_AddMFIJoystickDevice(SDL_JoystickDeviceItem *device, GCControlle return false; } -#ifdef ENABLE_PHYSICAL_INPUT_PROFILE if (@available(macOS 10.16, iOS 14.0, tvOS 14.0, *)) { NSDictionary *elements = controller.physicalInputProfile.elements; @@ -558,9 +497,7 @@ static bool IOS_AddMFIJoystickDevice(SDL_JoystickDeviceItem *device, GCControlle device->pause_button_index = (int)[device->buttons indexOfObject:GCInputButtonMenu]; } #endif - } else -#endif - if (controller.extendedGamepad) { + } else if (controller.extendedGamepad) { GCExtendedGamepad *gamepad = controller.extendedGamepad; int nbuttons = 0; BOOL has_direct_menu = FALSE; @@ -612,24 +549,6 @@ static bool IOS_AddMFIJoystickDevice(SDL_JoystickDeviceItem *device, GCControlle device->naxes = 6; // 2 thumbsticks and 2 triggers device->nhats = 1; // d-pad device->nbuttons = nbuttons; - - } else if (controller.gamepad) { - int nbuttons = 0; - - // These buttons are part of the original MFi spec - device->button_mask |= (1 << SDL_GAMEPAD_BUTTON_SOUTH); - device->button_mask |= (1 << SDL_GAMEPAD_BUTTON_EAST); - device->button_mask |= (1 << SDL_GAMEPAD_BUTTON_WEST); - device->button_mask |= (1 << SDL_GAMEPAD_BUTTON_NORTH); - device->button_mask |= (1 << SDL_GAMEPAD_BUTTON_LEFT_SHOULDER); - device->button_mask |= (1 << SDL_GAMEPAD_BUTTON_RIGHT_SHOULDER); - device->button_mask |= (1 << SDL_GAMEPAD_BUTTON_START); - nbuttons += 7; - device->pause_button_index = (nbuttons - 1); - - device->naxes = 0; // no traditional analog inputs - device->nhats = 1; // d-pad - device->nbuttons = nbuttons; } #ifdef SDL_PLATFORM_TVOS else if (controller.microGamepad) { @@ -677,7 +596,7 @@ static bool IOS_AddMFIJoystickDevice(SDL_JoystickDeviceItem *device, GCControlle } #endif // SDL_JOYSTICK_MFI -#if defined(SDL_JOYSTICK_MFI) +#ifdef SDL_JOYSTICK_MFI static void IOS_AddJoystickDevice(GCController *controller) { SDL_JoystickDeviceItem *device = deviceList; @@ -975,7 +894,6 @@ static bool IOS_JoystickOpen(SDL_Joystick *joystick, int device_index) }; } -#ifdef ENABLE_MFI_SENSORS if (@available(macOS 10.16, iOS 14.0, tvOS 14.0, *)) { GCController *controller = joystick->hwdata->controller; GCMotion *motion = controller.motion; @@ -986,9 +904,7 @@ static bool IOS_JoystickOpen(SDL_Joystick *joystick, int device_index) SDL_PrivateJoystickAddSensor(joystick, SDL_SENSOR_ACCEL, 0.0f); } } -#endif // ENABLE_MFI_SENSORS -#ifdef ENABLE_MFI_SYSTEM_GESTURE_STATE if (@available(macOS 10.16, iOS 14.0, tvOS 14.0, *)) { GCController *controller = joystick->hwdata->controller; for (id key in controller.physicalInputProfile.buttons) { @@ -998,17 +914,13 @@ static bool IOS_JoystickOpen(SDL_Joystick *joystick, int device_index) } } } -#endif // ENABLE_MFI_SYSTEM_GESTURE_STATE if (@available(macOS 10.16, iOS 14.0, tvOS 14.0, *)) { GCController *controller = device->controller; -#ifdef ENABLE_MFI_LIGHT if (controller.light) { SDL_SetBooleanProperty(SDL_GetJoystickProperties(joystick), SDL_PROP_JOYSTICK_CAP_RGB_LED_BOOLEAN, true); } -#endif -#ifdef ENABLE_MFI_RUMBLE if (controller.haptics) { for (GCHapticsLocality locality in controller.haptics.supportedLocalities) { if ([locality isEqualToString:GCHapticsLocalityHandles]) { @@ -1018,7 +930,6 @@ static bool IOS_JoystickOpen(SDL_Joystick *joystick, int device_index) } } } -#endif } #endif // SDL_JOYSTICK_MFI } @@ -1064,7 +975,7 @@ static void IOS_MFIJoystickUpdate(SDL_Joystick *joystick) int i; Uint64 timestamp = SDL_GetTicksNS(); -#if defined(DEBUG_CONTROLLER_STATE) && defined(ENABLE_PHYSICAL_INPUT_PROFILE) +#ifdef DEBUG_CONTROLLER_STATE if (@available(macOS 10.16, iOS 14.0, tvOS 14.0, *)) { if (controller.physicalInputProfile) { for (id key in controller.physicalInputProfile.buttons) { @@ -1091,7 +1002,6 @@ static void IOS_MFIJoystickUpdate(SDL_Joystick *joystick) } #endif // DEBUG_CONTROLLER_STATE -#ifdef ENABLE_PHYSICAL_INPUT_PROFILE if (@available(macOS 10.16, iOS 14.0, tvOS 14.0, *)) { NSDictionary *elements = controller.physicalInputProfile.elements; NSDictionary *buttons = controller.physicalInputProfile.buttons; @@ -1118,9 +1028,7 @@ static void IOS_MFIJoystickUpdate(SDL_Joystick *joystick) } SDL_SendJoystickButton(timestamp, joystick, button++, down); } - } else -#endif - if (controller.extendedGamepad) { + } else if (controller.extendedGamepad) { bool isstack; GCExtendedGamepad *gamepad = controller.extendedGamepad; @@ -1185,33 +1093,6 @@ static void IOS_MFIJoystickUpdate(SDL_Joystick *joystick) SDL_SendJoystickButton(timestamp, joystick, i, buttons[i]); } - SDL_small_free(buttons, isstack); - } else if (controller.gamepad) { - bool isstack; - GCGamepad *gamepad = controller.gamepad; - - // Button order matches the XInput Windows mappings. - bool *buttons = SDL_small_alloc(bool, joystick->nbuttons, &isstack); - int button_count = 0; - - if (buttons == NULL) { - return; - } - - buttons[button_count++] = gamepad.buttonA.isPressed; - buttons[button_count++] = gamepad.buttonB.isPressed; - buttons[button_count++] = gamepad.buttonX.isPressed; - buttons[button_count++] = gamepad.buttonY.isPressed; - buttons[button_count++] = gamepad.leftShoulder.isPressed; - buttons[button_count++] = gamepad.rightShoulder.isPressed; - buttons[button_count++] = (device->pause_button_pressed > 0); - - hatstate = IOS_MFIJoystickHatStateForDPad(gamepad.dpad); - - for (i = 0; i < button_count; i++) { - SDL_SendJoystickButton(timestamp, joystick, i, buttons[i]); - } - SDL_small_free(buttons, isstack); } #ifdef SDL_PLATFORM_TVOS @@ -1251,7 +1132,6 @@ static void IOS_MFIJoystickUpdate(SDL_Joystick *joystick) } } -#ifdef ENABLE_PHYSICAL_INPUT_PROFILE if (@available(macOS 10.16, iOS 14.0, tvOS 14.0, *)) { if (device->has_dualshock_touchpad) { GCControllerDirectionPad *dpad; @@ -1271,33 +1151,29 @@ static void IOS_MFIJoystickUpdate(SDL_Joystick *joystick) } } } -#endif // ENABLE_PHYSICAL_INPUT_PROFILE -#ifdef ENABLE_MFI_SENSORS - if (@available(macOS 10.16, iOS 14.0, tvOS 14.0, *)) { - GCMotion *motion = controller.motion; - if (motion && motion.sensorsActive) { - float data[3]; - - if (motion.hasRotationRate) { - GCRotationRate rate = motion.rotationRate; - data[0] = rate.x; - data[1] = rate.z; - data[2] = -rate.y; - SDL_SendJoystickSensor(timestamp, joystick, SDL_SENSOR_GYRO, timestamp, data, 3); - } - if (motion.hasGravityAndUserAcceleration) { - GCAcceleration accel = motion.acceleration; - data[0] = -accel.x * SDL_STANDARD_GRAVITY; - data[1] = -accel.y * SDL_STANDARD_GRAVITY; - data[2] = -accel.z * SDL_STANDARD_GRAVITY; - SDL_SendJoystickSensor(timestamp, joystick, SDL_SENSOR_ACCEL, timestamp, data, 3); - } + if (@available(macOS 10.16, iOS 14.0, tvOS 14.0, *)) { + GCMotion *motion = controller.motion; + if (motion && motion.sensorsActive) { + float data[3]; + + if (motion.hasRotationRate) { + GCRotationRate rate = motion.rotationRate; + data[0] = rate.x; + data[1] = rate.z; + data[2] = -rate.y; + SDL_SendJoystickSensor(timestamp, joystick, SDL_SENSOR_GYRO, timestamp, data, 3); + } + if (motion.hasGravityAndUserAcceleration) { + GCAcceleration accel = motion.acceleration; + data[0] = -accel.x * SDL_STANDARD_GRAVITY; + data[1] = -accel.y * SDL_STANDARD_GRAVITY; + data[2] = -accel.z * SDL_STANDARD_GRAVITY; + SDL_SendJoystickSensor(timestamp, joystick, SDL_SENSOR_ACCEL, timestamp, data, 3); } } -#endif // ENABLE_MFI_SENSORS + } -#ifdef ENABLE_MFI_BATTERY if (@available(macOS 10.16, iOS 14.0, tvOS 14.0, *)) { GCDeviceBattery *battery = controller.battery; if (battery) { @@ -1321,13 +1197,10 @@ static void IOS_MFIJoystickUpdate(SDL_Joystick *joystick) SDL_SendJoystickPowerInfo(joystick, state, percent); } } -#endif // ENABLE_MFI_BATTERY } #endif // SDL_JOYSTICK_MFI } -#ifdef ENABLE_MFI_RUMBLE - @interface SDL3_RumbleMotor : NSObject @property(nonatomic, strong) CHHapticEngine *engine API_AVAILABLE(macos(10.16), ios(13.0), tvos(14.0)); @property(nonatomic, strong) id player API_AVAILABLE(macos(10.16), ios(13.0), tvos(14.0)); @@ -1522,11 +1395,8 @@ - (void)cleanup return nil; } -#endif // ENABLE_MFI_RUMBLE - static bool IOS_JoystickRumble(SDL_Joystick *joystick, Uint16 low_frequency_rumble, Uint16 high_frequency_rumble) { -#ifdef ENABLE_MFI_RUMBLE SDL_JoystickDeviceItem *device = joystick->hwdata; if (device == NULL) { @@ -1548,14 +1418,10 @@ static bool IOS_JoystickRumble(SDL_Joystick *joystick, Uint16 low_frequency_rumb } else { return SDL_Unsupported(); } -#else - return SDL_Unsupported(); -#endif } static bool IOS_JoystickRumbleTriggers(SDL_Joystick *joystick, Uint16 left_rumble, Uint16 right_rumble) { -#ifdef ENABLE_MFI_RUMBLE SDL_JoystickDeviceItem *device = joystick->hwdata; if (device == NULL) { @@ -1577,14 +1443,10 @@ static bool IOS_JoystickRumbleTriggers(SDL_Joystick *joystick, Uint16 left_rumbl } else { return SDL_Unsupported(); } -#else - return SDL_Unsupported(); -#endif } static bool IOS_JoystickSetLED(SDL_Joystick *joystick, Uint8 red, Uint8 green, Uint8 blue) { -#ifdef ENABLE_MFI_LIGHT @autoreleasepool { SDL_JoystickDeviceItem *device = joystick->hwdata; @@ -1603,7 +1465,6 @@ static bool IOS_JoystickSetLED(SDL_Joystick *joystick, Uint8 red, Uint8 green, U } } } -#endif // ENABLE_MFI_LIGHT return SDL_Unsupported(); } @@ -1615,7 +1476,6 @@ static bool IOS_JoystickSendEffect(SDL_Joystick *joystick, const void *data, int static bool IOS_JoystickSetSensorsEnabled(SDL_Joystick *joystick, bool enabled) { -#ifdef ENABLE_MFI_SENSORS @autoreleasepool { SDL_JoystickDeviceItem *device = joystick->hwdata; @@ -1632,7 +1492,6 @@ static bool IOS_JoystickSetSensorsEnabled(SDL_Joystick *joystick, bool enabled) } } } -#endif // ENABLE_MFI_SENSORS return SDL_Unsupported(); } @@ -1661,7 +1520,6 @@ static void IOS_JoystickClose(SDL_Joystick *joystick) device->joystick = NULL; @autoreleasepool { -#ifdef ENABLE_MFI_RUMBLE if (device->rumble) { SDL3_RumbleContext *rumble = (__bridge SDL3_RumbleContext *)device->rumble; @@ -1669,7 +1527,6 @@ static void IOS_JoystickClose(SDL_Joystick *joystick) CFRelease(device->rumble); device->rumble = NULL; } -#endif // ENABLE_MFI_RUMBLE if (device->controller) { #ifdef SDL_JOYSTICK_MFI @@ -1677,7 +1534,6 @@ static void IOS_JoystickClose(SDL_Joystick *joystick) controller.controllerPausedHandler = nil; controller.playerIndex = -1; -#ifdef ENABLE_MFI_SYSTEM_GESTURE_STATE if (@available(macOS 10.16, iOS 14.0, tvOS 14.0, *)) { for (id key in controller.physicalInputProfile.buttons) { GCControllerButtonInput *button = controller.physicalInputProfile.buttons[key]; @@ -1686,8 +1542,6 @@ static void IOS_JoystickClose(SDL_Joystick *joystick) } } } -#endif // ENABLE_MFI_SYSTEM_GESTURE_STATE - #endif // SDL_JOYSTICK_MFI } } @@ -1728,7 +1582,6 @@ static void IOS_JoystickQuit(void) static bool IOS_JoystickGetGamepadMapping(int device_index, SDL_GamepadMapping *out) { -#ifdef ENABLE_PHYSICAL_INPUT_PROFILE SDL_JoystickDeviceItem *device = GetDeviceForIndex(device_index); if (device == NULL) { return false; @@ -1861,8 +1714,6 @@ static bool IOS_JoystickGetGamepadMapping(int device_index, SDL_GamepadMapping * return true; } -#endif // ENABLE_PHYSICAL_INPUT_PROFILE - return false; } @@ -1888,7 +1739,7 @@ bool IOS_SupportedHIDDevice(IOHIDDeviceRef device) } #endif -#if defined(SDL_JOYSTICK_MFI) && defined(ENABLE_PHYSICAL_INPUT_PROFILE) +#ifdef SDL_JOYSTICK_MFI /* NOLINTNEXTLINE(readability-non-const-parameter): getCString takes a non-const char* */ static void GetAppleSFSymbolsNameForElement(GCControllerElement *element, char *name) { @@ -1909,132 +1760,126 @@ static void GetAppleSFSymbolsNameForElement(GCControllerElement *element, char * return controller.extendedGamepad.dpad; } - if (controller.gamepad) { - return controller.gamepad.dpad; - } - if (controller.microGamepad) { return controller.microGamepad.dpad; } return nil; } -#endif // SDL_JOYSTICK_MFI && ENABLE_PHYSICAL_INPUT_PROFILE +#endif // SDL_JOYSTICK_MFI const char *IOS_GetAppleSFSymbolsNameForButton(SDL_Gamepad *gamepad, SDL_GamepadButton button) { char elementName[256]; elementName[0] = '\0'; -#if defined(SDL_JOYSTICK_MFI) && defined(ENABLE_PHYSICAL_INPUT_PROFILE) +#ifdef SDL_JOYSTICK_MFI if (gamepad && SDL_GetGamepadJoystick(gamepad)->driver == &SDL_IOS_JoystickDriver) { if (@available(macOS 10.16, iOS 14.0, tvOS 14.0, *)) { GCController *controller = SDL_GetGamepadJoystick(gamepad)->hwdata->controller; - if ([controller respondsToSelector:@selector(physicalInputProfile)]) { - NSDictionary *elements = controller.physicalInputProfile.elements; - switch (button) { - case SDL_GAMEPAD_BUTTON_SOUTH: - GetAppleSFSymbolsNameForElement(elements[GCInputButtonA], elementName); - break; - case SDL_GAMEPAD_BUTTON_EAST: - GetAppleSFSymbolsNameForElement(elements[GCInputButtonB], elementName); - break; - case SDL_GAMEPAD_BUTTON_WEST: - GetAppleSFSymbolsNameForElement(elements[GCInputButtonX], elementName); - break; - case SDL_GAMEPAD_BUTTON_NORTH: - GetAppleSFSymbolsNameForElement(elements[GCInputButtonY], elementName); - break; - case SDL_GAMEPAD_BUTTON_BACK: - GetAppleSFSymbolsNameForElement(elements[GCInputButtonOptions], elementName); - break; - case SDL_GAMEPAD_BUTTON_GUIDE: - GetAppleSFSymbolsNameForElement(elements[@"Button Home"], elementName); - break; - case SDL_GAMEPAD_BUTTON_START: - GetAppleSFSymbolsNameForElement(elements[GCInputButtonMenu], elementName); - break; - case SDL_GAMEPAD_BUTTON_LEFT_STICK: - GetAppleSFSymbolsNameForElement(elements[GCInputLeftThumbstickButton], elementName); - break; - case SDL_GAMEPAD_BUTTON_RIGHT_STICK: - GetAppleSFSymbolsNameForElement(elements[GCInputRightThumbstickButton], elementName); - break; - case SDL_GAMEPAD_BUTTON_LEFT_SHOULDER: - GetAppleSFSymbolsNameForElement(elements[GCInputLeftShoulder], elementName); - break; - case SDL_GAMEPAD_BUTTON_RIGHT_SHOULDER: - GetAppleSFSymbolsNameForElement(elements[GCInputRightShoulder], elementName); - break; - case SDL_GAMEPAD_BUTTON_DPAD_UP: - { - GCControllerDirectionPad *dpad = GetDirectionalPadForController(controller); - if (dpad) { - GetAppleSFSymbolsNameForElement(dpad.up, elementName); - if (SDL_strlen(elementName) == 0) { - SDL_strlcpy(elementName, "dpad.up.fill", sizeof(elementName)); - } + NSDictionary *elements = controller.physicalInputProfile.elements; + switch (button) { + case SDL_GAMEPAD_BUTTON_SOUTH: + GetAppleSFSymbolsNameForElement(elements[GCInputButtonA], elementName); + break; + case SDL_GAMEPAD_BUTTON_EAST: + GetAppleSFSymbolsNameForElement(elements[GCInputButtonB], elementName); + break; + case SDL_GAMEPAD_BUTTON_WEST: + GetAppleSFSymbolsNameForElement(elements[GCInputButtonX], elementName); + break; + case SDL_GAMEPAD_BUTTON_NORTH: + GetAppleSFSymbolsNameForElement(elements[GCInputButtonY], elementName); + break; + case SDL_GAMEPAD_BUTTON_BACK: + GetAppleSFSymbolsNameForElement(elements[GCInputButtonOptions], elementName); + break; + case SDL_GAMEPAD_BUTTON_GUIDE: + GetAppleSFSymbolsNameForElement(elements[@"Button Home"], elementName); + break; + case SDL_GAMEPAD_BUTTON_START: + GetAppleSFSymbolsNameForElement(elements[GCInputButtonMenu], elementName); + break; + case SDL_GAMEPAD_BUTTON_LEFT_STICK: + GetAppleSFSymbolsNameForElement(elements[GCInputLeftThumbstickButton], elementName); + break; + case SDL_GAMEPAD_BUTTON_RIGHT_STICK: + GetAppleSFSymbolsNameForElement(elements[GCInputRightThumbstickButton], elementName); + break; + case SDL_GAMEPAD_BUTTON_LEFT_SHOULDER: + GetAppleSFSymbolsNameForElement(elements[GCInputLeftShoulder], elementName); + break; + case SDL_GAMEPAD_BUTTON_RIGHT_SHOULDER: + GetAppleSFSymbolsNameForElement(elements[GCInputRightShoulder], elementName); + break; + case SDL_GAMEPAD_BUTTON_DPAD_UP: + { + GCControllerDirectionPad *dpad = GetDirectionalPadForController(controller); + if (dpad) { + GetAppleSFSymbolsNameForElement(dpad.up, elementName); + if (SDL_strlen(elementName) == 0) { + SDL_strlcpy(elementName, "dpad.up.fill", sizeof(elementName)); } - break; } - case SDL_GAMEPAD_BUTTON_DPAD_DOWN: - { - GCControllerDirectionPad *dpad = GetDirectionalPadForController(controller); - if (dpad) { - GetAppleSFSymbolsNameForElement(dpad.down, elementName); - if (SDL_strlen(elementName) == 0) { - SDL_strlcpy(elementName, "dpad.down.fill", sizeof(elementName)); - } + break; + } + case SDL_GAMEPAD_BUTTON_DPAD_DOWN: + { + GCControllerDirectionPad *dpad = GetDirectionalPadForController(controller); + if (dpad) { + GetAppleSFSymbolsNameForElement(dpad.down, elementName); + if (SDL_strlen(elementName) == 0) { + SDL_strlcpy(elementName, "dpad.down.fill", sizeof(elementName)); } - break; } - case SDL_GAMEPAD_BUTTON_DPAD_LEFT: - { - GCControllerDirectionPad *dpad = GetDirectionalPadForController(controller); - if (dpad) { - GetAppleSFSymbolsNameForElement(dpad.left, elementName); - if (SDL_strlen(elementName) == 0) { - SDL_strlcpy(elementName, "dpad.left.fill", sizeof(elementName)); - } + break; + } + case SDL_GAMEPAD_BUTTON_DPAD_LEFT: + { + GCControllerDirectionPad *dpad = GetDirectionalPadForController(controller); + if (dpad) { + GetAppleSFSymbolsNameForElement(dpad.left, elementName); + if (SDL_strlen(elementName) == 0) { + SDL_strlcpy(elementName, "dpad.left.fill", sizeof(elementName)); } - break; } - case SDL_GAMEPAD_BUTTON_DPAD_RIGHT: - { - GCControllerDirectionPad *dpad = GetDirectionalPadForController(controller); - if (dpad) { - GetAppleSFSymbolsNameForElement(dpad.right, elementName); - if (SDL_strlen(elementName) == 0) { - SDL_strlcpy(elementName, "dpad.right.fill", sizeof(elementName)); - } + break; + } + case SDL_GAMEPAD_BUTTON_DPAD_RIGHT: + { + GCControllerDirectionPad *dpad = GetDirectionalPadForController(controller); + if (dpad) { + GetAppleSFSymbolsNameForElement(dpad.right, elementName); + if (SDL_strlen(elementName) == 0) { + SDL_strlcpy(elementName, "dpad.right.fill", sizeof(elementName)); } - break; - } - case SDL_GAMEPAD_BUTTON_MISC1: - GetAppleSFSymbolsNameForElement(elements[GCInputDualShockTouchpadButton], elementName); - break; - case SDL_GAMEPAD_BUTTON_RIGHT_PADDLE1: - GetAppleSFSymbolsNameForElement(elements[GCInputXboxPaddleOne], elementName); - break; - case SDL_GAMEPAD_BUTTON_LEFT_PADDLE1: - GetAppleSFSymbolsNameForElement(elements[GCInputXboxPaddleThree], elementName); - break; - case SDL_GAMEPAD_BUTTON_RIGHT_PADDLE2: - GetAppleSFSymbolsNameForElement(elements[GCInputXboxPaddleTwo], elementName); - break; - case SDL_GAMEPAD_BUTTON_LEFT_PADDLE2: - GetAppleSFSymbolsNameForElement(elements[GCInputXboxPaddleFour], elementName); - break; - case SDL_GAMEPAD_BUTTON_TOUCHPAD: - GetAppleSFSymbolsNameForElement(elements[GCInputDualShockTouchpadButton], elementName); - break; - default: - break; } + break; + } + case SDL_GAMEPAD_BUTTON_MISC1: + GetAppleSFSymbolsNameForElement(elements[GCInputDualShockTouchpadButton], elementName); + break; + case SDL_GAMEPAD_BUTTON_RIGHT_PADDLE1: + GetAppleSFSymbolsNameForElement(elements[GCInputXboxPaddleOne], elementName); + break; + case SDL_GAMEPAD_BUTTON_LEFT_PADDLE1: + GetAppleSFSymbolsNameForElement(elements[GCInputXboxPaddleThree], elementName); + break; + case SDL_GAMEPAD_BUTTON_RIGHT_PADDLE2: + GetAppleSFSymbolsNameForElement(elements[GCInputXboxPaddleTwo], elementName); + break; + case SDL_GAMEPAD_BUTTON_LEFT_PADDLE2: + GetAppleSFSymbolsNameForElement(elements[GCInputXboxPaddleFour], elementName); + break; + case SDL_GAMEPAD_BUTTON_TOUCHPAD: + GetAppleSFSymbolsNameForElement(elements[GCInputDualShockTouchpadButton], elementName); + break; + default: + break; } } } -#endif +#endif // SDL_JOYSTICK_MFI return *elementName ? SDL_GetPersistentString(elementName) : NULL; } @@ -2044,38 +1889,37 @@ static void GetAppleSFSymbolsNameForElement(GCControllerElement *element, char * char elementName[256]; elementName[0] = '\0'; -#if defined(SDL_JOYSTICK_MFI) && defined(ENABLE_PHYSICAL_INPUT_PROFILE) +#ifdef SDL_JOYSTICK_MFI if (gamepad && SDL_GetGamepadJoystick(gamepad)->driver == &SDL_IOS_JoystickDriver) { if (@available(macOS 10.16, iOS 14.0, tvOS 14.0, *)) { GCController *controller = SDL_GetGamepadJoystick(gamepad)->hwdata->controller; - if ([controller respondsToSelector:@selector(physicalInputProfile)]) { - NSDictionary *elements = controller.physicalInputProfile.elements; - switch (axis) { - case SDL_GAMEPAD_AXIS_LEFTX: - GetAppleSFSymbolsNameForElement(elements[GCInputLeftThumbstick], elementName); - break; - case SDL_GAMEPAD_AXIS_LEFTY: - GetAppleSFSymbolsNameForElement(elements[GCInputLeftThumbstick], elementName); - break; - case SDL_GAMEPAD_AXIS_RIGHTX: - GetAppleSFSymbolsNameForElement(elements[GCInputRightThumbstick], elementName); - break; - case SDL_GAMEPAD_AXIS_RIGHTY: - GetAppleSFSymbolsNameForElement(elements[GCInputRightThumbstick], elementName); - break; - case SDL_GAMEPAD_AXIS_LEFT_TRIGGER: - GetAppleSFSymbolsNameForElement(elements[GCInputLeftTrigger], elementName); - break; - case SDL_GAMEPAD_AXIS_RIGHT_TRIGGER: - GetAppleSFSymbolsNameForElement(elements[GCInputRightTrigger], elementName); - break; - default: - break; - } + NSDictionary *elements = controller.physicalInputProfile.elements; + switch (axis) { + case SDL_GAMEPAD_AXIS_LEFTX: + GetAppleSFSymbolsNameForElement(elements[GCInputLeftThumbstick], elementName); + break; + case SDL_GAMEPAD_AXIS_LEFTY: + GetAppleSFSymbolsNameForElement(elements[GCInputLeftThumbstick], elementName); + break; + case SDL_GAMEPAD_AXIS_RIGHTX: + GetAppleSFSymbolsNameForElement(elements[GCInputRightThumbstick], elementName); + break; + case SDL_GAMEPAD_AXIS_RIGHTY: + GetAppleSFSymbolsNameForElement(elements[GCInputRightThumbstick], elementName); + break; + case SDL_GAMEPAD_AXIS_LEFT_TRIGGER: + GetAppleSFSymbolsNameForElement(elements[GCInputLeftTrigger], elementName); + break; + case SDL_GAMEPAD_AXIS_RIGHT_TRIGGER: + GetAppleSFSymbolsNameForElement(elements[GCInputRightTrigger], elementName); + break; + default: + break; } } } -#endif +#endif // SDL_JOYSTICK_MFI + return *elementName ? SDL_GetPersistentString(elementName) : NULL; } diff --git a/src/misc/ios/SDL_sysurl.m b/src/misc/ios/SDL_sysurl.m index 1cc39b7cb739e..1221edadbea6a 100644 --- a/src/misc/ios/SDL_sysurl.m +++ b/src/misc/ios/SDL_sysurl.m @@ -34,13 +34,7 @@ bool SDL_SYS_OpenURL(const char *url) if (![[UIApplication sharedApplication] canOpenURL:nsurl]) { return SDL_SetError("No handler registered for this type of URL"); } - if (@available(iOS 10.0, tvOS 10.0, *)) { - [[UIApplication sharedApplication] openURL:nsurl options:@{} completionHandler:^(BOOL success) {}]; - } else { - #ifndef SDL_PLATFORM_VISIONOS // Fallback is never available in any version of VisionOS (but correct API always is). - [[UIApplication sharedApplication] openURL:nsurl]; - #endif - } + [[UIApplication sharedApplication] openURL:nsurl options:@{} completionHandler:^(BOOL success) {}]; return true; } } diff --git a/src/render/metal/SDL_render_metal.m b/src/render/metal/SDL_render_metal.m index 14ce4882bb4f2..0aac565d3888b 100644 --- a/src/render/metal/SDL_render_metal.m +++ b/src/render/metal/SDL_render_metal.m @@ -25,7 +25,6 @@ #include "../SDL_sysrender.h" #include "../../video/SDL_pixels_c.h" -#include #import #import #import @@ -171,18 +170,6 @@ @interface SDL3METAL_TextureData : NSObject @implementation SDL3METAL_TextureData @end -static bool IsMetalAvailable() -{ -#if (defined(SDL_PLATFORM_MACOS) && (MAC_OS_X_VERSION_MIN_REQUIRED < 101100)) - // this checks a weak symbol. - if (MTLCreateSystemDefaultDevice == NULL) { // probably on 10.10 or lower. - SDL_SetError("Metal framework not available on this system"); - return false; - } -#endif - return true; -} - static const MTLBlendOperation invalidBlendOperation = (MTLBlendOperation)0xFFFFFFFF; static const MTLBlendFactor invalidBlendFactor = (MTLBlendFactor)0xFFFFFFFF; @@ -690,19 +677,14 @@ static bool METAL_CreateTexture(SDL_Renderer *renderer, SDL_Texture *texture, SD height:(NSUInteger)texture->h mipmapped:NO]; - // Not available in iOS 8. - if ([mtltexdesc respondsToSelector:@selector(usage)]) { - if (texture->access == SDL_TEXTUREACCESS_TARGET) { - mtltexdesc.usage = MTLTextureUsageShaderRead | MTLTextureUsageRenderTarget; - } else { - mtltexdesc.usage = MTLTextureUsageShaderRead; - } + if (texture->access == SDL_TEXTUREACCESS_TARGET) { + mtltexdesc.usage = MTLTextureUsageShaderRead | MTLTextureUsageRenderTarget; + } else { + mtltexdesc.usage = MTLTextureUsageShaderRead; } if (surface) { - if (@available(iOS 11.0, tvOS 11.0, *)) { - mtltexture = [data.mtldevice newTextureWithDescriptor:mtltexdesc iosurface:surface plane:0]; - } + mtltexture = [data.mtldevice newTextureWithDescriptor:mtltexdesc iosurface:surface plane:0]; } else { mtltexture = [data.mtldevice newTextureWithDescriptor:mtltexdesc]; } @@ -733,9 +715,7 @@ static bool METAL_CreateTexture(SDL_Renderer *renderer, SDL_Texture *texture, SD if (yuv || nv12) { if (surface) { - if (@available(iOS 11.0, tvOS 11.0, *)) { - mtltextureUv = [data.mtldevice newTextureWithDescriptor:mtltexdesc iosurface:surface plane:1]; - } + mtltextureUv = [data.mtldevice newTextureWithDescriptor:mtltexdesc iosurface:surface plane:1]; } else { mtltextureUv = [data.mtldevice newTextureWithDescriptor:mtltexdesc]; } @@ -787,11 +767,7 @@ static void METAL_UploadTextureData(id texture, SDL_Rect rect, int s static MTLStorageMode METAL_GetStorageMode(id resource) { - // iOS 8 does not have this method. - if ([resource respondsToSelector:@selector(storageMode)]) { - return resource.storageMode; - } - return MTLStorageModeShared; + return resource.storageMode; } static bool METAL_UpdateTextureInternal(SDL_Renderer *renderer, SDL3METAL_TextureData *texturedata, @@ -1845,28 +1821,27 @@ in case we want to use it later (recreating the renderer) static bool METAL_SetVSync(SDL_Renderer *renderer, const int vsync) { -#if (defined(SDL_PLATFORM_MACOS) && defined(MAC_OS_X_VERSION_10_13)) || TARGET_OS_MACCATALYST - if (@available(macOS 10.13, *)) { - SDL3METAL_RenderData *data = (__bridge SDL3METAL_RenderData *)renderer->internal; - switch (vsync) { - case 0: - data.mtllayer.displaySyncEnabled = NO; - break; - case 1: - data.mtllayer.displaySyncEnabled = YES; - break; - default: - return SDL_Unsupported(); - } - return true; +#if defined(SDL_PLATFORM_MACOS) || TARGET_OS_MACCATALYST + SDL3METAL_RenderData *data = (__bridge SDL3METAL_RenderData *)renderer->internal; + switch (vsync) { + case 0: + data.mtllayer.displaySyncEnabled = NO; + break; + case 1: + data.mtllayer.displaySyncEnabled = YES; + break; + default: + return SDL_Unsupported(); } -#endif + return true; +#else switch (vsync) { case 1: return true; default: return SDL_Unsupported(); } +#endif } static SDL_MetalView GetWindowView(SDL_Window *window) @@ -1961,10 +1936,6 @@ static bool METAL_CreateRenderer(SDL_Renderer *renderer, SDL_Window *window, SDL const size_t YCbCr_shader_matrix_size = 4 * 4 * sizeof(float); - if (!IsMetalAvailable()) { - return false; - } - SDL_SetupRendererColorspace(renderer, create_props); #ifndef SDL_PLATFORM_TVOS @@ -2187,10 +2158,8 @@ in case we want to use it later (recreating the renderer) SDL_AddSupportedTextureFormat(renderer, SDL_PIXELFORMAT_NV21); SDL_AddSupportedTextureFormat(renderer, SDL_PIXELFORMAT_P010); -#if (defined(SDL_PLATFORM_MACOS) && defined(MAC_OS_X_VERSION_10_13)) || TARGET_OS_MACCATALYST - if (@available(macOS 10.13, *)) { - data.mtllayer.displaySyncEnabled = NO; - } +#if defined(SDL_PLATFORM_MACOS) || TARGET_OS_MACCATALYST + data.mtllayer.displaySyncEnabled = NO; #endif // https://developer.apple.com/metal/Metal-Feature-Set-Tables.pdf @@ -2199,28 +2168,15 @@ in case we want to use it later (recreating the renderer) maxtexsize = 16384; #elif defined(SDL_PLATFORM_TVOS) maxtexsize = 8192; -#ifdef __TVOS_11_0 - if (@available(tvOS 11.0, *)) { - if ([mtldevice supportsFeatureSet:MTLFeatureSet_tvOS_GPUFamily2_v1]) { - maxtexsize = 16384; - } + if ([mtldevice supportsFeatureSet:MTLFeatureSet_tvOS_GPUFamily2_v1]) { + maxtexsize = 16384; } -#endif #else -#ifdef __IPHONE_11_0 -#pragma clang diagnostic push -#pragma clang diagnostic ignored "-Wunguarded-availability-new" if ([mtldevice supportsFeatureSet:MTLFeatureSet_iOS_GPUFamily4_v1]) { maxtexsize = 16384; - } else -#pragma clang diagnostic pop -#endif -#ifdef __IPHONE_10_0 - if ([mtldevice supportsFeatureSet:MTLFeatureSet_iOS_GPUFamily3_v1]) { + } else if ([mtldevice supportsFeatureSet:MTLFeatureSet_iOS_GPUFamily3_v1]) { maxtexsize = 16384; - } else -#endif - if ([mtldevice supportsFeatureSet:MTLFeatureSet_iOS_GPUFamily2_v2] || [mtldevice supportsFeatureSet:MTLFeatureSet_iOS_GPUFamily1_v2]) { + } else if ([mtldevice supportsFeatureSet:MTLFeatureSet_iOS_GPUFamily2_v2] || [mtldevice supportsFeatureSet:MTLFeatureSet_iOS_GPUFamily1_v2]) { maxtexsize = 8192; } else { maxtexsize = 4096; diff --git a/src/video/cocoa/SDL_cocoaclipboard.m b/src/video/cocoa/SDL_cocoaclipboard.m index 5254c770a4eda..42c2ad64baa20 100644 --- a/src/video/cocoa/SDL_cocoaclipboard.m +++ b/src/video/cocoa/SDL_cocoaclipboard.m @@ -28,10 +28,6 @@ #include -#if MAC_OS_X_VERSION_MAX_ALLOWED < 101300 -typedef NSString *NSPasteboardType; // Defined in macOS 10.13+ -#endif - @interface Cocoa_PasteboardDataProvider : NSObject { SDL_ClipboardDataCallback m_callback; diff --git a/src/video/cocoa/SDL_cocoaevents.m b/src/video/cocoa/SDL_cocoaevents.m index 89f72b2bd20d1..74c5c192b5681 100644 --- a/src/video/cocoa/SDL_cocoaevents.m +++ b/src/video/cocoa/SDL_cocoaevents.m @@ -25,10 +25,6 @@ #include "SDL_cocoavideo.h" #include "../../events/SDL_events_c.h" -#ifndef MAC_OS_X_VERSION_10_12 -#define NSEventTypeApplicationDefined NSApplicationDefined -#endif - static SDL_Window *FindSDLWindowForNSWindow(NSWindow *win) { SDL_Window *sdlwindow = NULL; diff --git a/src/video/cocoa/SDL_cocoamodes.m b/src/video/cocoa/SDL_cocoamodes.m index 77968cc7cc96a..4fd245a21f683 100644 --- a/src/video/cocoa/SDL_cocoamodes.m +++ b/src/video/cocoa/SDL_cocoamodes.m @@ -32,12 +32,6 @@ #include #include -// This gets us MAC_OS_X_VERSION_MIN_REQUIRED... -#include - -#ifndef MAC_OS_X_VERSION_10_13 -#define NSAppKitVersionNumber10_12 1504 -#endif #if (IOGRAPHICSTYPES_REV < 40) #define kDisplayModeNativeFlag 0x02000000 #endif @@ -307,7 +301,6 @@ static void Cocoa_GetHDRProperties(CGDirectDisplayID displayID, SDL_HDROutputPro HDR->SDR_white_level = 1.0f; HDR->HDR_headroom = 1.0f; -#if MAC_OS_X_VERSION_MAX_ALLOWED >= 101500 // Added in the 10.15 SDK if (@available(macOS 10.15, *)) { NSScreen *screen = GetNSScreenForDisplayID(displayID); if (screen) { @@ -318,7 +311,6 @@ static void Cocoa_GetHDRProperties(CGDirectDisplayID displayID, SDL_HDROutputPro } } } -#endif } diff --git a/src/video/cocoa/SDL_cocoavideo.h b/src/video/cocoa/SDL_cocoavideo.h index f4d649dc3eeee..75c1ec79f0490 100644 --- a/src/video/cocoa/SDL_cocoavideo.h +++ b/src/video/cocoa/SDL_cocoavideo.h @@ -40,59 +40,6 @@ #include "SDL_cocoawindow.h" #include "SDL_cocoapen.h" -#ifndef MAC_OS_X_VERSION_10_12 -#define DECLARE_EVENT(name) static const NSEventType NSEventType##name = NS##name -DECLARE_EVENT(LeftMouseDown); -DECLARE_EVENT(LeftMouseUp); -DECLARE_EVENT(RightMouseDown); -DECLARE_EVENT(RightMouseUp); -DECLARE_EVENT(OtherMouseDown); -DECLARE_EVENT(OtherMouseUp); -DECLARE_EVENT(MouseMoved); -DECLARE_EVENT(LeftMouseDragged); -DECLARE_EVENT(RightMouseDragged); -DECLARE_EVENT(OtherMouseDragged); -DECLARE_EVENT(ScrollWheel); -DECLARE_EVENT(KeyDown); -DECLARE_EVENT(KeyUp); -DECLARE_EVENT(FlagsChanged); -#undef DECLARE_EVENT - -static const NSEventMask NSEventMaskAny = NSAnyEventMask; - -#define DECLARE_MODIFIER_FLAG(name) static const NSUInteger NSEventModifierFlag##name = NS##name##KeyMask -DECLARE_MODIFIER_FLAG(Shift); -DECLARE_MODIFIER_FLAG(Control); -DECLARE_MODIFIER_FLAG(Command); -DECLARE_MODIFIER_FLAG(NumericPad); -DECLARE_MODIFIER_FLAG(Help); -DECLARE_MODIFIER_FLAG(Function); -#undef DECLARE_MODIFIER_FLAG -static const NSUInteger NSEventModifierFlagCapsLock = NSAlphaShiftKeyMask; -static const NSUInteger NSEventModifierFlagOption = NSAlternateKeyMask; - -#define DECLARE_WINDOW_MASK(name) static const unsigned int NSWindowStyleMask##name = NS##name##WindowMask -DECLARE_WINDOW_MASK(Borderless); -DECLARE_WINDOW_MASK(Titled); -DECLARE_WINDOW_MASK(Closable); -DECLARE_WINDOW_MASK(Miniaturizable); -DECLARE_WINDOW_MASK(Resizable); -DECLARE_WINDOW_MASK(TexturedBackground); -DECLARE_WINDOW_MASK(UnifiedTitleAndToolbar); -DECLARE_WINDOW_MASK(FullScreen); -/*DECLARE_WINDOW_MASK(FullSizeContentView);*/ // Not used, fails compile on older SDKs -static const unsigned int NSWindowStyleMaskUtilityWindow = NSUtilityWindowMask; -static const unsigned int NSWindowStyleMaskDocModalWindow = NSDocModalWindowMask; -static const unsigned int NSWindowStyleMaskHUDWindow = NSHUDWindowMask; -#undef DECLARE_WINDOW_MASK - -#define DECLARE_ALERT_STYLE(name) static const NSUInteger NSAlertStyle##name = NS##name##AlertStyle -DECLARE_ALERT_STYLE(Warning); -DECLARE_ALERT_STYLE(Informational); -DECLARE_ALERT_STYLE(Critical); -#undef DECLARE_ALERT_STYLE -#endif - // Private display data @class SDL3TranslatorResponder; @@ -112,9 +59,4 @@ DECLARE_ALERT_STYLE(Critical); extern SDL_SystemTheme Cocoa_GetSystemTheme(void); extern NSImage *Cocoa_CreateImage(SDL_Surface *surface); -// Fix build with the 10.11 SDK -#if MAC_OS_X_VERSION_MAX_ALLOWED < 101200 -#define NSEventSubtypeMouseEvent NSMouseEventSubtype -#endif - #endif // SDL_cocoavideo_h_ diff --git a/src/video/cocoa/SDL_cocoavideo.m b/src/video/cocoa/SDL_cocoavideo.m index 7d595e1366ada..b9977c441bc91 100644 --- a/src/video/cocoa/SDL_cocoavideo.m +++ b/src/video/cocoa/SDL_cocoavideo.m @@ -245,15 +245,13 @@ void Cocoa_VideoQuit(SDL_VideoDevice *_this) // This function assumes that it's called from within an autorelease pool SDL_SystemTheme Cocoa_GetSystemTheme(void) { -#if MAC_OS_X_VERSION_MAX_ALLOWED >= 101400 // Added in the 10.14.0 SDK. - if ([[NSApplication sharedApplication] respondsToSelector:@selector(effectiveAppearance)]) { + if (@available(macOS 10.14, *)) { NSAppearance* appearance = [[NSApplication sharedApplication] effectiveAppearance]; if ([appearance.name containsString: @"Dark"]) { return SDL_SYSTEM_THEME_DARK; } } -#endif return SDL_SYSTEM_THEME_LIGHT; } diff --git a/src/video/cocoa/SDL_cocoawindow.m b/src/video/cocoa/SDL_cocoawindow.m index 01fdc7b422df4..2ca579513d57c 100644 --- a/src/video/cocoa/SDL_cocoawindow.m +++ b/src/video/cocoa/SDL_cocoawindow.m @@ -22,10 +22,6 @@ #ifdef SDL_VIDEO_DRIVER_COCOA -#if MAC_OS_X_VERSION_MAX_ALLOWED < 1090 -#error SDL for macOS must be built with a 10.9 SDK or above. -#endif // MAC_OS_X_VERSION_MAX_ALLOWED < 1090 - #include // For FLT_MAX #include "../../events/SDL_dropevents_c.h" @@ -71,10 +67,6 @@ @interface NSScreen (SDL) @end @interface NSWindow (SDL) -#if MAC_OS_X_VERSION_MAX_ALLOWED < 101000 // Added in the 10.10 SDK -@property(readonly) NSRect contentLayoutRect; -#endif - // This is available as of 10.13.2, but isn't in public headers @property(nonatomic) NSRect mouseConfinementRect; @end @@ -1944,20 +1936,16 @@ - (void)handleTouches:(NSTouchPhase)phase withEvent:(NSEvent *)theEvent */ SDL_Window *window = NULL; -#if MAC_OS_X_VERSION_MAX_ALLOWED >= 101202 // Added in the 10.12.2 SDK. - if ([touch respondsToSelector:@selector(type)]) { - /* TODO: Before implementing direct touch support here, we need to - * figure out whether the OS generates mouse events from them on its - * own. If it does, we should prevent SendTouch from generating - * synthetic mouse events for these touches itself (while also - * sending a window.) It will also need to use normalized window- - * relative coordinates via [touch locationInView:]. - */ - if ([touch type] == NSTouchTypeDirect) { - continue; - } + /* TODO: Before implementing direct touch support here, we need to + * figure out whether the OS generates mouse events from them on its + * own. If it does, we should prevent SendTouch from generating + * synthetic mouse events for these touches itself (while also + * sending a window.) It will also need to use normalized window- + * relative coordinates via [touch locationInView:]. + */ + if ([touch type] == NSTouchTypeDirect) { + continue; } -#endif if (SDL_AddTouch(touchId, devtype, "") < 0) { return; @@ -2301,12 +2289,7 @@ bool Cocoa_CreateWindow(SDL_VideoDevice *_this, SDL_Window *window, SDL_Properti [nswindow setColorSpace:[NSColorSpace sRGBColorSpace]]; -#if MAC_OS_X_VERSION_MAX_ALLOWED >= 101200 // Added in the 10.12.0 SDK. - // By default, don't allow users to make our window tabbed in 10.12 or later - if ([nswindow respondsToSelector:@selector(setTabbingMode:)]) { - [nswindow setTabbingMode:NSWindowTabbingModeDisallowed]; - } -#endif + [nswindow setTabbingMode:NSWindowTabbingModeDisallowed]; if (videodata.allow_spaces) { // we put fullscreen desktop windows in their own Space, without a toggle button or menubar, later @@ -2351,8 +2334,7 @@ bool Cocoa_CreateWindow(SDL_VideoDevice *_this, SDL_Window *window, SDL_Properti if ((window->flags & SDL_WINDOW_OPENGL) && _this->gl_config.profile_mask == SDL_GL_CONTEXT_PROFILE_ES) { [nsview setWantsLayer:TRUE]; - if ((window->flags & SDL_WINDOW_HIGH_PIXEL_DENSITY) && - [nswindow.screen respondsToSelector:@selector(backingScaleFactor)]) { + if ((window->flags & SDL_WINDOW_HIGH_PIXEL_DENSITY)) { nsview.layer.contentsScale = nswindow.screen.backingScaleFactor; } else { nsview.layer.contentsScale = 1; diff --git a/src/video/uikit/SDL_uikitappdelegate.m b/src/video/uikit/SDL_uikitappdelegate.m index e1521312a3f9f..6a37e51129886 100644 --- a/src/video/uikit/SDL_uikitappdelegate.m +++ b/src/video/uikit/SDL_uikitappdelegate.m @@ -30,14 +30,6 @@ #include "../../events/SDL_events_c.h" -#ifndef SDL_PLATFORM_TVOS -#include - -#ifndef __IPHONE_13_0 -#define __IPHONE_13_0 130000 -#endif -#endif - #ifdef main #undef main #endif @@ -159,13 +151,11 @@ - (UIStatusBarStyle)preferredStatusBarStyle if ([statusBarStyle isEqualToString:@"UIStatusBarStyleLightContent"]) { return UIStatusBarStyleLightContent; } -#if __IPHONE_OS_VERSION_MAX_ALLOWED >= __IPHONE_13_0 if (@available(iOS 13.0, *)) { if ([statusBarStyle isEqualToString:@"UIStatusBarStyleDarkContent"]) { return UIStatusBarStyleDarkContent; } } -#endif return UIStatusBarStyleDefault; } @@ -517,8 +507,6 @@ - (void)sendDropFileForURL:(NSURL *)url fromSourceApplication:(NSString *)source SDL_SendDropComplete(NULL); } -#if defined(SDL_PLATFORM_TVOS) || (defined(__IPHONE_9_0) && __IPHONE_OS_VERSION_MIN_REQUIRED >= __IPHONE_9_0) - - (BOOL)application:(UIApplication *)app openURL:(NSURL *)url options:(NSDictionary *)options { // TODO: Handle options @@ -526,16 +514,6 @@ - (BOOL)application:(UIApplication *)app openURL:(NSURL *)url options:(NSDiction return YES; } -#else - -- (BOOL)application:(UIApplication *)application openURL:(NSURL *)url sourceApplication:(NSString *)sourceApplication annotation:(id)annotation -{ - [self sendDropFileForURL:url fromSourceApplication:sourceApplication]; - return YES; -} - -#endif - @end #endif // SDL_VIDEO_DRIVER_UIKIT diff --git a/src/video/uikit/SDL_uikitevents.m b/src/video/uikit/SDL_uikitevents.m index 660bf6b7f131b..8479b4f44163e 100644 --- a/src/video/uikit/SDL_uikitevents.m +++ b/src/video/uikit/SDL_uikitevents.m @@ -31,14 +31,8 @@ #include "SDL_uikitwindow.h" #import - -#if (__IPHONE_OS_VERSION_MAX_ALLOWED >= 140000) || (__APPLETV_OS_VERSION_MAX_ALLOWED >= 140000) || (__MAC_OS_VERSION_MAX_ALLOWED > 1500000) #import -#define ENABLE_GCKEYBOARD -#define ENABLE_GCMOUSE -#endif - static BOOL UIKit_EventPumpEnabled = YES; @interface SDL_LifecycleObserver : NSObject @@ -175,8 +169,6 @@ touch events to get processed (which is important to get certain #endif } -#ifdef ENABLE_GCKEYBOARD - static id keyboard_connect_observer = nil; static id keyboard_disconnect_observer = nil; @@ -257,20 +249,6 @@ void SDL_QuitGCKeyboard(void) } } -#else - -void SDL_InitGCKeyboard(void) -{ -} - -void SDL_QuitGCKeyboard(void) -{ -} - -#endif // ENABLE_GCKEYBOARD - -#ifdef ENABLE_GCMOUSE - static id mouse_connect_observer = nil; static id mouse_disconnect_observer = nil; static bool mouse_relative_mode = false; @@ -471,21 +449,4 @@ void SDL_QuitGCMouse(void) } } -#else - -void SDL_InitGCMouse(void) -{ -} - -bool SDL_GCMouseRelativeMode(void) -{ - return false; -} - -void SDL_QuitGCMouse(void) -{ -} - -#endif // ENABLE_GCMOUSE - #endif // SDL_VIDEO_DRIVER_UIKIT diff --git a/src/video/uikit/SDL_uikitmodes.m b/src/video/uikit/SDL_uikitmodes.m index e2ac1a6dc4f47..d3247dbd98e02 100644 --- a/src/video/uikit/SDL_uikitmodes.m +++ b/src/video/uikit/SDL_uikitmodes.m @@ -131,12 +131,7 @@ static void UIKit_FreeDisplayModeData(SDL_DisplayMode *mode) #ifndef SDL_PLATFORM_VISIONOS static float UIKit_GetDisplayModeRefreshRate(UIScreen *uiscreen) { -#ifdef __IPHONE_10_3 - if ([uiscreen respondsToSelector:@selector(maximumFramesPerSecond)]) { - return (float)uiscreen.maximumFramesPerSecond; - } -#endif - return 0.0f; + return (float)uiscreen.maximumFramesPerSecond; } static bool UIKit_AddSingleDisplayMode(SDL_VideoDisplay *display, int w, int h, diff --git a/src/video/uikit/SDL_uikitpen.h b/src/video/uikit/SDL_uikitpen.h index 39887e6a37084..1e755892c287a 100644 --- a/src/video/uikit/SDL_uikitpen.h +++ b/src/video/uikit/SDL_uikitpen.h @@ -30,7 +30,7 @@ extern void UIKit_HandlePenMotion(SDL_uikitview *view, UITouch *pencil); extern void UIKit_HandlePenPress(SDL_uikitview *view, UITouch *pencil); extern void UIKit_HandlePenRelease(SDL_uikitview *view, UITouch *pencil); -#if !defined(SDL_PLATFORM_TVOS) && defined(__IPHONE_13_0) +#if !defined(SDL_PLATFORM_TVOS) extern void UIKit_HandlePenHover(SDL_uikitview *view, UIHoverGestureRecognizer *recognizer) API_AVAILABLE(ios(13.0)); #endif diff --git a/src/video/uikit/SDL_uikitpen.m b/src/video/uikit/SDL_uikitpen.m index 9b83e7e7d0e16..622513c24d37a 100644 --- a/src/video/uikit/SDL_uikitpen.m +++ b/src/video/uikit/SDL_uikitpen.m @@ -107,7 +107,7 @@ static void UIKit_HandlePenAxes(SDL_Window *window, NSTimeInterval nstimestamp, } } -#if !defined(SDL_PLATFORM_TVOS) && defined(__IPHONE_13_0) +#if !defined(SDL_PLATFORM_TVOS) extern void UIKit_HandlePenHover(SDL_uikitview *view, UIHoverGestureRecognizer *recognizer) { float zOffset = 0.0f; diff --git a/src/video/uikit/SDL_uikitvideo.m b/src/video/uikit/SDL_uikitvideo.m index 02f097232ee40..43f0b30da3b8a 100644 --- a/src/video/uikit/SDL_uikitvideo.m +++ b/src/video/uikit/SDL_uikitvideo.m @@ -259,13 +259,8 @@ void UIKit_ForceUpdateHomeIndicator(void) if (focus) { SDL_UIKitWindowData *data = (__bridge SDL_UIKitWindowData *)focus->internal; if (data != nil) { -#pragma clang diagnostic push -#pragma clang diagnostic ignored "-Wunguarded-availability-new" - if ([data.viewcontroller respondsToSelector:@selector(setNeedsUpdateOfHomeIndicatorAutoHidden)]) { - [data.viewcontroller performSelectorOnMainThread:@selector(setNeedsUpdateOfHomeIndicatorAutoHidden) withObject:nil waitUntilDone:NO]; - [data.viewcontroller performSelectorOnMainThread:@selector(setNeedsUpdateOfScreenEdgesDeferringSystemGestures) withObject:nil waitUntilDone:NO]; - } -#pragma clang diagnostic pop + [data.viewcontroller performSelectorOnMainThread:@selector(setNeedsUpdateOfHomeIndicatorAutoHidden) withObject:nil waitUntilDone:NO]; + [data.viewcontroller performSelectorOnMainThread:@selector(setNeedsUpdateOfScreenEdgesDeferringSystemGestures) withObject:nil waitUntilDone:NO]; } } #endif // !SDL_PLATFORM_TVOS diff --git a/src/video/uikit/SDL_uikitview.h b/src/video/uikit/SDL_uikitview.h index df3374afc553c..78c2beda36157 100644 --- a/src/video/uikit/SDL_uikitview.h +++ b/src/video/uikit/SDL_uikitview.h @@ -23,7 +23,7 @@ #include "../SDL_sysvideo.h" -#if !defined(SDL_PLATFORM_TVOS) && defined(__IPHONE_13_4) +#if !defined(SDL_PLATFORM_TVOS) @interface SDL_uikitview : UIView #else @interface SDL_uikitview : UIView @@ -35,16 +35,12 @@ - (SDL_Window *)getSDLWindow; #if !defined(SDL_PLATFORM_TVOS) -#if defined(__IPHONE_13_0) - (void)pencilHovering:(UIHoverGestureRecognizer *)recognizer API_AVAILABLE(ios(13.0)); -#endif -#if defined(__IPHONE_13_4) - (UIPointerRegion *)pointerInteraction:(UIPointerInteraction *)interaction regionForRequest:(UIPointerRegionRequest *)request defaultRegion:(UIPointerRegion *)defaultRegion API_AVAILABLE(ios(13.4)); - (UIPointerStyle *)pointerInteraction:(UIPointerInteraction *)interaction styleForRegion:(UIPointerRegion *)region API_AVAILABLE(ios(13.4)); - (void)indirectPointerHovering:(UIHoverGestureRecognizer *)recognizer API_AVAILABLE(ios(13.4)); #endif -#endif - (CGPoint)touchLocation:(UITouch *)touch shouldNormalize:(BOOL)normalize; - (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event; diff --git a/src/video/uikit/SDL_uikitview.m b/src/video/uikit/SDL_uikitview.m index 5c30cdb161291..ba3b09bf3fe29 100644 --- a/src/video/uikit/SDL_uikitview.m +++ b/src/video/uikit/SDL_uikitview.m @@ -49,7 +49,7 @@ @implementation SDL_uikitview SDL_TouchID directTouchId; SDL_TouchID indirectTouchId; -#if !defined(SDL_PLATFORM_TVOS) && defined(__IPHONE_13_4) +#if !defined(SDL_PLATFORM_TVOS) UIPointerInteraction *indirectPointerInteraction API_AVAILABLE(ios(13.4)); #endif } @@ -86,15 +86,12 @@ - (instancetype)initWithFrame:(CGRect)frame self.multipleTouchEnabled = YES; SDL_AddTouch(directTouchId, SDL_TOUCH_DEVICE_DIRECT, ""); -#if defined(__IPHONE_13_0) if (@available(iOS 13.0, *)) { UIHoverGestureRecognizer *pencilRecognizer = [[UIHoverGestureRecognizer alloc] initWithTarget:self action:@selector(pencilHovering:)]; pencilRecognizer.allowedTouchTypes = @[@(UITouchTypePencil)]; [self addGestureRecognizer:pencilRecognizer]; } -#endif -#if defined(__IPHONE_13_4) if (@available(iOS 13.4, *)) { indirectPointerInteraction = [[UIPointerInteraction alloc] initWithDelegate:self]; [self addInteraction:indirectPointerInteraction]; @@ -103,7 +100,6 @@ - (instancetype)initWithFrame:(CGRect)frame indirectPointerRecognizer.allowedTouchTypes = @[@(UITouchTypeIndirectPointer)]; [self addGestureRecognizer:indirectPointerRecognizer]; } -#endif #endif // !defined(SDL_PLATFORM_TVOS) } @@ -173,7 +169,6 @@ - (SDL_Window *)getSDLWindow #if !defined(SDL_PLATFORM_TVOS) -#if defined(__IPHONE_13_4) - (UIPointerRegion *)pointerInteraction:(UIPointerInteraction *)interaction regionForRequest:(UIPointerRegionRequest *)request defaultRegion:(UIPointerRegion *)defaultRegion API_AVAILABLE(ios(13.4)) { return [UIPointerRegion regionWithRect:self.bounds identifier:nil]; @@ -253,10 +248,6 @@ - (void)indirectPointerReleased:(UITouch *)touch fromEvent:(UIEvent *)event API_ } } -#endif // __IPHONE_13_4 - -#if defined(__IPHONE_13_0) - - (void)pencilHovering:(UIHoverGestureRecognizer *)recognizer API_AVAILABLE(ios(13.0)) { switch (recognizer.state) { @@ -290,19 +281,13 @@ - (void)pencilReleased:(UITouch *)touch UIKit_HandlePenRelease(self, touch); } -#endif // defined(__IPHONE_13_0) #endif // !defined(SDL_PLATFORM_TVOS) - (SDL_TouchDeviceType)touchTypeForTouch:(UITouch *)touch { -#ifdef __IPHONE_9_0 - if ([touch respondsToSelector:@selector((type))]) { - if (touch.type == UITouchTypeIndirect) { - return SDL_TOUCH_DEVICE_INDIRECT_RELATIVE; - } + if (touch.type == UITouchTypeIndirect) { + return SDL_TOUCH_DEVICE_INDIRECT_RELATIVE; } -#endif - return SDL_TOUCH_DEVICE_DIRECT; } @@ -332,36 +317,26 @@ - (CGPoint)touchLocation:(UITouch *)touch shouldNormalize:(BOOL)normalize - (float)pressureForTouch:(UITouch *)touch { -#ifdef __IPHONE_9_0 - if ([touch respondsToSelector:@selector(force)]) { - return (float)touch.force; - } -#endif - - return 1.0f; + return (float)touch.force; } - (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event { for (UITouch *touch in touches) { #if !defined(SDL_PLATFORM_TVOS) -#if defined(__IPHONE_13_0) if (@available(iOS 13.0, *)) { if (touch.type == UITouchTypePencil) { [self pencilPressed:touch]; continue; } } -#endif -#if defined(__IPHONE_13_4) if (@available(iOS 13.4, *)) { if (touch.type == UITouchTypeIndirectPointer) { [self indirectPointerPressed:touch fromEvent:event]; continue; } } -#endif #endif // !defined(SDL_PLATFORM_TVOS) SDL_TouchDeviceType touchType = [self touchTypeForTouch:touch]; @@ -385,23 +360,19 @@ - (void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event { for (UITouch *touch in touches) { #if !defined(SDL_PLATFORM_TVOS) -#if defined(__IPHONE_13_0) if (@available(iOS 13.0, *)) { if (touch.type == UITouchTypePencil) { [self pencilReleased:touch]; continue; } } -#endif -#if defined(__IPHONE_13_4) if (@available(iOS 13.4, *)) { if (touch.type == UITouchTypeIndirectPointer) { [self indirectPointerReleased:touch fromEvent:event]; continue; } } -#endif #endif // !defined(SDL_PLATFORM_TVOS) SDL_TouchDeviceType touchType = [self touchTypeForTouch:touch]; @@ -425,23 +396,19 @@ - (void)touchesCancelled:(NSSet *)touches withEvent:(UIEvent *)event { for (UITouch *touch in touches) { #if !defined(SDL_PLATFORM_TVOS) -#if defined(__IPHONE_13_0) if (@available(iOS 13.0, *)) { if (touch.type == UITouchTypePencil) { [self pencilReleased:touch]; continue; } } -#endif -#if defined(__IPHONE_13_4) if (@available(iOS 13.4, *)) { if (touch.type == UITouchTypeIndirectPointer) { [self indirectPointerReleased:touch fromEvent:event]; continue; } } -#endif #endif // !defined(SDL_PLATFORM_TVOS) SDL_TouchDeviceType touchType = [self touchTypeForTouch:touch]; @@ -463,23 +430,19 @@ - (void)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event { for (UITouch *touch in touches) { #if !defined(SDL_PLATFORM_TVOS) -#if defined(__IPHONE_13_0) if (@available(iOS 13.0, *)) { if (touch.type == UITouchTypePencil) { [self pencilMoving:touch]; continue; } } -#endif -#if defined(__IPHONE_13_4) if (@available(iOS 13.4, *)) { if (touch.type == UITouchTypeIndirectPointer) { [self indirectPointerMoving:touch]; continue; } } -#endif #endif // !defined(SDL_PLATFORM_TVOS) SDL_TouchDeviceType touchType = [self touchTypeForTouch:touch]; @@ -500,25 +463,18 @@ - (void)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event - (void)safeAreaInsetsDidChange { // Update the safe area insets - if (@available(iOS 11.0, tvOS 11.0, *)) { - SDL_SetWindowSafeAreaInsets(sdlwindow, - (int)SDL_ceilf(self.safeAreaInsets.left), - (int)SDL_ceilf(self.safeAreaInsets.right), - (int)SDL_ceilf(self.safeAreaInsets.top), - (int)SDL_ceilf(self.safeAreaInsets.bottom)); - } + SDL_SetWindowSafeAreaInsets(sdlwindow, + (int)SDL_ceilf(self.safeAreaInsets.left), + (int)SDL_ceilf(self.safeAreaInsets.right), + (int)SDL_ceilf(self.safeAreaInsets.top), + (int)SDL_ceilf(self.safeAreaInsets.bottom)); } -#if defined(SDL_PLATFORM_TVOS) || defined(__IPHONE_9_1) - (SDL_Scancode)scancodeFromPress:(UIPress *)press { -#ifdef __IPHONE_13_4 - if ([press respondsToSelector:@selector((key))]) { - if (press.key != nil) { - return (SDL_Scancode)press.key.keyCode; - } + if (press.key != nil) { + return (SDL_Scancode)press.key.keyCode; } -#endif #ifndef SDL_JOYSTICK_DISABLED // Presses from Apple TV remote @@ -597,8 +553,6 @@ - (void)pressesChanged:(NSSet *)presses withEvent:(UIPressesEvent *)e } } -#endif // defined(SDL_PLATFORM_TVOS) || defined(__IPHONE_9_1) - #ifdef SDL_PLATFORM_TVOS - (void)swipeGesture:(UISwipeGestureRecognizer *)gesture { diff --git a/src/video/uikit/SDL_uikitviewcontroller.m b/src/video/uikit/SDL_uikitviewcontroller.m index 862df1967e286..1059ed061dbeb 100644 --- a/src/video/uikit/SDL_uikitviewcontroller.m +++ b/src/video/uikit/SDL_uikitviewcontroller.m @@ -49,13 +49,8 @@ static void SDLCALL SDL_HideHomeIndicatorHintChanged(void *userdata, const char @autoreleasepool { SDL_uikitviewcontroller *viewcontroller = (__bridge SDL_uikitviewcontroller *)userdata; viewcontroller.homeIndicatorHidden = (hint && *hint) ? SDL_atoi(hint) : -1; -#pragma clang diagnostic push -#pragma clang diagnostic ignored "-Wunguarded-availability-new" - if ([viewcontroller respondsToSelector:@selector(setNeedsUpdateOfHomeIndicatorAutoHidden)]) { - [viewcontroller setNeedsUpdateOfHomeIndicatorAutoHidden]; - [viewcontroller setNeedsUpdateOfScreenEdgesDeferringSystemGestures]; - } -#pragma clang diagnostic pop + [viewcontroller setNeedsUpdateOfHomeIndicatorAutoHidden]; + [viewcontroller setNeedsUpdateOfScreenEdgesDeferringSystemGestures]; } } #endif @@ -176,18 +171,11 @@ - (void)startAnimation #ifdef SDL_PLATFORM_VISIONOS displayLink.preferredFramesPerSecond = 90 / animationInterval; //TODO: Get frame max frame rate on visionOS -#elif defined(__IPHONE_10_3) +#else SDL_UIKitWindowData *data = (__bridge SDL_UIKitWindowData *)window->internal; - if ([displayLink respondsToSelector:@selector(preferredFramesPerSecond)] && data != nil && data.uiwindow != nil && [data.uiwindow.screen respondsToSelector:@selector(maximumFramesPerSecond)]) { - displayLink.preferredFramesPerSecond = data.uiwindow.screen.maximumFramesPerSecond / animationInterval; - } else + displayLink.preferredFramesPerSecond = data.uiwindow.screen.maximumFramesPerSecond / animationInterval; #endif - { -#if __IPHONE_OS_VERSION_MIN_REQUIRED < 100300 - [displayLink setFrameInterval:animationInterval]; -#endif - } [displayLink addToRunLoop:[NSRunLoop currentRunLoop] forMode:NSDefaultRunLoopMode]; } @@ -411,28 +399,16 @@ - (void)setTextFieldProperties:(SDL_PropertiesID) props break; case SDL_TEXTINPUT_TYPE_TEXT_USERNAME: textField.keyboardType = UIKeyboardTypeDefault; - if (@available(iOS 11.0, tvOS 11.0, *)) { - textField.textContentType = UITextContentTypeUsername; - } else { - textField.textContentType = nil; - } + textField.textContentType = UITextContentTypeUsername; break; case SDL_TEXTINPUT_TYPE_TEXT_PASSWORD_HIDDEN: textField.keyboardType = UIKeyboardTypeDefault; - if (@available(iOS 11.0, tvOS 11.0, *)) { - textField.textContentType = UITextContentTypePassword; - } else { - textField.textContentType = nil; - } + textField.textContentType = UITextContentTypePassword; textField.secureTextEntry = YES; break; case SDL_TEXTINPUT_TYPE_TEXT_PASSWORD_VISIBLE: textField.keyboardType = UIKeyboardTypeDefault; - if (@available(iOS 11.0, tvOS 11.0, *)) { - textField.textContentType = UITextContentTypePassword; - } else { - textField.textContentType = nil; - } + textField.textContentType = UITextContentTypePassword; break; case SDL_TEXTINPUT_TYPE_NUMBER: textField.keyboardType = UIKeyboardTypeNumberPad; diff --git a/src/video/uikit/SDL_uikitwindow.m b/src/video/uikit/SDL_uikitwindow.m index 109f5e81a102a..1bc7936007a2c 100644 --- a/src/video/uikit/SDL_uikitwindow.m +++ b/src/video/uikit/SDL_uikitwindow.m @@ -319,7 +319,6 @@ SDL_FullscreenResult UIKit_SetWindowFullscreen(SDL_VideoDevice *_this, SDL_Windo void UIKit_UpdatePointerLock(SDL_VideoDevice *_this, SDL_Window *window) { #ifndef SDL_PLATFORM_TVOS -#if defined(__IPHONE_14_0) && __IPHONE_OS_VERSION_MAX_ALLOWED >= __IPHONE_14_0 @autoreleasepool { SDL_UIKitWindowData *data = (__bridge SDL_UIKitWindowData *)window->internal; SDL_uikitviewcontroller *viewcontroller = data.viewcontroller; @@ -327,7 +326,6 @@ void UIKit_UpdatePointerLock(SDL_VideoDevice *_this, SDL_Window *window) [viewcontroller setNeedsUpdateOfPrefersPointerLocked]; } } -#endif // defined(__IPHONE_14_0) && __IPHONE_OS_VERSION_MAX_ALLOWED >= __IPHONE_14_0 #endif // !SDL_PLATFORM_TVOS } @@ -400,11 +398,7 @@ void UIKit_GetWindowSizeInPixels(SDL_VideoDevice *_this, SDL_Window *window, int /* Get all possible valid orientations. If the app delegate doesn't tell * us, we get the orientations from Info.plist via UIApplication. */ - if ([app.delegate respondsToSelector:@selector(application:supportedInterfaceOrientationsForWindow:)]) { - validOrientations = [app.delegate application:app supportedInterfaceOrientationsForWindow:data.uiwindow]; - } else { - validOrientations = [app supportedInterfaceOrientationsForWindow:data.uiwindow]; - } + validOrientations = [app.delegate application:app supportedInterfaceOrientationsForWindow:data.uiwindow]; if (hint != NULL) { NSArray *orientations = [@(hint) componentsSeparatedByString:@" "]; From 5ca735b40f1b0834a3d2029b3dea2c0d6eff6abc Mon Sep 17 00:00:00 2001 From: Sam Lantinga Date: Tue, 14 Jan 2025 10:52:04 -0800 Subject: [PATCH 049/340] Only use WAVE surround sound channel layouts on macOS 10.15+ --- src/audio/coreaudio/SDL_coreaudio.m | 22 ++++++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) diff --git a/src/audio/coreaudio/SDL_coreaudio.m b/src/audio/coreaudio/SDL_coreaudio.m index d518d883cdf26..f18fffef02b90 100644 --- a/src/audio/coreaudio/SDL_coreaudio.m +++ b/src/audio/coreaudio/SDL_coreaudio.m @@ -765,12 +765,26 @@ static bool PrepareAudioQueue(SDL_AudioDevice *device) layout.mChannelLayoutTag = kAudioChannelLayoutTag_DVD_12; break; case 7: - // L R C LFE Cs Ls Rs - layout.mChannelLayoutTag = kAudioChannelLayoutTag_WAVE_6_1; + if (@available(macOS 10.15, iOS 13.0, tvOS 13.0, *)) { + // L R C LFE Cs Ls Rs + layout.mChannelLayoutTag = kAudioChannelLayoutTag_WAVE_6_1; + } else { + // FIXME: We need to manually swizzle channels into a supported layout + // L R C LFE Ls Rs Cs + //layout.mChannelLayoutTag = kAudioChannelLayoutTag_MPEG_6_1_A; + return SDL_SetError("Unsupported audio channels"); + } break; case 8: - // L R C LFE Rls Rrs Ls Rs - layout.mChannelLayoutTag = kAudioChannelLayoutTag_WAVE_7_1; + if (@available(macOS 10.15, iOS 13.0, tvOS 13.0, *)) { + // L R C LFE Rls Rrs Ls Rs + layout.mChannelLayoutTag = kAudioChannelLayoutTag_WAVE_7_1; + } else { + // FIXME: We need to manually swizzle channels into a supported layout + // L R C LFE Ls Rs Rls Rrs + //layout.mChannelLayoutTag = kAudioChannelLayoutTag_MPEG_7_1_C; + return SDL_SetError("Unsupported audio channels"); + } break; default: return SDL_SetError("Unsupported audio channels"); From a41f93bd10e584d5085892875cbda69408c9f019 Mon Sep 17 00:00:00 2001 From: Sam Lantinga Date: Tue, 14 Jan 2025 12:22:00 -0800 Subject: [PATCH 050/340] Added https://github.com/Ravbug/sdl3-sample as a more complete Android example --- docs/INTRO-androidstudio.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/docs/INTRO-androidstudio.md b/docs/INTRO-androidstudio.md index 10cfcad9cb998..f4d8eccabba8b 100644 --- a/docs/INTRO-androidstudio.md +++ b/docs/INTRO-androidstudio.md @@ -10,4 +10,8 @@ We'll start by creating a simple project to build and run [hello.c](hello.c) - Run Android Studio and open the newly created build/org.libsdl.hello directory - Build and run! +A more complete example is available at: + +https://github.com/Ravbug/sdl3-sample + Additional information and troubleshooting is available in [README-android.md](README-android.md) From 04e3b67707cc586686060d1d9ae786d5d3a09729 Mon Sep 17 00:00:00 2001 From: Sam Lantinga Date: Tue, 14 Jan 2025 12:22:15 -0800 Subject: [PATCH 051/340] Removed outdated Visual Studio instructions --- docs/README-visualc.md | 113 ----------------------------------------- 1 file changed, 113 deletions(-) delete mode 100644 docs/README-visualc.md diff --git a/docs/README-visualc.md b/docs/README-visualc.md deleted file mode 100644 index 4849da4fc1b6f..0000000000000 --- a/docs/README-visualc.md +++ /dev/null @@ -1,113 +0,0 @@ -Using SDL with Microsoft Visual C++ -=================================== - -#### by Lion Kimbro with additions by James Turk - -You can either use the precompiled libraries from the [SDL](https://www.libsdl.org/download.php) web site, or you can build SDL -yourself. - -### Building SDL - -0. To build SDL, your machine must, at a minimum, have the DirectX9.0c SDK installed. It may or may not be retrievable from -the [Microsoft](https://www.microsoft.com) website, so you might need to locate it [online](https://duckduckgo.com/?q=directx9.0c+sdk+download&t=h_&ia=web). -_Editor's note: I've been able to successfully build SDL using Visual Studio 2019 **without** the DX9.0c SDK_ - -1. Open the Visual Studio solution file at `./VisualC/SDL.sln`. - -2. Your IDE will likely prompt you to upgrade this solution file to whatever later version of the IDE you're using. In the `Retarget Projects` dialog, -all of the affected project files should be checked allowing you to use the latest `Windows SDK Version` you have installed, along with -the `Platform Toolset`. - -If you choose *NOT* to upgrade to use the latest `Windows SDK Version` or `Platform Toolset`, then you'll need the `Visual Studio 2010 Platform Toolset`. - -3. Build the `.dll` and `.lib` files by right clicking on each project in turn (Projects are listed in the _Workspace_ -panel in the _FileView_ tab), and selecting `Build`. - -You may get a few warnings, but you should not get any errors. - -Later, we will refer to the following `.lib` and `.dll` files that have just been generated: - -- `./VisualC/Win32/Debug/SDL3.dll` or `./VisualC/Win32/Release/SDL3.dll` -- `./VisualC/Win32/Debug/SDL3.lib` or `./VisualC/Win32/Release/SDL3.lib` - -_Note for the `x64` versions, just replace `Win32` in the path with `x64`_ - -### Creating a Project with SDL - -- Create a project as a `Win32 Application`. - -- Create a C++ file for your project. - -- Set the C runtime to `Multi-threaded DLL` in the menu: - `Project|Settings|C/C++ tab|Code Generation|Runtime Library `. - -- Add the SDL `include` directory to your list of includes in the menu: - `Project|Settings|C/C++ tab|Preprocessor|Additional include directories ` - -*VC7 Specific: Instead of doing this, I find it easier to add the -include and library directories to the list that VC7 keeps. Do this by -selecting Tools|Options|Projects|VC++ Directories and under the "Show -Directories For:" dropbox select "Include Files", and click the "New -Directory Icon" and add the [SDLROOT]\\include directory (e.g. If you -installed to c:\\SDL\\ add c:\\SDL\\include). Proceed to change the -dropbox selection to "Library Files" and add [SDLROOT]\\lib.* - -The "include directory" I am referring to is the `./include` folder. - -Now we're going to use the files that we had created earlier in the *Build SDL* step. - -Copy the following file into your Project directory: - -- `SDL3.dll` - -Add the following file to your project (It is not necessary to copy it to your project directory): - -- `SDL3.lib` - -To add them to your project, right click on your project, and select -`Add files to project`. - -**Instead of adding the files to your project, it is more desirable to add them to the linker options: Project|Properties|Linker|Command Line -and type the names of the libraries to link with in the "Additional Options:" box. Note: This must be done for each build configuration -(e.g. Release,Debug).** - -### Hello SDL - -Here's a sample SDL snippet to verify everything is setup in your IDE: - -```c -#include -#include // only include this one in the source file with main()! - -int main( int argc, char* argv[] ) -{ - const int WIDTH = 640; - const int HEIGHT = 480; - SDL_Window* window = NULL; - SDL_Renderer* renderer = NULL; - - SDL_Init(SDL_INIT_VIDEO); - window = SDL_CreateWindow("Hello SDL", WIDTH, HEIGHT, 0); - renderer = SDL_CreateRenderer(window, NULL); - - SDL_DestroyRenderer(renderer); - SDL_DestroyWindow(window); - SDL_Quit(); - return 0; -} -``` - -### That's it! - -I hope that this document has helped you get through the most difficult part of using the SDL: installing it. -Suggestions for improvements should be posted to the [Github Issues](https://github.com/libsdl-org/SDL/issues). - -### Credits - -Thanks to [Paulus Esterhazy](mailto:pesterhazy@gmx.net), for the work on VC++ port. - -This document was originally called "VisualC.txt", and was written by [Sam Lantinga](mailto:slouken@libsdl.org). - -Later, it was converted to HTML and expanded into the document that you see today by [Lion Kimbro](mailto:snowlion@sprynet.com). - -Minor Fixes and Visual C++ 7 Information (in italic) was added by [James Turk](mailto:james@conceptofzero.net) From b2793a2ce2d84df536db13dc40fb145ed4dba6c3 Mon Sep 17 00:00:00 2001 From: Sam Lantinga Date: Tue, 14 Jan 2025 12:58:30 -0800 Subject: [PATCH 052/340] Removed obsolete Raspberry Pi documentation --- docs/README-raspberrypi.md | 188 ------------------------------------- 1 file changed, 188 deletions(-) delete mode 100644 docs/README-raspberrypi.md diff --git a/docs/README-raspberrypi.md b/docs/README-raspberrypi.md deleted file mode 100644 index ba34f47b1fea0..0000000000000 --- a/docs/README-raspberrypi.md +++ /dev/null @@ -1,188 +0,0 @@ -Raspberry Pi -============ - -Requirements: - -Raspberry Pi OS (other Linux distros may work as well). - -In modern times, the Raspberry Pi works mostly like any other Linux device: -for video, you can use X11, Wayland, or KMSDRM. For audio, you can use ALSA, -PulseAudio, or PipeWire, etc. OpenGL, OpenGL ES, and Vulkan are known to work. - -There is a video backend in SDL called "rpi" that uses a deprecated Broadcom -interface (named "dispmanx") to draw directly to the console without X11. -Newer Raspberry Pi OS releases don't support this (and work fine with our -"kmsdrm" backend for the same purposes, a standard Linux interface). Don't -panic if you can't use this backend, or CMake says it can't find libraries it -needs for this. - -SDL has, in past times, worked on the original Raspberry Pi and the RPi 2, but -these devices are no longer targets we actively test; if they broke, please -report bugs or send patches! - -The Raspberry Pi 3 and later (in 32-bit and 64-bit mode) are still known to -work well at the time of this writing. The Raspberry Pi Zero and Zero 2 are -also known to work well. - - -## Documentation Out Of Date - -The rest of this document is likely out of date; a lot has changed in recent -years in both SDL and the Raspberry Pi universe, and this document has not -been updated to reflect those details. Take the rest of this information with -a grain of salt! - - - -NEON ----- - -If your Pi has NEON support, make sure you add -mfpu=neon to your CFLAGS so -that SDL will select some otherwise-disabled highly-optimized code. The -original Pi and Pi Zero units don't have NEON; everything from the Pi2/PiZero2 -and later do. - - -Cross compiling from x86 Linux ------------------------------- - -To cross compile SDL for Raspbian from your desktop machine, you'll need a -Raspbian system root and the cross compilation tools. We'll assume these tools -will be placed in /opt/rpi-tools - - sudo git clone --depth 1 https://github.com/raspberrypi/tools /opt/rpi-tools - -You'll also need a Raspbian binary image. -Get it from: http://downloads.raspberrypi.org/raspbian_latest -After unzipping, you'll get file with a name like: "-wheezy-raspbian.img" -Let's assume the sysroot will be built in /opt/rpi-sysroot. - - export SYSROOT=/opt/rpi-sysroot - sudo kpartx -a -v .img - sudo mount -o loop /dev/mapper/loop0p2 /mnt - sudo cp -r /mnt $SYSROOT - sudo apt-get install qemu binfmt-support qemu-user-static - sudo cp /usr/bin/qemu-arm-static $SYSROOT/usr/bin - sudo mount --bind /dev $SYSROOT/dev - sudo mount --bind /proc $SYSROOT/proc - sudo mount --bind /sys $SYSROOT/sys - -Now, before chrooting into the ARM sysroot, you'll need to apply a workaround, -edit $SYSROOT/etc/ld.so.preload and comment out all lines in it. - - sudo chroot $SYSROOT - apt-get install libudev-dev libasound2-dev libdbus-1-dev libraspberrypi0 libraspberrypi-bin libraspberrypi-dev libx11-dev libxext-dev libxrandr-dev libxcursor-dev libxi-dev libxss-dev - exit - sudo umount $SYSROOT/dev - sudo umount $SYSROOT/proc - sudo umount $SYSROOT/sys - sudo umount /mnt - -There's one more fix required, as the libdl.so symlink uses an absolute path -which doesn't quite work in our setup. - - sudo rm -rf $SYSROOT/usr/lib/arm-linux-gnueabihf/libdl.so - sudo ln -s ../../../lib/arm-linux-gnueabihf/libdl.so.2 $SYSROOT/usr/lib/arm-linux-gnueabihf/libdl.so - -The final step is compiling SDL itself. - - export CC="/opt/rpi-tools/arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian/bin/arm-linux-gnueabihf-gcc --sysroot=$SYSROOT -I$SYSROOT/opt/vc/include -I$SYSROOT/usr/include -I$SYSROOT/opt/vc/include/interface/vcos/pthreads -I$SYSROOT/opt/vc/include/interface/vmcs_host/linux" - cd - mkdir -p build;cd build - LDFLAGS="-L$SYSROOT/opt/vc/lib" ../configure --with-sysroot=$SYSROOT --host=arm-raspberry-linux-gnueabihf --prefix=$PWD/rpi-sdl3-installed --disable-pulseaudio --disable-esd - make - make install - -To be able to deploy this to /usr/local in the Raspbian system you need to fix up a few paths: - - perl -w -pi -e "s#$PWD/rpi-sdl3-installed#/usr/local#g;" ./rpi-sdl3-installed/lib/libSDL3.la ./rpi-sdl3-installed/lib/pkgconfig/sdl3.pc - -Apps don't work or poor video/audio performance ------------------------------------------------ - -If you get sound problems, buffer underruns, etc, run "sudo rpi-update" to -update the RPi's firmware. Note that doing so will fix these problems, but it -will also render the CMA - Dynamic Memory Split functionality useless. - -Also, by default the Raspbian distro configures the GPU RAM at 64MB, this is too -low in general, specially if a 1080p TV is hooked up. - -See here how to configure this setting: http://elinux.org/RPiconfig - -Using a fixed gpu_mem=128 is the best option (specially if you updated the -firmware, using CMA probably won't work, at least it's the current case). - -No input --------- - -Make sure you belong to the "input" group. - - sudo usermod -aG input `whoami` - -No HDMI Audio -------------- - -If you notice that ALSA works but there's no audio over HDMI, try adding: - - hdmi_drive=2 - -to your config.txt file and reboot. - -Reference: http://www.raspberrypi.org/phpBB3/viewtopic.php?t=5062 - -Text Input API support ----------------------- - -The Text Input API is supported, with translation of scan codes done via the -kernel symbol tables. For this to work, SDL needs access to a valid console. -If you notice there's no SDL_EVENT_TEXT_INPUT message being emitted, double check that -your app has read access to one of the following: - -* /proc/self/fd/0 -* /dev/tty -* /dev/tty[0...6] -* /dev/vc/0 -* /dev/console - -This is usually not a problem if you run from the physical terminal (as opposed -to running from a pseudo terminal, such as via SSH). If running from a PTS, a -quick workaround is to run your app as root or add yourself to the tty group, -then re-login to the system. - - sudo usermod -aG tty `whoami` - -The keyboard layout used by SDL is the same as the one the kernel uses. -To configure the layout on Raspbian: - - sudo dpkg-reconfigure keyboard-configuration - -To configure the locale, which controls which keys are interpreted as letters, -this determining the CAPS LOCK behavior: - - sudo dpkg-reconfigure locales - - -OpenGL problems ---------------- - -If you have desktop OpenGL headers installed at build time in your RPi or cross -compilation environment, support for it will be built in. However, the chipset -does not actually have support for it, which causes issues in certain SDL apps -since the presence of OpenGL support supersedes the ES/ES2 variants. -The workaround is to disable OpenGL at configuration time: - - ./configure --disable-video-opengl - -Or if the application uses the Render functions, you can use the SDL_RENDER_DRIVER -environment variable: - - export SDL_RENDER_DRIVER=opengles2 - -Notes ------ - -* When launching apps remotely (via SSH), SDL can prevent local keystrokes from - leaking into the console only if it has root privileges. Launching apps locally - does not suffer from this issue. - - From 9e60a8994fbfd63a541848da2e30109c4f99da75 Mon Sep 17 00:00:00 2001 From: "Ryan C. Gordon" Date: Tue, 14 Jan 2025 16:35:04 -0500 Subject: [PATCH 053/340] audio: Allow streams to change the device-side channels maps. Fixes #11881. --- include/SDL3/SDL_audio.h | 20 +++++++++++++++++++- src/audio/SDL_audio.c | 38 +++++++++++++++++++++++++++++++++++--- src/audio/SDL_audiocvt.c | 13 ++++++++----- src/audio/SDL_sysaudio.h | 6 +++++- 4 files changed, 67 insertions(+), 10 deletions(-) diff --git a/include/SDL3/SDL_audio.h b/include/SDL3/SDL_audio.h index fdfc376ae86a6..544f4b7a19285 100644 --- a/include/SDL3/SDL_audio.h +++ b/include/SDL3/SDL_audio.h @@ -942,7 +942,7 @@ extern SDL_DECLSPEC void SDLCALL SDL_CloseAudioDevice(SDL_AudioDeviceID devid); * Binding a stream to a device will set its output format for playback * devices, and its input format for recording devices, so they match the * device's settings. The caller is welcome to change the other end of the - * stream's format at any time. + * stream's format at any time with SDL_SetAudioStreamFormat(). * * \param devid an audio device to bind a stream to. * \param streams an array of audio streams to bind. @@ -1104,6 +1104,12 @@ extern SDL_DECLSPEC bool SDLCALL SDL_GetAudioStreamFormat(SDL_AudioStream *strea * next sound file, and start putting that new data while the previous sound * file is still queued, and everything will still play back correctly. * + * If a stream is bound to a device, then the format of the side of the stream + * bound to a device cannot be changed (src_spec for recording devices, + * dst_spec for playback devices). Attempts to make a change to this side + * will be ignored, but this will not report an error. The other side's format + * can be changed. + * * \param stream the stream the format is being changed. * \param src_spec the new format of the audio input; if NULL, it is not * changed. @@ -1298,6 +1304,11 @@ extern SDL_DECLSPEC int * SDLCALL SDL_GetAudioStreamOutputChannelMap(SDL_AudioSt * race condition hasn't changed the format while this call is setting the * channel map. * + * Unlike attempting to change the stream's format, the input channel map on a + * stream bound to a recording device is permitted to change at any time; any + * data added to the stream from the device after this call will have the new + * mapping, but previously-added data will still have the prior mapping. + * * \param stream the SDL_AudioStream to change. * \param chmap the new channel map, NULL to reset to default. * \param count The number of channels in the map. @@ -1349,6 +1360,13 @@ extern SDL_DECLSPEC bool SDLCALL SDL_SetAudioStreamInputChannelMap(SDL_AudioStre * race condition hasn't changed the format while this call is setting the * channel map. * + * Unlike attempting to change the stream's format, the output channel map on + * a stream bound to a recording device is permitted to change at any time; + * any data added to the stream after this call will have the new mapping, but + * previously-added data will still have the prior mapping. When the channel + * map doesn't match the hardware's channel layout, SDL will convert the data + * before feeding it to the device for playback. + * * \param stream the SDL_AudioStream to change. * \param chmap the new channel map, NULL to reset to default. * \param count The number of channels in the map. diff --git a/src/audio/SDL_audio.c b/src/audio/SDL_audio.c index bc1704b60eb42..db4c55f3fde3a 100644 --- a/src/audio/SDL_audio.c +++ b/src/audio/SDL_audio.c @@ -281,6 +281,18 @@ bool SDL_AudioSpecsEqual(const SDL_AudioSpec *a, const SDL_AudioSpec *b, const i return true; } +bool SDL_AudioChannelMapsEqual(int channels, const int *channel_map_a, const int *channel_map_b) +{ + if (channel_map_a == channel_map_b) { + return true; + } else if ((channel_map_a != NULL) != (channel_map_b != NULL)) { + return false; + } else if (channel_map_a && (SDL_memcmp(channel_map_a, channel_map_b, sizeof (*channel_map_a) * channels) != 0)) { + return false; + } + return true; +} + // Zombie device implementation... @@ -1134,7 +1146,7 @@ bool SDL_PlaybackAudioThreadIterate(SDL_AudioDevice *device) SDL_AudioStream *stream = logdev->bound_streams; // We should have updated this elsewhere if the format changed! - SDL_assert(SDL_AudioSpecsEqual(&stream->dst_spec, &device->spec, stream->dst_chmap, device->chmap)); + SDL_assert(SDL_AudioSpecsEqual(&stream->dst_spec, &device->spec, NULL, NULL)); const int br = SDL_GetAtomicInt(&logdev->paused) ? 0 : SDL_GetAudioStreamDataAdjustGain(stream, device_buffer, buffer_size, logdev->gain); if (br < 0) { // Probably OOM. Kill the audio device; the whole thing is likely dying soon anyhow. @@ -1143,6 +1155,12 @@ bool SDL_PlaybackAudioThreadIterate(SDL_AudioDevice *device) } else if (br < buffer_size) { SDL_memset(device_buffer + br, device->silence_value, buffer_size - br); // silence whatever we didn't write to. } + + // generally channel maps will line up, but if the audio stream's chmap has been explicitly changed, do a final swizzle to device layout. + if ((br > 0) && (!SDL_AudioChannelMapsEqual(device->spec.channels, stream->dst_chmap, device->chmap))) { + ConvertAudio(br / SDL_AUDIO_FRAMESIZE(device->spec), device_buffer, device->spec.format, device->spec.channels, NULL, + device_buffer, device->spec.format, device->spec.channels, device->chmap, NULL, 1.0f); + } } else { // need to actually mix (or silence the buffer) float *final_mix_buffer = (float *) ((device->spec.format == SDL_AUDIO_F32) ? device_buffer : device->mix_buffer); const int needed_samples = buffer_size / SDL_AUDIO_BYTESIZE(device->spec.format); @@ -1170,7 +1188,7 @@ bool SDL_PlaybackAudioThreadIterate(SDL_AudioDevice *device) for (SDL_AudioStream *stream = logdev->bound_streams; stream; stream = stream->next_binding) { // We should have updated this elsewhere if the format changed! - SDL_assert(SDL_AudioSpecsEqual(&stream->dst_spec, &outspec, stream->dst_chmap, device->chmap)); + SDL_assert(SDL_AudioSpecsEqual(&stream->dst_spec, &outspec, NULL, NULL)); /* this will hold a lock on `stream` while getting. We don't explicitly lock the streams for iterating here because the binding linked list can only change while the device lock is held. @@ -1181,6 +1199,11 @@ bool SDL_PlaybackAudioThreadIterate(SDL_AudioDevice *device) failed = true; break; } else if (br > 0) { // it's okay if we get less than requested, we mix what we have. + // generally channel maps will line up, but if the audio stream's chmap has been explicitly changed, do a final swizzle to device layout. + if (!SDL_AudioChannelMapsEqual(device->spec.channels, stream->dst_chmap, device->chmap)) { + ConvertAudio(br / SDL_AUDIO_FRAMESIZE(device->spec), device->work_buffer, device->spec.format, device->spec.channels, NULL, + device->work_buffer, device->spec.format, device->spec.channels, device->chmap, NULL, 1.0f); + } MixFloat32Audio(mix_buffer, (float *) device->work_buffer, br); } } @@ -1303,11 +1326,20 @@ bool SDL_RecordingAudioThreadIterate(SDL_AudioDevice *device) SDL_assert(stream->src_spec.channels == device->spec.channels); SDL_assert(stream->src_spec.freq == device->spec.freq); + void *final_buf = output_buffer; + + // generally channel maps will line up, but if the audio stream's chmap has been explicitly changed, do a final swizzle to stream layout. + if (!SDL_AudioChannelMapsEqual(device->spec.channels, stream->src_chmap, device->chmap)) { + final_buf = device->mix_buffer; // this is otherwise unused on recording devices, so it makes convenient scratch space here. + ConvertAudio(br / SDL_AUDIO_FRAMESIZE(device->spec), output_buffer, device->spec.format, device->spec.channels, NULL, + final_buf, device->spec.format, device->spec.channels, stream->src_chmap, NULL, 1.0f); + } + /* this will hold a lock on `stream` while putting. We don't explicitly lock the streams for iterating here because the binding linked list can only change while the device lock is held. (we _do_ lock the stream during binding/unbinding to make sure that two threads can't try to bind the same stream to different devices at the same time, though.) */ - if (!SDL_PutAudioStreamData(stream, output_buffer, br)) { + if (!SDL_PutAudioStreamData(stream, final_buf, br)) { // oh crud, we probably ran out of memory. This is possibly an overreaction to kill the audio device, but it's likely the whole thing is going down in a moment anyhow. failed = true; break; diff --git a/src/audio/SDL_audiocvt.c b/src/audio/SDL_audiocvt.c index fcfe0afaed4a6..daf44da02b80e 100644 --- a/src/audio/SDL_audiocvt.c +++ b/src/audio/SDL_audiocvt.c @@ -154,7 +154,7 @@ static void SwizzleAudio(const int num_frames, void *dst, const void *src, int c { const int bitsize = (int) SDL_AUDIO_BITSIZE(fmt); - bool has_null_mappings = false; + bool has_null_mappings = false; // !!! FIXME: calculate this when setting the channel map instead. for (int i = 0; i < channels; i++) { if (map[i] == -1) { has_null_mappings = true; @@ -257,6 +257,11 @@ void ConvertAudio(int num_frames, const int dst_bitsize = (int) SDL_AUDIO_BITSIZE(dst_format); const int dst_sample_frame_size = (dst_bitsize / 8) * dst_channels; + const bool chmaps_match = (src_channels == dst_channels) && SDL_AudioChannelMapsEqual(src_channels, src_map, dst_map); + if (chmaps_match) { + src_map = dst_map = NULL; // NULL both these out so we don't do any unnecessary swizzling. + } + /* Type conversion goes like this now: - swizzle through source channel map to "standard" layout. - byteswap to CPU native format first if necessary. @@ -635,8 +640,6 @@ bool SetAudioStreamChannelMap(SDL_AudioStream *stream, const SDL_AudioSpec *spec // already have this map, don't allocate/copy it again. } else if (SDL_ChannelMapIsBogus(chmap, channels)) { result = SDL_SetError("Invalid channel mapping"); - } else if ((isinput != -1) && stream->bound_device && (!!isinput == !!stream->bound_device->physical_device->recording)) { - // quietly refuse to change the format of the end currently bound to a device. } else { if (SDL_ChannelMapIsDefault(chmap, channels)) { chmap = NULL; // just apply a default mapping. @@ -661,12 +664,12 @@ bool SetAudioStreamChannelMap(SDL_AudioStream *stream, const SDL_AudioSpec *spec bool SDL_SetAudioStreamInputChannelMap(SDL_AudioStream *stream, const int *chmap, int channels) { - return SetAudioStreamChannelMap(stream, &stream->src_spec, &stream->src_chmap, chmap, channels, true); + return SetAudioStreamChannelMap(stream, &stream->src_spec, &stream->src_chmap, chmap, channels, 1); } bool SDL_SetAudioStreamOutputChannelMap(SDL_AudioStream *stream, const int *chmap, int channels) { - return SetAudioStreamChannelMap(stream, &stream->dst_spec, &stream->dst_chmap, chmap, channels, false); + return SetAudioStreamChannelMap(stream, &stream->dst_spec, &stream->dst_chmap, chmap, channels, 0); } int *SDL_GetAudioStreamInputChannelMap(SDL_AudioStream *stream, int *count) diff --git a/src/audio/SDL_sysaudio.h b/src/audio/SDL_sysaudio.h index a733052d3a0a2..d36c63ad87f46 100644 --- a/src/audio/SDL_sysaudio.h +++ b/src/audio/SDL_sysaudio.h @@ -125,9 +125,13 @@ extern void ConvertAudio(int num_frames, // Compare two SDL_AudioSpecs, return true if they match exactly. // Using SDL_memcmp directly isn't safe, since potential padding might not be initialized. -// either channel maps can be NULL for the default (and both should be if you don't care about them). +// either channel map can be NULL for the default (and both should be if you don't care about them). extern bool SDL_AudioSpecsEqual(const SDL_AudioSpec *a, const SDL_AudioSpec *b, const int *channel_map_a, const int *channel_map_b); +// See if two channel maps match +// either channel map can be NULL for the default (and both should be if you don't care about them). +extern bool SDL_AudioChannelMapsEqual(int channels, const int *channel_map_a, const int *channel_map_b); + // allocate+copy a channel map. extern int *SDL_ChannelMapDup(const int *origchmap, int channels); From bf793bf4395088ac8d8be9f0fc376eb939182dfe Mon Sep 17 00:00:00 2001 From: SDL Wiki Bot Date: Tue, 14 Jan 2025 21:44:52 +0000 Subject: [PATCH 054/340] Sync SDL3 wiki -> header [ci skip] --- include/SDL3/SDL_audio.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/include/SDL3/SDL_audio.h b/include/SDL3/SDL_audio.h index 544f4b7a19285..911b2b9964514 100644 --- a/include/SDL3/SDL_audio.h +++ b/include/SDL3/SDL_audio.h @@ -1106,9 +1106,9 @@ extern SDL_DECLSPEC bool SDLCALL SDL_GetAudioStreamFormat(SDL_AudioStream *strea * * If a stream is bound to a device, then the format of the side of the stream * bound to a device cannot be changed (src_spec for recording devices, - * dst_spec for playback devices). Attempts to make a change to this side - * will be ignored, but this will not report an error. The other side's format - * can be changed. + * dst_spec for playback devices). Attempts to make a change to this side will + * be ignored, but this will not report an error. The other side's format can + * be changed. * * \param stream the stream the format is being changed. * \param src_spec the new format of the audio input; if NULL, it is not From 191a6417d581b79cab5698dee84554ea64b5ac61 Mon Sep 17 00:00:00 2001 From: Green Sky Date: Tue, 14 Jan 2025 23:15:14 +0100 Subject: [PATCH 055/340] events: use SDL_memmove instead of SDL_memcpy for overlapping memory --- src/events/SDL_keyboard.c | 2 +- src/events/SDL_mouse.c | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/events/SDL_keyboard.c b/src/events/SDL_keyboard.c index 30e35ad5f940b..46e28deff990f 100644 --- a/src/events/SDL_keyboard.c +++ b/src/events/SDL_keyboard.c @@ -160,7 +160,7 @@ void SDL_RemoveKeyboard(SDL_KeyboardID keyboardID, bool send_event) SDL_free(SDL_keyboards[keyboard_index].name); if (keyboard_index != SDL_keyboard_count - 1) { - SDL_memcpy(&SDL_keyboards[keyboard_index], &SDL_keyboards[keyboard_index + 1], (SDL_keyboard_count - keyboard_index - 1) * sizeof(SDL_keyboards[keyboard_index])); + SDL_memmove(&SDL_keyboards[keyboard_index], &SDL_keyboards[keyboard_index + 1], (SDL_keyboard_count - keyboard_index - 1) * sizeof(SDL_keyboards[keyboard_index])); } --SDL_keyboard_count; diff --git a/src/events/SDL_mouse.c b/src/events/SDL_mouse.c index bfdabb9fff224..becfe28e5d1f1 100644 --- a/src/events/SDL_mouse.c +++ b/src/events/SDL_mouse.c @@ -328,7 +328,7 @@ void SDL_RemoveMouse(SDL_MouseID mouseID, bool send_event) SDL_free(SDL_mice[mouse_index].name); if (mouse_index != SDL_mouse_count - 1) { - SDL_memcpy(&SDL_mice[mouse_index], &SDL_mice[mouse_index + 1], (SDL_mouse_count - mouse_index - 1) * sizeof(SDL_mice[mouse_index])); + SDL_memmove(&SDL_mice[mouse_index], &SDL_mice[mouse_index + 1], (SDL_mouse_count - mouse_index - 1) * sizeof(SDL_mice[mouse_index])); } --SDL_mouse_count; @@ -339,7 +339,7 @@ void SDL_RemoveMouse(SDL_MouseID mouseID, bool send_event) if (source->mouseID == mouseID) { SDL_free(source->clickstate); if (i != mouse->num_sources - 1) { - SDL_memcpy(&mouse->sources[i], &mouse->sources[i + 1], (mouse->num_sources - i - 1) * sizeof(mouse->sources[i])); + SDL_memmove(&mouse->sources[i], &mouse->sources[i + 1], (mouse->num_sources - i - 1) * sizeof(mouse->sources[i])); } --mouse->num_sources; break; From 49dd24e19575ac82aa51a16f3fb7758809820a15 Mon Sep 17 00:00:00 2001 From: Sam Lantinga Date: Tue, 14 Jan 2025 14:31:20 -0800 Subject: [PATCH 056/340] Fixed potentially overlapping memcpy() to use memmove() --- src/core/android/SDL_android.c | 2 +- src/joystick/hidapi/SDL_hidapi_ps4.c | 2 +- src/joystick/hidapi/SDL_hidapi_ps5.c | 2 +- src/test/SDL_test_font.c | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/core/android/SDL_android.c b/src/core/android/SDL_android.c index 2026861f568de..daf0f29f17aeb 100644 --- a/src/core/android/SDL_android.c +++ b/src/core/android/SDL_android.c @@ -883,7 +883,7 @@ static int FindLifecycleEvent(SDL_AndroidLifecycleEvent event) static void RemoveLifecycleEvent(int index) { if (index < Android_NumLifecycleEvents - 1) { - SDL_memcpy(&Android_LifecycleEvents[index], &Android_LifecycleEvents[index+1], (Android_NumLifecycleEvents - index - 1) * sizeof(Android_LifecycleEvents[index])); + SDL_memmove(&Android_LifecycleEvents[index], &Android_LifecycleEvents[index+1], (Android_NumLifecycleEvents - index - 1) * sizeof(Android_LifecycleEvents[index])); } --Android_NumLifecycleEvents; } diff --git a/src/joystick/hidapi/SDL_hidapi_ps4.c b/src/joystick/hidapi/SDL_hidapi_ps4.c index 8f65b954e7cb7..4fe7b03d77ed6 100644 --- a/src/joystick/hidapi/SDL_hidapi_ps4.c +++ b/src/joystick/hidapi/SDL_hidapi_ps4.c @@ -298,7 +298,7 @@ static bool HIDAPI_DriverPS4_InitDevice(SDL_HIDAPI_Device *device) j = -1; for (i = 0; i < 12; i += 2) { j += 1; - SDL_memcpy(&serial[j], &device->serial[i], 2); + SDL_memmove(&serial[j], &device->serial[i], 2); j += 2; serial[j] = '-'; } diff --git a/src/joystick/hidapi/SDL_hidapi_ps5.c b/src/joystick/hidapi/SDL_hidapi_ps5.c index 3fff18e956d05..7226fa2092331 100644 --- a/src/joystick/hidapi/SDL_hidapi_ps5.c +++ b/src/joystick/hidapi/SDL_hidapi_ps5.c @@ -387,7 +387,7 @@ static bool HIDAPI_DriverPS5_InitDevice(SDL_HIDAPI_Device *device) j = -1; for (i = 0; i < 12; i += 2) { j += 1; - SDL_memcpy(&serial[j], &device->serial[i], 2); + SDL_memmove(&serial[j], &device->serial[i], 2); j += 2; serial[j] = '-'; } diff --git a/src/test/SDL_test_font.c b/src/test/SDL_test_font.c index 2910948b3dd2c..00268f6eeddd6 100644 --- a/src/test/SDL_test_font.c +++ b/src/test/SDL_test_font.c @@ -123,7 +123,7 @@ void SDLTest_TextWindowAddTextWithLength(SDLTest_TextWindow *textwin, const char if (newline) { if (textwin->current == textwin->numlines - 1) { SDL_free(textwin->lines[0]); - SDL_memcpy(&textwin->lines[0], &textwin->lines[1], (textwin->numlines - 1) * sizeof(textwin->lines[1])); + SDL_memmove(&textwin->lines[0], &textwin->lines[1], (textwin->numlines - 1) * sizeof(textwin->lines[1])); textwin->lines[textwin->current] = NULL; } else { ++textwin->current; From a4547fe77a469968566ebc020938fc62e08d4315 Mon Sep 17 00:00:00 2001 From: Sam Lantinga Date: Tue, 14 Jan 2025 15:54:48 -0800 Subject: [PATCH 057/340] Updated weak framework dependencies for new deployment targets --- CMakeLists.txt | 18 ++++++------------ Xcode/SDL/SDL.xcodeproj/project.pbxproj | 21 ++++++++++----------- 2 files changed, 16 insertions(+), 23 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 5d0f095f76d96..a6f3be1dc25d3 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -2397,6 +2397,7 @@ elseif(APPLE) endif() if(SDL_FRAMEWORK_COCOA) sdl_link_dependency(cocoa LIBS "$" PKG_CONFIG_LINK_OPTIONS "-Wl,-framework,Cocoa") + # macOS 11.0+ iOS 14.0+ tvOS 14.0+ sdl_link_dependency(uniformtypeidentifiers LIBS "$" PKG_CONFIG_LINK_OPTIONS "-Wl,-weak_framework,UniformTypeIdentifiers") endif() if(SDL_FRAMEWORK_IOKIT) @@ -2432,25 +2433,17 @@ elseif(APPLE) if(SDL_FRAMEWORK_GAMECONTROLLER) find_library(GAMECONTROLLER GameController) if(GAMECONTROLLER) - sdl_link_dependency(game_controller LIBS "$" PKG_CONFIG_LINK_OPTIONS "-Wl,-weak_framework,GameController") + sdl_link_dependency(game_controller LIBS "$" PKG_CONFIG_LINK_OPTIONS "-Wl,-framework,GameController") endif() endif() if(SDL_FRAMEWORK_METAL) - if(IOS OR TVOS OR VISIONOS OR WATCHOS) - sdl_link_dependency(metal LIBS "$" PKG_CONFIG_LINK_OPTIONS "-Wl,-framework,Metal") - else() - sdl_link_dependency(metal LIBS "$" PKG_CONFIG_LINK_OPTIONS "-Wl,-weak_framework,Metal") - endif() + sdl_link_dependency(metal LIBS "$" PKG_CONFIG_LINK_OPTIONS "-Wl,-framework,Metal") endif() if(SDL_FRAMEWORK_OPENGLES) sdl_link_dependency(opengles LIBS "$" PKG_CONFIG_LINK_OPTIONS "-Wl,-framework,OpenGLES") endif() if(SDL_FRAMEWORK_QUARTZCORE) - if(IOS OR TVOS OR VISIONOS OR WATCHOS) - sdl_link_dependency(quartz_core LIBS "$" PKG_CONFIG_LINK_OPTIONS "-Wl,-framework,QuartzCore") - else() - sdl_link_dependency(metal LIBS "$" PKG_CONFIG_LINK_OPTIONS "-Wl,-weak_framework,QuartzCore") - endif() + sdl_link_dependency(quartz_core LIBS "$" PKG_CONFIG_LINK_OPTIONS "-Wl,-framework,QuartzCore") endif() if(SDL_FRAMEWORK_UIKIT) sdl_link_dependency(ui_kit LIBS "$" PKG_CONFIG_LINK_OPTIONS "-Wl,-framework,UIKit") @@ -2458,7 +2451,8 @@ elseif(APPLE) if(SDL_FRAMEWORK_COREHAPTICS) find_library(COREHAPTICS CoreHaptics) if(COREHAPTICS) - sdl_link_dependency(core_haptics LIBS "$" PKG_CONFIG_LINK_OPTIONS "-Wl,-framework,CoreHaptics") + # macOS 10.15+ iOS 13.0+ tvOS 14.0+ + sdl_link_dependency(core_haptics LIBS "$" PKG_CONFIG_LINK_OPTIONS "-Wl,-weak_framework,CoreHaptics") endif() endif() diff --git a/Xcode/SDL/SDL.xcodeproj/project.pbxproj b/Xcode/SDL/SDL.xcodeproj/project.pbxproj index cd52392b6b388..e10903b809897 100644 --- a/Xcode/SDL/SDL.xcodeproj/project.pbxproj +++ b/Xcode/SDL/SDL.xcodeproj/project.pbxproj @@ -46,21 +46,22 @@ 000098E9DAA43EF6FF7F0000 /* SDL_camera.c in Sources */ = {isa = PBXBuildFile; fileRef = 0000035D38C3899C7EFD0000 /* SDL_camera.c */; }; 0000A03C0F32C43816F40000 /* SDL_asyncio_windows_ioring.c in Sources */ = {isa = PBXBuildFile; fileRef = 000030DD21496B5C0F210000 /* SDL_asyncio_windows_ioring.c */; }; 0000A4DA2F45A31DC4F00000 /* SDL_sysmain_callbacks.m in Sources */ = {isa = PBXBuildFile; fileRef = 0000BB287BA0A0178C1A0000 /* SDL_sysmain_callbacks.m */; }; + 0000A877C7DB9FA935FC0000 /* SDL_uikitpen.m in Sources */ = {isa = PBXBuildFile; fileRef = 000053D344416737F6050000 /* SDL_uikitpen.m */; }; 0000AEB9AE90228CA2D60000 /* SDL_asyncio.c in Sources */ = {isa = PBXBuildFile; fileRef = 00003928A612EC33D42C0000 /* SDL_asyncio.c */; }; 0000D5B526B85DE7AB1C0000 /* SDL_cocoapen.m in Sources */ = {isa = PBXBuildFile; fileRef = 0000CCA310B73A7B59910000 /* SDL_cocoapen.m */; }; 007317A40858DECD00B2BC32 /* Cocoa.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 0073179D0858DECD00B2BC32 /* Cocoa.framework */; platformFilters = (macos, ); }; 007317A60858DECD00B2BC32 /* IOKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 0073179F0858DECD00B2BC32 /* IOKit.framework */; platformFilters = (ios, maccatalyst, macos, ); }; 00CFA89D106B4BA100758660 /* ForceFeedback.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 00CFA89C106B4BA100758660 /* ForceFeedback.framework */; platformFilters = (macos, ); }; - 00D0D08410675DD9004B05EF /* CoreFoundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 00D0D08310675DD9004B05EF /* CoreFoundation.framework */; platformFilters = (ios, maccatalyst, macos, tvos, watchos, ); }; + 00D0D08410675DD9004B05EF /* CoreFoundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 00D0D08310675DD9004B05EF /* CoreFoundation.framework */; platformFilters = (ios, maccatalyst, macos, tvos, ); settings = {ATTRIBUTES = (Required, ); }; }; 00D0D0D810675E46004B05EF /* Carbon.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 007317C10858E15000B2BC32 /* Carbon.framework */; platformFilters = (macos, ); }; 1485C3312BBA4AF30063985B /* UniformTypeIdentifiers.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1485C32F2BBA4A0C0063985B /* UniformTypeIdentifiers.framework */; platformFilters = (maccatalyst, macos, ); settings = {ATTRIBUTES = (Weak, ); }; }; - 557D0CFA254586CA003913E3 /* CoreHaptics.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = F37DC5F225350EBC0002E6F7 /* CoreHaptics.framework */; platformFilters = (ios, maccatalyst, macos, tvos, ); }; - 557D0CFB254586D7003913E3 /* GameController.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = A75FDABD23E28B6200529352 /* GameController.framework */; settings = {ATTRIBUTES = (Weak, ); }; }; + 557D0CFA254586CA003913E3 /* CoreHaptics.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = F37DC5F225350EBC0002E6F7 /* CoreHaptics.framework */; platformFilters = (ios, maccatalyst, macos, tvos, ); settings = {ATTRIBUTES = (Weak, ); }; }; + 557D0CFB254586D7003913E3 /* GameController.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = A75FDABD23E28B6200529352 /* GameController.framework */; settings = {ATTRIBUTES = (Required, ); }; }; 5616CA4C252BB2A6005D5928 /* SDL_url.c in Sources */ = {isa = PBXBuildFile; fileRef = 5616CA49252BB2A5005D5928 /* SDL_url.c */; }; 5616CA4D252BB2A6005D5928 /* SDL_sysurl.h in Headers */ = {isa = PBXBuildFile; fileRef = 5616CA4A252BB2A6005D5928 /* SDL_sysurl.h */; }; 5616CA4E252BB2A6005D5928 /* SDL_sysurl.m in Sources */ = {isa = PBXBuildFile; fileRef = 5616CA4B252BB2A6005D5928 /* SDL_sysurl.m */; }; - 564624361FF821C20074AC87 /* QuartzCore.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 564624351FF821B80074AC87 /* QuartzCore.framework */; settings = {ATTRIBUTES = (Weak, ); }; }; - 564624381FF821DA0074AC87 /* Metal.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 564624371FF821CB0074AC87 /* Metal.framework */; settings = {ATTRIBUTES = (Weak, ); }; }; + 564624361FF821C20074AC87 /* QuartzCore.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 564624351FF821B80074AC87 /* QuartzCore.framework */; settings = {ATTRIBUTES = (Required, ); }; }; + 564624381FF821DA0074AC87 /* Metal.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 564624371FF821CB0074AC87 /* Metal.framework */; settings = {ATTRIBUTES = (Required, ); }; }; 566E26CF246274CC00718109 /* SDL_syslocale.m in Sources */ = {isa = PBXBuildFile; fileRef = 566E26CC246274CB00718109 /* SDL_syslocale.m */; }; 566E26D8246274CC00718109 /* SDL_locale.c in Sources */ = {isa = PBXBuildFile; fileRef = 566E26CD246274CB00718109 /* SDL_locale.c */; }; 566E26E1246274CC00718109 /* SDL_syslocale.h in Headers */ = {isa = PBXBuildFile; fileRef = 566E26CE246274CC00718109 /* SDL_syslocale.h */; }; @@ -75,7 +76,7 @@ A1626A522617008D003F1973 /* SDL_triangle.h in Headers */ = {isa = PBXBuildFile; fileRef = A1626A512617008C003F1973 /* SDL_triangle.h */; }; A1BB8B6327F6CF330057CFA8 /* SDL_list.c in Sources */ = {isa = PBXBuildFile; fileRef = A1BB8B6127F6CF320057CFA8 /* SDL_list.c */; }; A1BB8B6C27F6CF330057CFA8 /* SDL_list.h in Headers */ = {isa = PBXBuildFile; fileRef = A1BB8B6227F6CF330057CFA8 /* SDL_list.h */; }; - A7381E961D8B69D600B177DD /* CoreAudio.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = A7381E951D8B69D600B177DD /* CoreAudio.framework */; platformFilters = (ios, maccatalyst, macos, tvos, watchos, ); }; + A7381E961D8B69D600B177DD /* CoreAudio.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = A7381E951D8B69D600B177DD /* CoreAudio.framework */; platformFilters = (ios, maccatalyst, macos, tvos, ); settings = {ATTRIBUTES = (Required, ); }; }; A7381E971D8B6A0300B177DD /* AudioToolbox.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = A7381E931D8B69C300B177DD /* AudioToolbox.framework */; platformFilters = (ios, maccatalyst, macos, tvos, ); }; A75FDB5823E39E6100529352 /* hidapi.h in Headers */ = {isa = PBXBuildFile; fileRef = A75FDB5723E39E6100529352 /* hidapi.h */; }; A75FDBB723E4CBC700529352 /* License.txt in Resources */ = {isa = PBXBuildFile; fileRef = 00794D3F09D0C461003FC8A1 /* License.txt */; }; @@ -529,9 +530,7 @@ F3FA5A252B59ACE000FEAD97 /* yuv_rgb_common.h in Headers */ = {isa = PBXBuildFile; fileRef = F3FA5A1C2B59ACE000FEAD97 /* yuv_rgb_common.h */; }; F3FD042E2C9B755700824C4C /* SDL_hidapi_nintendo.h in Headers */ = {isa = PBXBuildFile; fileRef = F3FD042C2C9B755700824C4C /* SDL_hidapi_nintendo.h */; }; F3FD042F2C9B755700824C4C /* SDL_hidapi_steam_hori.c in Sources */ = {isa = PBXBuildFile; fileRef = F3FD042D2C9B755700824C4C /* SDL_hidapi_steam_hori.c */; }; - FA73671D19A540EF004122E4 /* CoreVideo.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FA73671C19A540EF004122E4 /* CoreVideo.framework */; platformFilters = (ios, maccatalyst, macos, tvos, watchos, ); }; - 000012E88BE7D71B274A0000 /* SDL_uikitpen.h in Headers */ = {isa = PBXBuildFile; fileRef = 000063D3D80F97ADC7770000 /* SDL_uikitpen.h */; }; - 0000A877C7DB9FA935FC0000 /* SDL_uikitpen.m in Sources */ = {isa = PBXBuildFile; fileRef = 000053D344416737F6050000 /* SDL_uikitpen.m */; }; + FA73671D19A540EF004122E4 /* CoreVideo.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FA73671C19A540EF004122E4 /* CoreVideo.framework */; platformFilters = (ios, maccatalyst, macos, tvos, ); settings = {ATTRIBUTES = (Required, ); }; }; /* End PBXBuildFile section */ /* Begin PBXContainerItemProxy section */ @@ -565,9 +564,11 @@ 00003260407E1002EAC10000 /* SDL_main_callbacks.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDL_main_callbacks.h; sourceTree = ""; }; 00003928A612EC33D42C0000 /* SDL_asyncio.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SDL_asyncio.c; sourceTree = ""; }; 00003F472C51CE7DF6160000 /* SDL_systime.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SDL_systime.c; sourceTree = ""; }; + 000053D344416737F6050000 /* SDL_uikitpen.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SDL_uikitpen.m; sourceTree = ""; }; 0000585B2CAB450B40540000 /* SDL_sysasyncio.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDL_sysasyncio.h; sourceTree = ""; }; 00005BD74B46358B33A20000 /* SDL_camera_dummy.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SDL_camera_dummy.c; sourceTree = ""; }; 00005D3EB902478835E20000 /* SDL_syscamera.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDL_syscamera.h; sourceTree = ""; }; + 000063D3D80F97ADC7770000 /* SDL_uikitpen.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDL_uikitpen.h; sourceTree = ""; }; 0000641A9BAC11AB3FBE0000 /* SDL_time.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SDL_time.c; sourceTree = ""; }; 000078E1881E857EBB6C0000 /* SDL_hashtable.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SDL_hashtable.c; sourceTree = ""; }; 00008B79BF08CBCEAC460000 /* SDL_camera_coremedia.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SDL_camera_coremedia.m; sourceTree = ""; }; @@ -1094,8 +1095,6 @@ F59C710600D5CB5801000001 /* SDL.info */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = text; path = SDL.info; sourceTree = ""; }; F5A2EF3900C6A39A01000001 /* BUGS.txt */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = text; name = BUGS.txt; path = ../../BUGS.txt; sourceTree = SOURCE_ROOT; }; FA73671C19A540EF004122E4 /* CoreVideo.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreVideo.framework; path = System/Library/Frameworks/CoreVideo.framework; sourceTree = SDKROOT; }; - 000063D3D80F97ADC7770000 /* SDL_uikitpen.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SDL_uikitpen.h; path = SDL_uikitpen.h; sourceTree = ""; }; - 000053D344416737F6050000 /* SDL_uikitpen.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = SDL_uikitpen.m; path = SDL_uikitpen.m; sourceTree = ""; }; /* End PBXFileReference section */ /* Begin PBXFrameworksBuildPhase section */ From ffe194c52e5c2d5006f5e5783c4d50cb62e0a0e4 Mon Sep 17 00:00:00 2001 From: Sam Lantinga Date: Tue, 14 Jan 2025 16:16:05 -0800 Subject: [PATCH 058/340] Fixed build when SDL_JOYSTICK_MFI isn't enabled --- src/joystick/apple/SDL_mfijoystick.m | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/src/joystick/apple/SDL_mfijoystick.m b/src/joystick/apple/SDL_mfijoystick.m index c224bb2f4f5f6..996bc33f783c7 100644 --- a/src/joystick/apple/SDL_mfijoystick.m +++ b/src/joystick/apple/SDL_mfijoystick.m @@ -42,9 +42,9 @@ #endif #endif // SDL_PLATFORM_MACOS -#ifdef SDL_JOYSTICK_MFI #import +#ifdef SDL_JOYSTICK_MFI static id connectObserver = nil; static id disconnectObserver = nil; @@ -1201,6 +1201,7 @@ static void IOS_MFIJoystickUpdate(SDL_Joystick *joystick) #endif // SDL_JOYSTICK_MFI } +#ifdef SDL_JOYSTICK_MFI @interface SDL3_RumbleMotor : NSObject @property(nonatomic, strong) CHHapticEngine *engine API_AVAILABLE(macos(10.16), ios(13.0), tvos(14.0)); @property(nonatomic, strong) id player API_AVAILABLE(macos(10.16), ios(13.0), tvos(14.0)); @@ -1395,8 +1396,11 @@ - (void)cleanup return nil; } +#endif // SDL_JOYSTICK_MFI + static bool IOS_JoystickRumble(SDL_Joystick *joystick, Uint16 low_frequency_rumble, Uint16 high_frequency_rumble) { +#ifdef SDL_JOYSTICK_MFI SDL_JoystickDeviceItem *device = joystick->hwdata; if (device == NULL) { @@ -1415,13 +1419,14 @@ static bool IOS_JoystickRumble(SDL_Joystick *joystick, Uint16 low_frequency_rumb if (device->rumble) { SDL3_RumbleContext *rumble = (__bridge SDL3_RumbleContext *)device->rumble; return [rumble rumbleWithLowFrequency:low_frequency_rumble andHighFrequency:high_frequency_rumble]; - } else { - return SDL_Unsupported(); } +#endif + return SDL_Unsupported(); } static bool IOS_JoystickRumbleTriggers(SDL_Joystick *joystick, Uint16 left_rumble, Uint16 right_rumble) { +#ifdef SDL_JOYSTICK_MFI SDL_JoystickDeviceItem *device = joystick->hwdata; if (device == NULL) { @@ -1440,9 +1445,9 @@ static bool IOS_JoystickRumbleTriggers(SDL_Joystick *joystick, Uint16 left_rumbl if (device->rumble) { SDL3_RumbleContext *rumble = (__bridge SDL3_RumbleContext *)device->rumble; return [rumble rumbleLeftTrigger:left_rumble andRightTrigger:right_rumble]; - } else { - return SDL_Unsupported(); } +#endif + return SDL_Unsupported(); } static bool IOS_JoystickSetLED(SDL_Joystick *joystick, Uint8 red, Uint8 green, Uint8 blue) @@ -1465,7 +1470,6 @@ static bool IOS_JoystickSetLED(SDL_Joystick *joystick, Uint8 red, Uint8 green, U } } } - return SDL_Unsupported(); } @@ -1519,6 +1523,7 @@ static void IOS_JoystickClose(SDL_Joystick *joystick) device->joystick = NULL; +#ifdef SDL_JOYSTICK_MFI @autoreleasepool { if (device->rumble) { SDL3_RumbleContext *rumble = (__bridge SDL3_RumbleContext *)device->rumble; @@ -1529,7 +1534,6 @@ static void IOS_JoystickClose(SDL_Joystick *joystick) } if (device->controller) { -#ifdef SDL_JOYSTICK_MFI GCController *controller = device->controller; controller.controllerPausedHandler = nil; controller.playerIndex = -1; @@ -1542,9 +1546,10 @@ static void IOS_JoystickClose(SDL_Joystick *joystick) } } } -#endif // SDL_JOYSTICK_MFI } } +#endif // SDL_JOYSTICK_MFI + if (device->is_siri_remote) { --SDL_AppleTVRemoteOpenedAsJoystick; } From 0eaa6197c52d82a8f9243e67e741c6961b63d644 Mon Sep 17 00:00:00 2001 From: Sam Lantinga Date: Tue, 14 Jan 2025 16:28:54 -0800 Subject: [PATCH 059/340] Removed unnecessary __builtin_available check --- src/joystick/apple/SDL_mfijoystick.m | 5 ----- 1 file changed, 5 deletions(-) diff --git a/src/joystick/apple/SDL_mfijoystick.m b/src/joystick/apple/SDL_mfijoystick.m index 996bc33f783c7..23d6b23f80535 100644 --- a/src/joystick/apple/SDL_mfijoystick.m +++ b/src/joystick/apple/SDL_mfijoystick.m @@ -727,16 +727,11 @@ static bool IOS_JoystickInit(void) } #ifdef SDL_PLATFORM_MACOS -#if SDL_HAS_BUILTIN(__builtin_available) if (@available(macOS 10.16, *)) { // Continue with initialization on macOS 11+ } else { return true; } -#else - // No @available, must be an older macOS version - return true; -#endif #endif @autoreleasepool { From 29c684c626474cf0e9c4828a922a8963d7df1cdb Mon Sep 17 00:00:00 2001 From: Sam Lantinga Date: Tue, 14 Jan 2025 18:05:24 -0800 Subject: [PATCH 060/340] Removed debug logging --- .../app/src/main/java/org/libsdl/app/SDLActivity.java | 1 - 1 file changed, 1 deletion(-) diff --git a/android-project/app/src/main/java/org/libsdl/app/SDLActivity.java b/android-project/app/src/main/java/org/libsdl/app/SDLActivity.java index 8a1aa690b497e..82f64dde46ba7 100644 --- a/android-project/app/src/main/java/org/libsdl/app/SDLActivity.java +++ b/android-project/app/src/main/java/org/libsdl/app/SDLActivity.java @@ -1495,7 +1495,6 @@ public static boolean handleKeyEvent(View v, int keyCode, KeyEvent event, InputC // on some devices key events are sent for mouse BUTTON_BACK/FORWARD presses // they are ignored here because sending them as mouse input to SDL is messy if ((keyCode == KeyEvent.KEYCODE_BACK) || (keyCode == KeyEvent.KEYCODE_FORWARD)) { - Log.v("SDL", "keycode is back or forward"); switch (event.getAction()) { case KeyEvent.ACTION_DOWN: case KeyEvent.ACTION_UP: From 1ab61635a9efc31b3bb5c5fed41fad8951abab01 Mon Sep 17 00:00:00 2001 From: Sam Lantinga Date: Tue, 14 Jan 2025 18:48:19 -0800 Subject: [PATCH 061/340] Use SDL_Log() for keyboard debugging. --- src/events/SDL_keyboard.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/events/SDL_keyboard.c b/src/events/SDL_keyboard.c index 46e28deff990f..0ad2ff6dde113 100644 --- a/src/events/SDL_keyboard.c +++ b/src/events/SDL_keyboard.c @@ -26,7 +26,9 @@ #include "SDL_keymap_c.h" #include "../video/SDL_sysvideo.h" -// #define DEBUG_KEYBOARD +#if 0 +#define DEBUG_KEYBOARD +#endif // Global keyboard information @@ -217,7 +219,7 @@ void SDL_ResetKeyboard(void) int scancode; #ifdef DEBUG_KEYBOARD - printf("Resetting keyboard\n"); + SDL_Log("Resetting keyboard\n"); #endif for (scancode = SDL_SCANCODE_UNKNOWN; scancode < SDL_SCANCODE_COUNT; ++scancode) { if (keyboard->keystate[scancode]) { @@ -514,7 +516,7 @@ static bool SDL_SendKeyboardKeyInternal(Uint64 timestamp, Uint32 flags, SDL_Keyb const Uint8 source = flags & KEYBOARD_SOURCE_MASK; #ifdef DEBUG_KEYBOARD - printf("The '%s' key has been %s\n", SDL_GetScancodeName(scancode), down ? "pressed" : "released"); + SDL_Log("The '%s' key has been %s\n", SDL_GetScancodeName(scancode), down ? "pressed" : "released"); #endif // Figure out what type of event this is From e19a56f4d5440f645c09666c3a315cc8dbd0e4a2 Mon Sep 17 00:00:00 2001 From: Sam Lantinga Date: Tue, 14 Jan 2025 18:53:36 -0800 Subject: [PATCH 062/340] Don't send fake key events while processing real ones on Android Fixes https://github.com/libsdl-org/SDL/issues/11350 --- .../main/java/org/libsdl/app/SDLActivity.java | 13 +++++++++-- .../org/libsdl/app/SDLInputConnection.java | 22 ++++++++++--------- 2 files changed, 23 insertions(+), 12 deletions(-) diff --git a/android-project/app/src/main/java/org/libsdl/app/SDLActivity.java b/android-project/app/src/main/java/org/libsdl/app/SDLActivity.java index 82f64dde46ba7..75a3df9c1565f 100644 --- a/android-project/app/src/main/java/org/libsdl/app/SDLActivity.java +++ b/android-project/app/src/main/java/org/libsdl/app/SDLActivity.java @@ -231,6 +231,7 @@ public enum NativeState { protected static boolean mSDLMainFinished = false; protected static boolean mActivityCreated = false; private static SDLFileDialogState mFileDialogState = null; + protected static boolean mDispatchingKeyEvent = false; protected static SDLGenericMotionListener_API14 getMotionListener() { if (mMotionListener == null) { @@ -807,7 +808,14 @@ public boolean dispatchKeyEvent(KeyEvent event) { ) { return false; } - return super.dispatchKeyEvent(event); + mDispatchingKeyEvent = true; + boolean result = super.dispatchKeyEvent(event); + mDispatchingKeyEvent = false; + return result; + } + + public static boolean dispatchingKeyEvent() { + return mDispatchingKeyEvent; } /* Transition to next state */ @@ -1507,6 +1515,8 @@ public static boolean handleKeyEvent(View v, int keyCode, KeyEvent event, InputC } if (event.getAction() == KeyEvent.ACTION_DOWN) { + onNativeKeyDown(keyCode); + if (isTextInputEvent(event)) { if (ic != null) { ic.commitText(String.valueOf((char) event.getUnicodeChar()), 1); @@ -1514,7 +1524,6 @@ public static boolean handleKeyEvent(View v, int keyCode, KeyEvent event, InputC SDLInputConnection.nativeCommitText(String.valueOf((char) event.getUnicodeChar()), 1); } } - onNativeKeyDown(keyCode); return true; } else if (event.getAction() == KeyEvent.ACTION_UP) { onNativeKeyUp(keyCode); diff --git a/android-project/app/src/main/java/org/libsdl/app/SDLInputConnection.java b/android-project/app/src/main/java/org/libsdl/app/SDLInputConnection.java index e1d29a8890e2d..accce4ba3f657 100644 --- a/android-project/app/src/main/java/org/libsdl/app/SDLInputConnection.java +++ b/android-project/app/src/main/java/org/libsdl/app/SDLInputConnection.java @@ -111,18 +111,20 @@ protected void updateText() { if (matchLength < text.length()) { String pendingText = text.subSequence(matchLength, text.length()).toString(); - for (offset = 0; offset < pendingText.length(); ) { - int codePoint = pendingText.codePointAt(offset); - if (codePoint == '\n') { - if (SDLActivity.onNativeSoftReturnKey()) { - return; + if (!SDLActivity.dispatchingKeyEvent()) { + for (offset = 0; offset < pendingText.length(); ) { + int codePoint = pendingText.codePointAt(offset); + if (codePoint == '\n') { + if (SDLActivity.onNativeSoftReturnKey()) { + return; + } } + /* Higher code points don't generate simulated scancodes */ + if (codePoint > 0 && codePoint < 128) { + nativeGenerateScancodeForUnichar((char)codePoint); + } + offset += Character.charCount(codePoint); } - /* Higher code points don't generate simulated scancodes */ - if (codePoint < 128) { - nativeGenerateScancodeForUnichar((char)codePoint); - } - offset += Character.charCount(codePoint); } SDLInputConnection.nativeCommitText(pendingText, 0); } From 9ed23a4b7983e88c0209468a8ef5af80edf929ed Mon Sep 17 00:00:00 2001 From: Sam Lantinga Date: Tue, 14 Jan 2025 19:25:31 -0800 Subject: [PATCH 063/340] Updated SDL_SetEventFilter() documentation --- include/SDL3/SDL_events.h | 13 +++---------- 1 file changed, 3 insertions(+), 10 deletions(-) diff --git a/include/SDL3/SDL_events.h b/include/SDL3/SDL_events.h index 55d417ef597ec..f372e0fae571e 100644 --- a/include/SDL3/SDL_events.h +++ b/include/SDL3/SDL_events.h @@ -1377,8 +1377,9 @@ extern SDL_DECLSPEC bool SDLCALL SDL_PushEvent(SDL_Event *event); typedef bool (SDLCALL *SDL_EventFilter)(void *userdata, SDL_Event *event); /** - * Set up a filter to process all events before they change internal state and - * are posted to the internal event queue. + * Set up a filter to process all events before they are added to the internal event queue. + * + * If you just want to see events without modifying them or preventing them from being queued, you should use SDL_AddEventWatch() instead. * * If the filter function returns true when called, then the event will be * added to the internal queue. If it returns false, then the event will be @@ -1392,17 +1393,9 @@ typedef bool (SDLCALL *SDL_EventFilter)(void *userdata, SDL_Event *event); * interrupt signal (e.g. pressing Ctrl-C), it will be delivered to the * application at the next event poll. * - * There is one caveat when dealing with the SDL_QuitEvent event type. The - * event filter is only called when the window manager desires to close the - * application window. If the event filter returns 1, then the window will be - * closed, otherwise the window will remain open if possible. - * * Note: Disabled events never make it to the event filter function; see * SDL_SetEventEnabled(). * - * Note: If you just want to inspect events without filtering, you should use - * SDL_AddEventWatch() instead. - * * Note: Events pushed onto the queue with SDL_PushEvent() get passed through * the event filter, but events pushed onto the queue with SDL_PeepEvents() do * not. From 3bea84531d4b30b64449b0c2dc7e29e613d1b628 Mon Sep 17 00:00:00 2001 From: SDL Wiki Bot Date: Wed, 15 Jan 2025 03:27:28 +0000 Subject: [PATCH 064/340] Sync SDL3 wiki -> header [ci skip] --- include/SDL3/SDL_events.h | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/include/SDL3/SDL_events.h b/include/SDL3/SDL_events.h index f372e0fae571e..df62ca62ffa1c 100644 --- a/include/SDL3/SDL_events.h +++ b/include/SDL3/SDL_events.h @@ -1377,9 +1377,11 @@ extern SDL_DECLSPEC bool SDLCALL SDL_PushEvent(SDL_Event *event); typedef bool (SDLCALL *SDL_EventFilter)(void *userdata, SDL_Event *event); /** - * Set up a filter to process all events before they are added to the internal event queue. + * Set up a filter to process all events before they are added to the internal + * event queue. * - * If you just want to see events without modifying them or preventing them from being queued, you should use SDL_AddEventWatch() instead. + * If you just want to see events without modifying them or preventing them + * from being queued, you should use SDL_AddEventWatch() instead. * * If the filter function returns true when called, then the event will be * added to the internal queue. If it returns false, then the event will be From 81e57147f8a2d4d0de8f180b33c30a1a6e3718d1 Mon Sep 17 00:00:00 2001 From: Sam Lantinga Date: Tue, 14 Jan 2025 21:09:43 -0800 Subject: [PATCH 065/340] Child windows shouldn't take focus if the parent window is in relative mouse mode Fixes https://github.com/libsdl-org/SDL/issues/11807 on Windows --- src/video/windows/SDL_windowsevents.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/video/windows/SDL_windowsevents.c b/src/video/windows/SDL_windowsevents.c index 9360857816d91..18edb76d330d5 100644 --- a/src/video/windows/SDL_windowsevents.c +++ b/src/video/windows/SDL_windowsevents.c @@ -1119,6 +1119,16 @@ LRESULT CALLBACK WIN_WindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lPara if (SDL_WINDOW_IS_POPUP(data->window)) { return MA_NOACTIVATE; } + + // Check parents to see if they are in relative mouse mode and focused + SDL_Window *parent = data->window->parent; + while (parent) { + if ((parent->flags & SDL_WINDOW_INPUT_FOCUS) && + (parent->flags & SDL_WINDOW_MOUSE_RELATIVE_MODE)) { + return MA_NOACTIVATE; + } + parent = parent->parent; + } } break; case WM_SETFOCUS: From 4dd585fb6241c019b041a6fb43fe2099ebac2c71 Mon Sep 17 00:00:00 2001 From: Sam Lantinga Date: Tue, 14 Jan 2025 21:22:14 -0800 Subject: [PATCH 066/340] coreaudio: convert MPEG channel layout to WAVE channel layout --- src/audio/coreaudio/SDL_coreaudio.m | 26 ++++++++++++++++++++------ 1 file changed, 20 insertions(+), 6 deletions(-) diff --git a/src/audio/coreaudio/SDL_coreaudio.m b/src/audio/coreaudio/SDL_coreaudio.m index f18fffef02b90..3652709e06da1 100644 --- a/src/audio/coreaudio/SDL_coreaudio.m +++ b/src/audio/coreaudio/SDL_coreaudio.m @@ -769,10 +769,17 @@ static bool PrepareAudioQueue(SDL_AudioDevice *device) // L R C LFE Cs Ls Rs layout.mChannelLayoutTag = kAudioChannelLayoutTag_WAVE_6_1; } else { - // FIXME: We need to manually swizzle channels into a supported layout // L R C LFE Ls Rs Cs - //layout.mChannelLayoutTag = kAudioChannelLayoutTag_MPEG_6_1_A; - return SDL_SetError("Unsupported audio channels"); + layout.mChannelLayoutTag = kAudioChannelLayoutTag_MPEG_6_1_A; + + // Convert from SDL channel layout to kAudioChannelLayoutTag_MPEG_6_1_A + static const int swizzle_map[7] = { + 0, 1, 2, 3, 6, 4, 5 + }; + device->chmap = SDL_ChannelMapDup(swizzle_map, SDL_arraysize(swizzle_map)); + if (!device->chmap) { + return false; + } } break; case 8: @@ -780,10 +787,17 @@ static bool PrepareAudioQueue(SDL_AudioDevice *device) // L R C LFE Rls Rrs Ls Rs layout.mChannelLayoutTag = kAudioChannelLayoutTag_WAVE_7_1; } else { - // FIXME: We need to manually swizzle channels into a supported layout // L R C LFE Ls Rs Rls Rrs - //layout.mChannelLayoutTag = kAudioChannelLayoutTag_MPEG_7_1_C; - return SDL_SetError("Unsupported audio channels"); + layout.mChannelLayoutTag = kAudioChannelLayoutTag_MPEG_7_1_C; + + // Convert from SDL channel layout to kAudioChannelLayoutTag_MPEG_7_1_C + static const int swizzle_map[8] = { + 0, 1, 2, 3, 6, 7, 4, 5 + }; + device->chmap = SDL_ChannelMapDup(swizzle_map, SDL_arraysize(swizzle_map)); + if (!device->chmap) { + return false; + } } break; default: From 8e9c44bc3b1f08968d14f485002e7472b689bd67 Mon Sep 17 00:00:00 2001 From: Sam Lantinga Date: Tue, 14 Jan 2025 22:35:13 -0800 Subject: [PATCH 067/340] Fixed accidental removal of optional delegate interface check Fixes https://github.com/libsdl-org/SDL/issues/11970 --- src/video/uikit/SDL_uikitwindow.m | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/video/uikit/SDL_uikitwindow.m b/src/video/uikit/SDL_uikitwindow.m index 1bc7936007a2c..2b258b19139b5 100644 --- a/src/video/uikit/SDL_uikitwindow.m +++ b/src/video/uikit/SDL_uikitwindow.m @@ -398,7 +398,11 @@ void UIKit_GetWindowSizeInPixels(SDL_VideoDevice *_this, SDL_Window *window, int /* Get all possible valid orientations. If the app delegate doesn't tell * us, we get the orientations from Info.plist via UIApplication. */ - validOrientations = [app.delegate application:app supportedInterfaceOrientationsForWindow:data.uiwindow]; + if ([app.delegate respondsToSelector:@selector(application:supportedInterfaceOrientationsForWindow:)]) { + validOrientations = [app.delegate application:app supportedInterfaceOrientationsForWindow:data.uiwindow]; + } else { + validOrientations = [app supportedInterfaceOrientationsForWindow:data.uiwindow]; + } if (hint != NULL) { NSArray *orientations = [@(hint) componentsSeparatedByString:@" "]; From 169c8d5140df522561f0f44d1490eea14e44b27b Mon Sep 17 00:00:00 2001 From: ImThour Date: Wed, 15 Jan 2025 11:27:00 +0530 Subject: [PATCH 068/340] Fix incorrect hotspot calculation for cursor positioning Corrected the calculation of the vertical hotspot position in the `GetCachedCursor` function. Changed the variable from `data->hot_x` to `data->hot_y` to ensure the correct vertical position of the cursor's hotspot is used when scaling. --- src/video/windows/SDL_windowsmouse.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/video/windows/SDL_windowsmouse.c b/src/video/windows/SDL_windowsmouse.c index af99ef6276d35..3a1c7cac8924c 100644 --- a/src/video/windows/SDL_windowsmouse.c +++ b/src/video/windows/SDL_windowsmouse.c @@ -390,7 +390,7 @@ static HCURSOR GetCachedCursor(SDL_Cursor *cursor) } int hot_x = (int)SDL_round(data->hot_x * scale); - int hot_y = (int)SDL_round(data->hot_x * scale); + int hot_y = (int)SDL_round(data->hot_y * scale); hcursor = WIN_CreateHCursor(surface, hot_x, hot_y); if (!hcursor) { goto error; From dabc93a631903570cc80a56e3a9002ac13535d57 Mon Sep 17 00:00:00 2001 From: "Ryan C. Gordon" Date: Tue, 14 Jan 2025 23:30:10 -0500 Subject: [PATCH 069/340] pen: Send virtual mouse and touch events for pen input. Fixes #11948. --- include/SDL3/SDL_hints.h | 30 +++++++++++ include/SDL3/SDL_pen.h | 16 ++++++ src/events/SDL_mouse.c | 30 +++++++++++ src/events/SDL_mouse_c.h | 2 + src/events/SDL_pen.c | 77 +++++++++++++++++++++++++-- src/events/SDL_pen_c.h | 8 +-- src/events/SDL_touch.c | 35 +++++------- src/video/wayland/SDL_waylandevents.c | 2 +- 8 files changed, 168 insertions(+), 32 deletions(-) diff --git a/include/SDL3/SDL_hints.h b/include/SDL3/SDL_hints.h index 0a4bc48f7dae0..a33b8174c3ef2 100644 --- a/include/SDL3/SDL_hints.h +++ b/include/SDL3/SDL_hints.h @@ -4185,6 +4185,36 @@ extern "C" { */ #define SDL_HINT_ASSERT "SDL_ASSERT" +/** + * A variable controlling whether pen events should generate synthetic mouse + * events. + * + * The variable can be set to the following values: + * + * - "0": Pen events will not generate mouse events. + * - "1": Pen events will generate mouse events. (default) + * + * This hint can be set anytime. + * + * \since This hint is available since SDL 3.2.0. + */ +#define SDL_HINT_PEN_MOUSE_EVENTS "SDL_PEN_MOUSE_EVENTS" + +/** + * A variable controlling whether pen events should generate synthetic touch + * events. + * + * The variable can be set to the following values: + * + * - "0": Pen events will not generate touch events. + * - "1": Pen events will generate touch events. (default) + * + * This hint can be set anytime. + * + * \since This hint is available since SDL 3.2.0. + */ +#define SDL_HINT_PEN_TOUCH_EVENTS "SDL_PEN_TOUCH_EVENTS" + /** * An enumeration of hint priorities. diff --git a/include/SDL3/SDL_pen.h b/include/SDL3/SDL_pen.h index 838be6d4f0447..61305905a13b2 100644 --- a/include/SDL3/SDL_pen.h +++ b/include/SDL3/SDL_pen.h @@ -40,6 +40,8 @@ #define SDL_pen_h_ #include +#include +#include /* Set up for C function definitions, even when using C++ */ #ifdef __cplusplus @@ -59,6 +61,20 @@ extern "C" { */ typedef Uint32 SDL_PenID; +/** + * The SDL_MouseID for mouse events simulated with pen input. + * + * \since This macro is available since SDL 3.1.3. + */ +#define SDL_PEN_MOUSEID ((SDL_MouseID)-2) + +/** + * The SDL_TouchID for touch events simulated with pen input. + * + * \since This macro is available since SDL 3.1.3. + */ +#define SDL_PEN_TOUCHID ((SDL_TouchID)-2) + /** * Pen input flags, as reported by various pen events' `pen_state` field. diff --git a/src/events/SDL_mouse.c b/src/events/SDL_mouse.c index becfe28e5d1f1..932cf13610c37 100644 --- a/src/events/SDL_mouse.c +++ b/src/events/SDL_mouse.c @@ -173,6 +173,24 @@ static void SDLCALL SDL_MouseTouchEventsChanged(void *userdata, const char *name } } +static void SDLCALL SDL_PenMouseEventsChanged(void *userdata, const char *name, const char *oldValue, const char *hint) +{ + SDL_Mouse *mouse = (SDL_Mouse *)userdata; + + mouse->pen_mouse_events = SDL_GetStringBoolean(hint, true); +} + +static void SDLCALL SDL_PenTouchEventsChanged(void *userdata, const char *name, const char *oldValue, const char *hint) +{ + SDL_Mouse *mouse = (SDL_Mouse *)userdata; + + mouse->pen_touch_events = SDL_GetStringBoolean(hint, true); + + if (mouse->pen_touch_events) { + SDL_AddTouch(SDL_PEN_TOUCHID, SDL_TOUCH_DEVICE_DIRECT, "pen_input"); + } +} + static void SDLCALL SDL_MouseAutoCaptureChanged(void *userdata, const char *name, const char *oldValue, const char *hint) { SDL_Mouse *mouse = (SDL_Mouse *)userdata; @@ -239,6 +257,12 @@ bool SDL_PreInitMouse(void) SDL_AddHintCallback(SDL_HINT_MOUSE_TOUCH_EVENTS, SDL_MouseTouchEventsChanged, mouse); + SDL_AddHintCallback(SDL_HINT_PEN_MOUSE_EVENTS, + SDL_PenMouseEventsChanged, mouse); + + SDL_AddHintCallback(SDL_HINT_PEN_TOUCH_EVENTS, + SDL_PenTouchEventsChanged, mouse); + SDL_AddHintCallback(SDL_HINT_MOUSE_AUTO_CAPTURE, SDL_MouseAutoCaptureChanged, mouse); @@ -1043,6 +1067,12 @@ void SDL_QuitMouse(void) SDL_RemoveHintCallback(SDL_HINT_MOUSE_TOUCH_EVENTS, SDL_MouseTouchEventsChanged, mouse); + SDL_RemoveHintCallback(SDL_HINT_PEN_MOUSE_EVENTS, + SDL_PenMouseEventsChanged, mouse); + + SDL_RemoveHintCallback(SDL_HINT_PEN_TOUCH_EVENTS, + SDL_PenTouchEventsChanged, mouse); + SDL_RemoveHintCallback(SDL_HINT_MOUSE_AUTO_CAPTURE, SDL_MouseAutoCaptureChanged, mouse); diff --git a/src/events/SDL_mouse_c.h b/src/events/SDL_mouse_c.h index 81dad3ace8b7f..01974d9a87590 100644 --- a/src/events/SDL_mouse_c.h +++ b/src/events/SDL_mouse_c.h @@ -118,6 +118,8 @@ typedef struct int double_click_radius; bool touch_mouse_events; bool mouse_touch_events; + bool pen_mouse_events; + bool pen_touch_events; bool was_touch_mouse_events; // Was a touch-mouse event pending? #ifdef SDL_PLATFORM_VITA Uint8 vita_touch_mouse_device; diff --git a/src/events/SDL_pen.c b/src/events/SDL_pen.c index 028d59b0d9241..6db1b0ee14413 100644 --- a/src/events/SDL_pen.c +++ b/src/events/SDL_pen.c @@ -26,6 +26,8 @@ #include "SDL_events_c.h" #include "SDL_pen_c.h" +static SDL_PenID pen_touching = 0; // used for synthetic mouse/touch events. + typedef struct SDL_Pen { SDL_PenID instance_id; @@ -111,6 +113,7 @@ void SDL_QuitPen(void) SDL_free(pen_devices); pen_devices = NULL; pen_device_count = 0; + pen_touching = 0; } #if 0 // not a public API at the moment. @@ -309,7 +312,7 @@ void SDL_RemoveAllPenDevices(void (*callback)(SDL_PenID instance_id, void *handl SDL_UnlockRWLock(pen_device_rwlock); } -void SDL_SendPenTouch(Uint64 timestamp, SDL_PenID instance_id, const SDL_Window *window, bool eraser, bool down) +void SDL_SendPenTouch(Uint64 timestamp, SDL_PenID instance_id, SDL_Window *window, bool eraser, bool down) { bool send_event = false; SDL_PenInputFlags input_state = 0; @@ -363,10 +366,45 @@ void SDL_SendPenTouch(Uint64 timestamp, SDL_PenID instance_id, const SDL_Window event.ptouch.down = down; SDL_PushEvent(&event); } + + SDL_Mouse *mouse = SDL_GetMouse(); + if (mouse && window) { + if (mouse->pen_mouse_events) { + if (down) { + if (!pen_touching) { + SDL_SendMouseMotion(timestamp, window, SDL_PEN_MOUSEID, false, x, y); + SDL_SendMouseButton(timestamp, window, SDL_PEN_MOUSEID, SDL_BUTTON_LEFT, true); + } + } else { + if (pen_touching == instance_id) { + SDL_SendMouseButton(timestamp, window, SDL_PEN_MOUSEID, SDL_BUTTON_LEFT, false); + } + } + } + + if (mouse->pen_touch_events) { + const SDL_EventType touchtype = down ? SDL_EVENT_FINGER_DOWN : SDL_EVENT_FINGER_UP; + const float normalized_x = x / (float)window->w; + const float normalized_y = y / (float)window->h; + if (!pen_touching || (pen_touching == instance_id)) { + SDL_SendTouch(timestamp, SDL_PEN_TOUCHID, SDL_BUTTON_LEFT, window, touchtype, normalized_x, normalized_y, pen->axes[SDL_PEN_AXIS_PRESSURE]); + } + } + } + + if (down) { + if (!pen_touching) { + pen_touching = instance_id; + } + } else { + if (pen_touching == instance_id) { + pen_touching = 0; + } + } } } -void SDL_SendPenAxis(Uint64 timestamp, SDL_PenID instance_id, const SDL_Window *window, SDL_PenAxis axis, float value) +void SDL_SendPenAxis(Uint64 timestamp, SDL_PenID instance_id, SDL_Window *window, SDL_PenAxis axis, float value) { SDL_assert((axis >= 0) && (axis < SDL_PEN_AXIS_COUNT)); // fix the backend if this triggers. @@ -405,10 +443,19 @@ void SDL_SendPenAxis(Uint64 timestamp, SDL_PenID instance_id, const SDL_Window * event.paxis.axis = axis; event.paxis.value = value; SDL_PushEvent(&event); + + if (window && (axis == SDL_PEN_AXIS_PRESSURE) && (pen_touching == instance_id)) { + SDL_Mouse *mouse = SDL_GetMouse(); + if (mouse && mouse->pen_touch_events) { + const float normalized_x = x / (float)window->w; + const float normalized_y = y / (float)window->h; + SDL_SendTouchMotion(timestamp, SDL_PEN_TOUCHID, SDL_BUTTON_LEFT, window, normalized_x, normalized_y, value); + } + } } } -void SDL_SendPenMotion(Uint64 timestamp, SDL_PenID instance_id, const SDL_Window *window, float x, float y) +void SDL_SendPenMotion(Uint64 timestamp, SDL_PenID instance_id, SDL_Window *window, float x, float y) { bool send_event = false; SDL_PenInputFlags input_state = 0; @@ -440,10 +487,25 @@ void SDL_SendPenMotion(Uint64 timestamp, SDL_PenID instance_id, const SDL_Window event.pmotion.x = x; event.pmotion.y = y; SDL_PushEvent(&event); + + if (window && (pen_touching == instance_id)) { + SDL_Mouse *mouse = SDL_GetMouse(); + if (mouse) { + if (mouse->pen_mouse_events) { + SDL_SendMouseMotion(timestamp, window, SDL_PEN_MOUSEID, false, x, y); + } + + if (mouse->pen_touch_events) { + const float normalized_x = x / (float)window->w; + const float normalized_y = y / (float)window->h; + SDL_SendTouchMotion(timestamp, SDL_PEN_TOUCHID, SDL_BUTTON_LEFT, window, normalized_x, normalized_y, pen->axes[SDL_PEN_AXIS_PRESSURE]); + } + } + } } } -void SDL_SendPenButton(Uint64 timestamp, SDL_PenID instance_id, const SDL_Window *window, Uint8 button, bool down) +void SDL_SendPenButton(Uint64 timestamp, SDL_PenID instance_id, SDL_Window *window, Uint8 button, bool down) { bool send_event = false; SDL_PenInputFlags input_state = 0; @@ -492,6 +554,13 @@ void SDL_SendPenButton(Uint64 timestamp, SDL_PenID instance_id, const SDL_Window event.pbutton.button = button; event.pbutton.down = down; SDL_PushEvent(&event); + + if (window && (pen_touching == instance_id)) { + SDL_Mouse *mouse = SDL_GetMouse(); + if (mouse && mouse->pen_mouse_events) { + SDL_SendMouseButton(timestamp, window, SDL_PEN_MOUSEID, button + 1, down); + } + } } } } diff --git a/src/events/SDL_pen_c.h b/src/events/SDL_pen_c.h index 7175483a53861..1eff47f230716 100644 --- a/src/events/SDL_pen_c.h +++ b/src/events/SDL_pen_c.h @@ -67,16 +67,16 @@ extern void SDL_RemovePenDevice(Uint64 timestamp, SDL_PenID instance_id); extern void SDL_RemoveAllPenDevices(void (*callback)(SDL_PenID instance_id, void *handle, void *userdata), void *userdata); // Backend calls this when a pen's button changes, to generate events and update state. -extern void SDL_SendPenTouch(Uint64 timestamp, SDL_PenID instance_id, const SDL_Window *window, bool eraser, bool down); +extern void SDL_SendPenTouch(Uint64 timestamp, SDL_PenID instance_id, SDL_Window *window, bool eraser, bool down); // Backend calls this when a pen moves on the tablet, to generate events and update state. -extern void SDL_SendPenMotion(Uint64 timestamp, SDL_PenID instance_id, const SDL_Window *window, float x, float y); +extern void SDL_SendPenMotion(Uint64 timestamp, SDL_PenID instance_id, SDL_Window *window, float x, float y); // Backend calls this when a pen's axis changes, to generate events and update state. -extern void SDL_SendPenAxis(Uint64 timestamp, SDL_PenID instance_id, const SDL_Window *window, SDL_PenAxis axis, float value); +extern void SDL_SendPenAxis(Uint64 timestamp, SDL_PenID instance_id, SDL_Window *window, SDL_PenAxis axis, float value); // Backend calls this when a pen's button changes, to generate events and update state. -extern void SDL_SendPenButton(Uint64 timestamp, SDL_PenID instance_id, const SDL_Window *window, Uint8 button, bool down); +extern void SDL_SendPenButton(Uint64 timestamp, SDL_PenID instance_id, SDL_Window *window, Uint8 button, bool down); // Backend can optionally use this to find the SDL_PenID for the `handle` that was passed to SDL_AddPenDevice. extern SDL_PenID SDL_FindPenByHandle(void *handle); diff --git a/src/events/SDL_touch.c b/src/events/SDL_touch.c index de9b6915a78bb..3a4f54bd070c1 100644 --- a/src/events/SDL_touch.c +++ b/src/events/SDL_touch.c @@ -29,14 +29,9 @@ static int SDL_num_touch = 0; static SDL_Touch **SDL_touchDevices = NULL; // for mapping touch events to mice - -#define SYNTHESIZE_TOUCH_TO_MOUSE 1 - -#if SYNTHESIZE_TOUCH_TO_MOUSE static bool finger_touching = false; static SDL_FingerID track_fingerid; static SDL_TouchID track_touchid; -#endif // Public functions bool SDL_InitTouch(void) @@ -257,7 +252,6 @@ static void SDL_DelFinger(SDL_Touch *touch, SDL_FingerID fingerid) void SDL_SendTouch(Uint64 timestamp, SDL_TouchID id, SDL_FingerID fingerid, SDL_Window *window, SDL_EventType type, float x, float y, float pressure) { SDL_Finger *finger; - SDL_Mouse *mouse; bool down = (type == SDL_EVENT_FINGER_DOWN); SDL_Touch *touch = SDL_GetTouch(id); @@ -265,19 +259,18 @@ void SDL_SendTouch(Uint64 timestamp, SDL_TouchID id, SDL_FingerID fingerid, SDL_ return; } - mouse = SDL_GetMouse(); + SDL_Mouse *mouse = SDL_GetMouse(); -#if SYNTHESIZE_TOUCH_TO_MOUSE // SDL_HINT_TOUCH_MOUSE_EVENTS: controlling whether touch events should generate synthetic mouse events // SDL_HINT_VITA_TOUCH_MOUSE_DEVICE: controlling which touchpad should generate synthetic mouse events, PSVita-only { + // FIXME: maybe we should only restrict to a few SDL_TouchDeviceType + if ((id != SDL_MOUSE_TOUCHID) && (id != SDL_PEN_TOUCHID)) { #ifdef SDL_PLATFORM_VITA - if (mouse->touch_mouse_events && ((mouse->vita_touch_mouse_device == id) || (mouse->vita_touch_mouse_device == 2))) { + if (mouse->touch_mouse_events && ((mouse->vita_touch_mouse_device == id) || (mouse->vita_touch_mouse_device == 2))) { #else - if (mouse->touch_mouse_events) { + if (mouse->touch_mouse_events) { #endif - // FIXME: maybe we should only restrict to a few SDL_TouchDeviceType - if (id != SDL_MOUSE_TOUCHID) { if (window) { if (down) { if (finger_touching == false) { @@ -318,13 +311,12 @@ void SDL_SendTouch(Uint64 timestamp, SDL_TouchID id, SDL_FingerID fingerid, SDL_ } } } -#endif // SDL_HINT_MOUSE_TOUCH_EVENTS: if not set, discard synthetic touch events coming from platform layer - if (mouse->mouse_touch_events == 0) { - if (id == SDL_MOUSE_TOUCHID) { - return; - } + if (!mouse->mouse_touch_events && (id == SDL_MOUSE_TOUCHID)) { + return; + } else if (!mouse->pen_touch_events && (id == SDL_PEN_TOUCHID)) { + return; } finger = SDL_GetFinger(touch, fingerid); @@ -384,7 +376,6 @@ void SDL_SendTouchMotion(Uint64 timestamp, SDL_TouchID id, SDL_FingerID fingerid { SDL_Touch *touch; SDL_Finger *finger; - SDL_Mouse *mouse; float xrel, yrel, prel; touch = SDL_GetTouch(id); @@ -392,13 +383,12 @@ void SDL_SendTouchMotion(Uint64 timestamp, SDL_TouchID id, SDL_FingerID fingerid return; } - mouse = SDL_GetMouse(); + SDL_Mouse *mouse = SDL_GetMouse(); -#if SYNTHESIZE_TOUCH_TO_MOUSE // SDL_HINT_TOUCH_MOUSE_EVENTS: controlling whether touch events should generate synthetic mouse events { - if (mouse->touch_mouse_events) { - if (id != SDL_MOUSE_TOUCHID) { + if ((id != SDL_MOUSE_TOUCHID) && (id != SDL_PEN_TOUCHID)) { + if (mouse->touch_mouse_events) { if (window) { if (finger_touching == true && track_touchid == id && track_fingerid == fingerid) { float pos_x = (x * (float)window->w); @@ -421,7 +411,6 @@ void SDL_SendTouchMotion(Uint64 timestamp, SDL_TouchID id, SDL_FingerID fingerid } } } -#endif // SDL_HINT_MOUSE_TOUCH_EVENTS: if not set, discard synthetic touch events coming from platform layer if (mouse->mouse_touch_events == 0) { diff --git a/src/video/wayland/SDL_waylandevents.c b/src/video/wayland/SDL_waylandevents.c index 36e2933970763..03982fbad4109 100644 --- a/src/video/wayland/SDL_waylandevents.c +++ b/src/video/wayland/SDL_waylandevents.c @@ -2957,7 +2957,7 @@ static void tablet_tool_handle_frame(void *data, struct zwp_tablet_tool_v2 *tool const Uint64 timestamp = Wayland_GetEventTimestamp(SDL_MS_TO_NS(time)); const SDL_PenID instance_id = sdltool->instance_id; - const SDL_Window *window = sdltool->tool_focus; + SDL_Window *window = sdltool->tool_focus; // I don't know if this is necessary (or makes sense), but send motion before pen downs, but after pen ups, so you don't get unexpected lines drawn. if (sdltool->frame_motion_set && (sdltool->frame_pen_down != -1)) { From ebb24eedc83d7916b183c1c4223649c847db1e96 Mon Sep 17 00:00:00 2001 From: "Ryan C. Gordon" Date: Wed, 15 Jan 2025 01:55:32 -0500 Subject: [PATCH 070/340] mouse: Clean up virtual touch devices as appropriate. --- src/events/SDL_mouse.c | 28 ++++++++++++++++++++++++++-- src/events/SDL_mouse_c.h | 2 ++ 2 files changed, 28 insertions(+), 2 deletions(-) diff --git a/src/events/SDL_mouse.c b/src/events/SDL_mouse.c index 932cf13610c37..429cc4e97bea8 100644 --- a/src/events/SDL_mouse.c +++ b/src/events/SDL_mouse.c @@ -169,7 +169,15 @@ static void SDLCALL SDL_MouseTouchEventsChanged(void *userdata, const char *name mouse->mouse_touch_events = SDL_GetStringBoolean(hint, default_value); if (mouse->mouse_touch_events) { - SDL_AddTouch(SDL_MOUSE_TOUCHID, SDL_TOUCH_DEVICE_DIRECT, "mouse_input"); + if (!mouse->added_mouse_touch_device) { + SDL_AddTouch(SDL_MOUSE_TOUCHID, SDL_TOUCH_DEVICE_DIRECT, "mouse_input"); + mouse->added_mouse_touch_device = true; + } + } else { + if (mouse->added_mouse_touch_device) { + SDL_DelTouch(SDL_MOUSE_TOUCHID); + mouse->added_mouse_touch_device = false; + } } } @@ -187,7 +195,15 @@ static void SDLCALL SDL_PenTouchEventsChanged(void *userdata, const char *name, mouse->pen_touch_events = SDL_GetStringBoolean(hint, true); if (mouse->pen_touch_events) { - SDL_AddTouch(SDL_PEN_TOUCHID, SDL_TOUCH_DEVICE_DIRECT, "pen_input"); + if (!mouse->added_pen_touch_device) { + SDL_AddTouch(SDL_PEN_TOUCHID, SDL_TOUCH_DEVICE_DIRECT, "pen_input"); + mouse->added_pen_touch_device = true; + } + } else { + if (mouse->added_pen_touch_device) { + SDL_DelTouch(SDL_PEN_TOUCHID); + mouse->added_pen_touch_device = false; + } } } @@ -1010,6 +1026,14 @@ void SDL_QuitMouse(void) SDL_Cursor *cursor, *next; SDL_Mouse *mouse = SDL_GetMouse(); + if (mouse->added_mouse_touch_device) { + SDL_DelTouch(SDL_MOUSE_TOUCHID); + } + + if (mouse->added_pen_touch_device) { + SDL_DelTouch(SDL_PEN_TOUCHID); + } + if (mouse->CaptureMouse) { SDL_CaptureMouse(false); SDL_UpdateMouseCapture(true); diff --git a/src/events/SDL_mouse_c.h b/src/events/SDL_mouse_c.h index 01974d9a87590..43cc5207da806 100644 --- a/src/events/SDL_mouse_c.h +++ b/src/events/SDL_mouse_c.h @@ -121,6 +121,8 @@ typedef struct bool pen_mouse_events; bool pen_touch_events; bool was_touch_mouse_events; // Was a touch-mouse event pending? + bool added_mouse_touch_device; // did we SDL_AddTouch() a virtual touch device for the mouse? + bool added_pen_touch_device; // did we SDL_AddTouch() a virtual touch device for pens? #ifdef SDL_PLATFORM_VITA Uint8 vita_touch_mouse_device; #endif From a446381ea9023197491fd66328c1b4c8f6da8a53 Mon Sep 17 00:00:00 2001 From: Sam Lantinga Date: Tue, 14 Jan 2025 23:28:00 -0800 Subject: [PATCH 071/340] Tooltips and unfocusable windows can't become main windows --- src/video/cocoa/SDL_cocoawindow.m | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/video/cocoa/SDL_cocoawindow.m b/src/video/cocoa/SDL_cocoawindow.m index 2ca579513d57c..947db1e976c42 100644 --- a/src/video/cocoa/SDL_cocoawindow.m +++ b/src/video/cocoa/SDL_cocoawindow.m @@ -36,7 +36,9 @@ #include "SDL_cocoaopengles.h" #include "SDL_cocoavideo.h" -// #define DEBUG_COCOAWINDOW +#if 0 +#define DEBUG_COCOAWINDOW +#endif #ifdef DEBUG_COCOAWINDOW #define DLog(fmt, ...) printf("%s: " fmt "\n", __func__, ##__VA_ARGS__) @@ -125,7 +127,7 @@ - (BOOL)canBecomeKeyWindow - (BOOL)canBecomeMainWindow { SDL_Window *window = [self findSDLWindow]; - if (window && !SDL_WINDOW_IS_POPUP(window)) { + if (window && !(window->flags & (SDL_WINDOW_TOOLTIP | SDL_WINDOW_NOT_FOCUSABLE)) && !SDL_WINDOW_IS_POPUP(window)) { return YES; } else { return NO; From 51fa076fdc56c3d9da92bf2f25bd78a23b80362e Mon Sep 17 00:00:00 2001 From: Sam Lantinga Date: Tue, 14 Jan 2025 23:28:31 -0800 Subject: [PATCH 072/340] Don't send normal keyboard events if no application window has focus This can happen if all the windows shown have the SDL_WINDOW_NOT_FOCUSABLE flag. We'll still accept modifier state changes though, so you can do Control-click actions. --- src/video/cocoa/SDL_cocoakeyboard.m | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/video/cocoa/SDL_cocoakeyboard.m b/src/video/cocoa/SDL_cocoakeyboard.m index 19ee5932019bf..f73572da59c4a 100644 --- a/src/video/cocoa/SDL_cocoakeyboard.m +++ b/src/video/cocoa/SDL_cocoakeyboard.m @@ -476,7 +476,7 @@ void Cocoa_HandleKeyEvent(SDL_VideoDevice *_this, NSEvent *event) [data.fieldEdit setPendingKey:scancode scancode:code timestamp:Cocoa_GetEventTimestamp([event timestamp])]; [data.fieldEdit interpretKeyEvents:[NSArray arrayWithObject:event]]; [data.fieldEdit sendPendingKey]; - } else { + } else if (SDL_GetKeyboardFocus()) { SDL_SendKeyboardKey(Cocoa_GetEventTimestamp([event timestamp]), SDL_DEFAULT_KEYBOARD_ID, scancode, code, true); } break; From 8ce176b59a824cca0458858ffe32542adfea15e7 Mon Sep 17 00:00:00 2001 From: Petar Popovic Date: Wed, 30 Oct 2024 22:12:25 +0100 Subject: [PATCH 073/340] SDL_GetMouseNameForID(): Set an error message for invalid mouse IDs. --- src/events/SDL_mouse.c | 1 + 1 file changed, 1 insertion(+) diff --git a/src/events/SDL_mouse.c b/src/events/SDL_mouse.c index 429cc4e97bea8..5e72a1cc0dc2a 100644 --- a/src/events/SDL_mouse.c +++ b/src/events/SDL_mouse.c @@ -428,6 +428,7 @@ const char *SDL_GetMouseNameForID(SDL_MouseID instance_id) { int mouse_index = SDL_GetMouseIndex(instance_id); if (mouse_index < 0) { + SDL_SetError("Mouse %" SDL_PRIu32 " not found", instance_id); return NULL; } return SDL_GetPersistentString(SDL_mice[mouse_index].name); From 23410debf7ad2d05d4662ed38af110e43b2e3a14 Mon Sep 17 00:00:00 2001 From: Sam Lantinga Date: Wed, 15 Jan 2025 00:01:06 -0800 Subject: [PATCH 074/340] SDL_GetKeyboardNameForID(): Set an error message for invalid keyboard IDs --- src/events/SDL_keyboard.c | 1 + 1 file changed, 1 insertion(+) diff --git a/src/events/SDL_keyboard.c b/src/events/SDL_keyboard.c index 0ad2ff6dde113..e4664fba6d296 100644 --- a/src/events/SDL_keyboard.c +++ b/src/events/SDL_keyboard.c @@ -208,6 +208,7 @@ const char *SDL_GetKeyboardNameForID(SDL_KeyboardID instance_id) { int keyboard_index = SDL_GetKeyboardIndex(instance_id); if (keyboard_index < 0) { + SDL_SetError("Keyboard %" SDL_PRIu32 " not found", instance_id); return NULL; } return SDL_GetPersistentString(SDL_keyboards[keyboard_index].name); From 67382e9c839a41188dc06e0b8089445123453611 Mon Sep 17 00:00:00 2001 From: Sam Lantinga Date: Wed, 15 Jan 2025 07:39:05 -0800 Subject: [PATCH 075/340] Fixed detection of function keys on Emscripten Fixes https://github.com/libsdl-org/SDL/issues/11973 --- src/video/emscripten/SDL_emscriptenevents.c | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/src/video/emscripten/SDL_emscriptenevents.c b/src/video/emscripten/SDL_emscriptenevents.c index 8084ed2fe3f82..834bca8beb619 100644 --- a/src/video/emscripten/SDL_emscriptenevents.c +++ b/src/video/emscripten/SDL_emscriptenevents.c @@ -482,6 +482,17 @@ static EM_BOOL Emscripten_HandleTouch(int eventType, const EmscriptenTouchEvent return preventDefault; } +static bool IsFunctionKey(SDL_Scancode scancode) +{ + if (scancode >= SDL_SCANCODE_F1 && scancode <= SDL_SCANCODE_F12) { + return true; + } + if (scancode >= SDL_SCANCODE_F13 && scancode <= SDL_SCANCODE_F24) { + return true; + } + return false; +} + /* This is a great tool to see web keyboard events live: * https://w3c.github.io/uievents/tools/key-event-viewer.html */ @@ -557,7 +568,7 @@ static EM_BOOL Emscripten_HandleKey(int eventType, const EmscriptenKeyboardEvent (scancode == SDL_SCANCODE_UP) || (scancode == SDL_SCANCODE_RIGHT) || (scancode == SDL_SCANCODE_DOWN) || - ((scancode >= SDL_SCANCODE_F1) && (scancode <= SDL_SCANCODE_F15)) || + IsFunctionKey(scancode) || keyEvent->ctrlKey) { is_nav_key = true; } From 19954719278c612aa41055483a090ece37ad7e79 Mon Sep 17 00:00:00 2001 From: Sam Lantinga Date: Wed, 15 Jan 2025 09:36:55 -0800 Subject: [PATCH 076/340] cocoa: fixed resizing windows with fixed aspect ratio The existing algorithm works well for min-max ratios, but didn't allow edge expansion of fixed aspect ratio windows. Use NSWindow setContentAspectRatio instead. --- src/video/cocoa/SDL_cocoavideo.m | 1 + src/video/cocoa/SDL_cocoawindow.h | 1 + src/video/cocoa/SDL_cocoawindow.m | 21 ++++++++++++++++++--- 3 files changed, 20 insertions(+), 3 deletions(-) diff --git a/src/video/cocoa/SDL_cocoavideo.m b/src/video/cocoa/SDL_cocoavideo.m index b9977c441bc91..aae54ebad8d96 100644 --- a/src/video/cocoa/SDL_cocoavideo.m +++ b/src/video/cocoa/SDL_cocoavideo.m @@ -103,6 +103,7 @@ static void Cocoa_DeleteDevice(SDL_VideoDevice *device) device->SetWindowSize = Cocoa_SetWindowSize; device->SetWindowMinimumSize = Cocoa_SetWindowMinimumSize; device->SetWindowMaximumSize = Cocoa_SetWindowMaximumSize; + device->SetWindowAspectRatio = Cocoa_SetWindowAspectRatio; device->SetWindowOpacity = Cocoa_SetWindowOpacity; device->GetWindowSizeInPixels = Cocoa_GetWindowSizeInPixels; device->ShowWindow = Cocoa_ShowWindow; diff --git a/src/video/cocoa/SDL_cocoawindow.h b/src/video/cocoa/SDL_cocoawindow.h index af567b8af2899..6df69f442a080 100644 --- a/src/video/cocoa/SDL_cocoawindow.h +++ b/src/video/cocoa/SDL_cocoawindow.h @@ -168,6 +168,7 @@ extern bool Cocoa_SetWindowPosition(SDL_VideoDevice *_this, SDL_Window *window); extern void Cocoa_SetWindowSize(SDL_VideoDevice *_this, SDL_Window *window); extern void Cocoa_SetWindowMinimumSize(SDL_VideoDevice *_this, SDL_Window *window); extern void Cocoa_SetWindowMaximumSize(SDL_VideoDevice *_this, SDL_Window *window); +extern void Cocoa_SetWindowAspectRatio(SDL_VideoDevice *_this, SDL_Window *window); extern void Cocoa_GetWindowSizeInPixels(SDL_VideoDevice *_this, SDL_Window *window, int *w, int *h); extern bool Cocoa_SetWindowOpacity(SDL_VideoDevice *_this, SDL_Window *window, float opacity); extern void Cocoa_ShowWindow(SDL_VideoDevice *_this, SDL_Window *window); diff --git a/src/video/cocoa/SDL_cocoawindow.m b/src/video/cocoa/SDL_cocoawindow.m index 947db1e976c42..daa544f7a43c0 100644 --- a/src/video/cocoa/SDL_cocoawindow.m +++ b/src/video/cocoa/SDL_cocoawindow.m @@ -1109,7 +1109,7 @@ - (NSSize)windowWillResize:(NSWindow *)sender toSize:(NSSize)frameSize { SDL_Window *window = _data.window; - if (window->min_aspect > 0.0f || window->max_aspect > 0.0f) { + if (window->min_aspect != window->max_aspect) { NSWindow *nswindow = _data.nswindow; NSRect newContentRect = [nswindow contentRectForFrameRect:NSMakeRect(0, 0, frameSize.width, frameSize.height)]; NSSize newSize = newContentRect.size; @@ -1121,9 +1121,9 @@ - (NSSize)windowWillResize:(NSWindow *)sender toSize:(NSSize)frameSize aspectRatio = newSize.width / newSize.height; if (maxAspectRatio > 0.0f && aspectRatio > maxAspectRatio) { - newSize.width = (int)SDL_roundf(newSize.height * maxAspectRatio); + newSize.width = SDL_roundf(newSize.height * maxAspectRatio); } else if (minAspectRatio > 0.0f && aspectRatio < minAspectRatio) { - newSize.height = (int)SDL_roundf(newSize.width / minAspectRatio); + newSize.height = SDL_roundf(newSize.width / minAspectRatio); } NSRect newFrameRect = [nswindow frameRectForContentRect:NSMakeRect(0, 0, newSize.width, newSize.height)]; @@ -2515,6 +2515,21 @@ void Cocoa_SetWindowMaximumSize(SDL_VideoDevice *_this, SDL_Window *window) } } +void Cocoa_SetWindowAspectRatio(SDL_VideoDevice *_this, SDL_Window *window) +{ + @autoreleasepool { + SDL_CocoaWindowData *windata = (__bridge SDL_CocoaWindowData *)window->internal; + + if (window->min_aspect > 0.0f && window->min_aspect == window->max_aspect) { + int numerator = 0, denominator = 1; + SDL_CalculateFraction(window->max_aspect, &numerator, &denominator); + [windata.nswindow setContentAspectRatio:NSMakeSize(numerator, denominator)]; + } else { + [windata.nswindow setContentAspectRatio:NSMakeSize(0, 0)]; + } + } +} + void Cocoa_GetWindowSizeInPixels(SDL_VideoDevice *_this, SDL_Window *window, int *w, int *h) { @autoreleasepool { From 18d21b36febb86abbf791e83bc61a8d4c85d85a4 Mon Sep 17 00:00:00 2001 From: Sam Lantinga Date: Wed, 15 Jan 2025 10:03:48 -0800 Subject: [PATCH 077/340] windows: use the initial rect to anchor fixed aspect ratio resizing Fixes https://github.com/libsdl-org/SDL/issues/11688 --- src/video/windows/SDL_windowsevents.c | 13 +++++++++---- src/video/windows/SDL_windowswindow.h | 1 + 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/src/video/windows/SDL_windowsevents.c b/src/video/windows/SDL_windowsevents.c index 18edb76d330d5..60ccac8ebe115 100644 --- a/src/video/windows/SDL_windowsevents.c +++ b/src/video/windows/SDL_windowsevents.c @@ -1682,6 +1682,11 @@ LRESULT CALLBACK WIN_WindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lPara case WM_ENTERSIZEMOVE: case WM_ENTERMENULOOP: { + data->initial_size_rect.left = data->window->x; + data->initial_size_rect.right = data->window->x + data->window->w; + data->initial_size_rect.top = data->window->y; + data->initial_size_rect.bottom = data->window->y + data->window->h; + SetTimer(hwnd, (UINT_PTR)SDL_IterateMainCallbacks, USER_TIMER_MINIMUM, NULL); } break; @@ -1775,7 +1780,7 @@ LRESULT CALLBACK WIN_WindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lPara case WMSZ_LEFT: clientDragRect.left = clientDragRect.right - w; if (lock_aspect_ratio) { - clientDragRect.top = (clientDragRect.bottom + clientDragRect.top - h) / 2; + clientDragRect.top = (data->initial_size_rect.bottom + data->initial_size_rect.top - h) / 2; } clientDragRect.bottom = h + clientDragRect.top; break; @@ -1786,7 +1791,7 @@ LRESULT CALLBACK WIN_WindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lPara case WMSZ_RIGHT: clientDragRect.right = w + clientDragRect.left; if (lock_aspect_ratio) { - clientDragRect.top = (clientDragRect.bottom + clientDragRect.top - h) / 2; + clientDragRect.top = (data->initial_size_rect.bottom + data->initial_size_rect.top - h) / 2; } clientDragRect.bottom = h + clientDragRect.top; break; @@ -1796,7 +1801,7 @@ LRESULT CALLBACK WIN_WindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lPara break; case WMSZ_TOP: if (lock_aspect_ratio) { - clientDragRect.left = (clientDragRect.right + clientDragRect.left - w) / 2; + clientDragRect.left = (data->initial_size_rect.right + data->initial_size_rect.left - w) / 2; } clientDragRect.right = w + clientDragRect.left; clientDragRect.top = clientDragRect.bottom - h; @@ -1807,7 +1812,7 @@ LRESULT CALLBACK WIN_WindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lPara break; case WMSZ_BOTTOM: if (lock_aspect_ratio) { - clientDragRect.left = (clientDragRect.right + clientDragRect.left - w) / 2; + clientDragRect.left = (data->initial_size_rect.right + data->initial_size_rect.left - w) / 2; } clientDragRect.right = w + clientDragRect.left; clientDragRect.bottom = h + clientDragRect.top; diff --git a/src/video/windows/SDL_windowswindow.h b/src/video/windows/SDL_windowswindow.h index 6d37e1630d454..467c5b893fffa 100644 --- a/src/video/windows/SDL_windowswindow.h +++ b/src/video/windows/SDL_windowswindow.h @@ -82,6 +82,7 @@ struct SDL_WindowData bool windowed_mode_was_maximized; bool in_window_deactivation; bool force_resizable; + RECT initial_size_rect; RECT cursor_clipped_rect; // last successfully committed clipping rect for this window RECT cursor_ctrlock_rect; // this is Windows-specific, but probably does not need to be per-window UINT windowed_mode_corner_rounding; From fc9b2478d86daa789918e28c4978400983fdbe68 Mon Sep 17 00:00:00 2001 From: Sam Lantinga Date: Wed, 15 Jan 2025 10:51:12 -0800 Subject: [PATCH 078/340] windows: don't set focus click pending if SDL_HINT_MOUSE_FOCUS_CLICKTHROUGH is set Fixes https://github.com/libsdl-org/SDL/issues/11976 --- src/video/windows/SDL_windowsevents.c | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/src/video/windows/SDL_windowsevents.c b/src/video/windows/SDL_windowsevents.c index 60ccac8ebe115..4d4df9e940915 100644 --- a/src/video/windows/SDL_windowsevents.c +++ b/src/video/windows/SDL_windowsevents.c @@ -241,9 +241,7 @@ static void WIN_CheckWParamMouseButton(Uint64 timestamp, bool bwParamMousePresse data->focus_click_pending &= ~SDL_BUTTON_MASK(button); WIN_UpdateClipCursor(data->window); } - if (WIN_ShouldIgnoreFocusClick(data)) { - return; - } + return; } if (bwParamMousePressed && !(mouseFlags & SDL_BUTTON_MASK(button))) { @@ -323,7 +321,7 @@ static void WIN_UpdateFocus(SDL_Window *window, bool expect_focus) if (has_focus) { POINT cursorPos; - if (!(window->flags & SDL_WINDOW_MOUSE_CAPTURE)) { + if (WIN_ShouldIgnoreFocusClick(data) && !(window->flags & SDL_WINDOW_MOUSE_CAPTURE)) { bool swapButtons = GetSystemMetrics(SM_SWAPBUTTON) != 0; if (GetAsyncKeyState(VK_LBUTTON)) { data->focus_click_pending |= !swapButtons ? SDL_BUTTON_LMASK : SDL_BUTTON_RMASK; @@ -676,9 +674,7 @@ static void WIN_HandleRawMouseInput(Uint64 timestamp, SDL_VideoData *data, HANDL windowdata->focus_click_pending &= ~SDL_BUTTON_MASK(button); WIN_UpdateClipCursor(window); } - if (WIN_ShouldIgnoreFocusClick(windowdata)) { - continue; - } + continue; } SDL_SendMouseButton(timestamp, window, mouseID, button, down); From 84d35587ee400d9704e38042652fe5cbaab30c68 Mon Sep 17 00:00:00 2001 From: "Ryan C. Gordon" Date: Wed, 15 Jan 2025 14:08:53 -0500 Subject: [PATCH 079/340] filesystem: SDL_SYS_EnumerateDirectory inexplicably takes the same arg twice. --- src/filesystem/SDL_filesystem.c | 2 +- src/filesystem/SDL_sysfilesystem.h | 2 +- src/filesystem/dummy/SDL_sysfsops.c | 2 +- src/filesystem/posix/SDL_sysfsops.c | 4 ++-- src/filesystem/windows/SDL_sysfsops.c | 6 +++--- 5 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/filesystem/SDL_filesystem.c b/src/filesystem/SDL_filesystem.c index e3066f2bef0af..6bb905a0b851e 100644 --- a/src/filesystem/SDL_filesystem.c +++ b/src/filesystem/SDL_filesystem.c @@ -121,7 +121,7 @@ bool SDL_EnumerateDirectory(const char *path, SDL_EnumerateDirectoryCallback cal } else if (!callback) { return SDL_InvalidParamError("callback"); } - return SDL_SYS_EnumerateDirectory(path, path, callback, userdata); + return SDL_SYS_EnumerateDirectory(path, callback, userdata); } bool SDL_GetPathInfo(const char *path, SDL_PathInfo *info) diff --git a/src/filesystem/SDL_sysfilesystem.h b/src/filesystem/SDL_sysfilesystem.h index 10ca00504c073..f9f4c592a00ef 100644 --- a/src/filesystem/SDL_sysfilesystem.h +++ b/src/filesystem/SDL_sysfilesystem.h @@ -28,7 +28,7 @@ extern char *SDL_SYS_GetPrefPath(const char *org, const char *app); extern char *SDL_SYS_GetUserFolder(SDL_Folder folder); extern char *SDL_SYS_GetCurrentDirectory(void); -extern bool SDL_SYS_EnumerateDirectory(const char *path, const char *dirname, SDL_EnumerateDirectoryCallback cb, void *userdata); +extern bool SDL_SYS_EnumerateDirectory(const char *path, SDL_EnumerateDirectoryCallback cb, void *userdata); extern bool SDL_SYS_RemovePath(const char *path); extern bool SDL_SYS_RenamePath(const char *oldpath, const char *newpath); extern bool SDL_SYS_CopyFile(const char *oldpath, const char *newpath); diff --git a/src/filesystem/dummy/SDL_sysfsops.c b/src/filesystem/dummy/SDL_sysfsops.c index 606202d18ae68..d8553e91e7a60 100644 --- a/src/filesystem/dummy/SDL_sysfsops.c +++ b/src/filesystem/dummy/SDL_sysfsops.c @@ -28,7 +28,7 @@ #include "../SDL_sysfilesystem.h" -bool SDL_SYS_EnumerateDirectory(const char *path, const char *dirname, SDL_EnumerateDirectoryCallback cb, void *userdata) +bool SDL_SYS_EnumerateDirectory(const char *path, SDL_EnumerateDirectoryCallback cb, void *userdata) { return SDL_Unsupported(); } diff --git a/src/filesystem/posix/SDL_sysfsops.c b/src/filesystem/posix/SDL_sysfsops.c index b16c724058652..0658b8f1554d9 100644 --- a/src/filesystem/posix/SDL_sysfsops.c +++ b/src/filesystem/posix/SDL_sysfsops.c @@ -35,7 +35,7 @@ #include #include -bool SDL_SYS_EnumerateDirectory(const char *path, const char *dirname, SDL_EnumerateDirectoryCallback cb, void *userdata) +bool SDL_SYS_EnumerateDirectory(const char *path, SDL_EnumerateDirectoryCallback cb, void *userdata) { SDL_EnumerationResult result = SDL_ENUM_CONTINUE; @@ -51,7 +51,7 @@ bool SDL_SYS_EnumerateDirectory(const char *path, const char *dirname, SDL_Enume if ((SDL_strcmp(name, ".") == 0) || (SDL_strcmp(name, "..") == 0)) { continue; } - result = cb(userdata, dirname, name); + result = cb(userdata, path, name); } closedir(dir); diff --git a/src/filesystem/windows/SDL_sysfsops.c b/src/filesystem/windows/SDL_sysfsops.c index 1c4fe5a99e977..89961c6a8fa8e 100644 --- a/src/filesystem/windows/SDL_sysfsops.c +++ b/src/filesystem/windows/SDL_sysfsops.c @@ -29,7 +29,7 @@ #include "../../core/windows/SDL_windows.h" #include "../SDL_sysfilesystem.h" -bool SDL_SYS_EnumerateDirectory(const char *path, const char *dirname, SDL_EnumerateDirectoryCallback cb, void *userdata) +bool SDL_SYS_EnumerateDirectory(const char *path, SDL_EnumerateDirectoryCallback cb, void *userdata) { SDL_EnumerationResult result = SDL_ENUM_CONTINUE; if (*path == '\0') { // if empty (completely at the root), we need to enumerate drive letters. @@ -38,7 +38,7 @@ bool SDL_SYS_EnumerateDirectory(const char *path, const char *dirname, SDL_Enume for (int i = 'A'; (result == SDL_ENUM_CONTINUE) && (i <= 'Z'); i++) { if (drives & (1 << (i - 'A'))) { name[0] = (char) i; - result = cb(userdata, dirname, name); + result = cb(userdata, path, name); } } } else { @@ -79,7 +79,7 @@ bool SDL_SYS_EnumerateDirectory(const char *path, const char *dirname, SDL_Enume if (!utf8fn) { result = SDL_ENUM_FAILURE; } else { - result = cb(userdata, dirname, utf8fn); + result = cb(userdata, path, utf8fn); SDL_free(utf8fn); } } while ((result == SDL_ENUM_CONTINUE) && (FindNextFileW(dir, &entw) != 0)); From dd0bdc256101adb931866299b7c3ad07d13c51e7 Mon Sep 17 00:00:00 2001 From: Frank Praznik Date: Wed, 15 Jan 2025 14:45:48 -0500 Subject: [PATCH 080/340] win32: Pass through non-left mouse button presses when over draggable areas Returning anything other an HTCLIENT result will cause windows to eat the button press, so ensure that non-left presses are passed through to the client over draggable areas. --- src/video/windows/SDL_windowsevents.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/video/windows/SDL_windowsevents.c b/src/video/windows/SDL_windowsevents.c index 4d4df9e940915..1a91e03d7d7e0 100644 --- a/src/video/windows/SDL_windowsevents.c +++ b/src/video/windows/SDL_windowsevents.c @@ -2072,7 +2072,19 @@ LRESULT CALLBACK WIN_WindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lPara return ret; \ } case SDL_HITTEST_DRAGGABLE: + { + /* If the mouse button state is something other than none or left button down, + * return HTCLIENT, or Windows will eat the button press. + */ + SDL_MouseButtonFlags buttonState = SDL_GetGlobalMouseState(NULL, NULL); + if (buttonState && !(buttonState & SDL_BUTTON_LMASK)) { + // Set focus in case it was lost while previously moving over a draggable area. + SDL_SetMouseFocus(window); + return HTCLIENT; + } + POST_HIT_TEST(HTCAPTION); + } case SDL_HITTEST_RESIZE_TOPLEFT: POST_HIT_TEST(HTTOPLEFT); case SDL_HITTEST_RESIZE_TOP: From c9d602307c4e062b480f857009aef6a048cf3bb5 Mon Sep 17 00:00:00 2001 From: Frank Praznik Date: Wed, 15 Jan 2025 15:14:04 -0500 Subject: [PATCH 081/340] cocoa: Only process hit tests on left clicks Otherwise, right-click events over drag areas will be eaten. --- src/video/cocoa/SDL_cocoawindow.m | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/src/video/cocoa/SDL_cocoawindow.m b/src/video/cocoa/SDL_cocoawindow.m index daa544f7a43c0..48cc065ec40ff 100644 --- a/src/video/cocoa/SDL_cocoawindow.m +++ b/src/video/cocoa/SDL_cocoawindow.m @@ -1668,11 +1668,6 @@ - (void)mouseDown:(NSEvent *)theEvent } } - if ([self processHitTest:theEvent]) { - SDL_SendWindowEvent(_data.window, SDL_EVENT_WINDOW_HIT_TEST, 0, 0); - return; // dragging, drop event. - } - switch ([theEvent buttonNumber]) { case 0: if (([theEvent modifierFlags] & NSEventModifierFlagControl) && @@ -1695,6 +1690,11 @@ - (void)mouseDown:(NSEvent *)theEvent break; } + if (button == SDL_BUTTON_LEFT && [self processHitTest:theEvent]) { + SDL_SendWindowEvent(_data.window, SDL_EVENT_WINDOW_HIT_TEST, 0, 0); + return; // dragging, drop event. + } + Cocoa_SendMouseButtonClicks(mouse, theEvent, _data.window, button, true); } @@ -1721,11 +1721,6 @@ - (void)mouseUp:(NSEvent *)theEvent return; } - if ([self processHitTest:theEvent]) { - SDL_SendWindowEvent(_data.window, SDL_EVENT_WINDOW_HIT_TEST, 0, 0); - return; // stopped dragging, drop event. - } - switch ([theEvent buttonNumber]) { case 0: if (wasCtrlLeft) { @@ -1746,6 +1741,11 @@ - (void)mouseUp:(NSEvent *)theEvent break; } + if (button == SDL_BUTTON_LEFT && [self processHitTest:theEvent]) { + SDL_SendWindowEvent(_data.window, SDL_EVENT_WINDOW_HIT_TEST, 0, 0); + return; // stopped dragging, drop event. + } + Cocoa_SendMouseButtonClicks(mouse, theEvent, _data.window, button, false); } From 355f69ebfe7a5f44a28e10569589a1d300aad2b5 Mon Sep 17 00:00:00 2001 From: cosmonaut Date: Wed, 15 Jan 2025 13:45:36 -0800 Subject: [PATCH 082/340] GPU: Ensure thread safety of Vulkan resource creation --- src/gpu/vulkan/SDL_gpu_vulkan.c | 24 ++++++++++-------------- 1 file changed, 10 insertions(+), 14 deletions(-) diff --git a/src/gpu/vulkan/SDL_gpu_vulkan.c b/src/gpu/vulkan/SDL_gpu_vulkan.c index 0037006320e8e..6bf12b0f23d51 100644 --- a/src/gpu/vulkan/SDL_gpu_vulkan.c +++ b/src/gpu/vulkan/SDL_gpu_vulkan.c @@ -1198,7 +1198,6 @@ struct VulkanRenderer SDL_Mutex *submitLock; SDL_Mutex *acquireCommandBufferLock; SDL_Mutex *acquireUniformBufferLock; - SDL_Mutex *renderPassFetchLock; SDL_Mutex *framebufferFetchLock; SDL_Mutex *windowLock; @@ -4924,7 +4923,6 @@ static void VULKAN_DestroyDevice( SDL_DestroyMutex(renderer->submitLock); SDL_DestroyMutex(renderer->acquireCommandBufferLock); SDL_DestroyMutex(renderer->acquireUniformBufferLock); - SDL_DestroyMutex(renderer->renderPassFetchLock); SDL_DestroyMutex(renderer->framebufferFetchLock); SDL_DestroyMutex(renderer->windowLock); @@ -7092,15 +7090,11 @@ static VkRenderPass VULKAN_INTERNAL_FetchRenderPass( key.depthStencilTargetDescription.stencilStoreOp = depthStencilTargetInfo->stencil_store_op; } - SDL_LockMutex(renderer->renderPassFetchLock); - bool result = SDL_FindInHashTable( renderer->renderPassHashTable, (const void *)&key, (const void **)&renderPassWrapper); - SDL_UnlockMutex(renderer->renderPassFetchLock); - if (result) { return renderPassWrapper->handle; } @@ -7123,14 +7117,11 @@ static VkRenderPass VULKAN_INTERNAL_FetchRenderPass( renderPassWrapper = SDL_malloc(sizeof(VulkanRenderPassHashTableValue)); renderPassWrapper->handle = renderPassHandle; - SDL_LockMutex(renderer->renderPassFetchLock); - SDL_InsertIntoHashTable( renderer->renderPassHashTable, (const void *)allocedKey, (const void *)renderPassWrapper); - SDL_UnlockMutex(renderer->renderPassFetchLock); return renderPassHandle; } @@ -11653,7 +11644,6 @@ static SDL_GPUDevice *VULKAN_CreateDevice(bool debugMode, bool preferLowPower, S renderer->submitLock = SDL_CreateMutex(); renderer->acquireCommandBufferLock = SDL_CreateMutex(); renderer->acquireUniformBufferLock = SDL_CreateMutex(); - renderer->renderPassFetchLock = SDL_CreateMutex(); renderer->framebufferFetchLock = SDL_CreateMutex(); renderer->windowLock = SDL_CreateMutex(); @@ -11705,6 +11695,7 @@ static SDL_GPUDevice *VULKAN_CreateDevice(bool debugMode, bool preferLowPower, S // Initialize caches + // manually synchronized due to submission timing renderer->commandPoolHashTable = SDL_CreateHashTable( (void *)renderer, 64, @@ -11713,14 +11704,16 @@ static SDL_GPUDevice *VULKAN_CreateDevice(bool debugMode, bool preferLowPower, S VULKAN_INTERNAL_CommandPoolHashNuke, false, false); + // thread-safe renderer->renderPassHashTable = SDL_CreateHashTable( (void *)renderer, 64, VULKAN_INTERNAL_RenderPassHashFunction, VULKAN_INTERNAL_RenderPassHashKeyMatch, VULKAN_INTERNAL_RenderPassHashNuke, - false, false); + true, false); + // manually synchronized due to iteration renderer->framebufferHashTable = SDL_CreateHashTable( (void *)renderer, 64, @@ -11729,29 +11722,32 @@ static SDL_GPUDevice *VULKAN_CreateDevice(bool debugMode, bool preferLowPower, S VULKAN_INTERNAL_FramebufferHashNuke, false, false); + // thread-safe renderer->graphicsPipelineResourceLayoutHashTable = SDL_CreateHashTable( (void *)renderer, 64, VULKAN_INTERNAL_GraphicsPipelineResourceLayoutHashFunction, VULKAN_INTERNAL_GraphicsPipelineResourceLayoutHashKeyMatch, VULKAN_INTERNAL_GraphicsPipelineResourceLayoutHashNuke, - false, false); + true, false); + // thread-safe renderer->computePipelineResourceLayoutHashTable = SDL_CreateHashTable( (void *)renderer, 64, VULKAN_INTERNAL_ComputePipelineResourceLayoutHashFunction, VULKAN_INTERNAL_ComputePipelineResourceLayoutHashKeyMatch, VULKAN_INTERNAL_ComputePipelineResourceLayoutHashNuke, - false, false); + true, false); + // thread-safe renderer->descriptorSetLayoutHashTable = SDL_CreateHashTable( (void *)renderer, 64, VULKAN_INTERNAL_DescriptorSetLayoutHashFunction, VULKAN_INTERNAL_DescriptorSetLayoutHashKeyMatch, VULKAN_INTERNAL_DescriptorSetLayoutHashNuke, - false, false); + true, false); // Initialize fence pool From 2c7b7d1d33748b6c27eaf57cc5d96ce6c4c64a87 Mon Sep 17 00:00:00 2001 From: Sam Lantinga Date: Tue, 14 Jan 2025 19:41:02 -0800 Subject: [PATCH 083/340] Keep the lifecycle observer active while there are windows active Fixes https://github.com/libsdl-org/SDL/issues/11627 --- src/video/SDL_video.c | 12 ++++++++++++ src/video/uikit/SDL_uikitevents.m | 13 +++++++++++-- 2 files changed, 23 insertions(+), 2 deletions(-) diff --git a/src/video/SDL_video.c b/src/video/SDL_video.c index 3b5fa4d84d7fd..bbf99ecfa65fd 100644 --- a/src/video/SDL_video.c +++ b/src/video/SDL_video.c @@ -172,6 +172,10 @@ extern bool Cocoa_IsWindowInFullscreenSpace(SDL_Window *window); extern bool Cocoa_SetWindowFullscreenSpace(SDL_Window *window, bool state, bool blocking); #endif +#ifdef SDL_VIDEO_DRIVER_UIKIT +extern void SDL_UpdateLifecycleObserver(void); +#endif + static void SDL_CheckWindowDisplayChanged(SDL_Window *window); static void SDL_CheckWindowDisplayScaleChanged(SDL_Window *window); static void SDL_CheckWindowSafeAreaChanged(SDL_Window *window); @@ -2467,6 +2471,10 @@ SDL_Window *SDL_CreateWindowWithProperties(SDL_PropertiesID props) // Make sure window pixel size is up to date SDL_CheckWindowPixelSizeChanged(window); +#ifdef SDL_VIDEO_DRIVER_UIKIT + SDL_UpdateLifecycleObserver(); +#endif + SDL_ClearError(); return window; @@ -4198,6 +4206,10 @@ void SDL_DestroyWindow(SDL_Window *window) } SDL_free(window); + +#ifdef SDL_VIDEO_DRIVER_UIKIT + SDL_UpdateLifecycleObserver(); +#endif } bool SDL_ScreenSaverEnabled(void) diff --git a/src/video/uikit/SDL_uikitevents.m b/src/video/uikit/SDL_uikitevents.m index 8479b4f44163e..86224f7948b2a 100644 --- a/src/video/uikit/SDL_uikitevents.m +++ b/src/video/uikit/SDL_uikitevents.m @@ -44,7 +44,16 @@ @implementation SDL_LifecycleObserver - (void)update { NSNotificationCenter *notificationCenter = NSNotificationCenter.defaultCenter; - if ((UIKit_EventPumpEnabled || SDL_HasMainCallbacks()) && !self.isObservingNotifications) { + bool wants_observation = (UIKit_EventPumpEnabled || SDL_HasMainCallbacks()); + if (!wants_observation) { + // Make sure no windows have active animation callbacks + int num_windows = 0; + SDL_free(SDL_GetWindows(&num_windows)); + if (num_windows > 0) { + wants_observation = true; + } + } + if (wants_observation && !self.isObservingNotifications) { self.isObservingNotifications = YES; [notificationCenter addObserver:self selector:@selector(applicationDidBecomeActive) name:UIApplicationDidBecomeActiveNotification object:nil]; [notificationCenter addObserver:self selector:@selector(applicationWillResignActive) name:UIApplicationWillResignActiveNotification object:nil]; @@ -58,7 +67,7 @@ - (void)update name:UIApplicationDidChangeStatusBarOrientationNotification object:nil]; #endif - } else if (!UIKit_EventPumpEnabled && !SDL_HasMainCallbacks() && self.isObservingNotifications) { + } else if (!wants_observation && self.isObservingNotifications) { self.isObservingNotifications = NO; [notificationCenter removeObserver:self]; } From 5f4696ce636c5d6b250783115e06cbf20bf3bcd7 Mon Sep 17 00:00:00 2001 From: Sam Lantinga Date: Wed, 15 Jan 2025 20:38:16 -0800 Subject: [PATCH 084/340] Updating documentation for the 3.2.0 release * Simplified and updated the mingw release archive * Simplified and updated the msvc release archive * Updated the Xcode release archive * Updated the Android release archive --- .github/workflows/release.yml | 8 +++ CMakeLists.txt | 2 +- README.md | 2 +- WhatsNew.txt | 25 +-------- Xcode/SDL/SDL.xcodeproj/project.pbxproj | 16 +++--- Xcode/SDL/pkg-support/resources/INSTALL.md | 41 ++++++++++++++ Xcode/SDL/pkg-support/resources/License.txt | 19 ------- Xcode/SDL/pkg-support/resources/ReadMe.txt | 44 --------------- Xcode/SDL/pkg-support/resources/SDL_DS_Store | Bin 10244 -> 10244 bytes build-scripts/build-release.py | 13 ++++- .../android/{README.md.in => INSTALL.md.in} | 50 +++++++++++------ build-scripts/pkg-support/mingw/INSTALL.md | 53 ++++++++++++++++++ build-scripts/pkg-support/mingw/INSTALL.txt | 25 --------- build-scripts/pkg-support/msvc/INSTALL.md | 45 +++++++++++++++ .../pkg-support/msvc/arm64/INSTALL.md.in | 13 +++++ .../pkg-support/msvc/x64/INSTALL.md.in | 13 +++++ .../pkg-support/msvc/x86/INSTALL.md.in | 13 +++++ build-scripts/release-info.json | 25 +++------ 18 files changed, 249 insertions(+), 158 deletions(-) create mode 100644 Xcode/SDL/pkg-support/resources/INSTALL.md delete mode 100644 Xcode/SDL/pkg-support/resources/License.txt delete mode 100644 Xcode/SDL/pkg-support/resources/ReadMe.txt rename build-scripts/pkg-support/android/{README.md.in => INSTALL.md.in} (63%) create mode 100644 build-scripts/pkg-support/mingw/INSTALL.md delete mode 100644 build-scripts/pkg-support/mingw/INSTALL.txt create mode 100644 build-scripts/pkg-support/msvc/INSTALL.md create mode 100644 build-scripts/pkg-support/msvc/arm64/INSTALL.md.in create mode 100644 build-scripts/pkg-support/msvc/x64/INSTALL.md.in create mode 100644 build-scripts/pkg-support/msvc/x86/INSTALL.md.in diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 64199c7c6237b..bd0bcca590cef 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -77,6 +77,14 @@ jobs: shell: bash run: | ${{ steps.tar.outputs.path }}/build-scripts/test-versioning.sh + - name: 'Install Linux dependencies' + run: | + sudo apt-get update -y + sudo apt-get install -y \ + gnome-desktop-testing libasound2-dev libpulse-dev libaudio-dev libjack-dev libsndio-dev \ + libusb-1.0-0-dev libx11-dev libxext-dev libxrandr-dev libxcursor-dev libxfixes-dev libxi-dev \ + libxss-dev libwayland-dev libxkbcommon-dev libdrm-dev libgbm-dev libgl1-mesa-dev libgles2-mesa-dev \ + libegl1-mesa-dev libdbus-1-dev libibus-1.0-dev libudev-dev fcitx-libs-dev - name: 'CMake (configure + build + tests + examples)' run: | cmake -S ${{ steps.tar.outputs.path }} -B /tmp/build -DSDL_TEST_LIBRARY=TRUE -DSDL_TESTS=TRUE -DSDL_EXAMPLES=TRUE diff --git a/CMakeLists.txt b/CMakeLists.txt index a6f3be1dc25d3..129b6267b32d3 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -3330,8 +3330,8 @@ endif() set_source_files_properties(src/dynapi/SDL_dynapi.c PROPERTIES SKIP_PRECOMPILE_HEADERS 1) set(SDL_FRAMEWORK_RESOURCES - Xcode/SDL/pkg-support/resources/ReadMe.txt LICENSE.txt + README.md ) if(SDL_FRAMEWORK) sdl_sources(${SDL_FRAMEWORK_RESOURCES}) diff --git a/README.md b/README.md index fd143d869300d..68b0923a7f554 100644 --- a/README.md +++ b/README.md @@ -3,7 +3,7 @@ Simple DirectMedia Layer (SDL for short) is a cross-platform library designed to make it easy to write multi-media software, such as games and emulators. -You can find the latest release and additional documentation at: +You can find the latest release and additional information at: https://www.libsdl.org/ Installation instructions and a quick introduction is available in diff --git a/WhatsNew.txt b/WhatsNew.txt index 63d34758028d3..22b1a0f8bc212 100644 --- a/WhatsNew.txt +++ b/WhatsNew.txt @@ -2,32 +2,13 @@ This is a list of major changes in SDL's version history. --------------------------------------------------------------------------- -3.1.0: +3.2.0: --------------------------------------------------------------------------- -This is a preview release of the new SDL 3.0 API. - -The ABI hasn't been locked down yet, but it's fairly stable and feedback is welcome! - Check out [migration guide](docs/README-migration.md) for details on API changes since SDL 2.0, and tips on transitioning your code from SDL2 code to SDL3. There have been too many changes to list them all, but here are some of the highlights: -* The API has been significantly reworked to be easier to use and more consistent -* The 2D rendering API now has support for more advanced colorspaces and HDR rendering -* The 2D rendering API now has a Vulkan backend -* An example of hardware accelerated video playback using ffmpeg has been added in test/testffmpeg.c -* The shaped window API has been replaced with transparent windows -* Time and date functions have been added in SDL_time.h -* Support for webcam video recording has been added in SDL_camera.h -* Support for handling pens and tablets has been added in SDL_pen.h -* Support for file open and save dialogs has been added in SDL_dialog.h -* Cross-platform functions for working with files and directories are available in SDL_filesystem.h -* A cross-platform abstraction for working with user and game data has been added in SDL_storage.h -* Handling of main() has been moved to a header library and an optional callback-based program flow is available -* Support for simple object properties has been added in SDL_properties.h. These properties are available on many SDL objects, and can be used for more advanced functionality. - -Please let us know about issues and feedback at: https://github.com/libsdl-org/SDL/issues -The development team is focused on code, moving towards the final release, and we would love volunteers to help improve the documentation. Please send e-mail to slouken@libsdl.org if you'd like to help out! +https://wiki.libsdl.org/SDL3/NewFeatures -Finally, a giant thank you to all the people who have contributed code and feedback to the SDL 3.0 improvements! +Thank you to all the people who have contributed code and feedback to the SDL 3.0 release! diff --git a/Xcode/SDL/SDL.xcodeproj/project.pbxproj b/Xcode/SDL/SDL.xcodeproj/project.pbxproj index e10903b809897..ffe36a0ec60b6 100644 --- a/Xcode/SDL/SDL.xcodeproj/project.pbxproj +++ b/Xcode/SDL/SDL.xcodeproj/project.pbxproj @@ -79,8 +79,6 @@ A7381E961D8B69D600B177DD /* CoreAudio.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = A7381E951D8B69D600B177DD /* CoreAudio.framework */; platformFilters = (ios, maccatalyst, macos, tvos, ); settings = {ATTRIBUTES = (Required, ); }; }; A7381E971D8B6A0300B177DD /* AudioToolbox.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = A7381E931D8B69C300B177DD /* AudioToolbox.framework */; platformFilters = (ios, maccatalyst, macos, tvos, ); }; A75FDB5823E39E6100529352 /* hidapi.h in Headers */ = {isa = PBXBuildFile; fileRef = A75FDB5723E39E6100529352 /* hidapi.h */; }; - A75FDBB723E4CBC700529352 /* License.txt in Resources */ = {isa = PBXBuildFile; fileRef = 00794D3F09D0C461003FC8A1 /* License.txt */; }; - A75FDBB823E4CBC700529352 /* ReadMe.txt in Resources */ = {isa = PBXBuildFile; fileRef = F59C710300D5CB5801000001 /* ReadMe.txt */; }; A75FDBC523EA380300529352 /* SDL_hidapi_rumble.h in Headers */ = {isa = PBXBuildFile; fileRef = A75FDBC323EA380300529352 /* SDL_hidapi_rumble.h */; }; A75FDBCE23EA380300529352 /* SDL_hidapi_rumble.c in Sources */ = {isa = PBXBuildFile; fileRef = A75FDBC423EA380300529352 /* SDL_hidapi_rumble.c */; }; A79745702B2E9D39009D224A /* SDL_hidapi_steamdeck.c in Sources */ = {isa = PBXBuildFile; fileRef = A797456F2B2E9D39009D224A /* SDL_hidapi_steamdeck.c */; }; @@ -584,7 +582,6 @@ 0073179D0858DECD00B2BC32 /* Cocoa.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Cocoa.framework; path = System/Library/Frameworks/Cocoa.framework; sourceTree = SDKROOT; }; 0073179F0858DECD00B2BC32 /* IOKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = IOKit.framework; path = System/Library/Frameworks/IOKit.framework; sourceTree = SDKROOT; }; 007317C10858E15000B2BC32 /* Carbon.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Carbon.framework; path = System/Library/Frameworks/Carbon.framework; sourceTree = SDKROOT; }; - 00794D3F09D0C461003FC8A1 /* License.txt */ = {isa = PBXFileReference; lastKnownFileType = text; path = License.txt; sourceTree = ""; }; 00CFA89C106B4BA100758660 /* ForceFeedback.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = ForceFeedback.framework; path = System/Library/Frameworks/ForceFeedback.framework; sourceTree = SDKROOT; }; 00D0D08310675DD9004B05EF /* CoreFoundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreFoundation.framework; path = System/Library/Frameworks/CoreFoundation.framework; sourceTree = SDKROOT; }; 1485C32F2BBA4A0C0063985B /* UniformTypeIdentifiers.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = UniformTypeIdentifiers.framework; path = System/Library/Frameworks/UniformTypeIdentifiers.framework; sourceTree = SDKROOT; }; @@ -941,6 +938,9 @@ F36C342F2C0F876500991150 /* SDL_offscreenvulkan.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDL_offscreenvulkan.h; sourceTree = ""; }; F36C34302C0F876500991150 /* SDL_offscreenvulkan.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SDL_offscreenvulkan.c; sourceTree = ""; }; F36C7AD0294BA009004D61C3 /* SDL_runapp.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SDL_runapp.c; sourceTree = ""; }; + F373DA172D3889EE002158FA /* INSTALL.md */ = {isa = PBXFileReference; lastKnownFileType = net.daringfireball.markdown; path = INSTALL.md; sourceTree = ""; }; + F373DA182D388A1E002158FA /* LICENSE.txt */ = {isa = PBXFileReference; lastKnownFileType = text; name = LICENSE.txt; path = ../../../../LICENSE.txt; sourceTree = ""; }; + F373DA192D388A1E002158FA /* README.md */ = {isa = PBXFileReference; lastKnownFileType = net.daringfireball.markdown; name = README.md; path = ../../../../README.md; sourceTree = ""; }; F376F6182559B29300CFC0BC /* OpenGLES.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = OpenGLES.framework; path = Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS14.1.sdk/System/Library/Frameworks/OpenGLES.framework; sourceTree = DEVELOPER_DIR; }; F376F61A2559B2AF00CFC0BC /* UIKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = UIKit.framework; path = System/iOSSupport/System/Library/Frameworks/UIKit.framework; sourceTree = SDKROOT; }; F376F6312559B31D00CFC0BC /* GameController.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = GameController.framework; path = System/iOSSupport/System/Library/Frameworks/GameController.framework; sourceTree = SDKROOT; }; @@ -1091,7 +1091,6 @@ F3FA5A1C2B59ACE000FEAD97 /* yuv_rgb_common.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = yuv_rgb_common.h; sourceTree = ""; }; F3FD042C2C9B755700824C4C /* SDL_hidapi_nintendo.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = SDL_hidapi_nintendo.h; sourceTree = ""; }; F3FD042D2C9B755700824C4C /* SDL_hidapi_steam_hori.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = SDL_hidapi_steam_hori.c; sourceTree = ""; }; - F59C710300D5CB5801000001 /* ReadMe.txt */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = text; path = ReadMe.txt; sourceTree = ""; }; F59C710600D5CB5801000001 /* SDL.info */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = text; path = SDL.info; sourceTree = ""; }; F5A2EF3900C6A39A01000001 /* BUGS.txt */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = text; name = BUGS.txt; path = ../../BUGS.txt; sourceTree = SOURCE_ROOT; }; FA73671C19A540EF004122E4 /* CoreVideo.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreVideo.framework; path = System/Library/Frameworks/CoreVideo.framework; sourceTree = SDKROOT; }; @@ -2410,8 +2409,9 @@ isa = PBXGroup; children = ( F37A8E1928405AA100C38E95 /* CMake */, - 00794D3F09D0C461003FC8A1 /* License.txt */, - F59C710300D5CB5801000001 /* ReadMe.txt */, + F373DA182D388A1E002158FA /* LICENSE.txt */, + F373DA192D388A1E002158FA /* README.md */, + F373DA172D3889EE002158FA /* INSTALL.md */, ); path = resources; sourceTree = ""; @@ -2755,8 +2755,6 @@ buildActionMask = 2147483647; files = ( F37A8E1A28405AA100C38E95 /* CMake in Resources */, - A75FDBB823E4CBC700529352 /* ReadMe.txt in Resources */, - A75FDBB723E4CBC700529352 /* License.txt in Resources */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -2779,7 +2777,7 @@ ); runOnlyForDeploymentPostprocessing = 0; shellPath = /bin/sh; - shellScript = "set -ex\n\nmkdir -p build/dmg-tmp/share/cmake/SDL3\ncp -a build/SDL3.xcframework build/dmg-tmp/\n\ncp pkg-support/resources/License.txt build/dmg-tmp\ncp pkg-support/resources/ReadMe.txt build/dmg-tmp\ncp pkg-support/share/cmake/SDL3/SDL3Config.cmake build/dmg-tmp/share/cmake/SDL3\ncp pkg-support/share/cmake/SDL3/SDL3ConfigVersion.cmake build/dmg-tmp/share/cmake/SDL3\n\n# remove the .DS_Store files if any (we may want to provide one in the future for fancy .dmgs)\nfind build/dmg-tmp -name .DS_Store -exec rm -f \"{}\" \\;\n\n# for fancy .dmg\nmkdir -p build/dmg-tmp/.logo\ncp pkg-support/resources/SDL_DS_Store build/dmg-tmp/.DS_Store\ncp pkg-support/sdl_logo.pdf build/dmg-tmp/.logo\n\n# create the dmg\nhdiutil create -ov -fs HFS+ -volname SDL3 -srcfolder build/dmg-tmp build/SDL3.dmg\n\n# clean up\nrm -rf build/dmg-tmp\n"; + shellScript = "set -ex\n\nmkdir -p build/dmg-tmp/share/cmake/SDL3\ncp -a build/SDL3.xcframework build/dmg-tmp/\n\ncp ../../LICENSE.txt build/dmg-tmp\ncp ../../README.md build/dmg-tmp\ncp pkg-support/resources/INSTALL.md build/dmg-tmp\ncp pkg-support/share/cmake/SDL3/SDL3Config.cmake build/dmg-tmp/share/cmake/SDL3\ncp pkg-support/share/cmake/SDL3/SDL3ConfigVersion.cmake build/dmg-tmp/share/cmake/SDL3\n\n# remove the .DS_Store files if any (we may want to provide one in the future for fancy .dmgs)\nfind build/dmg-tmp -name .DS_Store -exec rm -f \"{}\" \\;\n\n# for fancy .dmg\nmkdir -p build/dmg-tmp/.logo\ncp pkg-support/resources/SDL_DS_Store build/dmg-tmp/.DS_Store\ncp pkg-support/sdl_logo.pdf build/dmg-tmp/.logo\n\n# create the dmg\nhdiutil create -ov -fs HFS+ -volname SDL3 -srcfolder build/dmg-tmp build/SDL3.dmg\n\n# clean up\nrm -rf build/dmg-tmp\n"; }; F3B38CF0296F63D1005DA6D3 /* ShellScript */ = { isa = PBXShellScriptBuildPhase; diff --git a/Xcode/SDL/pkg-support/resources/INSTALL.md b/Xcode/SDL/pkg-support/resources/INSTALL.md new file mode 100644 index 0000000000000..4058e96d174cf --- /dev/null +++ b/Xcode/SDL/pkg-support/resources/INSTALL.md @@ -0,0 +1,41 @@ + +# Using this package + +This package contains SDL built for Xcode, and includes support for macOS, iOS and tvOS. + +To use this package, drag SDL3.xcframework into your project. + +# Documentation + +An API reference, tutorials, and additional documentation is available at: + +https://wiki.libsdl.org/SDL3 + +# Example code + +There are simple example programs available at: + +https://examples.libsdl.org/SDL3 + +# Discussions + +## Discord + +You can join the official Discord server at: + +https://discord.com/invite/BwpFGBWsv8 + +## Forums/mailing lists + +You can join SDL development discussions at: + +https://discourse.libsdl.org/ + +Once you sign up, you can use the forum through the website or as a mailing list from your email client. + +## Announcement list + +You can sign up for the low traffic announcement list at: + +https://www.libsdl.org/mailing-list.php + diff --git a/Xcode/SDL/pkg-support/resources/License.txt b/Xcode/SDL/pkg-support/resources/License.txt deleted file mode 100644 index 144831ccfcc8a..0000000000000 --- a/Xcode/SDL/pkg-support/resources/License.txt +++ /dev/null @@ -1,19 +0,0 @@ - -Simple DirectMedia Layer -Copyright (C) 1997-2025 Sam Lantinga - -This software is provided 'as-is', without any express or implied -warranty. In no event will the authors be held liable for any damages -arising from the use of this software. - -Permission is granted to anyone to use this software for any purpose, -including commercial applications, and to alter it and redistribute it -freely, subject to the following restrictions: - -1. The origin of this software must not be misrepresented; you must not - claim that you wrote the original software. If you use this software - in a product, an acknowledgment in the product documentation would be - appreciated but is not required. -2. Altered source versions must be plainly marked as such, and must not be - misrepresented as being the original software. -3. This notice may not be removed or altered from any source distribution. diff --git a/Xcode/SDL/pkg-support/resources/ReadMe.txt b/Xcode/SDL/pkg-support/resources/ReadMe.txt deleted file mode 100644 index 6ea93478fe97e..0000000000000 --- a/Xcode/SDL/pkg-support/resources/ReadMe.txt +++ /dev/null @@ -1,44 +0,0 @@ -The Simple DirectMedia Layer (SDL for short) is a cross-platform -library designed to make it easy to write multi-media software, -such as games and emulators. - -The Simple DirectMedia Layer library source code is available from: -http://www.libsdl.org/ - -This library is distributed under the terms of the zlib license: -http://zlib.net/zlib_license.html - - -This packages contains the SDL framework for macOS. -Conforming with Apple guidelines, this framework -contains both the SDL runtime component and development header files. - - -To Install: -Copy "SDL3.xcframework" and "share" to /Library/Frameworks - -You may alternatively install it in /Library/Frameworks -if your access privileges are not high enough. - - -Use in CMake projects: -SDL3.xcframework can be used in CMake projects using the following pattern: -```cmake -find_package(SDL3 REQUIRED COMPONENTS SDL3) -add_executable(my_game ${MY_SOURCES}) -target_link_libraries(my_game PRIVATE SDL3::SDL3) -``` -If SDL3.framework is installed in a non-standard location, -please refer to the following link for ways to configure CMake: -https://cmake.org/cmake/help/latest/command/find_package.html#config-mode-search-procedure - - -Additional References: - - - Screencast tutorials for getting started with OpenSceneGraph/macOS are - available at: - http://www.openscenegraph.org/projects/osg/wiki/Support/Tutorials/MacOSXTips - Though these are OpenSceneGraph centric, the same exact concepts apply to - SDL, thus the videos are recommended for everybody getting started with - developing on macOS. (You can skim over the PlugIns stuff since SDL - doesn't have any PlugIns to worry about.) diff --git a/Xcode/SDL/pkg-support/resources/SDL_DS_Store b/Xcode/SDL/pkg-support/resources/SDL_DS_Store index 15519334371b712cc92952247564dbf6835bc7da..5a71413734b7193e94269f42433f40ec7b73415e 100644 GIT binary patch literal 10244 zcmeHMO>7(25uRO>5oycz>JL#}2VGPt;G&{Li3~+K20~GkDgjRInu;wWP9*-UC{`;j zyStL?x^CIPaEtb01ZdDh3b;TIJ@m&%_fS9wr3GJOH|q90S#$Pfi)! zy>ip8d;WpZp&*Pv7=bVXVFbbmgc0~(hydl1g>b)Z;@_mNoT4 z(S&u(Z;Iihd**mM)%jiI5wM~6Rm;`1xUK)F=esJZOn ztYbTF-rllSjN=~Gxma-;=Ur=CuCFt0akEsjX6$;&TlTH1ezE>7X!Ljb#XJ|R>hm4Z z(zPbW40Z%!%vW8@YCKzW>(z5>Yo6sVck!362p4>7bFs1JV19PvT+^>R4ez4mdZ5qQ zrLtw8Yvdi@cQ!AVT({JyS@~@TKEb@G4_71SG8Acr{;_`t7`{F{yPHg70mZxF!CP&qPRNE11Uwv*aqJv zIM?6$^`RZ~^eKKDytp>B`|y029X~CGpQb&|9itP}OCD9prWK$=HQ*REAz7p2bQo7p zkqUH{Qq)fa<6@5SJyXyC9UZ^u*jt;HH!dQ?-j3u>Nk6dhm?$aOXZF-+R(R#E2?WFdYeo0@|%ld|H>kZw}ef@^i z)`R_iGBBm&w?MJqoB4cF{c=|glhn0|Xo1fv-G1=HiXQ-fO7SN6s^W9tZz^7UjYw@1 zGQhWQ_rT(Yv>1J(>^K`|9w9))NHTc{6tIbSwnK;T(aG!q;a{|hvFPJA#~MRLpV|t@ zrEGU+$Y2@lGc|#uz%xLu1|qPLs(=9m?O>k;?fYuQLHiZe4(45l?p5FqfIm_5u#+>t ze|hdnw16yt)CNVWXF`GzbC$oucemav#6*9BwGqP<$#(w7D%X#1`unBAdZv*cD?*iFQ zkiXe`Ct`tJ@l%mqA_pH}UEJ5bH-dfsG#}W$n739WqK$Ieo*mzT0O4#KJd$m=hG^ycs{LU z=7>!2Hd>4AWL3H!K z?>mkUdH%spn};mm+5JHv@3RPgSO)N_G(v= z@p!EFUlxK7C@;^K{PlKuDND^Os%*SeulnnvZp#Ux4&5Ez;Le5iHRRYJ#&^)+SXKZKtBHSA>;*hX{NL zu?L8Gj$qs(&C;CEoP&;!`@-L=rF{WfsV=QJU4X_6YLBNuA7tlw%q|tA9iv^TjA8x? z>KB(v@Xw+h)HE(_?6de=SnThz_)z_>)Tw{qeYy{T$!R1qo1WrCPEU$N{wEKBhpuzq zc8;PxTt_5bvi3$$=ZDejT@e)N4nJW8K06V>9mimDK{khbh6|4n!U%*B`2UK47AX`9 zd8|38j`lB~i)$0O3S{7MElGt6KBE2x6?G&U{6IMcp!qcT1L1nsqn66cXr3ScBQPxKO~Zaqu7ld)y19N89Q5# zcecCZI3+b0goH$+Hb^{GC@O;Y=AjQr2+0pTK*K{GD#Sw(JRtE>2_qG$LRH~AckZn1 zbpru`K zND(^l5Gep;4Ap{w6AU0#DT`9>1`=;TO3)NCXsXB*LkXIrUX^-9DR%=IG$%zSAByZ* zkr|32dWU^gsFP9*Wb}+Y5P9IZ2ZG!^RoZUUO77wOUDJN8w4I2xKXNh->RMTy@3ae`7Zovm(zuoo<=Kw@_9nRViPW z6NvpV_yI!GewXM8r_gb#v+HzsPolT4e_-%4pB?IZ^mAt(dwey~U$V*@>vf*hl;?VN z)7^5Ocde4+&R0#(_r1;4L{9^=y-@b5m+H>-inG1!J2(7=%GaFLL|;qu%Z~lkgQ~@s zYtR`us1RLzx$ZdC=ho{Ldwy-L;rPpk@YNO3m+x#|sIGai&;8BU{EAm?Tyg3R$g5Vp zZdKPE^W`I^FKk-t&ZJwh8p{<7m4_$nF4U}YrMffVb^*+&)TGEU27&vqmhy$al%V>b;^XVbe$s?#<+Z__5$pasw{epf=f25C>W2+O?DnZk1DozU(I-nrmcz_-9d zV7`1}Sb}<_JS-FpJhVr9FN#-O=0Q%r{i~lX0zLuex#@+;jHc&jlC!zYR8lWY6_S(2 zjF~K$Sz}U5PfeMVGhv^W=r>M(I>-GBi)>ZQ{RHOvCI%DwOq>q93;iq4iDRQswnHkN@7G{i`8Lsg+(T>-)b&b)jSSQ3TVi)or)GS@k>1%~_-Y}ds-OAcIBb!ZU zaz;8=a&oq#r_+{|F`9wpI0(W`Mw=*mn<=YSa~*yr8&=gWc{fsZ$Fh^#^@{H_n`(|| zlR2o+#?oVUI(HDQcpox_(dy?sco0V`7vp9+9Ie_^tV6I3h$GZpsnZMmdx<$h?MciL z>b}G(aF=YW0f$jZ*(3UXXa|`0CR5)YBB`wBXqA_3`CiFu+w%P;KC2vo3A*>8%lo2D z{m+ay+*@qBiD5s)Jmdi|?^`~MUEm=p8HalKmNoZ8))*_5%DSD;74mkjq#J47${BV( zZP*#D;1tHvx}GU$+2-;c2mjWd;9*kgdc${pTzgSsYR6Yx-lYCvhSAaS-^wtIe3~0laSXS9evzDk88LLS-1!}xDt858%O(8xX)g`;5}^nLksbf zFjH!#dMD$Z@lVL;WEK}>bXMsKvJzw;Q(o1#DpjX`C>?xYo*3_lcZkF typing.Optional[int]: platform_versions = [] for platform_dir in platform_dirs: logger.debug("Found Android Platform SDK: %s", platform_dir) + if not (platform_dir / "android.jar").is_file(): + continue if m:= re_platform.match(platform_dir.name): platform_versions.append(int(m.group(1))) platform_versions.sort() @@ -1248,6 +1250,10 @@ def _build_msvc_cmake(self, arch_platform: VsArchPlatformConfig, dep_roots: list platform_context = self.get_context(extra_context=arch_platform.extra_context()) build_type = "Release" + extra_context = { + "ARCH": arch_platform.arch, + "PLATFORM": arch_platform.platform, + } built_paths = set(install_path / configure_text(f, context=platform_context) for file_mapping in (self.release_info["msvc"]["cmake"]["files-lib"], self.release_info["msvc"]["cmake"]["files-devel"]) for files_list in file_mapping.values() for f in files_list) logger.info("CMake builds these files, to be included in the package: %s", built_paths) @@ -1298,7 +1304,7 @@ def _build_msvc_cmake(self, arch_platform: VsArchPlatformConfig, dep_roots: list logger.info("Collecting files...") archive_file_tree = ArchiveFileTree() archive_file_tree.add_file_mapping(arc_dir="", file_mapping=self.release_info["msvc"]["cmake"]["files-lib"], file_mapping_root=install_path, context=platform_context, time=self.arc_time) - archive_file_tree.add_file_mapping(arc_dir="", file_mapping=self.release_info["msvc"]["files-lib"], file_mapping_root=self.root, context=self.get_context(), time=self.arc_time) + archive_file_tree.add_file_mapping(arc_dir="", file_mapping=self.release_info["msvc"]["files-lib"], file_mapping_root=self.root, context=self.get_context(extra_context=extra_context), time=self.arc_time) logger.info("Creating %s", zip_path) with Archiver(zip_path=zip_path) as archiver: @@ -1489,8 +1495,11 @@ def main(argv=None) -> int: if args.android_api is None: with section_printer.group("Detect Android APIS"): args.android_api = releaser._detect_android_api(android_home=args.android_home) - if args.android_api is None or not (Path(args.android_home) / f"platforms/android-{args.android_api}").is_dir(): + if args.android_api is None: parser.error("Invalid --android-api, and/or could not be detected") + android_api_path = Path(args.android_home) / f"platforms/android-{args.android_api}" + if not android_api_path.is_dir(): + parser.error(f"Android API directory does not exist ({android_api_path})") with section_printer.group("Android arguments"): print(f"android_home = {args.android_home}") print(f"android_ndk_home = {args.android_ndk_home}") diff --git a/build-scripts/pkg-support/android/README.md.in b/build-scripts/pkg-support/android/INSTALL.md.in similarity index 63% rename from build-scripts/pkg-support/android/README.md.in rename to build-scripts/pkg-support/android/INSTALL.md.in index 4314b74802031..602677335bcc7 100644 --- a/build-scripts/pkg-support/android/README.md.in +++ b/build-scripts/pkg-support/android/INSTALL.md.in @@ -1,17 +1,7 @@ -The Simple DirectMedia Layer (SDL for short) is a cross-platform library -designed to make it easy to write multi-media software, such as games -and emulators. +# Using this package -The Simple DirectMedia Layer library source code is available from: -https://www.libsdl.org/ - -This library is distributed under the terms of the zlib license: -http://www.zlib.net/zlib_license.html - -# @<@PROJECT_NAME@>@-@<@PROJECT_VERSION@>@.aar - -This Android archive allows use of @<@PROJECT_NAME@>@ in your Android project, without needing to copy any SDL source. +This package contains SDL built for the Android platform. ## Gradle integration @@ -65,13 +55,37 @@ python @<@PROJECT_NAME@>@-@<@PROJECT_VERSION@>@.aar -o android_prefix ``` Add `--help` for a list of all available options. +# Documentation + +An API reference, tutorials, and additional documentation is available at: + +https://wiki.libsdl.org/SDL3 + +# Example code + +There are simple example programs available at: + +https://examples.libsdl.org/SDL3 + +# Discussions + +## Discord + +You can join the official Discord server at: + +https://discord.com/invite/BwpFGBWsv8 + +## Forums/mailing lists + +You can join SDL development discussions at: + +https://discourse.libsdl.org/ + +Once you sign up, you can use the forum through the website or as a mailing list from your email client. -Look at the example programs in ./examples (of the source archive), and check out online documentation: - https://wiki.libsdl.org/SDL3/FrontPage +## Announcement list -Join the SDL discourse server if you want to join the community: - https://discourse.libsdl.org/ +You can sign up for the low traffic announcement list at: +https://www.libsdl.org/mailing-list.php -That's it! -Sam Lantinga diff --git a/build-scripts/pkg-support/mingw/INSTALL.md b/build-scripts/pkg-support/mingw/INSTALL.md new file mode 100644 index 0000000000000..83ea472eeed35 --- /dev/null +++ b/build-scripts/pkg-support/mingw/INSTALL.md @@ -0,0 +1,53 @@ + +# Using this package + +This package contains SDL built for the mingw-w64 toolchain. + +The files for 32-bit architecture are in i686-w64-mingw32 +The files for 64-bit architecture are in x86_64-w64-mingw32 + +You can install them to another location, just type `make` for help. + +To use this package, point your include path at _arch_/include and your library path at _arch_/lib, link with the SDL3 library and copy _arch_/bin/SDL3.dll next to your executable. + +e.g. +```sh +gcc -o hello.exe hello.c -Ix86_64-w64-mingw32/include -Lx86_64-w64-mingw32/lib -lSDL3 +cp x86_64-w64-mingw32/bin/SDL3.dll . +./hello.exe +``` + +# Documentation + +An API reference, tutorials, and additional documentation is available at: + +https://wiki.libsdl.org/SDL3 + +# Example code + +There are simple example programs available at: + +https://examples.libsdl.org/SDL3 + +# Discussions + +## Discord + +You can join the official Discord server at: + +https://discord.com/invite/BwpFGBWsv8 + +## Forums/mailing lists + +You can join SDL development discussions at: + +https://discourse.libsdl.org/ + +Once you sign up, you can use the forum through the website or as a mailing list from your email client. + +## Announcement list + +You can sign up for the low traffic announcement list at: + +https://www.libsdl.org/mailing-list.php + diff --git a/build-scripts/pkg-support/mingw/INSTALL.txt b/build-scripts/pkg-support/mingw/INSTALL.txt deleted file mode 100644 index 9baefeb298ae7..0000000000000 --- a/build-scripts/pkg-support/mingw/INSTALL.txt +++ /dev/null @@ -1,25 +0,0 @@ - -The 32-bit files are in i686-w64-mingw32 -The 64-bit files are in x86_64-w64-mingw32 - -To install SDL for 32-bit x86 executables (i686): - make install-i686 - -To install SDL for 64-bit x86 executables (x86_64): - make install-x86_64 - -To install both: - make install-all - -Use DESTDIR to change the target location - mkdir $HOME/mingw32-prefix - make install-i686 DESTDIR=$HOME/mingw32-prefix - -Look at the example programs in ./examples, and check out online documentation: - https://wiki.libsdl.org/SDL3/FrontPage - -Join the SDL discourse server if you want to join the community: - https://discourse.libsdl.org/ - -That's it! -Sam Lantinga diff --git a/build-scripts/pkg-support/msvc/INSTALL.md b/build-scripts/pkg-support/msvc/INSTALL.md new file mode 100644 index 0000000000000..82f812f36ee1d --- /dev/null +++ b/build-scripts/pkg-support/msvc/INSTALL.md @@ -0,0 +1,45 @@ + +# Using this package + +This package contains SDL built for Visual Studio. + +To use this package, edit your project properties: +- Add the include directory to "VC++ Directories" -> "Include Directories" +- Add the lib/_arch_ directory to "VC++ Directories" -> "Library Directories" +- Add SDL3.lib to Linker -> Input -> "Additional Dependencies" +- Copy lib/_arch_/SDL3.dll to your project directory. + +# Documentation + +An API reference, tutorials, and additional documentation is available at: + +https://wiki.libsdl.org/SDL3 + +# Example code + +There are simple example programs available at: + +https://examples.libsdl.org/SDL3 + +# Discussions + +## Discord + +You can join the official Discord server at: + +https://discord.com/invite/BwpFGBWsv8 + +## Forums/mailing lists + +You can join SDL development discussions at: + +https://discourse.libsdl.org/ + +Once you sign up, you can use the forum through the website or as a mailing list from your email client. + +## Announcement list + +You can sign up for the low traffic announcement list at: + +https://www.libsdl.org/mailing-list.php + diff --git a/build-scripts/pkg-support/msvc/arm64/INSTALL.md.in b/build-scripts/pkg-support/msvc/arm64/INSTALL.md.in new file mode 100644 index 0000000000000..c185171a32b6e --- /dev/null +++ b/build-scripts/pkg-support/msvc/arm64/INSTALL.md.in @@ -0,0 +1,13 @@ + +# Using this package + +This package contains @<@PROJECT_NAME@>@ built for arm64 Windows. + +To use this package, simply replace an existing 64-bit ARM @<@PROJECT_NAME@>@.dll with the one included here. + +# Development packages + +If you're looking for packages with headers and libraries, you can download one of these: +- @<@PROJECT_NAME@>@-devel-@<@PROJECT_VERSION@>@-VC.zip, for development using Visual Studio +- @<@PROJECT_NAME@>@-devel-@<@PROJECT_VERSION@>@-mingw.zip, for development using mingw-w64 + diff --git a/build-scripts/pkg-support/msvc/x64/INSTALL.md.in b/build-scripts/pkg-support/msvc/x64/INSTALL.md.in new file mode 100644 index 0000000000000..74cd67856ca9a --- /dev/null +++ b/build-scripts/pkg-support/msvc/x64/INSTALL.md.in @@ -0,0 +1,13 @@ + +# Using this package + +This package contains @<@PROJECT_NAME@>@ built for x64 Windows. + +To use this package, simply replace an existing 64-bit @<@PROJECT_NAME@>@.dll with the one included here. + +# Development packages + +If you're looking for packages with headers and libraries, you can download one of these: +- @<@PROJECT_NAME@>@-devel-@<@PROJECT_VERSION@>@-VC.zip, for development using Visual Studio +- @<@PROJECT_NAME@>@-devel-@<@PROJECT_VERSION@>@-mingw.zip, for development using mingw-w64 + diff --git a/build-scripts/pkg-support/msvc/x86/INSTALL.md.in b/build-scripts/pkg-support/msvc/x86/INSTALL.md.in new file mode 100644 index 0000000000000..041c116316eec --- /dev/null +++ b/build-scripts/pkg-support/msvc/x86/INSTALL.md.in @@ -0,0 +1,13 @@ + +# Using this package + +This package contains @<@PROJECT_NAME@>@ built for x86 Windows. + +To use this package, simply replace an existing 32-bit @<@PROJECT_NAME@>@.dll with the one included here. + +# Development packages + +If you're looking for packages with headers and libraries, you can download one of these: +- @<@PROJECT_NAME@>@-devel-@<@PROJECT_VERSION@>@-VC.zip, for development using Visual Studio +- @<@PROJECT_NAME@>@-devel-@<@PROJECT_VERSION@>@-mingw.zip, for development using mingw-w64 + diff --git a/build-scripts/release-info.json b/build-scripts/release-info.json index 250fc16db4c76..dc0bd31b30b30 100644 --- a/build-scripts/release-info.json +++ b/build-scripts/release-info.json @@ -45,21 +45,14 @@ }, "files": { "": [ - "build-scripts/pkg-support/mingw/INSTALL.txt", + "build-scripts/pkg-support/mingw/INSTALL.md", "build-scripts/pkg-support/mingw/Makefile", - "BUGS.txt", - "CREDITS.md", - "README-SDL.txt", - "WhatsNew.txt", "LICENSE.txt", "README.md" ], "cmake": [ "build-scripts/pkg-support/mingw/cmake/SDL3Config.cmake", "build-scripts/pkg-support/mingw/cmake/SDL3ConfigVersion.cmake" - ], - "docs": [ - "docs/*" ] } }, @@ -117,25 +110,22 @@ }, "files-lib": { "": [ - "README-SDL.txt" + "build-scripts/pkg-support/msvc/@<@ARCH@>@/INSTALL.md.in:INSTALL.md", + "LICENSE.txt", + "README.md" ] }, "files-devel": { "": [ - "README-SDL.txt", - "BUGS.txt", + "build-scripts/pkg-support/msvc/INSTALL.md", "LICENSE.txt", - "README.md", - "WhatsNew.txt" + "README.md" ], "cmake": [ "build-scripts/pkg-support/msvc/cmake/SDL3Config.cmake.in:SDL3Config.cmake", "build-scripts/pkg-support/msvc/cmake/SDL3ConfigVersion.cmake.in:SDL3ConfigVersion.cmake", "cmake/sdlcpu.cmake" ], - "docs": [ - "docs/*" - ], "include/SDL3": [ "include/SDL3/*.h" ] @@ -211,8 +201,9 @@ }, "files": { "": [ + "build-scripts/pkg-support/android/INSTALL.md.in:INSTALL.md", "LICENSE.txt", - "build-scripts/pkg-support/android/README.md.in:README.md" + "README.md" ] } } From ea642fe9ff17e90a0ccc0ec95d007859c4ab02bc Mon Sep 17 00:00:00 2001 From: Sam Lantinga Date: Wed, 15 Jan 2025 23:34:20 -0800 Subject: [PATCH 085/340] cocoa: clear mouse focus based on NSEventTypeMouseExited events (#11991) We can't directly set the mouse focus since we may get spammed by entered/exited events, but we can process the current focus later in the mouseMoved handler in line with the mouse motion event sequence. Fixes https://github.com/libsdl-org/SDL/issues/8188 --- src/video/cocoa/SDL_cocoaevents.m | 2 ++ src/video/cocoa/SDL_cocoamouse.h | 1 + src/video/cocoa/SDL_cocoamouse.m | 28 ++++++++++++++++++++++------ src/video/cocoa/SDL_cocoawindow.m | 6 ++++++ 4 files changed, 31 insertions(+), 6 deletions(-) diff --git a/src/video/cocoa/SDL_cocoaevents.m b/src/video/cocoa/SDL_cocoaevents.m index 74c5c192b5681..58cae9955460c 100644 --- a/src/video/cocoa/SDL_cocoaevents.m +++ b/src/video/cocoa/SDL_cocoaevents.m @@ -76,6 +76,8 @@ static void Cocoa_DispatchEvent(NSEvent *theEvent) case NSEventTypeOtherMouseDragged: // usually middle mouse dragged case NSEventTypeMouseMoved: case NSEventTypeScrollWheel: + case NSEventTypeMouseEntered: + case NSEventTypeMouseExited: Cocoa_HandleMouseEvent(_this, theEvent); break; case NSEventTypeKeyDown: diff --git a/src/video/cocoa/SDL_cocoamouse.h b/src/video/cocoa/SDL_cocoamouse.h index 7ddef5968a174..70282be9fa0d4 100644 --- a/src/video/cocoa/SDL_cocoamouse.h +++ b/src/video/cocoa/SDL_cocoamouse.h @@ -26,6 +26,7 @@ #include "SDL_cocoavideo.h" extern bool Cocoa_InitMouse(SDL_VideoDevice *_this); +extern NSWindow *Cocoa_GetMouseFocus(); extern void Cocoa_HandleMouseEvent(SDL_VideoDevice *_this, NSEvent *event); extern void Cocoa_HandleMouseWheel(SDL_Window *window, NSEvent *event); extern void Cocoa_HandleMouseWarp(CGFloat x, CGFloat y); diff --git a/src/video/cocoa/SDL_cocoamouse.m b/src/video/cocoa/SDL_cocoamouse.m index 38297f40830fb..77ebf109d02fa 100644 --- a/src/video/cocoa/SDL_cocoamouse.m +++ b/src/video/cocoa/SDL_cocoamouse.m @@ -27,7 +27,9 @@ #include "../../events/SDL_mouse_c.h" -// #define DEBUG_COCOAMOUSE +#if 0 +#define DEBUG_COCOAMOUSE +#endif #ifdef DEBUG_COCOAMOUSE #define DLog(fmt, ...) printf("%s: " fmt "\n", __func__, ##__VA_ARGS__) @@ -230,11 +232,11 @@ static bool Cocoa_ShowCursor(SDL_Cursor *cursor) SDL_VideoDevice *device = SDL_GetVideoDevice(); SDL_Window *window = (device ? device->windows : NULL); for (; window != NULL; window = window->next) { - SDL_CocoaWindowData *internal = (__bridge SDL_CocoaWindowData *)window->internal; - if (internal) { - [internal.nswindow performSelectorOnMainThread:@selector(invalidateCursorRectsForView:) - withObject:[internal.nswindow contentView] - waitUntilDone:NO]; + SDL_CocoaWindowData *data = (__bridge SDL_CocoaWindowData *)window->internal; + if (data) { + [data.nswindow performSelectorOnMainThread:@selector(invalidateCursorRectsForView:) + withObject:[data.nswindow contentView] + waitUntilDone:NO]; } } return true; @@ -428,6 +430,13 @@ static void Cocoa_HandleTitleButtonEvent(SDL_VideoDevice *_this, NSEvent *event) } } +static NSWindow *Cocoa_MouseFocus; + +NSWindow *Cocoa_GetMouseFocus() +{ + return Cocoa_MouseFocus; +} + void Cocoa_HandleMouseEvent(SDL_VideoDevice *_this, NSEvent *event) { SDL_MouseID mouseID = SDL_DEFAULT_MOUSE_ID; @@ -437,7 +446,14 @@ void Cocoa_HandleMouseEvent(SDL_VideoDevice *_this, NSEvent *event) CGFloat lastMoveX, lastMoveY; float deltaX, deltaY; bool seenWarp; + switch ([event type]) { + case NSEventTypeMouseEntered: + Cocoa_MouseFocus = [event window]; + return; + case NSEventTypeMouseExited: + Cocoa_MouseFocus = NULL; + return; case NSEventTypeMouseMoved: case NSEventTypeLeftMouseDragged: case NSEventTypeRightMouseDragged: diff --git a/src/video/cocoa/SDL_cocoawindow.m b/src/video/cocoa/SDL_cocoawindow.m index 48cc065ec40ff..c58e851b30129 100644 --- a/src/video/cocoa/SDL_cocoawindow.m +++ b/src/video/cocoa/SDL_cocoawindow.m @@ -1776,6 +1776,12 @@ - (void)mouseMoved:(NSEvent *)theEvent return; } + if (!Cocoa_GetMouseFocus()) { + // The mouse is no longer over any window in the application + SDL_SetMouseFocus(NULL); + return; + } + window = _data.window; contentView = _data.sdlContentView; point = [theEvent locationInWindow]; From 4d63a2b882687d2018f9fdbee0a8ac7a8b2639b0 Mon Sep 17 00:00:00 2001 From: "Ryan C. Gordon" Date: Thu, 16 Jan 2025 00:56:49 -0500 Subject: [PATCH 086/340] io: Renamed src/file to src/io Fixes #11980. --- Android.mk | 4 +-- CMakeLists.txt | 8 ++--- VisualC-GDK/SDL/SDL.vcxproj | 12 ++++---- VisualC-GDK/SDL/SDL.vcxproj.filters | 12 ++++---- VisualC/SDL/SDL.vcxproj | 12 ++++---- VisualC/SDL/SDL.vcxproj.filters | 30 +++++++++---------- Xcode/SDL/SDL.xcodeproj/project.pbxproj | 6 ++-- src/SDL.c | 2 +- src/{file => io}/SDL_asyncio.c | 0 src/{file => io}/SDL_asyncio_c.h | 0 src/{file => io}/SDL_iostream.c | 0 src/{file => io}/SDL_iostream_c.h | 0 src/{file => io}/SDL_sysasyncio.h | 0 .../generic/SDL_asyncio_generic.c | 0 .../io_uring/SDL_asyncio_liburing.c | 0 src/{file => io}/n3ds/SDL_iostreamromfs.c | 0 src/{file => io}/n3ds/SDL_iostreamromfs.h | 0 .../windows/SDL_asyncio_windows_ioring.c | 0 src/process/posix/SDL_posixprocess.c | 2 +- src/process/windows/SDL_windowsprocess.c | 2 +- 20 files changed, 45 insertions(+), 45 deletions(-) rename src/{file => io}/SDL_asyncio.c (100%) rename src/{file => io}/SDL_asyncio_c.h (100%) rename src/{file => io}/SDL_iostream.c (100%) rename src/{file => io}/SDL_iostream_c.h (100%) rename src/{file => io}/SDL_sysasyncio.h (100%) rename src/{file => io}/generic/SDL_asyncio_generic.c (100%) rename src/{file => io}/io_uring/SDL_asyncio_liburing.c (100%) rename src/{file => io}/n3ds/SDL_iostreamromfs.c (100%) rename src/{file => io}/n3ds/SDL_iostreamromfs.h (100%) rename src/{file => io}/windows/SDL_asyncio_windows_ioring.c (100%) diff --git a/Android.mk b/Android.mk index 9e79ee0bc9492..b5fe8955f9a1c 100644 --- a/Android.mk +++ b/Android.mk @@ -35,8 +35,8 @@ LOCAL_SRC_FILES := \ $(LOCAL_PATH)/src/dialog/android/SDL_androiddialog.c \ $(wildcard $(LOCAL_PATH)/src/dynapi/*.c) \ $(wildcard $(LOCAL_PATH)/src/events/*.c) \ - $(wildcard $(LOCAL_PATH)/src/file/*.c) \ - $(wildcard $(LOCAL_PATH)/src/file/generic/*.c) \ + $(wildcard $(LOCAL_PATH)/src/io/*.c) \ + $(wildcard $(LOCAL_PATH)/src/io/generic/*.c) \ $(wildcard $(LOCAL_PATH)/src/gpu/*.c) \ $(wildcard $(LOCAL_PATH)/src/gpu/vulkan/*.c) \ $(wildcard $(LOCAL_PATH)/src/haptic/*.c) \ diff --git a/CMakeLists.txt b/CMakeLists.txt index 129b6267b32d3..eb4fc9574102d 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1158,8 +1158,8 @@ sdl_glob_sources( "${SDL3_SOURCE_DIR}/src/cpuinfo/*.c" "${SDL3_SOURCE_DIR}/src/dynapi/*.c" "${SDL3_SOURCE_DIR}/src/events/*.c" - "${SDL3_SOURCE_DIR}/src/file/*.c" - "${SDL3_SOURCE_DIR}/src/file/generic/*.c" + "${SDL3_SOURCE_DIR}/src/io/*.c" + "${SDL3_SOURCE_DIR}/src/io/generic/*.c" "${SDL3_SOURCE_DIR}/src/filesystem/*.c" "${SDL3_SOURCE_DIR}/src/gpu/*.c" "${SDL3_SOURCE_DIR}/src/joystick/*.c" @@ -1774,7 +1774,7 @@ elseif(UNIX AND NOT APPLE AND NOT RISCOS AND NOT HAIKU) endif() if(HAVE_LIBURING_H) - sdl_sources("${SDL3_SOURCE_DIR}/src/file/io_uring/SDL_asyncio_liburing.c") + sdl_sources("${SDL3_SOURCE_DIR}/src/io/io_uring/SDL_asyncio_liburing.c") endif() # Always compiled for Linux, unconditionally: @@ -2912,7 +2912,7 @@ elseif(N3DS) sdl_glob_sources("${SDL3_SOURCE_DIR}/src/locale/n3ds/*.c") set(HAVE_SDL_LOCALE TRUE) - sdl_glob_sources("${SDL3_SOURCE_DIR}/src/file/n3ds/*.c") + sdl_glob_sources("${SDL3_SOURCE_DIR}/src/io/n3ds/*.c") endif() sdl_sources(${SDL3_SOURCE_DIR}/src/dialog/SDL_dialog.c) diff --git a/VisualC-GDK/SDL/SDL.vcxproj b/VisualC-GDK/SDL/SDL.vcxproj index 2422201d23f56..07a9b3be36f2c 100644 --- a/VisualC-GDK/SDL/SDL.vcxproj +++ b/VisualC-GDK/SDL/SDL.vcxproj @@ -441,8 +441,8 @@ - - + + @@ -529,9 +529,9 @@ - - - + + + @@ -673,7 +673,7 @@ - + true true diff --git a/VisualC-GDK/SDL/SDL.vcxproj.filters b/VisualC-GDK/SDL/SDL.vcxproj.filters index 7efaf3abe3fef..247bbdc0b034a 100644 --- a/VisualC-GDK/SDL/SDL.vcxproj.filters +++ b/VisualC-GDK/SDL/SDL.vcxproj.filters @@ -45,7 +45,7 @@ - + @@ -204,9 +204,9 @@ - - - + + + @@ -466,8 +466,8 @@ - - + + diff --git a/VisualC/SDL/SDL.vcxproj b/VisualC/SDL/SDL.vcxproj index 0221a54328aaf..134c730c30f71 100644 --- a/VisualC/SDL/SDL.vcxproj +++ b/VisualC/SDL/SDL.vcxproj @@ -356,8 +356,8 @@ - - + + @@ -419,12 +419,12 @@ - + - - + + @@ -557,7 +557,7 @@ - + diff --git a/VisualC/SDL/SDL.vcxproj.filters b/VisualC/SDL/SDL.vcxproj.filters index 111db56c2079e..176bea64c9c7d 100644 --- a/VisualC/SDL/SDL.vcxproj.filters +++ b/VisualC/SDL/SDL.vcxproj.filters @@ -25,7 +25,7 @@ {5e27e19f-b3f8-4e2d-b323-b00b2040ec86} - + {a3ab9cff-8495-4a5c-8af6-27e43199a712} @@ -211,10 +211,10 @@ {00009d5ded166cc6c6680ec771a30000} - + {00004d6806b6238cae0ed62db5440000} - + {000028b2ea36d7190d13777a4dc70000} @@ -447,11 +447,11 @@ filesystem - - file + + io - - file + + io main @@ -965,14 +965,14 @@ filesystem\windows - - file\generic + + io\generic - - file + + io - - file\windows + + io\windows main\generic @@ -1085,8 +1085,8 @@ events - - file + + io filesystem\windows diff --git a/Xcode/SDL/SDL.xcodeproj/project.pbxproj b/Xcode/SDL/SDL.xcodeproj/project.pbxproj index ffe36a0ec60b6..e1be7863f945d 100644 --- a/Xcode/SDL/SDL.xcodeproj/project.pbxproj +++ b/Xcode/SDL/SDL.xcodeproj/project.pbxproj @@ -1331,7 +1331,7 @@ F37E18542BA50EB40098C111 /* dialog */, A7D8A5D723E2513D00DCD162 /* dynapi */, A7D8A92923E2514000DCD162 /* events */, - A7D8A7DA23E2513E00DCD162 /* file */, + A7D8A7DA23E2513E00DCD162 /* io */, A7D8A7F623E2513F00DCD162 /* filesystem */, E4F257872C81903800FCEAFC /* gpu */, A7D8A5C223E2513D00DCD162 /* haptic */, @@ -1918,7 +1918,7 @@ path = darwin; sourceTree = ""; }; - A7D8A7DA23E2513E00DCD162 /* file */ = { + A7D8A7DA23E2513E00DCD162 /* io */ = { isa = PBXGroup; children = ( A7D8A7DB23E2513F00DCD162 /* SDL_iostream.c */, @@ -1928,7 +1928,7 @@ 000013C0F2EADC24ADC10000 /* generic */, 000064F9A2AAE947C1CD0000 /* windows */, ); - path = file; + path = io; sourceTree = ""; }; A7D8A7DF23E2513F00DCD162 /* power */ = { diff --git a/src/SDL.c b/src/SDL.c index 269a13028c382..90191d1b0c4d6 100644 --- a/src/SDL.c +++ b/src/SDL.c @@ -55,7 +55,7 @@ #include "video/SDL_surface_c.h" #include "video/SDL_video_c.h" #include "filesystem/SDL_filesystem_c.h" -#include "file/SDL_asyncio_c.h" +#include "io/SDL_asyncio_c.h" #ifdef SDL_PLATFORM_ANDROID #include "core/android/SDL_android.h" #endif diff --git a/src/file/SDL_asyncio.c b/src/io/SDL_asyncio.c similarity index 100% rename from src/file/SDL_asyncio.c rename to src/io/SDL_asyncio.c diff --git a/src/file/SDL_asyncio_c.h b/src/io/SDL_asyncio_c.h similarity index 100% rename from src/file/SDL_asyncio_c.h rename to src/io/SDL_asyncio_c.h diff --git a/src/file/SDL_iostream.c b/src/io/SDL_iostream.c similarity index 100% rename from src/file/SDL_iostream.c rename to src/io/SDL_iostream.c diff --git a/src/file/SDL_iostream_c.h b/src/io/SDL_iostream_c.h similarity index 100% rename from src/file/SDL_iostream_c.h rename to src/io/SDL_iostream_c.h diff --git a/src/file/SDL_sysasyncio.h b/src/io/SDL_sysasyncio.h similarity index 100% rename from src/file/SDL_sysasyncio.h rename to src/io/SDL_sysasyncio.h diff --git a/src/file/generic/SDL_asyncio_generic.c b/src/io/generic/SDL_asyncio_generic.c similarity index 100% rename from src/file/generic/SDL_asyncio_generic.c rename to src/io/generic/SDL_asyncio_generic.c diff --git a/src/file/io_uring/SDL_asyncio_liburing.c b/src/io/io_uring/SDL_asyncio_liburing.c similarity index 100% rename from src/file/io_uring/SDL_asyncio_liburing.c rename to src/io/io_uring/SDL_asyncio_liburing.c diff --git a/src/file/n3ds/SDL_iostreamromfs.c b/src/io/n3ds/SDL_iostreamromfs.c similarity index 100% rename from src/file/n3ds/SDL_iostreamromfs.c rename to src/io/n3ds/SDL_iostreamromfs.c diff --git a/src/file/n3ds/SDL_iostreamromfs.h b/src/io/n3ds/SDL_iostreamromfs.h similarity index 100% rename from src/file/n3ds/SDL_iostreamromfs.h rename to src/io/n3ds/SDL_iostreamromfs.h diff --git a/src/file/windows/SDL_asyncio_windows_ioring.c b/src/io/windows/SDL_asyncio_windows_ioring.c similarity index 100% rename from src/file/windows/SDL_asyncio_windows_ioring.c rename to src/io/windows/SDL_asyncio_windows_ioring.c diff --git a/src/process/posix/SDL_posixprocess.c b/src/process/posix/SDL_posixprocess.c index 2964ab537d20a..8dc01603408d8 100644 --- a/src/process/posix/SDL_posixprocess.c +++ b/src/process/posix/SDL_posixprocess.c @@ -34,7 +34,7 @@ #include #include "../SDL_sysprocess.h" -#include "../../file/SDL_iostream_c.h" +#include "../../io/SDL_iostream_c.h" #define READ_END 0 diff --git a/src/process/windows/SDL_windowsprocess.c b/src/process/windows/SDL_windowsprocess.c index 8c0a0a330c2c5..c1aee5c4ab2cb 100644 --- a/src/process/windows/SDL_windowsprocess.c +++ b/src/process/windows/SDL_windowsprocess.c @@ -24,7 +24,7 @@ #include "../../core/windows/SDL_windows.h" #include "../SDL_sysprocess.h" -#include "../../file/SDL_iostream_c.h" +#include "../../io/SDL_iostream_c.h" #define READ_END 0 #define WRITE_END 1 From 05877f2ceaefa03e12e769f986fca77b17313423 Mon Sep 17 00:00:00 2001 From: "Ryan C. Gordon" Date: Thu, 16 Jan 2025 00:59:31 -0500 Subject: [PATCH 087/340] cmake: Add the IoRing async i/o code to the Windows build. The Visual Studio projects have been compiling this for awhile, but apparently we haven't tested this through CMake before. Toolchains without access to the latest Windows 11 SDK headers have been preprocessing out the dependency on this code, so we never noticed. --- CMakeLists.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index eb4fc9574102d..a2b2bc9b5b51e 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1889,6 +1889,7 @@ elseif(WINDOWS) sdl_glob_sources("${SDL3_SOURCE_DIR}/src/core/windows/*.c") sdl_glob_sources("${SDL3_SOURCE_DIR}/src/main/windows/*.c") + sdl_glob_sources("${SDL3_SOURCE_DIR}/src/io/windows/*.c") if(TARGET SDL3-shared AND MSVC AND NOT SDL_LIBC) # Prevent codegen that would use the VC runtime libraries. From 3424ec948cbfbd598744770fd16dd687e4e13506 Mon Sep 17 00:00:00 2001 From: "Ryan C. Gordon" Date: Thu, 16 Jan 2025 00:10:07 -0500 Subject: [PATCH 088/340] video: SDL_GL_GetAttribute gets correct SDL_GL_CONTEXT_RELEASE_BEHAVIOR value. Original patch was from @ramezgerges (thanks!). Fixes #11697. --- src/video/SDL_video.c | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/src/video/SDL_video.c b/src/video/SDL_video.c index bbf99ecfa65fd..b896e99875b62 100644 --- a/src/video/SDL_video.c +++ b/src/video/SDL_video.c @@ -51,10 +51,14 @@ #include #endif // SDL_VIDEO_OPENGL_ES2 && !SDL_VIDEO_OPENGL -#ifndef SDL_VIDEO_OPENGL -#ifndef GL_CONTEXT_RELEASE_BEHAVIOR_KHR -#define GL_CONTEXT_RELEASE_BEHAVIOR_KHR 0x82FB +// GL_CONTEXT_RELEASE_BEHAVIOR and GL_CONTEXT_RELEASE_BEHAVIOR_KHR have the same number. +#ifndef GL_CONTEXT_RELEASE_BEHAVIOR +#define GL_CONTEXT_RELEASE_BEHAVIOR 0x82FB #endif + +// GL_CONTEXT_RELEASE_BEHAVIOR_FLUSH and GL_CONTEXT_RELEASE_BEHAVIOR_FLUSH_KHR have the same number. +#ifndef GL_CONTEXT_RELEASE_BEHAVIOR_FLUSH +#define GL_CONTEXT_RELEASE_BEHAVIOR_FLUSH 0x82FC #endif #ifdef SDL_PLATFORM_EMSCRIPTEN @@ -4820,11 +4824,7 @@ bool SDL_GL_GetAttribute(SDL_GLAttr attr, int *value) attrib = GL_SAMPLES; break; case SDL_GL_CONTEXT_RELEASE_BEHAVIOR: -#ifdef SDL_VIDEO_OPENGL attrib = GL_CONTEXT_RELEASE_BEHAVIOR; -#else - attrib = GL_CONTEXT_RELEASE_BEHAVIOR_KHR; -#endif break; case SDL_GL_BUFFER_SIZE: { @@ -4969,6 +4969,12 @@ bool SDL_GL_GetAttribute(SDL_GLAttr attr, int *value) } return SDL_SetError("OpenGL error: %08X", error); } + + // convert GL_CONTEXT_RELEASE_BEHAVIOR values back to SDL_GL_CONTEXT_RELEASE_BEHAVIOR values + if (attr == SDL_GL_CONTEXT_RELEASE_BEHAVIOR) { + *value = (*value == GL_CONTEXT_RELEASE_BEHAVIOR_FLUSH) ? SDL_GL_CONTEXT_RELEASE_BEHAVIOR_FLUSH : SDL_GL_CONTEXT_RELEASE_BEHAVIOR_NONE; + } + return true; #else return SDL_Unsupported(); From e98ee9bb04bd8bd29c237db593a6595b8e0d0893 Mon Sep 17 00:00:00 2001 From: Ramez Ragaa Date: Sat, 28 Dec 2024 23:47:54 +0200 Subject: [PATCH 089/340] Adjust testgl.c to test gl_release_behavior --- include/SDL3/SDL_test_common.h | 1 + src/test/SDL_test_common.c | 1 + test/testgl.c | 8 ++++++++ 3 files changed, 10 insertions(+) diff --git a/include/SDL3/SDL_test_common.h b/include/SDL3/SDL_test_common.h index 2d39bcf52b41e..3ab1ad01c23d0 100644 --- a/include/SDL3/SDL_test_common.h +++ b/include/SDL3/SDL_test_common.h @@ -139,6 +139,7 @@ typedef struct int gl_accum_blue_size; int gl_accum_alpha_size; int gl_stereo; + int gl_release_behavior; int gl_multisamplebuffers; int gl_multisamplesamples; int gl_retained_backing; diff --git a/src/test/SDL_test_common.c b/src/test/SDL_test_common.c index 335d5595dd28d..8e0590ae9fa7d 100644 --- a/src/test/SDL_test_common.c +++ b/src/test/SDL_test_common.c @@ -1226,6 +1226,7 @@ bool SDLTest_CommonInit(SDLTest_CommonState *state) SDL_GL_SetAttribute(SDL_GL_ACCUM_BLUE_SIZE, state->gl_accum_blue_size); SDL_GL_SetAttribute(SDL_GL_ACCUM_ALPHA_SIZE, state->gl_accum_alpha_size); SDL_GL_SetAttribute(SDL_GL_STEREO, state->gl_stereo); + SDL_GL_SetAttribute(SDL_GL_CONTEXT_RELEASE_BEHAVIOR, state->gl_release_behavior); SDL_GL_SetAttribute(SDL_GL_MULTISAMPLEBUFFERS, state->gl_multisamplebuffers); SDL_GL_SetAttribute(SDL_GL_MULTISAMPLESAMPLES, state->gl_multisamplesamples); if (state->gl_accelerated >= 0) { diff --git a/test/testgl.c b/test/testgl.c index 8854f21dca4c8..f109def341f3c 100644 --- a/test/testgl.c +++ b/test/testgl.c @@ -263,6 +263,9 @@ int main(int argc, char *argv[]) state->gl_green_size = 5; state->gl_blue_size = 5; state->gl_depth_size = 16; + /* For release_behavior to work, at least on Windows, you'll most likely need to set state->gl_major_version = 3 */ + /* state->gl_major_version = 3; */ + state->gl_release_behavior = 0; state->gl_double_buffer = 1; if (fsaa) { state->gl_multisamplebuffers = 1; @@ -331,6 +334,11 @@ int main(int argc, char *argv[]) } else { SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Failed to get SDL_GL_DEPTH_SIZE: %s\n", SDL_GetError()); } + if (SDL_GL_GetAttribute(SDL_GL_CONTEXT_RELEASE_BEHAVIOR, &value)) { + SDL_Log("SDL_GL_CONTEXT_RELEASE_BEHAVIOR: requested %d, got %d\n", 0, value); + } else { + SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Failed to get SDL_GL_CONTEXT_RELEASE_BEHAVIOR: %s\n", SDL_GetError()); + } if (fsaa) { if (SDL_GL_GetAttribute(SDL_GL_MULTISAMPLEBUFFERS, &value)) { SDL_Log("SDL_GL_MULTISAMPLEBUFFERS: requested 1, got %d\n", value); From 87e1b0eb89823156551c6244ed365f063a3b1dcf Mon Sep 17 00:00:00 2001 From: "Ryan C. Gordon" Date: Wed, 15 Jan 2025 17:03:01 -0500 Subject: [PATCH 090/340] filesystem: SDL_EnumerateDirectory() gives dirs with path seperators appended. Fixes #11065. Fixes #11427. --- include/SDL3/SDL_filesystem.h | 3 +++ src/filesystem/SDL_filesystem.c | 5 ++-- src/filesystem/posix/SDL_sysfsops.c | 27 ++++++++++++++++++---- src/filesystem/windows/SDL_sysfsops.c | 33 ++++++++++++++++++--------- test/testfilesystem.c | 9 +------- 5 files changed, 51 insertions(+), 26 deletions(-) diff --git a/include/SDL3/SDL_filesystem.h b/include/SDL3/SDL_filesystem.h index c228a0382f4bb..8baa254441952 100644 --- a/include/SDL3/SDL_filesystem.h +++ b/include/SDL3/SDL_filesystem.h @@ -313,6 +313,9 @@ typedef enum SDL_EnumerationResult * terminate the enumeration early, and dictate the return value of the * enumeration function itself. * + * `dirname` is guaranteed to end with a path separator ('\\' on + * Windows, '/' on most other platforms). + * * \param userdata an app-controlled pointer that is passed to the callback. * \param dirname the directory that is being enumerated. * \param fname the next entry in the enumeration. diff --git a/src/filesystem/SDL_filesystem.c b/src/filesystem/SDL_filesystem.c index 6bb905a0b851e..28388517c4978 100644 --- a/src/filesystem/SDL_filesystem.c +++ b/src/filesystem/SDL_filesystem.c @@ -307,7 +307,7 @@ static SDL_EnumerationResult SDLCALL GlobDirectoryCallback(void *userdata, const // !!! FIXME: and only casefold the new pieces instead of allocating and folding full paths for all of this. char *fullpath = NULL; - if (SDL_asprintf(&fullpath, "%s/%s", dirname, fname) < 0) { + if (SDL_asprintf(&fullpath, "%s%s", dirname, fname) < 0) { return SDL_ENUM_FAILURE; } @@ -417,7 +417,8 @@ char **SDL_InternalGlobDirectory(const char *path, const char *pattern, SDL_Glob data.enumerator = enumerator; data.getpathinfo = getpathinfo; data.fsuserdata = userdata; - data.basedirlen = SDL_strlen(path) + 1; // +1 for the '/' we'll be adding. + data.basedirlen = *path ? (SDL_strlen(path) + 1) : 0; // +1 for the '/' we'll be adding. + char **result = NULL; if (data.enumerator(path, GlobDirectoryCallback, &data, data.fsuserdata)) { diff --git a/src/filesystem/posix/SDL_sysfsops.c b/src/filesystem/posix/SDL_sysfsops.c index 0658b8f1554d9..c562c2aed2461 100644 --- a/src/filesystem/posix/SDL_sysfsops.c +++ b/src/filesystem/posix/SDL_sysfsops.c @@ -37,25 +37,42 @@ bool SDL_SYS_EnumerateDirectory(const char *path, SDL_EnumerateDirectoryCallback cb, void *userdata) { - SDL_EnumerationResult result = SDL_ENUM_CONTINUE; + char *pathwithsep = NULL; + int pathwithseplen = SDL_asprintf(&pathwithsep, "%s/", path); + if ((pathwithseplen == -1) || (!pathwithsep)) { + return false; + } + + // trim down to a single path separator at the end, in case the caller added one or more. + pathwithseplen--; + while ((pathwithseplen >= 0) && (pathwithsep[pathwithseplen] == '/')) { + pathwithsep[pathwithseplen--] = '\0'; + } - DIR *dir = opendir(path); + DIR *dir = opendir(pathwithsep); if (!dir) { + SDL_free(pathwithsep); return SDL_SetError("Can't open directory: %s", strerror(errno)); } + // make sure there's a path separator at the end now for the actual callback. + pathwithsep[++pathwithseplen] = '/'; + pathwithsep[++pathwithseplen] = '\0'; + + SDL_EnumerationResult result = SDL_ENUM_CONTINUE; struct dirent *ent; - while ((result == SDL_ENUM_CONTINUE) && ((ent = readdir(dir)) != NULL)) - { + while ((result == SDL_ENUM_CONTINUE) && ((ent = readdir(dir)) != NULL)) { const char *name = ent->d_name; if ((SDL_strcmp(name, ".") == 0) || (SDL_strcmp(name, "..") == 0)) { continue; } - result = cb(userdata, path, name); + result = cb(userdata, pathwithsep, name); } closedir(dir); + SDL_free(pathwithsep); + return (result != SDL_ENUM_FAILURE); } diff --git a/src/filesystem/windows/SDL_sysfsops.c b/src/filesystem/windows/SDL_sysfsops.c index 89961c6a8fa8e..9c48ba957b599 100644 --- a/src/filesystem/windows/SDL_sysfsops.c +++ b/src/filesystem/windows/SDL_sysfsops.c @@ -34,35 +34,45 @@ bool SDL_SYS_EnumerateDirectory(const char *path, SDL_EnumerateDirectoryCallback SDL_EnumerationResult result = SDL_ENUM_CONTINUE; if (*path == '\0') { // if empty (completely at the root), we need to enumerate drive letters. const DWORD drives = GetLogicalDrives(); - char name[3] = { 0, ':', '\0' }; + char name[] = { 0, ':', '\\', '\0' }; for (int i = 'A'; (result == SDL_ENUM_CONTINUE) && (i <= 'Z'); i++) { if (drives & (1 << (i - 'A'))) { name[0] = (char) i; - result = cb(userdata, path, name); + result = cb(userdata, "", name); } } } else { - const size_t patternlen = SDL_strlen(path) + 3; - char *pattern = (char *) SDL_malloc(patternlen); - if (!pattern) { - return false; - } - // you need a wildcard to enumerate through FindFirstFileEx(), but the wildcard is only checked in the // filename element at the end of the path string, so always tack on a "\\*" to get everything, and // also prevent any wildcards inserted by the app from being respected. - SDL_snprintf(pattern, patternlen, "%s\\*", path); + char *pattern = NULL; + int patternlen = SDL_asprintf(&pattern, "%s\\\\", path); // we'll replace that second '\\' in the trimdown. + if ((patternlen == -1) || (!pattern)) { + return false; + } + + // trim down to a single path separator at the end, in case the caller added one or more. + patternlen--; + while ((patternlen >= 0) && ((pattern[patternlen] == '\\') || (pattern[patternlen] == '/'))) { + pattern[patternlen--] ='\0'; + } + pattern[++patternlen] = '\\'; + pattern[++patternlen] = '*'; + pattern[++patternlen] = '\0'; WCHAR *wpattern = WIN_UTF8ToStringW(pattern); - SDL_free(pattern); if (!wpattern) { + SDL_free(pattern); return false; } + pattern[--patternlen] = '\0'; // chop off the '*' so we just have the dirname with a path separator. + WIN32_FIND_DATAW entw; HANDLE dir = FindFirstFileExW(wpattern, FindExInfoStandard, &entw, FindExSearchNameMatch, NULL, 0); SDL_free(wpattern); if (dir == INVALID_HANDLE_VALUE) { + SDL_free(pattern); return WIN_SetError("Failed to enumerate directory"); } @@ -79,12 +89,13 @@ bool SDL_SYS_EnumerateDirectory(const char *path, SDL_EnumerateDirectoryCallback if (!utf8fn) { result = SDL_ENUM_FAILURE; } else { - result = cb(userdata, path, utf8fn); + result = cb(userdata, pattern, utf8fn); SDL_free(utf8fn); } } while ((result == SDL_ENUM_CONTINUE) && (FindNextFileW(dir, &entw) != 0)); FindClose(dir); + SDL_free(pattern); } return (result != SDL_ENUM_FAILURE); diff --git a/test/testfilesystem.c b/test/testfilesystem.c index 5618413730bcf..9fe2cdb82383e 100644 --- a/test/testfilesystem.c +++ b/test/testfilesystem.c @@ -20,14 +20,7 @@ static SDL_EnumerationResult SDLCALL enum_callback(void *userdata, const char *o SDL_PathInfo info; char *fullpath = NULL; - /* you can use '/' for a path separator on Windows, but to make the log output look correct, we'll #ifdef this... */ - #ifdef SDL_PLATFORM_WINDOWS - const char *pathsep = "\\"; - #else - const char *pathsep = "/"; - #endif - - if (SDL_asprintf(&fullpath, "%s%s%s", origdir, *origdir ? pathsep : "", fname) < 0) { + if (SDL_asprintf(&fullpath, "%s%s", origdir, fname) < 0) { SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Out of memory!"); return SDL_ENUM_FAILURE; } From eb793dede7d7eae27d9c1e8e245b263b52c333e6 Mon Sep 17 00:00:00 2001 From: "Ryan C. Gordon" Date: Wed, 15 Jan 2025 17:06:09 -0500 Subject: [PATCH 091/340] filesystem: SDL_GetCurrentDirectory() should add a path separator at the end. --- include/SDL3/SDL_filesystem.h | 3 +++ src/filesystem/posix/SDL_sysfsops.c | 10 +++++++++- src/filesystem/windows/SDL_sysfilesystem.c | 12 +++++++++--- 3 files changed, 21 insertions(+), 4 deletions(-) diff --git a/include/SDL3/SDL_filesystem.h b/include/SDL3/SDL_filesystem.h index 8baa254441952..245fe1fe38a19 100644 --- a/include/SDL3/SDL_filesystem.h +++ b/include/SDL3/SDL_filesystem.h @@ -483,6 +483,9 @@ extern SDL_DECLSPEC char ** SDLCALL SDL_GlobDirectory(const char *path, const ch * platforms without this concept, this would cause surprises with file access * outside of SDL. * + * The returned path is guaranteed to end with a path separator ('\\' on + * Windows, '/' on most other platforms). + * * \returns a UTF-8 string of the current working directory in * platform-dependent notation. NULL if there's a problem. This * should be freed with SDL_free() when it is no longer needed. diff --git a/src/filesystem/posix/SDL_sysfsops.c b/src/filesystem/posix/SDL_sysfsops.c index c562c2aed2461..015b8d4b5a9f6 100644 --- a/src/filesystem/posix/SDL_sysfsops.c +++ b/src/filesystem/posix/SDL_sysfsops.c @@ -217,7 +217,7 @@ char *SDL_SYS_GetCurrentDirectory(void) } buf = (char *) ptr; - if (getcwd(buf, buflen) != NULL) { + if (getcwd(buf, buflen-1) != NULL) { break; // we got it! } @@ -231,6 +231,14 @@ char *SDL_SYS_GetCurrentDirectory(void) return NULL; } + // make sure there's a path separator at the end. + SDL_assert(SDL_strlen(buf) < (buflen + 2)); + buflen = SDL_strlen(buf); + if ((buflen == 0) || (buf[buflen-1] != '/')) { + buf[buflen] = '/'; + buf[buflen + 1] = '\0'; + } + return buf; } diff --git a/src/filesystem/windows/SDL_sysfilesystem.c b/src/filesystem/windows/SDL_sysfilesystem.c index df9c9322d8c51..39ba414895177 100644 --- a/src/filesystem/windows/SDL_sysfilesystem.c +++ b/src/filesystem/windows/SDL_sysfilesystem.c @@ -355,11 +355,17 @@ char *SDL_SYS_GetCurrentDirectory(void) if (bw == 0) { WIN_SetError("GetCurrentDirectoryW failed"); return NULL; - } else if (bw < buflen) { - break; // we got it! + } else if (bw < buflen) { // we got it! + // make sure there's a path separator at the end. + SDL_assert(bw < (buflen + 2)); + if ((bw == 0) || (wstr[bw-1] != '\\')) { + wstr[bw] = '\\'; + wstr[bw + 1] = '\0'; + } + break; } - void *ptr = SDL_realloc(wstr, bw * sizeof (WCHAR)); + void *ptr = SDL_realloc(wstr, (bw + 1) * sizeof (WCHAR)); if (!ptr) { SDL_free(wstr); return NULL; From 67664a0427b09887582df8b23e37cd6dead02cec Mon Sep 17 00:00:00 2001 From: "Ryan C. Gordon" Date: Wed, 15 Jan 2025 18:09:55 -0500 Subject: [PATCH 092/340] testfilesystem: test some Storage APIs, too. --- test/testfilesystem.c | 63 +++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 61 insertions(+), 2 deletions(-) diff --git a/test/testfilesystem.c b/test/testfilesystem.c index 9fe2cdb82383e..a2559119f8083 100644 --- a/test/testfilesystem.c +++ b/test/testfilesystem.c @@ -36,7 +36,7 @@ static SDL_EnumerationResult SDLCALL enum_callback(void *userdata, const char *o } else { type = "OTHER"; } - SDL_Log("%s (type=%s, size=%" SDL_PRIu64 ", create=%" SDL_PRIu64 ", mod=%" SDL_PRIu64 ", access=%" SDL_PRIu64 ")", + SDL_Log("DIRECTORY %s (type=%s, size=%" SDL_PRIu64 ", create=%" SDL_PRIu64 ", mod=%" SDL_PRIu64 ", access=%" SDL_PRIu64 ")", fullpath, type, info.size, info.modify_time, info.create_time, info.access_time); if (info.type == SDL_PATHTYPE_DIRECTORY) { @@ -51,6 +51,42 @@ static SDL_EnumerationResult SDLCALL enum_callback(void *userdata, const char *o } +static SDL_EnumerationResult SDLCALL enum_storage_callback(void *userdata, const char *origdir, const char *fname) +{ + SDL_Storage *storage = (SDL_Storage *) userdata; + SDL_PathInfo info; + char *fullpath = NULL; + + if (SDL_asprintf(&fullpath, "%s%s", origdir, fname) < 0) { + SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Out of memory!"); + return SDL_ENUM_FAILURE; + } + + if (!SDL_GetStoragePathInfo(storage, fullpath, &info)) { + SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't stat '%s': %s", fullpath, SDL_GetError()); + } else { + const char *type; + if (info.type == SDL_PATHTYPE_FILE) { + type = "FILE"; + } else if (info.type == SDL_PATHTYPE_DIRECTORY) { + type = "DIRECTORY"; + } else { + type = "OTHER"; + } + SDL_Log("STORAGE %s (type=%s, size=%" SDL_PRIu64 ", create=%" SDL_PRIu64 ", mod=%" SDL_PRIu64 ", access=%" SDL_PRIu64 ")", + fullpath, type, info.size, info.modify_time, info.create_time, info.access_time); + + if (info.type == SDL_PATHTYPE_DIRECTORY) { + if (!SDL_EnumerateStorageDirectory(storage, fullpath, enum_storage_callback, userdata)) { + SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Enumeration failed!"); + } + } + } + + SDL_free(fullpath); + return SDL_ENUM_CONTINUE; /* keep going */ +} + int main(int argc, char *argv[]) { SDLTest_CommonState *state; @@ -111,6 +147,7 @@ int main(int argc, char *argv[]) if (base_path) { char **globlist; + SDL_Storage *storage = NULL; SDL_IOStream *stream; const char *text = "foo\n"; @@ -124,7 +161,7 @@ int main(int argc, char *argv[]) } else { int i; for (i = 0; globlist[i]; i++) { - SDL_Log("GLOB[%d]: '%s'", i, globlist[i]); + SDL_Log("DIRECTORY GLOB[%d]: '%s'", i, globlist[i]); } SDL_free(globlist); } @@ -191,6 +228,28 @@ int main(int argc, char *argv[]) } else { SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "SDL_IOFromFile('testfilesystem-A', 'w') failed: %s", SDL_GetError()); } + + storage = SDL_OpenFileStorage(base_path); + if (!storage) { + SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Failed to open base path storage object: %s", SDL_GetError()); + } else { + if (!SDL_EnumerateStorageDirectory(storage, "", enum_storage_callback, storage)) { + SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Storage Base path enumeration failed!"); + } + + globlist = SDL_GlobStorageDirectory(storage, "", "C*/test*/T?st*", SDL_GLOB_CASEINSENSITIVE, NULL); + if (!globlist) { + SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Base path globbing failed!"); + } else { + int i; + for (i = 0; globlist[i]; i++) { + SDL_Log("STORAGE GLOB[%d]: '%s'", i, globlist[i]); + } + SDL_free(globlist); + } + SDL_CloseStorage(storage); + } + } SDL_Quit(); From 874c07f8de25e479ad720d1ccb15a830da7d842a Mon Sep 17 00:00:00 2001 From: "Ryan C. Gordon" Date: Wed, 15 Jan 2025 20:16:10 -0500 Subject: [PATCH 093/340] storage: Don't allow "." and ".." paths, enforce '/' dir separators. Also clarify what characters are valid for Storage paths in the category docs. Fixes #11079. Fixes #11370. Fixes #11369. --- include/SDL3/SDL_storage.h | 16 ++++ src/storage/SDL_storage.c | 93 +++++++++++++++++------- src/storage/generic/SDL_genericstorage.c | 34 ++++++--- test/testfilesystem.c | 59 ++++++++++++++- 4 files changed, 162 insertions(+), 40 deletions(-) diff --git a/include/SDL3/SDL_storage.h b/include/SDL3/SDL_storage.h index afe50cb1ddc53..f6be770db81ad 100644 --- a/include/SDL3/SDL_storage.h +++ b/include/SDL3/SDL_storage.h @@ -222,6 +222,22 @@ * playing on another PC (and vice versa) with the save data fully * synchronized across all devices, allowing for a seamless experience without * having to do full restarts of the program. + * + * ## Notes on valid paths + * + * All paths in the Storage API use Unix-style path separators ('/'). Using a + * different path separator will not work, even if the underlying platform + * would otherwise accept it. This is to keep code using the Storage API + * portable between platforms and Storage implementations and simplify app + * code. + * + * Paths with relative directories ("." and "..") are forbidden by the Storage + * API. + * + * All valid UTF-8 strings (discounting the NULL terminator character and the + * '/' path separator) are usable for filenames, however, an underlying + * Storage implementation may not support particularly strange sequences and + * refuse to create files with those names, etc. */ #ifndef SDL_storage_h_ diff --git a/src/storage/SDL_storage.c b/src/storage/SDL_storage.c index 15e68673bde74..a5687c651660e 100644 --- a/src/storage/SDL_storage.c +++ b/src/storage/SDL_storage.c @@ -56,6 +56,33 @@ struct SDL_Storage return result; \ } +// we don't make any effort to convert path separators here, because a) +// everything including Windows will accept a '/' separator and b) that +// conversion should probably happen in the storage backend anyhow. + +static bool ValidateStoragePath(const char *path) +{ + if (SDL_strchr(path, '\\')) { + return SDL_SetError("Windows-style path separators ('\\') not permitted, use '/' instead."); + } + + const char *ptr; + const char *prev = path; + while ((ptr = SDL_strchr(prev, '/')) != NULL) { + if ((SDL_strncmp(prev, "./", 2) == 0) || (SDL_strncmp(prev, "../", 3) == 0)) { + return SDL_SetError("Relative paths not permitted"); + } + prev = ptr + 1; + } + + // check the last path element (or the only path element). + if ((SDL_strcmp(prev, ".") == 0) || (SDL_strcmp(prev, "..") == 0)) { + return SDL_SetError("Relative paths not permitted"); + } + + return true; +} + SDL_Storage *SDL_OpenTitleStorage(const char *override, SDL_PropertiesID props) { SDL_Storage *storage = NULL; @@ -213,9 +240,9 @@ bool SDL_ReadStorageFile(SDL_Storage *storage, const char *path, void *destinati if (!path) { return SDL_InvalidParamError("path"); - } - - if (!storage->iface.read_file) { + } else if (!ValidateStoragePath(path)) { + return false; + } else if (!storage->iface.read_file) { return SDL_Unsupported(); } @@ -228,9 +255,9 @@ bool SDL_WriteStorageFile(SDL_Storage *storage, const char *path, const void *so if (!path) { return SDL_InvalidParamError("path"); - } - - if (!storage->iface.write_file) { + } else if (!ValidateStoragePath(path)) { + return false; + } else if (!storage->iface.write_file) { return SDL_Unsupported(); } @@ -243,9 +270,9 @@ bool SDL_CreateStorageDirectory(SDL_Storage *storage, const char *path) if (!path) { return SDL_InvalidParamError("path"); - } - - if (!storage->iface.mkdir) { + } else if (!ValidateStoragePath(path)) { + return false; + } else if (!storage->iface.mkdir) { return SDL_Unsupported(); } @@ -258,9 +285,9 @@ bool SDL_EnumerateStorageDirectory(SDL_Storage *storage, const char *path, SDL_E if (!path) { return SDL_InvalidParamError("path"); - } - - if (!storage->iface.enumerate) { + } else if (!ValidateStoragePath(path)) { + return false; + } else if (!storage->iface.enumerate) { return SDL_Unsupported(); } @@ -273,9 +300,9 @@ bool SDL_RemoveStoragePath(SDL_Storage *storage, const char *path) if (!path) { return SDL_InvalidParamError("path"); - } - - if (!storage->iface.remove) { + } else if (!ValidateStoragePath(path)) { + return false; + } else if (!storage->iface.remove) { return SDL_Unsupported(); } @@ -288,12 +315,13 @@ bool SDL_RenameStoragePath(SDL_Storage *storage, const char *oldpath, const char if (!oldpath) { return SDL_InvalidParamError("oldpath"); - } - if (!newpath) { + } else if (!newpath) { return SDL_InvalidParamError("newpath"); - } - - if (!storage->iface.rename) { + } else if (!ValidateStoragePath(oldpath)) { + return false; + } else if (!ValidateStoragePath(newpath)) { + return false; + } else if (!storage->iface.rename) { return SDL_Unsupported(); } @@ -306,12 +334,13 @@ bool SDL_CopyStorageFile(SDL_Storage *storage, const char *oldpath, const char * if (!oldpath) { return SDL_InvalidParamError("oldpath"); - } - if (!newpath) { + } else if (!newpath) { return SDL_InvalidParamError("newpath"); - } - - if (!storage->iface.copy) { + } else if (!ValidateStoragePath(oldpath)) { + return false; + } else if (!ValidateStoragePath(newpath)) { + return false; + } else if (!storage->iface.copy) { return SDL_Unsupported(); } @@ -331,9 +360,9 @@ bool SDL_GetStoragePathInfo(SDL_Storage *storage, const char *path, SDL_PathInfo if (!path) { return SDL_InvalidParamError("path"); - } - - if (!storage->iface.info) { + } else if (!ValidateStoragePath(path)) { + return false; + } else if (!storage->iface.info) { return SDL_Unsupported(); } @@ -365,6 +394,14 @@ static bool GlobStorageDirectoryEnumerator(const char *path, SDL_EnumerateDirect char **SDL_GlobStorageDirectory(SDL_Storage *storage, const char *path, const char *pattern, SDL_GlobFlags flags, int *count) { CHECK_STORAGE_MAGIC_RET(NULL) + + if (!path) { + SDL_InvalidParamError("path"); + return NULL; + } else if (!ValidateStoragePath(path)) { + return NULL; + } + return SDL_InternalGlobDirectory(path, pattern, flags, count, GlobStorageDirectoryEnumerator, GlobStorageDirectoryGetPathInfo, storage); } diff --git a/src/storage/generic/SDL_genericstorage.c b/src/storage/generic/SDL_genericstorage.c index d8c300c59fc1e..3d3e93025b1cc 100644 --- a/src/storage/generic/SDL_genericstorage.c +++ b/src/storage/generic/SDL_genericstorage.c @@ -26,15 +26,8 @@ static char *GENERIC_INTERNAL_CreateFullPath(const char *base, const char *relative) { - if (!base) { - return SDL_strdup(relative); - } - - size_t len = SDL_strlen(base) + SDL_strlen(relative) + 1; - char *result = (char*)SDL_malloc(len); - if (result != NULL) { - SDL_snprintf(result, len, "%s%s", base, relative); - } + char *result = NULL; + SDL_asprintf(&result, "%s%s", base ? base : "", relative); return result; } @@ -56,8 +49,27 @@ static SDL_EnumerationResult SDLCALL GENERIC_EnumerateDirectory(void *userdata, // SDL_EnumerateDirectory will return the full path, so for Storage we // can take the base directory and add its length to the dirname string, // effectively trimming the root without having to strdup anything. - GenericEnumerateData *wrap_data = (GenericEnumerateData *)userdata; - return wrap_data->real_callback(wrap_data->real_userdata, dirname + wrap_data->base_len, fname); + const GenericEnumerateData *wrap_data = (GenericEnumerateData *)userdata; + + dirname += wrap_data->base_len; // skip the base, just return the part inside of the Storage. + + #ifdef SDL_PLATFORM_WINDOWS + char *dirnamecpy = NULL; + const size_t slen = SDL_strlen(dirname); + if (slen && (dirname[slen - 1] == '\\')) { + dirnamecpy = SDL_strdup(dirname); + if (!dirnamecpy) { + return SDL_ENUM_FAILURE; + } + dirnamecpy[slen - 1] = '/'; // storage layer always uses '/' path separators. + dirname = dirnamecpy; + } + const SDL_EnumerationResult retval = wrap_data->real_callback(wrap_data->real_userdata, dirname, fname); + SDL_free(dirnamecpy); + return retval; + #else + return wrap_data->real_callback(wrap_data->real_userdata, dirname, fname); + #endif } static bool GENERIC_EnumerateStorageDirectory(void *userdata, const char *path, SDL_EnumerateDirectoryCallback callback, void *callback_userdata) diff --git a/test/testfilesystem.c b/test/testfilesystem.c index a2559119f8083..bdd0bac59ff31 100644 --- a/test/testfilesystem.c +++ b/test/testfilesystem.c @@ -150,6 +150,7 @@ int main(int argc, char *argv[]) SDL_Storage *storage = NULL; SDL_IOStream *stream; const char *text = "foo\n"; + SDL_PathInfo pathinfo; if (!SDL_EnumerateDirectory(base_path, enum_callback, NULL)) { SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Base path enumeration failed!"); @@ -233,7 +234,7 @@ int main(int argc, char *argv[]) if (!storage) { SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Failed to open base path storage object: %s", SDL_GetError()); } else { - if (!SDL_EnumerateStorageDirectory(storage, "", enum_storage_callback, storage)) { + if (!SDL_EnumerateStorageDirectory(storage, "CMakeFiles", enum_storage_callback, storage)) { SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Storage Base path enumeration failed!"); } @@ -247,6 +248,62 @@ int main(int argc, char *argv[]) } SDL_free(globlist); } + + /* these should fail: */ + if (!SDL_GetStoragePathInfo(storage, "CMakeFiles/../testsprite.c", &pathinfo)) { + SDL_Log("Storage access on path with internal '..' refused correctly."); + } else { + SDL_Log("Storage access on path with internal '..' accepted INCORRECTLY."); + } + + if (!SDL_GetStoragePathInfo(storage, "CMakeFiles/./TargetDirectories.txt", &pathinfo)) { + SDL_Log("Storage access on path with internal '.' refused correctly."); + } else { + SDL_Log("Storage access on path with internal '.' accepted INCORRECTLY."); + } + + if (!SDL_GetStoragePathInfo(storage, "../test", &pathinfo)) { + SDL_Log("Storage access on path with leading '..' refused correctly."); + } else { + SDL_Log("Storage access on path with leading '..' accepted INCORRECTLY."); + } + + if (!SDL_GetStoragePathInfo(storage, "./CMakeFiles", &pathinfo)) { + SDL_Log("Storage access on path with leading '.' refused correctly."); + } else { + SDL_Log("Storage access on path with leading '.' accepted INCORRECTLY."); + } + + if (!SDL_GetStoragePathInfo(storage, "CMakeFiles/..", &pathinfo)) { + SDL_Log("Storage access on path with trailing '..' refused correctly."); + } else { + SDL_Log("Storage access on path with trailing '..' accepted INCORRECTLY."); + } + + if (!SDL_GetStoragePathInfo(storage, "CMakeFiles/.", &pathinfo)) { + SDL_Log("Storage access on path with trailing '.' refused correctly."); + } else { + SDL_Log("Storage access on path with trailing '.' accepted INCORRECTLY."); + } + + if (!SDL_GetStoragePathInfo(storage, "..", &pathinfo)) { + SDL_Log("Storage access on path '..' refused correctly."); + } else { + SDL_Log("Storage access on path '..' accepted INCORRECTLY."); + } + + if (!SDL_GetStoragePathInfo(storage, ".", &pathinfo)) { + SDL_Log("Storage access on path '.' refused correctly."); + } else { + SDL_Log("Storage access on path '.' accepted INCORRECTLY."); + } + + if (!SDL_GetStoragePathInfo(storage, "CMakeFiles\\TargetDirectories.txt", &pathinfo)) { + SDL_Log("Storage access on path with Windows separator refused correctly."); + } else { + SDL_Log("Storage access on path with Windows separator accepted INCORRECTLY."); + } + SDL_CloseStorage(storage); } From 3ffb1a8cbdf3b986965b51c16c540f4e6d793010 Mon Sep 17 00:00:00 2001 From: "Ryan C. Gordon" Date: Wed, 15 Jan 2025 23:47:43 -0500 Subject: [PATCH 094/340] storage: generic title storage allows override paths without '/' appended. Fixes #11299. --- src/storage/generic/SDL_genericstorage.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/storage/generic/SDL_genericstorage.c b/src/storage/generic/SDL_genericstorage.c index 3d3e93025b1cc..b1270a761bab2 100644 --- a/src/storage/generic/SDL_genericstorage.c +++ b/src/storage/generic/SDL_genericstorage.c @@ -236,10 +236,15 @@ static const SDL_StorageInterface GENERIC_title_iface = { static SDL_Storage *GENERIC_Title_Create(const char *override, SDL_PropertiesID props) { SDL_Storage *result = NULL; - char *basepath = NULL; + if (override != NULL) { - basepath = SDL_strdup(override); + // make sure override has a path separator at the end. If you're not on Windows and used '\\', that's on you. + const size_t slen = SDL_strlen(override); + const bool need_sep = (!slen || ((override[slen-1] != '/') && (override[slen-1] != '\\'))); + if (SDL_asprintf(&basepath, "%s%s", override, need_sep ? "/" : "") == -1) { + return NULL; + } } else { const char *base = SDL_GetBasePath(); basepath = base ? SDL_strdup(base) : NULL; From 9225a421b790cf24aaef307e088c3d260a81e5a1 Mon Sep 17 00:00:00 2001 From: SDL Wiki Bot Date: Thu, 16 Jan 2025 13:20:18 +0000 Subject: [PATCH 095/340] Sync SDL3 wiki -> header [ci skip] --- include/SDL3/SDL_filesystem.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/include/SDL3/SDL_filesystem.h b/include/SDL3/SDL_filesystem.h index 245fe1fe38a19..81366842617ca 100644 --- a/include/SDL3/SDL_filesystem.h +++ b/include/SDL3/SDL_filesystem.h @@ -313,8 +313,8 @@ typedef enum SDL_EnumerationResult * terminate the enumeration early, and dictate the return value of the * enumeration function itself. * - * `dirname` is guaranteed to end with a path separator ('\\' on - * Windows, '/' on most other platforms). + * `dirname` is guaranteed to end with a path separator ('\\' on Windows, '/' + * on most other platforms). * * \param userdata an app-controlled pointer that is passed to the callback. * \param dirname the directory that is being enumerated. From 1dd8fadca2e8f34ccaa750758a4f7252c6c6e0c2 Mon Sep 17 00:00:00 2001 From: Sam Lantinga Date: Thu, 16 Jan 2025 08:32:49 -0800 Subject: [PATCH 096/340] Updated to version 3.1.10 for the release candidate --- CMakeLists.txt | 2 +- Xcode/SDL/Info-Framework.plist | 4 ++-- Xcode/SDL/SDL.xcodeproj/project.pbxproj | 12 ++++++------ Xcode/SDL/pkg-support/SDL.info | 2 +- .../src/main/java/org/libsdl/app/SDLActivity.java | 2 +- include/SDL3/SDL.h | 2 +- include/SDL3/SDL_version.h | 2 +- src/core/windows/version.rc | 8 ++++---- 8 files changed, 17 insertions(+), 17 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index a2b2bc9b5b51e..b89adcf99d246 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -5,7 +5,7 @@ if(NOT DEFINED CMAKE_BUILD_TYPE) endif() # See docs/release_checklist.md -project(SDL3 LANGUAGES C VERSION "3.1.9") +project(SDL3 LANGUAGES C VERSION "3.1.10") if(CMAKE_SOURCE_DIR STREQUAL PROJECT_SOURCE_DIR) set(SDL3_MAINPROJECT ON) diff --git a/Xcode/SDL/Info-Framework.plist b/Xcode/SDL/Info-Framework.plist index 3e57123363c68..408718cdc6ceb 100644 --- a/Xcode/SDL/Info-Framework.plist +++ b/Xcode/SDL/Info-Framework.plist @@ -19,10 +19,10 @@ CFBundlePackageType FMWK CFBundleShortVersionString - 3.1.9 + 3.1.10 CFBundleSignature SDLX CFBundleVersion - 3.1.9 + 3.1.10 diff --git a/Xcode/SDL/SDL.xcodeproj/project.pbxproj b/Xcode/SDL/SDL.xcodeproj/project.pbxproj index e1be7863f945d..c5e0abea87f08 100644 --- a/Xcode/SDL/SDL.xcodeproj/project.pbxproj +++ b/Xcode/SDL/SDL.xcodeproj/project.pbxproj @@ -3045,8 +3045,8 @@ CLANG_ENABLE_MODULES = YES; CLANG_ENABLE_OBJC_ARC = YES; DEPLOYMENT_POSTPROCESSING = YES; - DYLIB_COMPATIBILITY_VERSION = 110.0.0; - DYLIB_CURRENT_VERSION = 110.0.0; + DYLIB_COMPATIBILITY_VERSION = 111.0.0; + DYLIB_CURRENT_VERSION = 111.0.0; DYLIB_INSTALL_NAME_BASE = "@rpath"; ENABLE_STRICT_OBJC_MSGSEND = YES; GCC_ALTIVEC_EXTENSIONS = YES; @@ -3081,7 +3081,7 @@ "@loader_path/Frameworks", ); MACOSX_DEPLOYMENT_TARGET = 10.13; - MARKETING_VERSION = 3.1.9; + MARKETING_VERSION = 3.1.10; OTHER_LDFLAGS = "$(CONFIG_FRAMEWORK_LDFLAGS)"; PRODUCT_BUNDLE_IDENTIFIER = org.libsdl.SDL3; PRODUCT_NAME = SDL3; @@ -3109,8 +3109,8 @@ ALLOW_TARGET_PLATFORM_SPECIALIZATION = YES; CLANG_ENABLE_MODULES = YES; CLANG_ENABLE_OBJC_ARC = YES; - DYLIB_COMPATIBILITY_VERSION = 110.0.0; - DYLIB_CURRENT_VERSION = 110.0.0; + DYLIB_COMPATIBILITY_VERSION = 111.0.0; + DYLIB_CURRENT_VERSION = 111.0.0; DYLIB_INSTALL_NAME_BASE = "@rpath"; ENABLE_STRICT_OBJC_MSGSEND = YES; ENABLE_TESTABILITY = YES; @@ -3142,7 +3142,7 @@ "@loader_path/Frameworks", ); MACOSX_DEPLOYMENT_TARGET = 10.13; - MARKETING_VERSION = 3.1.9; + MARKETING_VERSION = 3.1.10; ONLY_ACTIVE_ARCH = YES; OTHER_LDFLAGS = "$(CONFIG_FRAMEWORK_LDFLAGS)"; PRODUCT_BUNDLE_IDENTIFIER = org.libsdl.SDL3; diff --git a/Xcode/SDL/pkg-support/SDL.info b/Xcode/SDL/pkg-support/SDL.info index 9d631cb845f8b..2b61604fbc7f0 100644 --- a/Xcode/SDL/pkg-support/SDL.info +++ b/Xcode/SDL/pkg-support/SDL.info @@ -1,4 +1,4 @@ -Title SDL 3.1.9 +Title SDL 3.1.10 Version 1 Description SDL Library for macOS (http://www.libsdl.org) DefaultLocation /Library/Frameworks diff --git a/android-project/app/src/main/java/org/libsdl/app/SDLActivity.java b/android-project/app/src/main/java/org/libsdl/app/SDLActivity.java index 75a3df9c1565f..90bf9f74f9a2a 100644 --- a/android-project/app/src/main/java/org/libsdl/app/SDLActivity.java +++ b/android-project/app/src/main/java/org/libsdl/app/SDLActivity.java @@ -60,7 +60,7 @@ public class SDLActivity extends Activity implements View.OnSystemUiVisibilityCh private static final String TAG = "SDL"; private static final int SDL_MAJOR_VERSION = 3; private static final int SDL_MINOR_VERSION = 1; - private static final int SDL_MICRO_VERSION = 9; + private static final int SDL_MICRO_VERSION = 10; /* // Display InputType.SOURCE/CLASS of events and devices // diff --git a/include/SDL3/SDL.h b/include/SDL3/SDL.h index 3dba4228bb5b4..7542bd61b7749 100644 --- a/include/SDL3/SDL.h +++ b/include/SDL3/SDL.h @@ -20,7 +20,7 @@ */ /** - * Main include header for the SDL library, version 3.1.9 + * Main include header for the SDL library, version 3.1.10 * * It is almost always best to include just this one header instead of * picking out individual headers included here. There are exceptions to diff --git a/include/SDL3/SDL_version.h b/include/SDL3/SDL_version.h index 692d49399b538..35bdb9757c0ee 100644 --- a/include/SDL3/SDL_version.h +++ b/include/SDL3/SDL_version.h @@ -62,7 +62,7 @@ extern "C" { * * \since This macro is available since SDL 3.1.3. */ -#define SDL_MICRO_VERSION 9 +#define SDL_MICRO_VERSION 10 /** * This macro turns the version numbers into a numeric value. diff --git a/src/core/windows/version.rc b/src/core/windows/version.rc index e12c99b9ecaf0..c5f22e8af1f51 100644 --- a/src/core/windows/version.rc +++ b/src/core/windows/version.rc @@ -9,8 +9,8 @@ LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US // VS_VERSION_INFO VERSIONINFO - FILEVERSION 3,1,9,0 - PRODUCTVERSION 3,1,9,0 + FILEVERSION 3,1,10,0 + PRODUCTVERSION 3,1,10,0 FILEFLAGSMASK 0x3fL FILEFLAGS 0x0L FILEOS 0x40004L @@ -23,12 +23,12 @@ BEGIN BEGIN VALUE "CompanyName", "\0" VALUE "FileDescription", "SDL\0" - VALUE "FileVersion", "3, 1, 9, 0\0" + VALUE "FileVersion", "3, 1, 10, 0\0" VALUE "InternalName", "SDL\0" VALUE "LegalCopyright", "Copyright (C) 2025 Sam Lantinga\0" VALUE "OriginalFilename", "SDL3.dll\0" VALUE "ProductName", "Simple DirectMedia Layer\0" - VALUE "ProductVersion", "3, 1, 9, 0\0" + VALUE "ProductVersion", "3, 1, 10, 0\0" END END BLOCK "VarFileInfo" From 7ee2ab383082822e348453f57c99ae01cc57dc51 Mon Sep 17 00:00:00 2001 From: Frank Praznik Date: Thu, 16 Jan 2025 11:52:16 -0500 Subject: [PATCH 097/340] wayland: Fix return value check from int-to-bool conversion --- src/video/wayland/SDL_waylandwindow.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/video/wayland/SDL_waylandwindow.c b/src/video/wayland/SDL_waylandwindow.c index 056a8bd50e82f..326f341218b40 100644 --- a/src/video/wayland/SDL_waylandwindow.c +++ b/src/video/wayland/SDL_waylandwindow.c @@ -2844,7 +2844,7 @@ bool Wayland_SetWindowIcon(SDL_VideoDevice *_this, SDL_Window *window, SDL_Surfa // TODO: Add high-DPI icon support Wayland_ReleaseSHMBuffer(&wind->icon); - if (Wayland_AllocSHMBuffer(icon->w, icon->h, &wind->icon) != 0) { + if (!Wayland_AllocSHMBuffer(icon->w, icon->h, &wind->icon)) { return SDL_SetError("wayland: failed to allocate SHM buffer for the icon"); } From d8e1ad0ebc67a06bae0523e917e5aea7398fcca4 Mon Sep 17 00:00:00 2001 From: Sam Lantinga Date: Thu, 16 Jan 2025 09:06:22 -0800 Subject: [PATCH 098/340] release: skip extended Android SDK versions --- build-scripts/build-release.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/build-scripts/build-release.py b/build-scripts/build-release.py index 166e353a52bc8..b4b1086fd8ba7 100755 --- a/build-scripts/build-release.py +++ b/build-scripts/build-release.py @@ -892,6 +892,10 @@ def _detect_android_api(self, android_home: str) -> typing.Optional[int]: for platform_dir in platform_dirs: logger.debug("Found Android Platform SDK: %s", platform_dir) if not (platform_dir / "android.jar").is_file(): + logger.debug("Skipping SDK, missing android.jar") + continue + if platform_dir.match('*/android-*-ext*'): + logger.debug("Skipping SDK, extended version") continue if m:= re_platform.match(platform_dir.name): platform_versions.append(int(m.group(1))) From c95b842b3059aeee4342b33826254117d378c492 Mon Sep 17 00:00:00 2001 From: Ethan Lee Date: Thu, 16 Jan 2025 12:19:46 -0500 Subject: [PATCH 099/340] video: Xbox does not use CreateIconFromSurface --- src/video/windows/SDL_surface_utils.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/video/windows/SDL_surface_utils.c b/src/video/windows/SDL_surface_utils.c index 05b237642b47f..e6a071f0cdee9 100644 --- a/src/video/windows/SDL_surface_utils.c +++ b/src/video/windows/SDL_surface_utils.c @@ -24,6 +24,7 @@ #include "../SDL_surface_c.h" +#if !(defined(SDL_PLATFORM_XBOXONE) || defined(SDL_PLATFORM_XBOXSERIES)) HICON CreateIconFromSurface(SDL_Surface *surface) { SDL_Surface *s = SDL_ConvertSurface(surface, SDL_PIXELFORMAT_RGBA32); @@ -93,3 +94,4 @@ HICON CreateIconFromSurface(SDL_Surface *surface) return hIcon; } +#endif From 326ce9bb8d02dd2d3bbf653643a27fdbbfa90d88 Mon Sep 17 00:00:00 2001 From: Ethan Lee Date: Thu, 16 Jan 2025 12:19:59 -0500 Subject: [PATCH 100/340] gpu: D3D12 buildfix for Xbox --- src/gpu/d3d12/SDL_gpu_d3d12.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/gpu/d3d12/SDL_gpu_d3d12.c b/src/gpu/d3d12/SDL_gpu_d3d12.c index 1ea3734555497..c142bae4486f2 100644 --- a/src/gpu/d3d12/SDL_gpu_d3d12.c +++ b/src/gpu/d3d12/SDL_gpu_d3d12.c @@ -6403,7 +6403,7 @@ static bool D3D12_INTERNAL_CreateSwapchain( createInfo.num_levels = 1; for (Uint32 i = 0; i < windowData->swapchainTextureCount; i += 1) { - texture = D3D12_INTERNAL_CreateTexture(renderer, &createInfo, true); + texture = D3D12_INTERNAL_CreateTexture(renderer, &createInfo, true, "Swapchain"); texture->container = &windowData->textureContainers[i]; windowData->textureContainers[i].activeTexture = texture; windowData->textureContainers[i].canBeCycled = false; From 1006236aa612325b009ca8c8711121c7b57caf5f Mon Sep 17 00:00:00 2001 From: Anonymous Maarten Date: Thu, 16 Jan 2025 05:14:36 +0100 Subject: [PATCH 101/340] ci: add summary to release.yml [ci skip] --- .github/workflows/release.yml | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index bd0bcca590cef..4fbd583784c9e 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -47,6 +47,14 @@ jobs: with: name: sources path: '${{ github.workspace}}/dist' + - name: 'Generate summary' + run: | + echo "Run the following commands to download all artifacts:" >> $GITHUB_STEP_SUMMARY + echo '```' >> $GITHUB_STEP_SUMMARY + echo "mkdir -p /tmp/${{ steps.releaser.outputs.project }}-${{ steps.releaser.outputs.version }}" >> $GITHUB_STEP_SUMMARY + echo "cd /tmp/${{ steps.releaser.outputs.project }}-${{ steps.releaser.outputs.version }}" >> $GITHUB_STEP_SUMMARY + echo "gh run -R ${{ github.repository }} download ${{ github.run_id }}" >> $GITHUB_STEP_SUMMARY + echo '```' >> $GITHUB_STEP_SUMMARY linux-verify: needs: [src] From 21a42d2b0d7441004b6dc463fd8e936696c64f2b Mon Sep 17 00:00:00 2001 From: Sam Lantinga Date: Thu, 16 Jan 2025 09:25:03 -0800 Subject: [PATCH 102/340] Add CategoryAPICategory to the complete API index --- build-scripts/wikiheaders.pl | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/build-scripts/wikiheaders.pl b/build-scripts/wikiheaders.pl index 98591493b7cc5..8649d4b0a964e 100755 --- a/build-scripts/wikiheaders.pl +++ b/build-scripts/wikiheaders.pl @@ -2627,6 +2627,12 @@ sub generate_quickref { +## Categories + + + + + ## Functions From 22d8e73530c39f81f39f1567e695d8779a762459 Mon Sep 17 00:00:00 2001 From: "Ryan C. Gordon" Date: Thu, 16 Jan 2025 13:16:18 -0500 Subject: [PATCH 103/340] include: filled in category documentation for SDL_messagebox.h. Reference Issue #11847. --- include/SDL3/SDL_messagebox.h | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/include/SDL3/SDL_messagebox.h b/include/SDL3/SDL_messagebox.h index b4bb082738840..4db449866a3ca 100644 --- a/include/SDL3/SDL_messagebox.h +++ b/include/SDL3/SDL_messagebox.h @@ -22,7 +22,18 @@ /** * # CategoryMessagebox * - * Message box support routines. + * SDL offers a simple message box API, which is useful for simple alerts, + * such as informing the user when something fatal happens at startup without + * the need to build a UI for it (or informing the user _before_ your UI is + * ready). + * + * These message boxes are native system dialogs where possible. + * + * There is both a customizable function (SDL_ShowMessageBox()) that offers + * lots of options for what to display and reports on what choice the user + * made, and also a much-simplified version (SDL_ShowSimpleMessageBox()), + * merely takes a text message and title, and waits until the user presses + * a single "OK" UI button. Often, this is all that is necessary. */ #ifndef SDL_messagebox_h_ From 07f7c404643e7c4b744727a01f3705cd89dc2950 Mon Sep 17 00:00:00 2001 From: SDL Wiki Bot Date: Thu, 16 Jan 2025 18:18:47 +0000 Subject: [PATCH 104/340] Sync SDL3 wiki -> header [ci skip] --- include/SDL3/SDL_messagebox.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/include/SDL3/SDL_messagebox.h b/include/SDL3/SDL_messagebox.h index 4db449866a3ca..862205ccc615b 100644 --- a/include/SDL3/SDL_messagebox.h +++ b/include/SDL3/SDL_messagebox.h @@ -32,8 +32,8 @@ * There is both a customizable function (SDL_ShowMessageBox()) that offers * lots of options for what to display and reports on what choice the user * made, and also a much-simplified version (SDL_ShowSimpleMessageBox()), - * merely takes a text message and title, and waits until the user presses - * a single "OK" UI button. Often, this is all that is necessary. + * merely takes a text message and title, and waits until the user presses a + * single "OK" UI button. Often, this is all that is necessary. */ #ifndef SDL_messagebox_h_ From 274bc95dfd052fa6d3260ea05d4a960ce7d92ed6 Mon Sep 17 00:00:00 2001 From: SDL Wiki Bot Date: Thu, 16 Jan 2025 18:29:57 +0000 Subject: [PATCH 105/340] Sync SDL3 wiki -> header [ci skip] --- include/SDL3/SDL_render.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/include/SDL3/SDL_render.h b/include/SDL3/SDL_render.h index d7428b075c8f7..56a6770f97a05 100644 --- a/include/SDL3/SDL_render.h +++ b/include/SDL3/SDL_render.h @@ -1273,8 +1273,8 @@ extern SDL_DECLSPEC bool SDLCALL SDL_LockTexture(SDL_Texture *texture, * `SDL_TEXTUREACCESS_STREAMING`. * \param rect a pointer to the rectangle to lock for access. If the rect is * NULL, the entire texture will be locked. - * \param surface this is filled in with an SDL surface representing the - * locked area. + * \param surface a pointer to an SDL surface of size **rect**. Don't assume + * any specific pixel content. * \returns true on success or false on failure; call SDL_GetError() for more * information. * From 9f6eeb10958f6c90e1c0e54bbc08c4737d73374b Mon Sep 17 00:00:00 2001 From: Frank Praznik Date: Thu, 16 Jan 2025 13:32:40 -0500 Subject: [PATCH 106/340] wayland: Set the border state before the initial configure This allows the toplevel bounds to be set correctly on borderless windows. --- src/video/wayland/SDL_waylandwindow.c | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/src/video/wayland/SDL_waylandwindow.c b/src/video/wayland/SDL_waylandwindow.c index 326f341218b40..8bd5e83b0aef5 100644 --- a/src/video/wayland/SDL_waylandwindow.c +++ b/src/video/wayland/SDL_waylandwindow.c @@ -1832,6 +1832,7 @@ void Wayland_ShowWindow(SDL_VideoDevice *_this, SDL_Window *window) } else { libdecor_frame_set_app_id(data->shell_surface.libdecor.frame, data->app_id); libdecor_frame_map(data->shell_surface.libdecor.frame); + libdecor_frame_set_visibility(data->shell_surface.libdecor.frame, !(window->flags & SDL_WINDOW_BORDERLESS)); if (c->zxdg_exporter_v2) { data->exported = zxdg_exporter_v2_export_toplevel(c->zxdg_exporter_v2, data->surface); @@ -1917,6 +1918,14 @@ void Wayland_ShowWindow(SDL_VideoDevice *_this, SDL_Window *window) xdg_toplevel_set_app_id(data->shell_surface.xdg.toplevel.xdg_toplevel, data->app_id); xdg_toplevel_add_listener(data->shell_surface.xdg.toplevel.xdg_toplevel, &toplevel_listener_xdg, data); + // Create the window decorations + if (c->decoration_manager) { + data->server_decoration = zxdg_decoration_manager_v1_get_toplevel_decoration(c->decoration_manager, data->shell_surface.xdg.toplevel.xdg_toplevel); + zxdg_toplevel_decoration_v1_add_listener(data->server_decoration, &decoration_listener, window); + const enum zxdg_toplevel_decoration_v1_mode mode = !(window->flags & SDL_WINDOW_BORDERLESS) ? ZXDG_TOPLEVEL_DECORATION_V1_MODE_SERVER_SIDE : ZXDG_TOPLEVEL_DECORATION_V1_MODE_CLIENT_SIDE; + zxdg_toplevel_decoration_v1_set_mode(data->server_decoration, mode); + } + if (c->zxdg_exporter_v2) { data->exported = zxdg_exporter_v2_export_toplevel(c->zxdg_exporter_v2, data->surface); zxdg_exported_v2_add_listener(data->exported, &exported_v2_listener, data); @@ -1955,13 +1964,6 @@ void Wayland_ShowWindow(SDL_VideoDevice *_this, SDL_Window *window) } else #endif if (data->shell_surface_type == WAYLAND_SHELL_SURFACE_TYPE_XDG_POPUP || data->shell_surface_type == WAYLAND_SHELL_SURFACE_TYPE_XDG_TOPLEVEL) { - - // Create the window decorations - if (data->shell_surface_type != WAYLAND_SHELL_SURFACE_TYPE_XDG_POPUP && data->shell_surface.xdg.toplevel.xdg_toplevel && c->decoration_manager) { - data->server_decoration = zxdg_decoration_manager_v1_get_toplevel_decoration(c->decoration_manager, data->shell_surface.xdg.toplevel.xdg_toplevel); - zxdg_toplevel_decoration_v1_add_listener(data->server_decoration, &decoration_listener, window); - } - /* Unlike libdecor we need to call this explicitly to prevent a deadlock. * libdecor will call this as part of their configure event! * -flibit From 5a564a718d7cf8d5e5b034b91bbb6c045fb9bd11 Mon Sep 17 00:00:00 2001 From: Frank Praznik Date: Thu, 16 Jan 2025 13:47:32 -0500 Subject: [PATCH 107/340] wayland: Add a dummy function for the libdecor dismiss popup callback This was never added, and we've been lucky that it's never called as libdecor doesn't check the function pointer for null before doing so. --- src/video/wayland/SDL_waylandwindow.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/video/wayland/SDL_waylandwindow.c b/src/video/wayland/SDL_waylandwindow.c index 8bd5e83b0aef5..c7294d28d76e8 100644 --- a/src/video/wayland/SDL_waylandwindow.c +++ b/src/video/wayland/SDL_waylandwindow.c @@ -1435,10 +1435,16 @@ static void decoration_frame_commit(struct libdecor_frame *frame, void *user_dat } } +static void decoration_dismiss_popup(struct libdecor_frame *frame, const char *seat_name, void *user_data) +{ + // NOP +} + static struct libdecor_frame_interface libdecor_frame_interface = { decoration_frame_configure, decoration_frame_close, decoration_frame_commit, + decoration_dismiss_popup }; #endif From b96bb152c2dffd39f49cec431f23ac60cec395b4 Mon Sep 17 00:00:00 2001 From: Frank Praznik Date: Thu, 16 Jan 2025 13:54:03 -0500 Subject: [PATCH 108/340] wayland: Don't redundantly set the border state when showing a window They are now set before the initial configure. --- src/video/wayland/SDL_waylandwindow.c | 1 - 1 file changed, 1 deletion(-) diff --git a/src/video/wayland/SDL_waylandwindow.c b/src/video/wayland/SDL_waylandwindow.c index c7294d28d76e8..ebf79a2609290 100644 --- a/src/video/wayland/SDL_waylandwindow.c +++ b/src/video/wayland/SDL_waylandwindow.c @@ -2012,7 +2012,6 @@ void Wayland_ShowWindow(SDL_VideoDevice *_this, SDL_Window *window) } #endif Wayland_SetWindowResizable(_this, window, !!(window->flags & SDL_WINDOW_RESIZABLE)); - Wayland_SetWindowBordered(_this, window, !(window->flags & SDL_WINDOW_BORDERLESS)); // We're finally done putting the window together, raise if possible if (c->activation_manager) { From eb168e410ca59e7a4b441adaa2d383bce307848c Mon Sep 17 00:00:00 2001 From: Sam Lantinga Date: Thu, 16 Jan 2025 11:41:28 -0800 Subject: [PATCH 109/340] Updated to version 3.1.11 for development --- CMakeLists.txt | 2 +- Xcode/SDL/Info-Framework.plist | 4 ++-- Xcode/SDL/SDL.xcodeproj/project.pbxproj | 12 ++++++------ Xcode/SDL/pkg-support/SDL.info | 2 +- .../src/main/java/org/libsdl/app/SDLActivity.java | 2 +- include/SDL3/SDL.h | 2 +- include/SDL3/SDL_version.h | 2 +- src/core/windows/version.rc | 8 ++++---- 8 files changed, 17 insertions(+), 17 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index b89adcf99d246..5a0861d6bf033 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -5,7 +5,7 @@ if(NOT DEFINED CMAKE_BUILD_TYPE) endif() # See docs/release_checklist.md -project(SDL3 LANGUAGES C VERSION "3.1.10") +project(SDL3 LANGUAGES C VERSION "3.1.11") if(CMAKE_SOURCE_DIR STREQUAL PROJECT_SOURCE_DIR) set(SDL3_MAINPROJECT ON) diff --git a/Xcode/SDL/Info-Framework.plist b/Xcode/SDL/Info-Framework.plist index 408718cdc6ceb..306991e7b4726 100644 --- a/Xcode/SDL/Info-Framework.plist +++ b/Xcode/SDL/Info-Framework.plist @@ -19,10 +19,10 @@ CFBundlePackageType FMWK CFBundleShortVersionString - 3.1.10 + 3.1.11 CFBundleSignature SDLX CFBundleVersion - 3.1.10 + 3.1.11 diff --git a/Xcode/SDL/SDL.xcodeproj/project.pbxproj b/Xcode/SDL/SDL.xcodeproj/project.pbxproj index c5e0abea87f08..3fee5496cd69d 100644 --- a/Xcode/SDL/SDL.xcodeproj/project.pbxproj +++ b/Xcode/SDL/SDL.xcodeproj/project.pbxproj @@ -3045,8 +3045,8 @@ CLANG_ENABLE_MODULES = YES; CLANG_ENABLE_OBJC_ARC = YES; DEPLOYMENT_POSTPROCESSING = YES; - DYLIB_COMPATIBILITY_VERSION = 111.0.0; - DYLIB_CURRENT_VERSION = 111.0.0; + DYLIB_COMPATIBILITY_VERSION = 112.0.0; + DYLIB_CURRENT_VERSION = 112.0.0; DYLIB_INSTALL_NAME_BASE = "@rpath"; ENABLE_STRICT_OBJC_MSGSEND = YES; GCC_ALTIVEC_EXTENSIONS = YES; @@ -3081,7 +3081,7 @@ "@loader_path/Frameworks", ); MACOSX_DEPLOYMENT_TARGET = 10.13; - MARKETING_VERSION = 3.1.10; + MARKETING_VERSION = 3.1.11; OTHER_LDFLAGS = "$(CONFIG_FRAMEWORK_LDFLAGS)"; PRODUCT_BUNDLE_IDENTIFIER = org.libsdl.SDL3; PRODUCT_NAME = SDL3; @@ -3109,8 +3109,8 @@ ALLOW_TARGET_PLATFORM_SPECIALIZATION = YES; CLANG_ENABLE_MODULES = YES; CLANG_ENABLE_OBJC_ARC = YES; - DYLIB_COMPATIBILITY_VERSION = 111.0.0; - DYLIB_CURRENT_VERSION = 111.0.0; + DYLIB_COMPATIBILITY_VERSION = 112.0.0; + DYLIB_CURRENT_VERSION = 112.0.0; DYLIB_INSTALL_NAME_BASE = "@rpath"; ENABLE_STRICT_OBJC_MSGSEND = YES; ENABLE_TESTABILITY = YES; @@ -3142,7 +3142,7 @@ "@loader_path/Frameworks", ); MACOSX_DEPLOYMENT_TARGET = 10.13; - MARKETING_VERSION = 3.1.10; + MARKETING_VERSION = 3.1.11; ONLY_ACTIVE_ARCH = YES; OTHER_LDFLAGS = "$(CONFIG_FRAMEWORK_LDFLAGS)"; PRODUCT_BUNDLE_IDENTIFIER = org.libsdl.SDL3; diff --git a/Xcode/SDL/pkg-support/SDL.info b/Xcode/SDL/pkg-support/SDL.info index 2b61604fbc7f0..e6efaf84cd007 100644 --- a/Xcode/SDL/pkg-support/SDL.info +++ b/Xcode/SDL/pkg-support/SDL.info @@ -1,4 +1,4 @@ -Title SDL 3.1.10 +Title SDL 3.1.11 Version 1 Description SDL Library for macOS (http://www.libsdl.org) DefaultLocation /Library/Frameworks diff --git a/android-project/app/src/main/java/org/libsdl/app/SDLActivity.java b/android-project/app/src/main/java/org/libsdl/app/SDLActivity.java index 90bf9f74f9a2a..1999ea5b22b07 100644 --- a/android-project/app/src/main/java/org/libsdl/app/SDLActivity.java +++ b/android-project/app/src/main/java/org/libsdl/app/SDLActivity.java @@ -60,7 +60,7 @@ public class SDLActivity extends Activity implements View.OnSystemUiVisibilityCh private static final String TAG = "SDL"; private static final int SDL_MAJOR_VERSION = 3; private static final int SDL_MINOR_VERSION = 1; - private static final int SDL_MICRO_VERSION = 10; + private static final int SDL_MICRO_VERSION = 11; /* // Display InputType.SOURCE/CLASS of events and devices // diff --git a/include/SDL3/SDL.h b/include/SDL3/SDL.h index 7542bd61b7749..65a85217604b9 100644 --- a/include/SDL3/SDL.h +++ b/include/SDL3/SDL.h @@ -20,7 +20,7 @@ */ /** - * Main include header for the SDL library, version 3.1.10 + * Main include header for the SDL library, version 3.1.11 * * It is almost always best to include just this one header instead of * picking out individual headers included here. There are exceptions to diff --git a/include/SDL3/SDL_version.h b/include/SDL3/SDL_version.h index 35bdb9757c0ee..57f7aca9c8606 100644 --- a/include/SDL3/SDL_version.h +++ b/include/SDL3/SDL_version.h @@ -62,7 +62,7 @@ extern "C" { * * \since This macro is available since SDL 3.1.3. */ -#define SDL_MICRO_VERSION 10 +#define SDL_MICRO_VERSION 11 /** * This macro turns the version numbers into a numeric value. diff --git a/src/core/windows/version.rc b/src/core/windows/version.rc index c5f22e8af1f51..f8129abc7c85b 100644 --- a/src/core/windows/version.rc +++ b/src/core/windows/version.rc @@ -9,8 +9,8 @@ LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US // VS_VERSION_INFO VERSIONINFO - FILEVERSION 3,1,10,0 - PRODUCTVERSION 3,1,10,0 + FILEVERSION 3,1,11,0 + PRODUCTVERSION 3,1,11,0 FILEFLAGSMASK 0x3fL FILEFLAGS 0x0L FILEOS 0x40004L @@ -23,12 +23,12 @@ BEGIN BEGIN VALUE "CompanyName", "\0" VALUE "FileDescription", "SDL\0" - VALUE "FileVersion", "3, 1, 10, 0\0" + VALUE "FileVersion", "3, 1, 11, 0\0" VALUE "InternalName", "SDL\0" VALUE "LegalCopyright", "Copyright (C) 2025 Sam Lantinga\0" VALUE "OriginalFilename", "SDL3.dll\0" VALUE "ProductName", "Simple DirectMedia Layer\0" - VALUE "ProductVersion", "3, 1, 10, 0\0" + VALUE "ProductVersion", "3, 1, 11, 0\0" END END BLOCK "VarFileInfo" From 07a5c144c651d21b41121225aa4ef2db43e74c59 Mon Sep 17 00:00:00 2001 From: SDL Wiki Bot Date: Thu, 16 Jan 2025 19:43:08 +0000 Subject: [PATCH 110/340] Sync SDL3 wiki -> header [ci skip] --- include/SDL3/SDL_audio.h | 2 +- include/SDL3/SDL_tray.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/include/SDL3/SDL_audio.h b/include/SDL3/SDL_audio.h index 911b2b9964514..3a9e8a9abfc55 100644 --- a/include/SDL3/SDL_audio.h +++ b/include/SDL3/SDL_audio.h @@ -1607,7 +1607,7 @@ extern SDL_DECLSPEC bool SDLCALL SDL_ResumeAudioStreamDevice(SDL_AudioStream *st * * \threadsafety It is safe to call this function from any thread. * - * \since This function is available since SDL 3.2.0. + * \since This function is available since SDL 3.1.3. * * \sa SDL_PauseAudioStreamDevice * \sa SDL_ResumeAudioStreamDevice diff --git a/include/SDL3/SDL_tray.h b/include/SDL3/SDL_tray.h index 8d1cac498472c..f1b67da488295 100644 --- a/include/SDL3/SDL_tray.h +++ b/include/SDL3/SDL_tray.h @@ -391,7 +391,7 @@ extern SDL_DECLSPEC void SDLCALL SDL_SetTrayEntryCallback(SDL_TrayEntry *entry, * * \param entry The entry to activate. * - * \since This function is available since SDL 3.2.0. + * \since This function is available since SDL 3.1.3. */ extern SDL_DECLSPEC void SDLCALL SDL_ClickTrayEntry(SDL_TrayEntry *entry); From cdc5483cf9683fabf0a897954a510574e61af418 Mon Sep 17 00:00:00 2001 From: ROllerozxa Date: Thu, 16 Jan 2025 20:18:11 +0100 Subject: [PATCH 111/340] Vita: Fix off-by-one error for synthetic mouse events --- src/events/SDL_mouse.c | 6 +++--- src/events/SDL_touch.c | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/events/SDL_mouse.c b/src/events/SDL_mouse.c index 5e72a1cc0dc2a..df89271531ce9 100644 --- a/src/events/SDL_mouse.c +++ b/src/events/SDL_mouse.c @@ -143,13 +143,13 @@ static void SDLCALL SDL_VitaTouchMouseDeviceChanged(void *userdata, const char * switch (*hint) { default: case '0': - mouse->vita_touch_mouse_device = 0; + mouse->vita_touch_mouse_device = 1; break; case '1': - mouse->vita_touch_mouse_device = 1; + mouse->vita_touch_mouse_device = 2; break; case '2': - mouse->vita_touch_mouse_device = 2; + mouse->vita_touch_mouse_device = 3; break; } } diff --git a/src/events/SDL_touch.c b/src/events/SDL_touch.c index 3a4f54bd070c1..ec4acb14b62ae 100644 --- a/src/events/SDL_touch.c +++ b/src/events/SDL_touch.c @@ -267,7 +267,7 @@ void SDL_SendTouch(Uint64 timestamp, SDL_TouchID id, SDL_FingerID fingerid, SDL_ // FIXME: maybe we should only restrict to a few SDL_TouchDeviceType if ((id != SDL_MOUSE_TOUCHID) && (id != SDL_PEN_TOUCHID)) { #ifdef SDL_PLATFORM_VITA - if (mouse->touch_mouse_events && ((mouse->vita_touch_mouse_device == id) || (mouse->vita_touch_mouse_device == 2))) { + if (mouse->touch_mouse_events && ((mouse->vita_touch_mouse_device == id) || (mouse->vita_touch_mouse_device == 3))) { #else if (mouse->touch_mouse_events) { #endif From dd4f5df8242b36ab61f843a5e3fc8cf024156514 Mon Sep 17 00:00:00 2001 From: Anonymous Maarten Date: Thu, 16 Jan 2025 19:55:17 +0100 Subject: [PATCH 112/340] release: support android-X-ext-Y directories [ci skip] --- build-scripts/build-release.py | 63 ++++++++++++++++++++++++---------- 1 file changed, 45 insertions(+), 18 deletions(-) diff --git a/build-scripts/build-release.py b/build-scripts/build-release.py index b4b1086fd8ba7..f3faa06c34eff 100755 --- a/build-scripts/build-release.py +++ b/build-scripts/build-release.py @@ -534,6 +534,15 @@ def _get_file_times(self, paths: tuple[str, ...]) -> dict[str, datetime.datetime return path_times +class AndroidApiVersion: + def __init__(self, name: str, ints: tuple[int, ...]): + self.name = name + self.ints = ints + + def __repr__(self) -> str: + return f"<{self.name} ({'.'.join(str(v) for v in self.ints)})>" + + class Releaser: def __init__(self, release_info: dict, commit: str, revision: str, root: Path, dist_path: Path, section_printer: SectionPrinter, executer: Executer, cmake_generator: str, deps_path: Path, overwrite: bool, github: bool, fast: bool): self.release_info = release_info @@ -885,28 +894,25 @@ def extract_filter(member: tarfile.TarInfo, path: str, /): self.artifacts["mingw-devel-tar-gz"] = tgz_path self.artifacts["mingw-devel-tar-xz"] = txz_path - def _detect_android_api(self, android_home: str) -> typing.Optional[int]: + def _detect_android_api(self, android_home: str) -> typing.Optional[AndroidApiVersion]: platform_dirs = list(Path(p) for p in glob.glob(f"{android_home}/platforms/android-*")) - re_platform = re.compile("android-([0-9]+)") - platform_versions = [] + re_platform = re.compile("^android-([0-9]+)(?:-ext([0-9]+))?$") + platform_versions: list[AndroidApiVersion] = [] for platform_dir in platform_dirs: logger.debug("Found Android Platform SDK: %s", platform_dir) if not (platform_dir / "android.jar").is_file(): logger.debug("Skipping SDK, missing android.jar") continue - if platform_dir.match('*/android-*-ext*'): - logger.debug("Skipping SDK, extended version") - continue if m:= re_platform.match(platform_dir.name): - platform_versions.append(int(m.group(1))) - platform_versions.sort() + platform_versions.append(AndroidApiVersion(name=platform_dir.name, ints=(int(m.group(1)), int(m.group(2) or 0)))) + platform_versions.sort(key=lambda v: v.ints) logger.info("Available platform versions: %s", platform_versions) - platform_versions = list(filter(lambda v: v >= self._android_api_minimum, platform_versions)) - logger.info("Valid platform versions (>=%d): %s", self._android_api_minimum, platform_versions) + platform_versions = list(filter(lambda v: v.ints >= self._android_api_minimum.ints, platform_versions)) + logger.info("Valid platform versions (>=%s): %s", self._android_api_minimum.ints, platform_versions) if not platform_versions: return None android_api = platform_versions[0] - logger.info("Selected API version %d", android_api) + logger.info("Selected API version %s", android_api) return android_api def _get_prefab_json_text(self) -> str: @@ -930,8 +936,19 @@ def _get_prefab_module_json_text(self, library_name: typing.Optional[str], expor return json.dumps(module_json_dict, indent=4) @property - def _android_api_minimum(self): - return self.release_info["android"]["api-minimum"] + def _android_api_minimum(self) -> AndroidApiVersion: + value = self.release_info["android"]["api-minimum"] + if isinstance(value, int): + ints = (value, ) + elif isinstance(value, str): + ints = tuple(split(".")) + else: + raise ValueError("Invalid android.api-minimum: must be X or X.Y") + match len(ints): + case 1: name = f"android-{ints[0]}" + case 2: name = f"android-{ints[0]}-ext-{ints[1]}" + case _: raise ValueError("Invalid android.api-minimum: must be X or X.Y") + return AndroidApiVersion(name=name, ints=ints) @property def _android_api_target(self): @@ -944,7 +961,7 @@ def _android_ndk_minimum(self): def _get_prefab_abi_json_text(self, abi: str, cpp: bool, shared: bool) -> str: abi_json_dict = { "abi": abi, - "api": self._android_api_minimum, + "api": self._android_api_minimum.ints[0], "ndk": self._android_ndk_minimum, "stl": "c++_shared" if cpp else "none", "static": not shared, @@ -957,7 +974,7 @@ def _get_android_manifest_text(self) -> str: xmlns:android="http://schemas.android.com/apk/res/android" package="org.libsdl.android.{self.project}" android:versionCode="1" android:versionName="1.0"> - """) @@ -1372,7 +1389,7 @@ def main(argv=None) -> int: parser.add_argument("--actions", choices=["download", "source", "android", "mingw", "msvc", "dmg"], required=True, nargs="+", dest="actions", help="What to do?") parser.set_defaults(loglevel=logging.INFO) parser.add_argument('--vs-year', dest="vs_year", help="Visual Studio year") - parser.add_argument('--android-api', type=int, dest="android_api", help="Android API version") + parser.add_argument('--android-api', dest="android_api", help="Android API version") parser.add_argument('--android-home', dest="android_home", default=os.environ.get("ANDROID_HOME"), help="Android Home folder") parser.add_argument('--android-ndk-home', dest="android_ndk_home", default=os.environ.get("ANDROID_NDK_HOME"), help="Android NDK Home folder") parser.add_argument('--cmake-generator', dest="cmake_generator", default="Ninja", help="CMake Generator") @@ -1499,9 +1516,19 @@ def main(argv=None) -> int: if args.android_api is None: with section_printer.group("Detect Android APIS"): args.android_api = releaser._detect_android_api(android_home=args.android_home) + else: + try: + android_api_ints = tuple(int(v) for v in args.android_api.split(".")) + match len(android_api_ints): + case 1: android_api_name = f"android-{android_api_ints[0]}" + case 2: android_api_name = f"android-{android_api_ints[0]}-ext-{android_api_ints[1]}" + case _: raise ValueError + except ValueError: + logger.error("Invalid --android-api, must be a 'X' or 'X.Y' version") + args.android_api = AndroidApiVersion(ints=android_api_ints, name=android_api_name) if args.android_api is None: parser.error("Invalid --android-api, and/or could not be detected") - android_api_path = Path(args.android_home) / f"platforms/android-{args.android_api}" + android_api_path = Path(args.android_home) / f"platforms/{args.android_api.name}" if not android_api_path.is_dir(): parser.error(f"Android API directory does not exist ({android_api_path})") with section_printer.group("Android arguments"): @@ -1509,7 +1536,7 @@ def main(argv=None) -> int: print(f"android_ndk_home = {args.android_ndk_home}") print(f"android_api = {args.android_api}") releaser.create_android_archives( - android_api=args.android_api, + android_api=args.android_api.ints[0], android_home=args.android_home, android_ndk_home=args.android_ndk_home, ) From c2dac95f58a1ddb85146fc2324212ac7b7f8e9fa Mon Sep 17 00:00:00 2001 From: "Ryan C. Gordon" Date: Thu, 16 Jan 2025 18:02:01 -0500 Subject: [PATCH 113/340] Revert "Add CategoryAPICategory to the complete API index" This reverts commit 21a42d2b0d7441004b6dc463fd8e936696c64f2b. It doesn't work like this, sorry. :) --- build-scripts/wikiheaders.pl | 6 ------ 1 file changed, 6 deletions(-) diff --git a/build-scripts/wikiheaders.pl b/build-scripts/wikiheaders.pl index 8649d4b0a964e..98591493b7cc5 100755 --- a/build-scripts/wikiheaders.pl +++ b/build-scripts/wikiheaders.pl @@ -2627,12 +2627,6 @@ sub generate_quickref { -## Categories - - - - - ## Functions From 616ae990696cc19b0cb4001e2bb881e0ab2d7b26 Mon Sep 17 00:00:00 2001 From: Sam Lantinga Date: Thu, 16 Jan 2025 15:45:51 -0800 Subject: [PATCH 114/340] Removed README-git.md We're fully hosted on GitHub, no need for additional explanation. --- docs/README-git.md | 16 ---------------- 1 file changed, 16 deletions(-) delete mode 100644 docs/README-git.md diff --git a/docs/README-git.md b/docs/README-git.md deleted file mode 100644 index aa0aa40547477..0000000000000 --- a/docs/README-git.md +++ /dev/null @@ -1,16 +0,0 @@ -git -========= - -The latest development version of SDL is available via git. -Git allows you to get up-to-the-minute fixes and enhancements; -as a developer works on a source tree, you can use "git" to mirror that -source tree instead of waiting for an official release. Please look -at the Git website ( https://git-scm.com/ ) for more -information on using git, where you can also download software for -macOS, Windows, and Unix systems. - - git clone https://github.com/libsdl-org/SDL - -There is a web interface to the Git repository at: - http://github.com/libsdl-org/SDL/ - From 4b429b9fa71dfc5b1688e3f87620341d5f67c0f4 Mon Sep 17 00:00:00 2001 From: Sam Lantinga Date: Thu, 16 Jan 2025 16:21:18 -0800 Subject: [PATCH 115/340] Updated README-platforms.md Also added platform specific README files --- docs/README-bsd.md | 6 ++++++ docs/README-cmake.md | 13 ++++++------- docs/README-haiku.md | 4 ++++ docs/README-platforms.md | 42 +++++++++++++++++++++++++++++++++++----- docs/README-ps4.md | 3 +++ docs/README-ps5.md | 3 +++ docs/README-steamos.md | 10 ++++++++++ docs/README-switch.md | 3 +++ docs/README.md | 22 +++------------------ 9 files changed, 75 insertions(+), 31 deletions(-) create mode 100644 docs/README-bsd.md create mode 100644 docs/README-haiku.md create mode 100644 docs/README-ps4.md create mode 100644 docs/README-ps5.md create mode 100644 docs/README-steamos.md create mode 100644 docs/README-switch.md diff --git a/docs/README-bsd.md b/docs/README-bsd.md new file mode 100644 index 0000000000000..d823060d6f190 --- /dev/null +++ b/docs/README-bsd.md @@ -0,0 +1,6 @@ +# FreeBSD / OpenBSD / NetBSD + +SDL is fully supported on BSD platforms, and is built using [CMake](README-cmake.md). + +If you want to run on the console, you can take a look at [KMSDRM support on BSD](README-kmsbsd.md) + diff --git a/docs/README-cmake.md b/docs/README-cmake.md index 2c29020314bb6..f2e4759cdca81 100644 --- a/docs/README-cmake.md +++ b/docs/README-cmake.md @@ -2,23 +2,22 @@ [www.cmake.org](https://www.cmake.org/) -The CMake build system is supported on the following platforms: +The CMake build system is supported with the following environments: +* Android +* Emscripten * FreeBSD +* Haiku * Linux +* macOS, iOS, tvOS, and visionOS with support for XCode * Microsoft Visual Studio * MinGW and Msys -* macOS, iOS, tvOS, and visionOS with support for XCode -* Android -* Emscripten * NetBSD -* Haiku * Nintendo 3DS * PlayStation 2 * PlayStation Portable * PlayStation Vita -* QNX 7.x/8.x -* RiscOS +* RISC OS ## Building SDL on Windows diff --git a/docs/README-haiku.md b/docs/README-haiku.md new file mode 100644 index 0000000000000..960bc3c7c4e23 --- /dev/null +++ b/docs/README-haiku.md @@ -0,0 +1,4 @@ +# Haiku OS + +SDL is fully supported on Haiku OS, and is built using [CMake](README-cmake.md). + diff --git a/docs/README-platforms.md b/docs/README-platforms.md index 14454ec5d5c46..77ae411d27385 100644 --- a/docs/README-platforms.md +++ b/docs/README-platforms.md @@ -1,8 +1,40 @@ -Platforms -========= +# Platforms -We maintain the list of supported platforms on our wiki now, and how to -build and install SDL for those platforms: +## Supported Platforms - https://wiki.libsdl.org/Installation +- [Android](README-android.md) +- [Emscripten](README-emscripten.md) +- [FreeBSD](README-bsd.md) +- [Haiku OS](README-haiku.md) +- [iOS](README-ios.md) +- [Linux](README-linux.md) +- [macOS](README-macos.md) +- [NetBSD](README-bsd.md) +- [Nintendo Switch](README-switch.md) +- [Nintendo 3DS](README-3ds.md) +- [OpenBSD](README-bsd.md) +- [PlayStation 2](README-ps2.md) +- [PlayStation 4](README-ps4.md) +- [PlayStation 5](README-ps5.md) +- [PlayStation Portable](README-psp.md) +- [PlayStation Vita](README-vita.md) +- [RISC OS](README-riscos.md) +- [SteamOS](README-steamos.md) +- [tvOS](README-ios.md) +- [Windows](README-windows.md) +- [Windows GDK](README-gdk.md) +- [Xbox](README-gdk.md) +## Unsupported Platforms + +If your favorite system is listed below, we aren't working on it. However, if you send reasonable patches and are willing to support the port in the long term, we are happy to take a look! + +All of these still work with [SDL2](/SDL2), which is an incompatible API, but an option if you need to support these platforms still. + +- Google Stadia +- NaCL +- Nokia N-Gage +- OS/2 +- QNX +- WinPhone +- WinRT/UWP diff --git a/docs/README-ps4.md b/docs/README-ps4.md new file mode 100644 index 0000000000000..29b5a939b3c5c --- /dev/null +++ b/docs/README-ps4.md @@ -0,0 +1,3 @@ +# Sony PlayStation 4 + +SDL3 runs on the PS4! There are commercial games shipping with this port. This port is kept in a separate repository, but is available for free, under the zlib license, to anyone that is under NDA for PlayStation development with Sony. Please contact Ryan (icculus at icculus dot org) for details. diff --git a/docs/README-ps5.md b/docs/README-ps5.md new file mode 100644 index 0000000000000..55470d43b7457 --- /dev/null +++ b/docs/README-ps5.md @@ -0,0 +1,3 @@ +# Sony PlayStation 5 + +SDL3 runs on the PS5! There are commercial games shipping with this port. This port is kept in a separate repository, but is available for free, under the zlib license, to anyone that is under NDA for PlayStation development with Sony. Please contact Ryan (icculus at icculus dot org) for details. diff --git a/docs/README-steamos.md b/docs/README-steamos.md new file mode 100644 index 0000000000000..0feab9a40ac94 --- /dev/null +++ b/docs/README-steamos.md @@ -0,0 +1,10 @@ +# SteamOS + +SteamOS is literally a Linux system, and uses the same binaries you distribute to generic Linux Steam users, so generally speaking, all the other [Linux advice](README-linux.md) applies. + +If you are shipping a Linux game on Steam, or explicitly targeting SteamOS, the system is guaranteed to provide SDL. The Steam Client will set up the dynamic loader path so that a known-good copy of SDL is available to any program that needs it before launching a game. Steam provides all major versions of SDL to date, in this manner, for both x86 and amd64, in addition to several add-on libraries like `SDL_image` and `SDL_mixer`. When shipping a Linux game on Steam, do not ship a build of SDL with your game. Link against SDL as normal, and expect it to be available on the player's system. This allows Valve to make fixes and improvements to their SDL and those fixes to flow on to your game. + +We are obsessive about SDL3 having a backwards-compatible ABI. Whether you build your game using the Steam Runtime SDK or just about any other copy of SDL, it _should_ work with the one that ships with Steam. + +In fact, it's not a bad idea to just copy the SDL build out of the Steam Runtime if you plan to ship a Linux game for non-Steam platforms, too, since you know it's definitely well-built. + diff --git a/docs/README-switch.md b/docs/README-switch.md new file mode 100644 index 0000000000000..16b7acd1f1e47 --- /dev/null +++ b/docs/README-switch.md @@ -0,0 +1,3 @@ +# Nintendo Switch + +SDL3 runs on the Nintendo Switch! There are commercial games shipping with this port. This port is kept in a separate repository, but is available for free, under the zlib license, to anyone that is under NDA for Switch development with Nintendo. Please contact Ryan (icculus at icculus dot org) for details. diff --git a/docs/README.md b/docs/README.md index 922fe64bbc662..d0f5a5409481d 100644 --- a/docs/README.md +++ b/docs/README.md @@ -7,8 +7,7 @@ to provide low level access to audio, keyboard, mouse, joystick, and graphics hardware. It is used by video playback software, emulators, and popular games including Valve's award winning catalog and many Humble Bundle games. -SDL officially supports Windows, macOS, Linux, iOS, and Android. -Support for other platforms may be found in the source code. +SDL officially supports Windows, macOS, Linux, iOS, Android, Xbox, PlayStation 4/5, Nintendo Switch, and many other platforms. SDL is written in C, works natively with C++, and there are bindings available for several other languages, including C# and Python. @@ -24,28 +23,13 @@ The header files and test programs are well commented and always up to date. Information on reporting bugs and contributing is available in [README-contributing.md](README-contributing.md) -More documentation and FAQs are available online at [the wiki](http://wiki.libsdl.org/) +More documentation and FAQs are available online at the [wiki](http://wiki.libsdl.org/) - [Migrating from SDL 2.0](README-migration.md) -- [Supported Platforms](README-platforms.md) - [main()](README-main-functions.md) - [High DPI Support](README-highdpi.md) - [Touch](README-touch.md) -- [Versions](README-versions.md) - -- [Android](README-android.md) -- [Emscripten](README-emscripten.md) -- [iOS](README-ios.md) -- [KMSDRM support on BSD](README-kmsbsd.md) -- [Linux](README-linux.md) -- [macOS](README-macos.md) -- [Nintendo 3DS](README-n3ds.md) -- [PS2](README-ps2.md) -- [PSP](README-psp.md) -- [PSVita](README-vita.md) -- [RISC OS](README-riscos.md) -- [Windows GDK](README-gdk.md) -- [Windows](README-windows.md) +- [Supported platforms](README-platforms.md) - [Porting information](README-porting.md) If you need help with the library, or just want to discuss SDL related From ae8df1dcbde0f9c53a4e9e5d9fd97cb663733dcb Mon Sep 17 00:00:00 2001 From: Sam Lantinga Date: Fri, 17 Jan 2025 11:52:33 -0800 Subject: [PATCH 116/340] Note that the primary monitor isn't always at 0,0 --- include/SDL3/SDL_video.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/SDL3/SDL_video.h b/include/SDL3/SDL_video.h index 00b98b33088f7..60eb314b89048 100644 --- a/include/SDL3/SDL_video.h +++ b/include/SDL3/SDL_video.h @@ -648,7 +648,7 @@ extern SDL_DECLSPEC const char * SDLCALL SDL_GetDisplayName(SDL_DisplayID displa /** * Get the desktop area represented by a display. * - * The primary display is always located at (0,0). + * The primary display is often located at (0,0), but may be placed at a different location depending on monitor layout. * * \param displayID the instance ID of the display to query. * \param rect the SDL_Rect structure filled in with the display bounds. From 9ed96f392df15c276ed5fe35fd7d836ff8c9d504 Mon Sep 17 00:00:00 2001 From: SDL Wiki Bot Date: Fri, 17 Jan 2025 19:46:20 +0000 Subject: [PATCH 117/340] Sync SDL3 wiki -> header [ci skip] --- include/SDL3/SDL_video.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/include/SDL3/SDL_video.h b/include/SDL3/SDL_video.h index 60eb314b89048..43e471799ef03 100644 --- a/include/SDL3/SDL_video.h +++ b/include/SDL3/SDL_video.h @@ -648,7 +648,8 @@ extern SDL_DECLSPEC const char * SDLCALL SDL_GetDisplayName(SDL_DisplayID displa /** * Get the desktop area represented by a display. * - * The primary display is often located at (0,0), but may be placed at a different location depending on monitor layout. + * The primary display is often located at (0,0), but may be placed at a + * different location depending on monitor layout. * * \param displayID the instance ID of the display to query. * \param rect the SDL_Rect structure filled in with the display bounds. From 656c519cca9c9266021cd7f568c30ea2663881d9 Mon Sep 17 00:00:00 2001 From: Sam Lantinga Date: Fri, 17 Jan 2025 12:08:45 -0800 Subject: [PATCH 118/340] Fixed warning C6313: Incorrect operator. Use an equality test to check for zero-valued flags. --- src/tray/unix/SDL_tray.c | 6 ++++-- src/tray/windows/SDL_tray.c | 4 ++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/src/tray/unix/SDL_tray.c b/src/tray/unix/SDL_tray.c index cc57fd78114d2..39deab4e5db64 100644 --- a/src/tray/unix/SDL_tray.c +++ b/src/tray/unix/SDL_tray.c @@ -591,12 +591,14 @@ SDL_TrayEntry *SDL_InsertTrayEntryAt(SDL_TrayMenu *menu, int pos, const char *la entry->item = gtk_separator_menu_item_new(); } else if (flags & SDL_TRAYENTRY_CHECKBOX) { entry->item = gtk_check_menu_item_new_with_label(label); - gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(entry->item), !!(flags & SDL_TRAYENTRY_CHECKED)); + gboolean active = ((flags & SDL_TRAYENTRY_CHECKED) != 0); + gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(entry->item), active); } else { entry->item = gtk_menu_item_new_with_label(label); } - gtk_widget_set_sensitive(entry->item, !(flags & SDL_TRAYENTRY_DISABLED)); + gboolean sensitive = ((flags & SDL_TRAYENTRY_DISABLED) == 0); + gtk_widget_set_sensitive(entry->item, sensitive); SDL_TrayEntry **new_entries = (SDL_TrayEntry **)SDL_realloc(menu->entries, (menu->nEntries + 2) * sizeof(*new_entries)); diff --git a/src/tray/windows/SDL_tray.c b/src/tray/windows/SDL_tray.c index 526c19004ef18..f5eb6da261571 100644 --- a/src/tray/windows/SDL_tray.c +++ b/src/tray/windows/SDL_tray.c @@ -523,7 +523,7 @@ bool SDL_GetTrayEntryChecked(SDL_TrayEntry *entry) GetMenuItemInfoW(entry->parent->hMenu, (UINT) entry->id, FALSE, &mii); - return !!(mii.fState & MFS_CHECKED); + return ((mii.fState & MFS_CHECKED) != 0); } void SDL_SetTrayEntryEnabled(SDL_TrayEntry *entry, bool enabled) @@ -549,7 +549,7 @@ bool SDL_GetTrayEntryEnabled(SDL_TrayEntry *entry) GetMenuItemInfoW(entry->parent->hMenu, (UINT) entry->id, FALSE, &mii); - return !!(mii.fState & MFS_ENABLED); + return ((mii.fState & MFS_ENABLED) != 0); } void SDL_SetTrayEntryCallback(SDL_TrayEntry *entry, SDL_TrayCallback callback, void *userdata) From 1848ce680b7f6002deda0770f9238cbbde7cbb6f Mon Sep 17 00:00:00 2001 From: Frank Praznik Date: Fri, 17 Jan 2025 15:23:41 -0500 Subject: [PATCH 119/340] win32: Use the window coordinates to get the monitor when de-minimizing a maximized window MonitorFromWindow can fail if called on a window being de-minimized, so fall back to using the monitor from the last window coordinates if initial retrieval fails. --- src/video/windows/SDL_windowsevents.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/video/windows/SDL_windowsevents.c b/src/video/windows/SDL_windowsevents.c index 1a91e03d7d7e0..459f43dfa5202 100644 --- a/src/video/windows/SDL_windowsevents.c +++ b/src/video/windows/SDL_windowsevents.c @@ -2022,7 +2022,12 @@ LRESULT CALLBACK WIN_WindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lPara WINDOWPLACEMENT placement; if (GetWindowPlacement(hwnd, &placement) && placement.showCmd == SW_MAXIMIZE) { // Maximized borderless windows should use the monitor work area. - HMONITOR hMonitor = MonitorFromWindow(hwnd, MONITOR_DEFAULTTONEAREST); + HMONITOR hMonitor = MonitorFromWindow(hwnd, MONITOR_DEFAULTTONULL); + if (!hMonitor) { + // The returned monitor can be null when restoring from minimized, so use the last coordinates. + const POINT pt = { data->window->windowed.x, data->window->windowed.y }; + hMonitor = MonitorFromPoint(pt, MONITOR_DEFAULTTONEAREST); + } if (hMonitor) { MONITORINFO info; SDL_zero(info); From 59ea078ee2ec3933e9303b4a0021235ea224fa1e Mon Sep 17 00:00:00 2001 From: Sam Lantinga Date: Fri, 17 Jan 2025 13:13:37 -0800 Subject: [PATCH 120/340] x11: check to see if displays moved when connected/disconnected Fixes https://github.com/libsdl-org/SDL/issues/9738 --- src/video/x11/SDL_x11modes.c | 72 +++++++++++++++++++++--------------- 1 file changed, 43 insertions(+), 29 deletions(-) diff --git a/src/video/x11/SDL_x11modes.c b/src/video/x11/SDL_x11modes.c index 76164d6757239..e17a2d105c5ef 100644 --- a/src/video/x11/SDL_x11modes.c +++ b/src/video/x11/SDL_x11modes.c @@ -541,6 +541,38 @@ static bool X11_UpdateXRandRDisplay(SDL_VideoDevice *_this, Display *dpy, int sc return true; } +static XRRScreenResources *X11_GetScreenResources(Display *dpy, int screen) +{ + XRRScreenResources *res = X11_XRRGetScreenResourcesCurrent(dpy, RootWindow(dpy, screen)); + if (!res || res->noutput == 0) { + if (res) { + X11_XRRFreeScreenResources(res); + } + res = X11_XRRGetScreenResources(dpy, RootWindow(dpy, screen)); + } + return res; +} + +static void X11_CheckDisplaysMoved(SDL_VideoDevice *_this, Display *dpy) +{ + const int screen = DefaultScreen(dpy); + XRRScreenResources *res = X11_GetScreenResources(dpy, screen); + if (!res) { + return; + } + + SDL_DisplayID *displays = SDL_GetDisplays(NULL); + if (displays) { + for (int i = 0; displays[i]; ++i) { + SDL_VideoDisplay *display = SDL_GetVideoDisplay(displays[i]); + const SDL_DisplayData *displaydata = display->internal; + X11_UpdateXRandRDisplay(_this, dpy, screen, displaydata->xrandr_output, res, display); + } + SDL_free(displays); + } + X11_XRRFreeScreenResources(res); +} + static void X11_HandleXRandROutputChange(SDL_VideoDevice *_this, const XRROutputChangeNotifyEvent *ev) { SDL_DisplayID *displays; @@ -568,29 +600,19 @@ static void X11_HandleXRandROutputChange(SDL_VideoDevice *_this, const XRROutput if (display) { SDL_DelVideoDisplay(display->id, true); } - } else if (ev->connection == RR_Connected) { // output is coming online - Display *dpy = ev->display; - const int screen = DefaultScreen(dpy); - XVisualInfo vinfo; - if (get_visualinfo(dpy, screen, &vinfo)) { - XRRScreenResources *res = X11_XRRGetScreenResourcesCurrent(dpy, RootWindow(dpy, screen)); - if (!res || res->noutput == 0) { - if (res) { - X11_XRRFreeScreenResources(res); - } - res = X11_XRRGetScreenResources(dpy, RootWindow(dpy, screen)); - } + X11_CheckDisplaysMoved(_this, ev->display); + } else if (ev->connection == RR_Connected) { // output is coming online + if (!display) { + Display *dpy = ev->display; + const int screen = DefaultScreen(dpy); + XRRScreenResources *res = X11_GetScreenResources(dpy, screen); if (res) { - if (display) { - X11_UpdateXRandRDisplay(_this, dpy, screen, ev->output, res, display); - } else { - X11_AddXRandRDisplay(_this, dpy, screen, ev->output, res, true); - } - + X11_AddXRandRDisplay(_this, dpy, screen, ev->output, res, true); X11_XRRFreeScreenResources(res); } } + X11_CheckDisplaysMoved(_this, ev->display); } } @@ -661,7 +683,6 @@ static bool X11_InitModes_XRandR(SDL_VideoDevice *_this) const int screencount = ScreenCount(dpy); const int default_screen = DefaultScreen(dpy); RROutput primary = X11_XRRGetOutputPrimary(dpy, RootWindow(dpy, default_screen)); - XRRScreenResources *res = NULL; int xrandr_error_base = 0; int looking_for_primary; int output; @@ -679,16 +700,9 @@ static bool X11_InitModes_XRandR(SDL_VideoDevice *_this) continue; } - res = X11_XRRGetScreenResourcesCurrent(dpy, RootWindow(dpy, screen)); - if (!res || res->noutput == 0) { - if (res) { - X11_XRRFreeScreenResources(res); - } - - res = X11_XRRGetScreenResources(dpy, RootWindow(dpy, screen)); - if (!res) { - continue; - } + XRRScreenResources *res = X11_GetScreenResources(dpy, screen); + if (!res) { + continue; } for (output = 0; output < res->noutput; output++) { From d4d22dd8decc62353d4ff36120cdd103d0ed7f48 Mon Sep 17 00:00:00 2001 From: cosmonaut Date: Fri, 17 Jan 2025 14:25:14 -0800 Subject: [PATCH 121/340] GPU: Add remarks about point topology --- include/SDL3/SDL_gpu.h | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/include/SDL3/SDL_gpu.h b/include/SDL3/SDL_gpu.h index f451c0cb6567c..1408a2459c590 100644 --- a/include/SDL3/SDL_gpu.h +++ b/include/SDL3/SDL_gpu.h @@ -515,6 +515,13 @@ typedef struct SDL_GPUFence SDL_GPUFence; /** * Specifies the primitive topology of a graphics pipeline. * + * If you are using POINTLIST you must include a point size output in the vertex shader. + * For HLSL compiling to SPIRV you must decorate a float output with [[vk::builtin("PointSize")]]. + * FOR GLSL you must set the gl_PointSize builtin. + * For MSL you must include a float output with the [[point_size]] decorator. + * Note that sized point topology is totally unsupported on D3D12. Any size other than 1 will be ignored. + * In general, you should avoid using point topology for both compatibility and performance reasons. You WILL regret using it. + * * \since This enum is available since SDL 3.1.3 * * \sa SDL_CreateGPUGraphicsPipeline From ee469c6aff65d2c2aa0dd9b5303d8e9f1dbfadc5 Mon Sep 17 00:00:00 2001 From: SDL Wiki Bot Date: Fri, 17 Jan 2025 22:26:32 +0000 Subject: [PATCH 122/340] Sync SDL3 wiki -> header [ci skip] --- include/SDL3/SDL_gpu.h | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/include/SDL3/SDL_gpu.h b/include/SDL3/SDL_gpu.h index 1408a2459c590..7a1beab26a8ca 100644 --- a/include/SDL3/SDL_gpu.h +++ b/include/SDL3/SDL_gpu.h @@ -515,12 +515,14 @@ typedef struct SDL_GPUFence SDL_GPUFence; /** * Specifies the primitive topology of a graphics pipeline. * - * If you are using POINTLIST you must include a point size output in the vertex shader. - * For HLSL compiling to SPIRV you must decorate a float output with [[vk::builtin("PointSize")]]. - * FOR GLSL you must set the gl_PointSize builtin. - * For MSL you must include a float output with the [[point_size]] decorator. - * Note that sized point topology is totally unsupported on D3D12. Any size other than 1 will be ignored. - * In general, you should avoid using point topology for both compatibility and performance reasons. You WILL regret using it. + * If you are using POINTLIST you must include a point size output in the + * vertex shader. For HLSL compiling to SPIRV you must decorate a float output + * with [[vk::builtin("PointSize")]]. FOR GLSL you must set the gl_PointSize + * builtin. For MSL you must include a float output with the [[point_size]] + * decorator. Note that sized point topology is totally unsupported on D3D12. + * Any size other than 1 will be ignored. In general, you should avoid using + * point topology for both compatibility and performance reasons. You WILL + * regret using it. * * \since This enum is available since SDL 3.1.3 * From d317fc9c080a233b24982f99197c20ff653882c3 Mon Sep 17 00:00:00 2001 From: "Ryan C. Gordon" Date: Fri, 17 Jan 2025 17:57:44 -0500 Subject: [PATCH 123/340] emscripten: resizable windows take whole page, resize with browser window. This also implements the SetWindowResizable interface, so this can be now toggled after window creation, too. Fixes #11949. --- src/video/emscripten/SDL_emscriptenevents.c | 9 +- src/video/emscripten/SDL_emscriptenvideo.c | 92 ++++++++++++++------- 2 files changed, 63 insertions(+), 38 deletions(-) diff --git a/src/video/emscripten/SDL_emscriptenevents.c b/src/video/emscripten/SDL_emscriptenevents.c index 834bca8beb619..c9437a9412a45 100644 --- a/src/video/emscripten/SDL_emscriptenevents.c +++ b/src/video/emscripten/SDL_emscriptenevents.c @@ -624,14 +624,9 @@ static EM_BOOL Emscripten_HandleResize(int eventType, const EmscriptenUiEvent *u } if (!(window_data->window->flags & SDL_WINDOW_FULLSCREEN)) { - // this will only work if the canvas size is set through css if (window_data->window->flags & SDL_WINDOW_RESIZABLE) { - double w = window_data->window->w; - double h = window_data->window->h; - - if (window_data->external_size) { - emscripten_get_element_css_size(window_data->canvas_id, &w, &h); - } + const double w = (double) uiEvent->windowInnerWidth; + const double h = (double) uiEvent->windowInnerHeight; emscripten_set_canvas_element_size(window_data->canvas_id, SDL_lroundf(w * window_data->pixel_ratio), SDL_lroundf(h * window_data->pixel_ratio)); diff --git a/src/video/emscripten/SDL_emscriptenvideo.c b/src/video/emscripten/SDL_emscriptenvideo.c index 413d96fc6089a..91c954874b673 100644 --- a/src/video/emscripten/SDL_emscriptenvideo.c +++ b/src/video/emscripten/SDL_emscriptenvideo.c @@ -47,6 +47,7 @@ static void Emscripten_DestroyWindow(SDL_VideoDevice *_this, SDL_Window *window) static SDL_FullscreenResult Emscripten_SetWindowFullscreen(SDL_VideoDevice *_this, SDL_Window *window, SDL_VideoDisplay *display, SDL_FullscreenOp fullscreen); static void Emscripten_PumpEvents(SDL_VideoDevice *_this); static void Emscripten_SetWindowTitle(SDL_VideoDevice *_this, SDL_Window *window); +static void Emscripten_SetWindowResizable(SDL_VideoDevice *_this, SDL_Window *window, bool resizable); static bool pumpevents_has_run = false; static int pending_swap_interval = -1; @@ -156,6 +157,7 @@ static SDL_VideoDevice *Emscripten_CreateDevice(void) device->CreateSDLWindow = Emscripten_CreateWindow; device->SetWindowTitle = Emscripten_SetWindowTitle; + device->SetWindowResizable = Emscripten_SetWindowResizable; /*device->SetWindowIcon = Emscripten_SetWindowIcon; device->SetWindowPosition = Emscripten_SetWindowPosition;*/ device->SetWindowSize = Emscripten_SetWindowSize; @@ -281,8 +283,6 @@ EMSCRIPTEN_KEEPALIVE void requestFullscreenThroughSDL(SDL_Window *window) static bool Emscripten_CreateWindow(SDL_VideoDevice *_this, SDL_Window *window, SDL_PropertiesID props) { SDL_WindowData *wdata; - double scaled_w, scaled_h; - double css_w, css_h; const char *selector; // Allocate window internal data @@ -304,44 +304,20 @@ static bool Emscripten_CreateWindow(SDL_VideoDevice *_this, SDL_Window *window, wdata->pixel_ratio = 1.0f; } - scaled_w = SDL_floor(window->w * wdata->pixel_ratio); - scaled_h = SDL_floor(window->h * wdata->pixel_ratio); - - // set a fake size to check if there is any CSS sizing the canvas - emscripten_set_canvas_element_size(wdata->canvas_id, 1, 1); - emscripten_get_element_css_size(wdata->canvas_id, &css_w, &css_h); - - wdata->external_size = SDL_floor(css_w) != 1 || SDL_floor(css_h) != 1; - - if ((window->flags & SDL_WINDOW_RESIZABLE) && wdata->external_size) { - // external css has resized us - scaled_w = css_w * wdata->pixel_ratio; - scaled_h = css_h * wdata->pixel_ratio; - - SDL_SendWindowEvent(window, SDL_EVENT_WINDOW_RESIZED, SDL_lroundf(css_w), SDL_lroundf(css_h)); - } - emscripten_set_canvas_element_size(wdata->canvas_id, SDL_lroundf(scaled_w), SDL_lroundf(scaled_h)); - - // if the size is not being controlled by css, we need to scale down for hidpi - if (!wdata->external_size) { - if (wdata->pixel_ratio != 1.0f) { - // scale canvas down - emscripten_set_element_css_size(wdata->canvas_id, window->w, window->h); - } - } - wdata->window = window; // Setup driver data for this window window->internal = wdata; + Emscripten_SetWindowResizable(_this, window, (window->flags & SDL_WINDOW_RESIZABLE) != 0); + // One window, it always has focus SDL_SetMouseFocus(window); SDL_SetKeyboardFocus(window); Emscripten_RegisterEventHandlers(wdata); - // disable the emscripten "fullscreen" button. + // Make the emscripten "fullscreen" button go through SDL. MAIN_THREAD_EM_ASM({ Module['requestFullscreen'] = function(lockPointer, resizeCanvas) { _requestFullscreenThroughSDL($0); @@ -354,10 +330,12 @@ static bool Emscripten_CreateWindow(SDL_VideoDevice *_this, SDL_Window *window, static void Emscripten_SetWindowSize(SDL_VideoDevice *_this, SDL_Window *window) { - SDL_WindowData *data; + if ((window->flags & SDL_WINDOW_RESIZABLE) == 0) { + return; // canvas size is being dictated by the browser window size, refuse request. + } if (window->internal) { - data = window->internal; + SDL_WindowData *data = window->internal; // update pixel ratio if (window->flags & SDL_WINDOW_HIGH_PIXEL_DENSITY) { data->pixel_ratio = emscripten_get_device_pixel_ratio(); @@ -455,4 +433,56 @@ static void Emscripten_SetWindowTitle(SDL_VideoDevice *_this, SDL_Window *window emscripten_set_window_title(window->title); } +static void Emscripten_SetWindowResizable(SDL_VideoDevice *_this, SDL_Window *window, bool resizable) +{ + SDL_WindowData *wdata = window->internal; + double scaled_w = SDL_floor(window->w * wdata->pixel_ratio); + double scaled_h = SDL_floor(window->h * wdata->pixel_ratio); + double css_w, css_h; + + // set a fake size to check if there is any CSS sizing the canvas + emscripten_set_canvas_element_size(wdata->canvas_id, 1, 1); + emscripten_get_element_css_size(wdata->canvas_id, &css_w, &css_h); + + wdata->external_size = SDL_floor(css_w) != 1 || SDL_floor(css_h) != 1; + if (wdata->external_size) { + window->flags &= ~SDL_WINDOW_RESIZABLE; // can't be resizable if something else is controlling it. + } + + // SDL_WINDOW_RESIZABLE takes up the entire page and resizes as the browser window resizes. + if (window->flags & SDL_WINDOW_RESIZABLE) { + const double w = (double) MAIN_THREAD_EM_ASM_INT({ return window.innerWidth; }); + const double h = (double) MAIN_THREAD_EM_ASM_INT({ return window.innerHeight; }); + + scaled_w = w * wdata->pixel_ratio; + scaled_h = h * wdata->pixel_ratio; + + MAIN_THREAD_EM_ASM({ + var canvas = document.querySelector(UTF8ToString($0)); + canvas.style.position = 'absolute'; + canvas.style.top = '0'; + canvas.style.right = '0'; + }, wdata->canvas_id); + + SDL_SendWindowEvent(window, SDL_EVENT_WINDOW_RESIZED, SDL_lroundf(scaled_w), SDL_lroundf(scaled_h)); + } else { + MAIN_THREAD_EM_ASM({ + var canvas = document.querySelector(UTF8ToString($0)); + canvas.style.position = undefined; + canvas.style.top = undefined; + canvas.style.right = undefined; + }, wdata->canvas_id); + } + + emscripten_set_canvas_element_size(wdata->canvas_id, SDL_lroundf(scaled_w), SDL_lroundf(scaled_h)); + + // if the size is not being controlled by css, we need to scale down for hidpi + if (!wdata->external_size) { + if (wdata->pixel_ratio != 1.0f) { + // scale canvas down + emscripten_set_element_css_size(wdata->canvas_id, window->w, window->h); + } + } +} + #endif // SDL_VIDEO_DRIVER_EMSCRIPTEN From d2fc394a2a878af925311631d3218f2933d351a6 Mon Sep 17 00:00:00 2001 From: SDL Wiki Bot Date: Fri, 17 Jan 2025 23:11:30 +0000 Subject: [PATCH 124/340] Sync SDL3 wiki -> header [ci skip] --- include/SDL3/SDL_gpu.h | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/include/SDL3/SDL_gpu.h b/include/SDL3/SDL_gpu.h index 7a1beab26a8ca..59315a1be6ee3 100644 --- a/include/SDL3/SDL_gpu.h +++ b/include/SDL3/SDL_gpu.h @@ -516,13 +516,18 @@ typedef struct SDL_GPUFence SDL_GPUFence; * Specifies the primitive topology of a graphics pipeline. * * If you are using POINTLIST you must include a point size output in the - * vertex shader. For HLSL compiling to SPIRV you must decorate a float output - * with [[vk::builtin("PointSize")]]. FOR GLSL you must set the gl_PointSize - * builtin. For MSL you must include a float output with the [[point_size]] - * decorator. Note that sized point topology is totally unsupported on D3D12. - * Any size other than 1 will be ignored. In general, you should avoid using - * point topology for both compatibility and performance reasons. You WILL - * regret using it. + * vertex shader. + * + * - For HLSL compiling to SPIRV you must decorate a float output with + * [[vk::builtin("PointSize")]]. + * - For GLSL you must set the gl_PointSize builtin. + * - For MSL you must include a float output with the [[point_size]] + * decorator. + * + * Note that sized point topology is totally unsupported on D3D12. Any size + * other than 1 will be ignored. In general, you should avoid using point + * topology for both compatibility and performance reasons. You WILL regret + * using it. * * \since This enum is available since SDL 3.1.3 * From e9f7f11f1ddd7c01ccec649d3f3a61d553d1ffd1 Mon Sep 17 00:00:00 2001 From: "Ryan C. Gordon" Date: Fri, 17 Jan 2025 18:39:12 -0500 Subject: [PATCH 125/340] fnsince.pl: Fix script once bump to 3.1.10 exposed a bug. --- build-scripts/fnsince.pl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build-scripts/fnsince.pl b/build-scripts/fnsince.pl index 8e8ec48e61ab0..e815dfd5eca35 100755 --- a/build-scripts/fnsince.pl +++ b/build-scripts/fnsince.pl @@ -90,7 +90,7 @@ my $tag = $fulltags{$release}; my $blobname = "$tag:src/dynapi/SDL_dynapi_overrides.h"; - if ($release =~ /\A3\.(0\.\d+|1\.[0123])/) { # make everything up to the first SDL3 prerelease look like 3.1.3 (ABI lock version). + if ($release =~ /\A3\.(0\.\d+|1\.[0123]\Z)/) { # make everything up to the first SDL3 prerelease look like 3.1.3 (ABI lock version). $release = '3.1.3'; } From feeea6a776239aff4475cc6e54e43e76cb8f5fd8 Mon Sep 17 00:00:00 2001 From: "Ryan C. Gordon" Date: Fri, 17 Jan 2025 18:42:04 -0500 Subject: [PATCH 126/340] Sync SDL3 wiki -> headers. --- include/SDL3/SDL_audio.h | 2 +- include/SDL3/SDL_tray.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/include/SDL3/SDL_audio.h b/include/SDL3/SDL_audio.h index 3a9e8a9abfc55..71457abbe6976 100644 --- a/include/SDL3/SDL_audio.h +++ b/include/SDL3/SDL_audio.h @@ -1607,7 +1607,7 @@ extern SDL_DECLSPEC bool SDLCALL SDL_ResumeAudioStreamDevice(SDL_AudioStream *st * * \threadsafety It is safe to call this function from any thread. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.1.10. * * \sa SDL_PauseAudioStreamDevice * \sa SDL_ResumeAudioStreamDevice diff --git a/include/SDL3/SDL_tray.h b/include/SDL3/SDL_tray.h index f1b67da488295..b001169856de4 100644 --- a/include/SDL3/SDL_tray.h +++ b/include/SDL3/SDL_tray.h @@ -391,7 +391,7 @@ extern SDL_DECLSPEC void SDLCALL SDL_SetTrayEntryCallback(SDL_TrayEntry *entry, * * \param entry The entry to activate. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.1.10. */ extern SDL_DECLSPEC void SDLCALL SDL_ClickTrayEntry(SDL_TrayEntry *entry); From 7c6adc1ca7c909ca20d110da82b3ab2519698319 Mon Sep 17 00:00:00 2001 From: Sam Lantinga Date: Fri, 17 Jan 2025 16:31:40 -0800 Subject: [PATCH 127/340] gpu renderer: removed unused sampler slots There used to be 3 scale modes, now there are only 2. --- src/render/gpu/SDL_render_gpu.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/render/gpu/SDL_render_gpu.c b/src/render/gpu/SDL_render_gpu.c index 10c0f6c905982..57ec05e8179a5 100644 --- a/src/render/gpu/SDL_render_gpu.c +++ b/src/render/gpu/SDL_render_gpu.c @@ -77,7 +77,7 @@ typedef struct GPU_RenderData GPU_ShaderUniformData shader_data; } state; - SDL_GPUSampler *samplers[3][2]; + SDL_GPUSampler *samplers[2][2]; } GPU_RenderData; typedef struct GPU_TextureData From a6a8598b9824f7860f532c6ccb3a74097f53b964 Mon Sep 17 00:00:00 2001 From: "Ryan C. Gordon" Date: Fri, 17 Jan 2025 20:02:59 -0500 Subject: [PATCH 128/340] storage: deal with paths with Windows '\\' path separators appended. Reference Issue #11986. --- src/storage/generic/SDL_genericstorage.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/storage/generic/SDL_genericstorage.c b/src/storage/generic/SDL_genericstorage.c index b1270a761bab2..cc0804feacab7 100644 --- a/src/storage/generic/SDL_genericstorage.c +++ b/src/storage/generic/SDL_genericstorage.c @@ -327,7 +327,12 @@ SDL_Storage *GENERIC_OpenFileStorage(const char *path) len += SDL_strlen(path); } if (len > 0) { - if (path[len-1] == '/') { + #ifdef SDL_PLATFORM_WINDOWS + const bool appended_separator = (path[len-1] == '/') || (path[len-1] == '\\'); + #else + const bool appended_separator = (path[len-1] == '/'); + #endif + if (appended_separator) { basepath = SDL_strdup(path); if (!basepath) { return NULL; From 010f27dc70a5ed21e03ac2bfe22f11109b1e8c44 Mon Sep 17 00:00:00 2001 From: "Ryan C. Gordon" Date: Fri, 17 Jan 2025 20:04:27 -0500 Subject: [PATCH 129/340] storage: enumerate and glob on storage can accept a NULL path. This will be treated as the root of the storage tree. --- include/SDL3/SDL_storage.h | 10 ++++++++-- src/storage/SDL_storage.c | 13 ++++++++----- 2 files changed, 16 insertions(+), 7 deletions(-) diff --git a/include/SDL3/SDL_storage.h b/include/SDL3/SDL_storage.h index f6be770db81ad..25e19f317bc73 100644 --- a/include/SDL3/SDL_storage.h +++ b/include/SDL3/SDL_storage.h @@ -543,8 +543,11 @@ extern SDL_DECLSPEC bool SDLCALL SDL_CreateStorageDirectory(SDL_Storage *storage * returned SDL_ENUM_SUCCESS to halt enumeration, or all directory entries * were enumerated. * + * If `path` is NULL, this is treated as a request to enumerate the root of + * the storage container's tree. An empty string also works for this. + * * \param storage a storage container. - * \param path the path of the directory to enumerate. + * \param path the path of the directory to enumerate, or NULL for the root. * \param callback a function that is called for each entry in the directory. * \param userdata a pointer that is passed to `callback`. * \returns true on success or false on failure; call SDL_GetError() for more @@ -646,8 +649,11 @@ extern SDL_DECLSPEC Uint64 SDLCALL SDL_GetStorageSpaceRemaining(SDL_Storage *sto * convenience, but if `count` is non-NULL, on return it will contain the * number of items in the array, not counting the NULL terminator. * + * If `path` is NULL, this is treated as a request to enumerate the root of + * the storage container's tree. An empty string also works for this. + * * \param storage a storage container. - * \param path the path of the directory to enumerate. + * \param path the path of the directory to enumerate, or NULL for the root. * \param pattern the pattern that files in the directory must match. Can be * NULL. * \param flags `SDL_GLOB_*` bitflags that affect this search. diff --git a/src/storage/SDL_storage.c b/src/storage/SDL_storage.c index a5687c651660e..75952ffd2328a 100644 --- a/src/storage/SDL_storage.c +++ b/src/storage/SDL_storage.c @@ -284,8 +284,10 @@ bool SDL_EnumerateStorageDirectory(SDL_Storage *storage, const char *path, SDL_E CHECK_STORAGE_MAGIC() if (!path) { - return SDL_InvalidParamError("path"); - } else if (!ValidateStoragePath(path)) { + path = ""; // we allow NULL to mean "root of the storage tree". + } + + if (!ValidateStoragePath(path)) { return false; } else if (!storage->iface.enumerate) { return SDL_Unsupported(); @@ -396,9 +398,10 @@ char **SDL_GlobStorageDirectory(SDL_Storage *storage, const char *path, const ch CHECK_STORAGE_MAGIC_RET(NULL) if (!path) { - SDL_InvalidParamError("path"); - return NULL; - } else if (!ValidateStoragePath(path)) { + path = ""; // we allow NULL to mean "root of the storage tree". + } + + if (!ValidateStoragePath(path)) { return NULL; } From b95989d14a195df3d4eb93d6e9130c5f0fee64e3 Mon Sep 17 00:00:00 2001 From: Nicolas Firmo do Patrocinio Barra Date: Fri, 17 Jan 2025 22:08:07 -0300 Subject: [PATCH 130/340] Fixed sine wave distortion over time. Audio distortion after a while caused by loss of precision in dividing a large floating point number resolved by keeping `current_sine_sample` (formelly named `total_samples_generated`) between 0 and freq - 1. --- examples/audio/01-simple-playback/simple-playback.c | 11 +++++++---- .../simple-playback-callback.c | 11 +++++++---- 2 files changed, 14 insertions(+), 8 deletions(-) diff --git a/examples/audio/01-simple-playback/simple-playback.c b/examples/audio/01-simple-playback/simple-playback.c index 0661de1d18c6a..8fb4fe49017fb 100644 --- a/examples/audio/01-simple-playback/simple-playback.c +++ b/examples/audio/01-simple-playback/simple-playback.c @@ -14,7 +14,7 @@ static SDL_Window *window = NULL; static SDL_Renderer *renderer = NULL; static SDL_AudioStream *stream = NULL; -static int total_samples_generated = 0; +static int current_sine_sample = 0; /* This function runs once at startup. */ SDL_AppResult SDL_AppInit(void **appstate, int argc, char *argv[]) @@ -76,11 +76,14 @@ SDL_AppResult SDL_AppIterate(void *appstate) /* generate a 440Hz pure tone */ for (i = 0; i < SDL_arraysize(samples); i++) { const int freq = 440; - const int phase = (total_samples_generated * freq) % 8000; - samples[i] = (float)SDL_sin(phase * 2 * SDL_PI_D / 8000.0); - total_samples_generated++; + const int phase = current_sine_sample * freq / 8000.0f; + samples[i] = SDL_sinf(phase * 2 * SDL_PI_F); + current_sine_sample++; } + /* wrapping around to avoid floating-point errors */ + current_sine_sample %= 8000; + /* feed the new data to the stream. It will queue at the end, and trickle out as the hardware needs more data. */ SDL_PutAudioStreamData(stream, samples, sizeof (samples)); } diff --git a/examples/audio/02-simple-playback-callback/simple-playback-callback.c b/examples/audio/02-simple-playback-callback/simple-playback-callback.c index fe79ffecea088..27d570951cd9d 100644 --- a/examples/audio/02-simple-playback-callback/simple-playback-callback.c +++ b/examples/audio/02-simple-playback-callback/simple-playback-callback.c @@ -17,7 +17,7 @@ static SDL_Window *window = NULL; static SDL_Renderer *renderer = NULL; static SDL_AudioStream *stream = NULL; -static int total_samples_generated = 0; +static int current_sine_sample = 0; /* this function will be called (usually in a background thread) when the audio stream is consuming data. */ static void SDLCALL FeedTheAudioStreamMore(void *userdata, SDL_AudioStream *astream, int additional_amount, int total_amount) @@ -36,11 +36,14 @@ static void SDLCALL FeedTheAudioStreamMore(void *userdata, SDL_AudioStream *astr /* generate a 440Hz pure tone */ for (i = 0; i < total; i++) { const int freq = 440; - const int phase = (total_samples_generated * freq) % 8000; - samples[i] = (float)SDL_sin(phase * 2 * SDL_PI_D / 8000.0); - total_samples_generated++; + const int phase = current_sine_sample * freq / 8000.0f; + samples[i] = SDL_sinf(phase * 2 * SDL_PI_F); + current_sine_sample++; } + /* wrapping around to avoid floating-point errors */ + current_sine_sample %= 8000; + /* feed the new data to the stream. It will queue at the end, and trickle out as the hardware needs more data. */ SDL_PutAudioStreamData(astream, samples, total * sizeof (float)); additional_amount -= total; /* subtract what we've just fed the stream. */ From 842f6dc40227c8b7aa5b92084b60b257690a9e90 Mon Sep 17 00:00:00 2001 From: Nicolas Firmo <49406269+NicolasFirmo@users.noreply.github.com> Date: Fri, 17 Jan 2025 23:12:47 -0300 Subject: [PATCH 131/340] Fixed wrong type of `phase` (#12014) `phase` should be a `float` value that ranges between `0` and `1`. --- examples/audio/01-simple-playback/simple-playback.c | 2 +- .../02-simple-playback-callback/simple-playback-callback.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/examples/audio/01-simple-playback/simple-playback.c b/examples/audio/01-simple-playback/simple-playback.c index 8fb4fe49017fb..35ddf8a84baec 100644 --- a/examples/audio/01-simple-playback/simple-playback.c +++ b/examples/audio/01-simple-playback/simple-playback.c @@ -76,7 +76,7 @@ SDL_AppResult SDL_AppIterate(void *appstate) /* generate a 440Hz pure tone */ for (i = 0; i < SDL_arraysize(samples); i++) { const int freq = 440; - const int phase = current_sine_sample * freq / 8000.0f; + const float phase = current_sine_sample * freq / 8000.0f; samples[i] = SDL_sinf(phase * 2 * SDL_PI_F); current_sine_sample++; } diff --git a/examples/audio/02-simple-playback-callback/simple-playback-callback.c b/examples/audio/02-simple-playback-callback/simple-playback-callback.c index 27d570951cd9d..5a783619f7da5 100644 --- a/examples/audio/02-simple-playback-callback/simple-playback-callback.c +++ b/examples/audio/02-simple-playback-callback/simple-playback-callback.c @@ -36,7 +36,7 @@ static void SDLCALL FeedTheAudioStreamMore(void *userdata, SDL_AudioStream *astr /* generate a 440Hz pure tone */ for (i = 0; i < total; i++) { const int freq = 440; - const int phase = current_sine_sample * freq / 8000.0f; + const float phase = current_sine_sample * freq / 8000.0f; samples[i] = SDL_sinf(phase * 2 * SDL_PI_F); current_sine_sample++; } From f3a39074b0b931d87ae442ceb2fa651d3f59751a Mon Sep 17 00:00:00 2001 From: "Ryan C. Gordon" Date: Sat, 18 Jan 2025 08:35:54 -0500 Subject: [PATCH 132/340] windows: use WS_THICKFRAME style on borderless windows. This is apparently necessary in newer Windows releases (Windows 10 and later?) to allow hit-testing to resize the window. Fixes #8406. --- src/video/windows/SDL_windowswindow.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/video/windows/SDL_windowswindow.c b/src/video/windows/SDL_windowswindow.c index 68e65847e62d0..ef516c19df2c6 100644 --- a/src/video/windows/SDL_windowswindow.c +++ b/src/video/windows/SDL_windowswindow.c @@ -147,12 +147,13 @@ static ATOM SDL_HelperWindowClass = 0; - WS_CAPTION: this seems to enable the Windows minimize animation - WS_SYSMENU: enables system context menu on task bar This will also cause the task bar to overlap the window and other windowed behaviors, so only use this for windows that shouldn't appear to be fullscreen + - WS_THICKFRAME: allows hit-testing to resize window (doesn't actually add a frame to a borderless window). */ #define STYLE_BASIC (WS_CLIPSIBLINGS | WS_CLIPCHILDREN) #define STYLE_FULLSCREEN (WS_POPUP | WS_MINIMIZEBOX) -#define STYLE_BORDERLESS (WS_POPUP | WS_MINIMIZEBOX) -#define STYLE_BORDERLESS_WINDOWED (WS_POPUP | WS_CAPTION | WS_SYSMENU | WS_MINIMIZEBOX) +#define STYLE_BORDERLESS (WS_POPUP | WS_MINIMIZEBOX | WS_THICKFRAME) +#define STYLE_BORDERLESS_WINDOWED (WS_POPUP | WS_CAPTION | WS_SYSMENU | WS_MINIMIZEBOX | WS_THICKFRAME) #define STYLE_NORMAL (WS_OVERLAPPED | WS_CAPTION | WS_SYSMENU | WS_MINIMIZEBOX) #define STYLE_RESIZABLE (WS_THICKFRAME | WS_MAXIMIZEBOX) #define STYLE_MASK (STYLE_FULLSCREEN | STYLE_BORDERLESS | STYLE_NORMAL | STYLE_RESIZABLE) From 6a72d32d410b78b190828b6690ce817f81e8f677 Mon Sep 17 00:00:00 2001 From: "Ryan C. Gordon" Date: Sat, 18 Jan 2025 08:43:55 -0500 Subject: [PATCH 133/340] emscripten: Let SDL_HINT_EMSCRIPTEN_KEYBOARD_ELEMENT accept "". This is used to say "don't even try to listen for keypresses," for apps that are managing this outside of SDL. Fixes #10292. --- include/SDL3/SDL_hints.h | 1 + src/video/emscripten/SDL_emscriptenevents.c | 16 ++++++++++------ 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/include/SDL3/SDL_hints.h b/include/SDL3/SDL_hints.h index a33b8174c3ef2..7a2938efe8ce5 100644 --- a/include/SDL3/SDL_hints.h +++ b/include/SDL3/SDL_hints.h @@ -730,6 +730,7 @@ extern "C" { * - "#document": the javascript document object * - "#screen": the javascript window.screen object * - "#canvas": the WebGL canvas element + * - "": Don't bind anything at all * - any other string without a leading # sign applies to the element on the * page with that ID. * diff --git a/src/video/emscripten/SDL_emscriptenevents.c b/src/video/emscripten/SDL_emscriptenevents.c index c9437a9412a45..5f2b6bf8d5a8f 100644 --- a/src/video/emscripten/SDL_emscriptenevents.c +++ b/src/video/emscripten/SDL_emscriptenevents.c @@ -1033,9 +1033,11 @@ void Emscripten_RegisterEventHandlers(SDL_WindowData *data) keyElement = EMSCRIPTEN_EVENT_TARGET_WINDOW; } - emscripten_set_keydown_callback(keyElement, data, 0, Emscripten_HandleKey); - emscripten_set_keyup_callback(keyElement, data, 0, Emscripten_HandleKey); - emscripten_set_keypress_callback(keyElement, data, 0, Emscripten_HandleKeyPress); + if (*keyElement) { + emscripten_set_keydown_callback(keyElement, data, 0, Emscripten_HandleKey); + emscripten_set_keyup_callback(keyElement, data, 0, Emscripten_HandleKey); + emscripten_set_keypress_callback(keyElement, data, 0, Emscripten_HandleKeyPress); + } emscripten_set_fullscreenchange_callback(EMSCRIPTEN_EVENT_TARGET_DOCUMENT, data, 0, Emscripten_HandleFullscreenChange); @@ -1092,9 +1094,11 @@ void Emscripten_UnregisterEventHandlers(SDL_WindowData *data) target = EMSCRIPTEN_EVENT_TARGET_WINDOW; } - emscripten_set_keydown_callback(target, NULL, 0, NULL); - emscripten_set_keyup_callback(target, NULL, 0, NULL); - emscripten_set_keypress_callback(target, NULL, 0, NULL); + if (*target) { + emscripten_set_keydown_callback(target, NULL, 0, NULL); + emscripten_set_keyup_callback(target, NULL, 0, NULL); + emscripten_set_keypress_callback(target, NULL, 0, NULL); + } emscripten_set_fullscreenchange_callback(EMSCRIPTEN_EVENT_TARGET_DOCUMENT, NULL, 0, NULL); From 90b7174a7d3879e2be9fd340e6ca860cf92ad4d8 Mon Sep 17 00:00:00 2001 From: Sam Lantinga Date: Sat, 18 Jan 2025 06:07:06 -0800 Subject: [PATCH 134/340] Respect the SDL_BORDERLESS_RESIZABLE_STYLE hint, but default it to true. --- src/video/windows/SDL_windowswindow.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/video/windows/SDL_windowswindow.c b/src/video/windows/SDL_windowswindow.c index ef516c19df2c6..427defb10d18f 100644 --- a/src/video/windows/SDL_windowswindow.c +++ b/src/video/windows/SDL_windowswindow.c @@ -143,6 +143,7 @@ static ATOM SDL_HelperWindowClass = 0; /* For borderless Windows, still want the following flag: - WS_MINIMIZEBOX: window will respond to Windows minimize commands sent to all windows, such as windows key + m, shaking title bar, etc. + - WS_MAXIMIZEBOX: window will respond to Windows maximize commands sent to all windows, and the window will fill the usable desktop area rather than the whole screen Additionally, non-fullscreen windows can add: - WS_CAPTION: this seems to enable the Windows minimize animation - WS_SYSMENU: enables system context menu on task bar @@ -152,8 +153,8 @@ static ATOM SDL_HelperWindowClass = 0; #define STYLE_BASIC (WS_CLIPSIBLINGS | WS_CLIPCHILDREN) #define STYLE_FULLSCREEN (WS_POPUP | WS_MINIMIZEBOX) -#define STYLE_BORDERLESS (WS_POPUP | WS_MINIMIZEBOX | WS_THICKFRAME) -#define STYLE_BORDERLESS_WINDOWED (WS_POPUP | WS_CAPTION | WS_SYSMENU | WS_MINIMIZEBOX | WS_THICKFRAME) +#define STYLE_BORDERLESS (WS_POPUP | WS_MINIMIZEBOX) +#define STYLE_BORDERLESS_WINDOWED (WS_POPUP | WS_CAPTION | WS_SYSMENU | WS_MINIMIZEBOX) #define STYLE_NORMAL (WS_OVERLAPPED | WS_CAPTION | WS_SYSMENU | WS_MINIMIZEBOX) #define STYLE_RESIZABLE (WS_THICKFRAME | WS_MAXIMIZEBOX) #define STYLE_MASK (STYLE_FULLSCREEN | STYLE_BORDERLESS | STYLE_NORMAL | STYLE_RESIZABLE) @@ -189,7 +190,7 @@ static DWORD GetWindowStyle(SDL_Window *window) see https://bugzilla.libsdl.org/show_bug.cgi?id=4466 */ if (!(window->flags & SDL_WINDOW_BORDERLESS) || - SDL_GetHintBoolean("SDL_BORDERLESS_RESIZABLE_STYLE", false)) { + SDL_GetHintBoolean("SDL_BORDERLESS_RESIZABLE_STYLE", true)) { style |= STYLE_RESIZABLE; } else if (window->flags & SDL_WINDOW_BORDERLESS) { /* Even if the resizable style hint isn't set, WS_MAXIMIZEBOX is still needed, or From c603a9c94af20b3a29150a52cace46ef9ebc1786 Mon Sep 17 00:00:00 2001 From: Sam Lantinga Date: Sat, 18 Jan 2025 06:16:10 -0800 Subject: [PATCH 135/340] Moved flag documentation --- src/video/windows/SDL_windowswindow.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/video/windows/SDL_windowswindow.c b/src/video/windows/SDL_windowswindow.c index 427defb10d18f..b3d2d69f23b9f 100644 --- a/src/video/windows/SDL_windowswindow.c +++ b/src/video/windows/SDL_windowswindow.c @@ -143,12 +143,12 @@ static ATOM SDL_HelperWindowClass = 0; /* For borderless Windows, still want the following flag: - WS_MINIMIZEBOX: window will respond to Windows minimize commands sent to all windows, such as windows key + m, shaking title bar, etc. - - WS_MAXIMIZEBOX: window will respond to Windows maximize commands sent to all windows, and the window will fill the usable desktop area rather than the whole screen Additionally, non-fullscreen windows can add: - WS_CAPTION: this seems to enable the Windows minimize animation - WS_SYSMENU: enables system context menu on task bar This will also cause the task bar to overlap the window and other windowed behaviors, so only use this for windows that shouldn't appear to be fullscreen - WS_THICKFRAME: allows hit-testing to resize window (doesn't actually add a frame to a borderless window). + - WS_MAXIMIZEBOX: window will respond to Windows maximize commands sent to all windows, and the window will fill the usable desktop area rather than the whole screen */ #define STYLE_BASIC (WS_CLIPSIBLINGS | WS_CLIPCHILDREN) From 923123a52764f98bf4775b9d103c256ca27cbd95 Mon Sep 17 00:00:00 2001 From: Sam Lantinga Date: Sat, 18 Jan 2025 06:19:27 -0800 Subject: [PATCH 136/340] emscripten: Let SDL_HINT_EMSCRIPTEN_KEYBOARD_ELEMENT accept "#none" This is used to say "don't even try to listen for keypresses," for apps that are managing this outside of SDL. Fixes #10292. --- include/SDL3/SDL_hints.h | 2 +- src/video/emscripten/SDL_emscriptenevents.c | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/include/SDL3/SDL_hints.h b/include/SDL3/SDL_hints.h index 7a2938efe8ce5..994143cc1c496 100644 --- a/include/SDL3/SDL_hints.h +++ b/include/SDL3/SDL_hints.h @@ -730,7 +730,7 @@ extern "C" { * - "#document": the javascript document object * - "#screen": the javascript window.screen object * - "#canvas": the WebGL canvas element - * - "": Don't bind anything at all + * - "#none": Don't bind anything at all * - any other string without a leading # sign applies to the element on the * page with that ID. * diff --git a/src/video/emscripten/SDL_emscriptenevents.c b/src/video/emscripten/SDL_emscriptenevents.c index 5f2b6bf8d5a8f..d4c3dfa030eae 100644 --- a/src/video/emscripten/SDL_emscriptenevents.c +++ b/src/video/emscripten/SDL_emscriptenevents.c @@ -1029,11 +1029,11 @@ void Emscripten_RegisterEventHandlers(SDL_WindowData *data) // Keyboard events are awkward keyElement = SDL_GetHint(SDL_HINT_EMSCRIPTEN_KEYBOARD_ELEMENT); - if (!keyElement) { + if (!keyElement || !*keyElement) { keyElement = EMSCRIPTEN_EVENT_TARGET_WINDOW; } - if (*keyElement) { + if (SDL_strcmp(keyElement, "#none") != 0) { emscripten_set_keydown_callback(keyElement, data, 0, Emscripten_HandleKey); emscripten_set_keyup_callback(keyElement, data, 0, Emscripten_HandleKey); emscripten_set_keypress_callback(keyElement, data, 0, Emscripten_HandleKeyPress); From 08e74d29bece273f9cc669945cc61e2353b1e0f4 Mon Sep 17 00:00:00 2001 From: Sam Lantinga Date: Sat, 18 Jan 2025 06:22:29 -0800 Subject: [PATCH 137/340] Fixed typo --- CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 5a0861d6bf033..46b0b43705097 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -2434,7 +2434,7 @@ elseif(APPLE) if(SDL_FRAMEWORK_GAMECONTROLLER) find_library(GAMECONTROLLER GameController) if(GAMECONTROLLER) - sdl_link_dependency(game_controller LIBS "$" PKG_CONFIG_LINK_OPTIONS "-Wl,-framework,GameController") + sdl_link_dependency(game_controller LIBS "$" PKG_CONFIG_LINK_OPTIONS "-Wl,-framework,GameController") endif() endif() if(SDL_FRAMEWORK_METAL) From 0401b07eea63763a4cb8aa52dd7cafd0b7197703 Mon Sep 17 00:00:00 2001 From: Sam Lantinga Date: Sat, 18 Jan 2025 06:23:14 -0800 Subject: [PATCH 138/340] Fixed typo --- CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 46b0b43705097..8eda4c518adb4 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -2453,7 +2453,7 @@ elseif(APPLE) find_library(COREHAPTICS CoreHaptics) if(COREHAPTICS) # macOS 10.15+ iOS 13.0+ tvOS 14.0+ - sdl_link_dependency(core_haptics LIBS "$" PKG_CONFIG_LINK_OPTIONS "-Wl,-weak_framework,CoreHaptics") + sdl_link_dependency(core_haptics LIBS "$" PKG_CONFIG_LINK_OPTIONS "-Wl,-weak_framework,CoreHaptics") endif() endif() From ad3c7b92f8726816580033fdaeb52933419102b8 Mon Sep 17 00:00:00 2001 From: Sam Lantinga Date: Sat, 18 Jan 2025 06:27:21 -0800 Subject: [PATCH 139/340] xcode+cmake: use SDL3.framework folder as IMPORTED_LOCATION [ci skip] --- Xcode/SDL/pkg-support/resources/cmake/SDL3Config.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Xcode/SDL/pkg-support/resources/cmake/SDL3Config.cmake b/Xcode/SDL/pkg-support/resources/cmake/SDL3Config.cmake index 784d27dbb018c..03673f3f4879f 100644 --- a/Xcode/SDL/pkg-support/resources/cmake/SDL3Config.cmake +++ b/Xcode/SDL/pkg-support/resources/cmake/SDL3Config.cmake @@ -59,7 +59,7 @@ if(NOT TARGET SDL3::SDL3-shared) set_target_properties(SDL3::SDL3-shared PROPERTIES FRAMEWORK "TRUE" - IMPORTED_LOCATION "${_sdl3_framework_path}/SDL3" + IMPORTED_LOCATION "${_sdl3_framework_path}" INTERFACE_LINK_LIBRARIES "SDL3::Headers" COMPATIBLE_INTERFACE_BOOL "SDL3_SHARED" INTERFACE_SDL3_SHARED "ON" From dbe3baeb0fd18a01a9e38c348657d75eabf9a3a3 Mon Sep 17 00:00:00 2001 From: Anonymous Maarten Date: Fri, 17 Jan 2025 20:15:25 +0100 Subject: [PATCH 140/340] release: document using the xcframework with CMake --- Xcode/SDL/pkg-support/resources/INSTALL.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Xcode/SDL/pkg-support/resources/INSTALL.md b/Xcode/SDL/pkg-support/resources/INSTALL.md index 4058e96d174cf..e50e084d3ae35 100644 --- a/Xcode/SDL/pkg-support/resources/INSTALL.md +++ b/Xcode/SDL/pkg-support/resources/INSTALL.md @@ -3,7 +3,9 @@ This package contains SDL built for Xcode, and includes support for macOS, iOS and tvOS. -To use this package, drag SDL3.xcframework into your project. +To use this package in Xcode, drag `SDL3.xcframework` into your project. + +To use this package in a CMake project, copy both `SDL3.xcframework` and `share` to `~/Library/Frameworks`. # Documentation From c7d1fd90eadf3d015d259625c7afec7aeb3a9731 Mon Sep 17 00:00:00 2001 From: Sam Lantinga Date: Sat, 18 Jan 2025 07:05:55 -0800 Subject: [PATCH 141/340] Added support for the 8BitDo Ultimate 2C Wireless in Bluetooth mode Closes https://github.com/libsdl-org/SDL/pull/11415 --- src/joystick/SDL_gamepad_db.h | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/joystick/SDL_gamepad_db.h b/src/joystick/SDL_gamepad_db.h index 0febbd84645cd..834c737eed799 100644 --- a/src/joystick/SDL_gamepad_db.h +++ b/src/joystick/SDL_gamepad_db.h @@ -68,6 +68,7 @@ static const char *s_GamepadMappings[] = { "03000000c82d00000160000000000000,8BitDo SN30 Pro,crc:fa59,a:b1,b:b0,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b6,leftstick:b13,lefttrigger:b8,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b14,righttrigger:b9,rightx:a3,righty:a4,start:b11,x:b4,y:b3,hint:!SDL_GAMECONTROLLER_USE_BUTTON_LABELS:=1,", /* Firmware v1.26, USB */ "03000000c82d00000161000000000000,8BitDo SN30 Pro,crc:190b,a:b1,b:b0,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,guide:b2,leftshoulder:b6,leftstick:b13,lefttrigger:b8,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b14,righttrigger:b9,rightx:a3,righty:a4,start:b11,x:b4,y:b3,hint:!SDL_GAMECONTROLLER_USE_BUTTON_LABELS:=1,", /* Bluetooth, firmware v1.26 uses b2 for guide, firmware v2.00 uses b12 for guide */ "030000003512000020ab000000000000,8BitDo SNES30 Gamepad,a:b1,b:b0,back:b10,dpdown:+a1,dpleft:-a0,dpright:+a0,dpup:-a1,leftshoulder:b6,rightshoulder:b7,start:b11,x:b4,y:b3,hint:!SDL_GAMECONTROLLER_USE_BUTTON_LABELS:=1,", + "03000000c82d00001b30000000000000,8BitDo Ultimate 2C Wireless,a:b0,b:b1,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b6,leftstick:b13,lefttrigger:b8,leftx:a0,lefty:a2,paddle1:b5,paddle2:b2,rightshoulder:b7,rightstick:b14,righttrigger:b9,rightx:a3,righty:a5,start:b11,x:b3,y:b4,", /* Bluetooth */ "03000000c82d00001130000000000000,8BitDo Ultimate Wired Controller,a:b0,b:b1,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b6,leftstick:b13,lefttrigger:b8,leftx:a0,lefty:a1,misc1:b26,paddle1:b24,paddle2:b25,rightshoulder:b7,rightstick:b14,righttrigger:b9,rightx:a3,righty:a4,start:b11,x:b3,y:b4,", "03000000c82d00001330000000000000,8BitDo Ultimate Wireless Controller,a:b0,b:b1,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b6,leftstick:b13,lefttrigger:b8,leftx:a0,lefty:a1,misc1:b26,paddle1:b23,paddle2:b19,rightshoulder:b7,rightstick:b14,righttrigger:b9,rightx:a3,righty:a4,start:b11,x:b3,y:b4,", "03000000c82d00001890000000000000,8BitDo Zero 2,a:b1,b:b0,back:b10,leftshoulder:b6,leftx:a0,lefty:a1,rightshoulder:b7,start:b11,x:b4,y:b3,hint:!SDL_GAMECONTROLLER_USE_BUTTON_LABELS:=1,", @@ -360,6 +361,7 @@ static const char *s_GamepadMappings[] = { "03000000c82d00000260000001000000,8BitDo SN30 Pro+,a:b1,b:b0,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b2,leftshoulder:b6,leftstick:b13,lefttrigger:b8,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b14,righttrigger:b9,rightx:a2,righty:a3,start:b11,x:b4,y:b3,hint:!SDL_GAMECONTROLLER_USE_BUTTON_LABELS:=1,", "03000000c82d00000261000000010000,8BitDo SN30 Pro+,a:b1,b:b0,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b2,leftshoulder:b6,leftstick:b13,lefttrigger:b8,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b14,righttrigger:b9,rightx:a2,righty:a3,start:b11,x:b4,y:b3,hint:!SDL_GAMECONTROLLER_USE_BUTTON_LABELS:=1,", "03000000c82d00000160000001000000,8BitDo SN30 Pro,a:b1,b:b0,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b6,leftstick:b13,lefttrigger:a4,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b14,righttrigger:a5,rightx:a2,righty:a3,start:b11,x:b4,y:b3,hint:!SDL_GAMECONTROLLER_USE_BUTTON_LABELS:=1,", + "03000000c82d00001b30000001000000,8BitDo Ultimate 2C Wireless,a:b0,b:b1,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b6,leftstick:b13,lefttrigger:a5,leftx:a0,lefty:a1,paddle1:b2,paddle2:b5,rightshoulder:b7,rightstick:b14,righttrigger:a4,rightx:a2,righty:a3,start:b11,x:b3,y:b4,", /* Bluetooth */ "03000000c82d00001130000000020000,8BitDo Ultimate Wired Controller,a:b0,b:b1,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b6,leftstick:b13,lefttrigger:a5,leftx:a0,lefty:a1,misc1:b26,paddle1:b24,paddle2:b25,rightshoulder:b7,rightstick:b14,righttrigger:a4,rightx:a2,righty:a3,start:b11,x:b3,y:b4,", "03000000c82d00001330000000020000,8BitDo Ultimate Wireless Controller,a:b0,b:b1,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b6,leftstick:b13,lefttrigger:a5,leftx:a0,lefty:a1,misc1:b26,paddle1:b23,paddle2:b19,rightshoulder:b7,rightstick:b14,righttrigger:a4,rightx:a2,righty:a3,start:b11,x:b3,y:b4,", "03000000c82d00001890000001000000,8BitDo Zero 2,a:b1,b:b0,back:b10,leftshoulder:b6,leftx:a0,lefty:a1,rightshoulder:b7,start:b11,x:b4,y:b3,hint:!SDL_GAMECONTROLLER_USE_BUTTON_LABELS:=1,", @@ -503,6 +505,7 @@ static const char *s_GamepadMappings[] = { "03000000c82d00000160000011010000,8BitDo SN30 Pro,a:b1,b:b0,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b6,leftstick:b13,lefttrigger:a4,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b14,righttrigger:a5,rightx:a2,righty:a3,start:b11,x:b4,y:b3,hint:!SDL_GAMECONTROLLER_USE_BUTTON_LABELS:=1,", "030000003512000020ab000010010000,8BitDo SNES30 Gamepad,a:b1,b:b0,back:b10,dpdown:+a1,dpleft:-a0,dpright:+a0,dpup:-a1,leftshoulder:b6,rightshoulder:b7,start:b11,x:b4,y:b3,hint:!SDL_GAMECONTROLLER_USE_BUTTON_LABELS:=1,", "05000000202800000900000000010000,8BitDo SNES30 Gamepad,a:b1,b:b0,back:b10,dpdown:b122,dpleft:b119,dpright:b120,dpup:b117,leftshoulder:b6,rightshoulder:b7,start:b11,x:b4,y:b3,hint:!SDL_GAMECONTROLLER_USE_BUTTON_LABELS:=1,", + "05000000c82d00001b30000001000000,8BitDo Ultimate 2C Wireless,a:b0,b:b1,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b6,leftstick:b13,lefttrigger:a5,leftx:a0,lefty:a1,paddle1:b5,paddle2:b2,rightshoulder:b7,rightstick:b14,righttrigger:a4,rightx:a2,righty:a3,start:b11,x:b3,y:b4,", /* Bluetooth */ "03000000c82d00001130000011010000,8BitDo Ultimate Wired Controller,a:b0,b:b1,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b6,leftstick:b13,lefttrigger:a5,leftx:a0,lefty:a1,misc1:b26,paddle1:b24,paddle2:b25,rightshoulder:b7,rightstick:b14,righttrigger:a4,rightx:a2,righty:a3,start:b11,x:b3,y:b4,", "03000000c82d00001330000011010000,8BitDo Ultimate Wireless Controller,a:b0,b:b1,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b6,leftstick:b13,lefttrigger:a5,leftx:a0,lefty:a1,misc1:b26,paddle1:b23,paddle2:b19,rightshoulder:b7,rightstick:b14,righttrigger:a4,rightx:a2,righty:a3,start:b11,x:b3,y:b4,", "03000000c82d00001890000011010000,8BitDo Zero 2,a:b1,b:b0,back:b10,leftshoulder:b6,leftx:a0,lefty:a1,rightshoulder:b7,start:b11,x:b4,y:b3,hint:!SDL_GAMECONTROLLER_USE_BUTTON_LABELS:=1,", From 75317dae590a5718378d155509fd3528a1615231 Mon Sep 17 00:00:00 2001 From: "Ryan C. Gordon" Date: Sat, 18 Jan 2025 10:10:55 -0500 Subject: [PATCH 142/340] include: Added category docs for SDL_mouse.h Reference Issue #11847. --- include/SDL3/SDL_mouse.h | 31 ++++++++++++++++++++++++++++++- 1 file changed, 30 insertions(+), 1 deletion(-) diff --git a/include/SDL3/SDL_mouse.h b/include/SDL3/SDL_mouse.h index d7b87fd881eef..a50a2609d1ed7 100644 --- a/include/SDL3/SDL_mouse.h +++ b/include/SDL3/SDL_mouse.h @@ -22,7 +22,36 @@ /** * # CategoryMouse * - * SDL mouse handling. + * Any GUI application has to deal with the mouse, and SDL provides functions + * to manage mouse input and the displayed cursor. + * + * Most interactions with the mouse will come through the event subsystem. + * Moving a mouse generates an SDL_EVENT_MOUSE_MOTION event, pushing a button + * generates SDL_EVENT_MOUSE_BUTTON_DOWN, etc, but one can also query the + * current state of the mouse at any time with SDL_GetMouseState(). + * + * For certain games, it's useful to disassociate the mouse cursor from mouse + * input. An FPS, for example, would not want the player's motion to stop as + * the mouse hits the edge of the window. For these scenarios, use + * SDL_SetWindowRelativeMouseMode(), which hides the cursor, grabs mouse input + * to the window, and reads mouse input no matter how far it moves. + * + * Games that want the system to track the mouse but want to draw their own + * cursor can use SDL_HideCursor() and SDL_ShowCursor(). It might be more + * efficient to let the system manage the cursor, if possible, using + * SDL_SetCursor() with a custom image made through SDL_CreateColorCursor(), + * or perhaps just a specific system cursor from SDL_CreateSystemCursor(). + * + * SDL can, on many platforms, differentiate between multiple connected mice, + * allowing for interesting input scenarios and multiplayer games. They can + * be enumerated with SDL_GetMice(), and SDL will send SDL_EVENT_MOUSE_ADDED + * and SDL_EVENT_MOUSE_REMOVED events as they are connected and unplugged. + * + * Since many apps only care about basic mouse input, SDL offers a virtual + * mouse device for touch and pen input, which often can make a desktop + * application work on a touchscreen phone without any code changes. Apps that + * care about touch/pen separately from mouse input should filter out + * events with a `which` field of SDL_TOUCH_MOUSEID/SDL_PEN_MOUSEID. */ #ifndef SDL_mouse_h_ From e054f3c0857678efb9c2d0eb4d29b8c6c83365ba Mon Sep 17 00:00:00 2001 From: SDL Wiki Bot Date: Sat, 18 Jan 2025 15:12:47 +0000 Subject: [PATCH 143/340] Sync SDL3 wiki -> header [ci skip] --- include/SDL3/SDL_mouse.h | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/include/SDL3/SDL_mouse.h b/include/SDL3/SDL_mouse.h index a50a2609d1ed7..d0ec3e6ccd634 100644 --- a/include/SDL3/SDL_mouse.h +++ b/include/SDL3/SDL_mouse.h @@ -43,15 +43,15 @@ * or perhaps just a specific system cursor from SDL_CreateSystemCursor(). * * SDL can, on many platforms, differentiate between multiple connected mice, - * allowing for interesting input scenarios and multiplayer games. They can - * be enumerated with SDL_GetMice(), and SDL will send SDL_EVENT_MOUSE_ADDED - * and SDL_EVENT_MOUSE_REMOVED events as they are connected and unplugged. + * allowing for interesting input scenarios and multiplayer games. They can be + * enumerated with SDL_GetMice(), and SDL will send SDL_EVENT_MOUSE_ADDED and + * SDL_EVENT_MOUSE_REMOVED events as they are connected and unplugged. * * Since many apps only care about basic mouse input, SDL offers a virtual * mouse device for touch and pen input, which often can make a desktop * application work on a touchscreen phone without any code changes. Apps that - * care about touch/pen separately from mouse input should filter out - * events with a `which` field of SDL_TOUCH_MOUSEID/SDL_PEN_MOUSEID. + * care about touch/pen separately from mouse input should filter out events + * with a `which` field of SDL_TOUCH_MOUSEID/SDL_PEN_MOUSEID. */ #ifndef SDL_mouse_h_ From 1d7a681e4dc7a2d7a2ac335c5c779881994985ba Mon Sep 17 00:00:00 2001 From: "Ryan C. Gordon" Date: Sat, 18 Jan 2025 10:14:23 -0500 Subject: [PATCH 144/340] Revert "emscripten: resizable windows take whole page, resize with browser window." This reverts commit d317fc9c080a233b24982f99197c20ff653882c3. This has some issues, we'll revisit it for 3.4.0. Reference Issue #11949. --- src/video/emscripten/SDL_emscriptenevents.c | 9 +- src/video/emscripten/SDL_emscriptenvideo.c | 92 +++++++-------------- 2 files changed, 38 insertions(+), 63 deletions(-) diff --git a/src/video/emscripten/SDL_emscriptenevents.c b/src/video/emscripten/SDL_emscriptenevents.c index d4c3dfa030eae..de9ec57ac8948 100644 --- a/src/video/emscripten/SDL_emscriptenevents.c +++ b/src/video/emscripten/SDL_emscriptenevents.c @@ -624,9 +624,14 @@ static EM_BOOL Emscripten_HandleResize(int eventType, const EmscriptenUiEvent *u } if (!(window_data->window->flags & SDL_WINDOW_FULLSCREEN)) { + // this will only work if the canvas size is set through css if (window_data->window->flags & SDL_WINDOW_RESIZABLE) { - const double w = (double) uiEvent->windowInnerWidth; - const double h = (double) uiEvent->windowInnerHeight; + double w = window_data->window->w; + double h = window_data->window->h; + + if (window_data->external_size) { + emscripten_get_element_css_size(window_data->canvas_id, &w, &h); + } emscripten_set_canvas_element_size(window_data->canvas_id, SDL_lroundf(w * window_data->pixel_ratio), SDL_lroundf(h * window_data->pixel_ratio)); diff --git a/src/video/emscripten/SDL_emscriptenvideo.c b/src/video/emscripten/SDL_emscriptenvideo.c index 91c954874b673..413d96fc6089a 100644 --- a/src/video/emscripten/SDL_emscriptenvideo.c +++ b/src/video/emscripten/SDL_emscriptenvideo.c @@ -47,7 +47,6 @@ static void Emscripten_DestroyWindow(SDL_VideoDevice *_this, SDL_Window *window) static SDL_FullscreenResult Emscripten_SetWindowFullscreen(SDL_VideoDevice *_this, SDL_Window *window, SDL_VideoDisplay *display, SDL_FullscreenOp fullscreen); static void Emscripten_PumpEvents(SDL_VideoDevice *_this); static void Emscripten_SetWindowTitle(SDL_VideoDevice *_this, SDL_Window *window); -static void Emscripten_SetWindowResizable(SDL_VideoDevice *_this, SDL_Window *window, bool resizable); static bool pumpevents_has_run = false; static int pending_swap_interval = -1; @@ -157,7 +156,6 @@ static SDL_VideoDevice *Emscripten_CreateDevice(void) device->CreateSDLWindow = Emscripten_CreateWindow; device->SetWindowTitle = Emscripten_SetWindowTitle; - device->SetWindowResizable = Emscripten_SetWindowResizable; /*device->SetWindowIcon = Emscripten_SetWindowIcon; device->SetWindowPosition = Emscripten_SetWindowPosition;*/ device->SetWindowSize = Emscripten_SetWindowSize; @@ -283,6 +281,8 @@ EMSCRIPTEN_KEEPALIVE void requestFullscreenThroughSDL(SDL_Window *window) static bool Emscripten_CreateWindow(SDL_VideoDevice *_this, SDL_Window *window, SDL_PropertiesID props) { SDL_WindowData *wdata; + double scaled_w, scaled_h; + double css_w, css_h; const char *selector; // Allocate window internal data @@ -304,20 +304,44 @@ static bool Emscripten_CreateWindow(SDL_VideoDevice *_this, SDL_Window *window, wdata->pixel_ratio = 1.0f; } + scaled_w = SDL_floor(window->w * wdata->pixel_ratio); + scaled_h = SDL_floor(window->h * wdata->pixel_ratio); + + // set a fake size to check if there is any CSS sizing the canvas + emscripten_set_canvas_element_size(wdata->canvas_id, 1, 1); + emscripten_get_element_css_size(wdata->canvas_id, &css_w, &css_h); + + wdata->external_size = SDL_floor(css_w) != 1 || SDL_floor(css_h) != 1; + + if ((window->flags & SDL_WINDOW_RESIZABLE) && wdata->external_size) { + // external css has resized us + scaled_w = css_w * wdata->pixel_ratio; + scaled_h = css_h * wdata->pixel_ratio; + + SDL_SendWindowEvent(window, SDL_EVENT_WINDOW_RESIZED, SDL_lroundf(css_w), SDL_lroundf(css_h)); + } + emscripten_set_canvas_element_size(wdata->canvas_id, SDL_lroundf(scaled_w), SDL_lroundf(scaled_h)); + + // if the size is not being controlled by css, we need to scale down for hidpi + if (!wdata->external_size) { + if (wdata->pixel_ratio != 1.0f) { + // scale canvas down + emscripten_set_element_css_size(wdata->canvas_id, window->w, window->h); + } + } + wdata->window = window; // Setup driver data for this window window->internal = wdata; - Emscripten_SetWindowResizable(_this, window, (window->flags & SDL_WINDOW_RESIZABLE) != 0); - // One window, it always has focus SDL_SetMouseFocus(window); SDL_SetKeyboardFocus(window); Emscripten_RegisterEventHandlers(wdata); - // Make the emscripten "fullscreen" button go through SDL. + // disable the emscripten "fullscreen" button. MAIN_THREAD_EM_ASM({ Module['requestFullscreen'] = function(lockPointer, resizeCanvas) { _requestFullscreenThroughSDL($0); @@ -330,12 +354,10 @@ static bool Emscripten_CreateWindow(SDL_VideoDevice *_this, SDL_Window *window, static void Emscripten_SetWindowSize(SDL_VideoDevice *_this, SDL_Window *window) { - if ((window->flags & SDL_WINDOW_RESIZABLE) == 0) { - return; // canvas size is being dictated by the browser window size, refuse request. - } + SDL_WindowData *data; if (window->internal) { - SDL_WindowData *data = window->internal; + data = window->internal; // update pixel ratio if (window->flags & SDL_WINDOW_HIGH_PIXEL_DENSITY) { data->pixel_ratio = emscripten_get_device_pixel_ratio(); @@ -433,56 +455,4 @@ static void Emscripten_SetWindowTitle(SDL_VideoDevice *_this, SDL_Window *window emscripten_set_window_title(window->title); } -static void Emscripten_SetWindowResizable(SDL_VideoDevice *_this, SDL_Window *window, bool resizable) -{ - SDL_WindowData *wdata = window->internal; - double scaled_w = SDL_floor(window->w * wdata->pixel_ratio); - double scaled_h = SDL_floor(window->h * wdata->pixel_ratio); - double css_w, css_h; - - // set a fake size to check if there is any CSS sizing the canvas - emscripten_set_canvas_element_size(wdata->canvas_id, 1, 1); - emscripten_get_element_css_size(wdata->canvas_id, &css_w, &css_h); - - wdata->external_size = SDL_floor(css_w) != 1 || SDL_floor(css_h) != 1; - if (wdata->external_size) { - window->flags &= ~SDL_WINDOW_RESIZABLE; // can't be resizable if something else is controlling it. - } - - // SDL_WINDOW_RESIZABLE takes up the entire page and resizes as the browser window resizes. - if (window->flags & SDL_WINDOW_RESIZABLE) { - const double w = (double) MAIN_THREAD_EM_ASM_INT({ return window.innerWidth; }); - const double h = (double) MAIN_THREAD_EM_ASM_INT({ return window.innerHeight; }); - - scaled_w = w * wdata->pixel_ratio; - scaled_h = h * wdata->pixel_ratio; - - MAIN_THREAD_EM_ASM({ - var canvas = document.querySelector(UTF8ToString($0)); - canvas.style.position = 'absolute'; - canvas.style.top = '0'; - canvas.style.right = '0'; - }, wdata->canvas_id); - - SDL_SendWindowEvent(window, SDL_EVENT_WINDOW_RESIZED, SDL_lroundf(scaled_w), SDL_lroundf(scaled_h)); - } else { - MAIN_THREAD_EM_ASM({ - var canvas = document.querySelector(UTF8ToString($0)); - canvas.style.position = undefined; - canvas.style.top = undefined; - canvas.style.right = undefined; - }, wdata->canvas_id); - } - - emscripten_set_canvas_element_size(wdata->canvas_id, SDL_lroundf(scaled_w), SDL_lroundf(scaled_h)); - - // if the size is not being controlled by css, we need to scale down for hidpi - if (!wdata->external_size) { - if (wdata->pixel_ratio != 1.0f) { - // scale canvas down - emscripten_set_element_css_size(wdata->canvas_id, window->w, window->h); - } - } -} - #endif // SDL_VIDEO_DRIVER_EMSCRIPTEN From cd0db8d35eec317f702d43f72a58a9f93646420a Mon Sep 17 00:00:00 2001 From: Sam Lantinga Date: Sat, 18 Jan 2025 08:09:25 -0800 Subject: [PATCH 145/340] Added Linux evdev mappings for the Wireless HORIPAD For Steam --- src/joystick/SDL_gamepad_db.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/joystick/SDL_gamepad_db.h b/src/joystick/SDL_gamepad_db.h index 834c737eed799..417eb6c4d888e 100644 --- a/src/joystick/SDL_gamepad_db.h +++ b/src/joystick/SDL_gamepad_db.h @@ -767,6 +767,8 @@ static const char *s_GamepadMappings[] = { "05000000ac0500003232000001000000,VR-BOX,a:b0,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b6,leftstick:b10,lefttrigger:b4,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b11,righttrigger:b5,rightx:a3,righty:a2,start:b9,x:b2,y:b3,", "030000006f0e00000302000011010000,Victrix Pro Fight Stick for PS4,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,lefttrigger:b6,rightshoulder:b5,righttrigger:b7,start:b9,x:b0,y:b3,", "030000006f0e00000702000011010000,Victrix Pro Fight Stick for PS4,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,rightshoulder:b5,righttrigger:b7,start:b9,x:b0,y:b3,", + "030000000d0f0000ab01000011010000,Wireless HORIPAD For Steam,a:b0,b:b1,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b6,leftstick:b13,lefttrigger:a5,leftx:a0,lefty:a1,misc2:b2,misc3:b16,misc4:b17,paddle1:b19,paddle2:b18,paddle3:b15,paddle4:b5,rightshoulder:b7,rightstick:b14,righttrigger:a4,rightx:a2,righty:a3,start:b11,x:b3,y:b4,", + "050000000d0f00009601000091000000,Wireless HORIPAD For Steam,a:b0,b:b1,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b6,leftstick:b13,lefttrigger:a5,leftx:a0,lefty:a1,misc2:b2,misc3:b16,misc4:b17,paddle1:b19,paddle2:b18,paddle3:b15,paddle4:b5,rightshoulder:b7,rightstick:b14,righttrigger:a4,rightx:a2,righty:a3,start:b11,x:b3,y:b4,", "030000005e0400008e02000010010000,X360 Controller,a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b10,righttrigger:a5,rightx:a3,righty:a4,start:b7,x:b2,y:b3,", "030000005e0400008e02000014010000,X360 Controller,a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b10,righttrigger:a5,rightx:a3,righty:a4,start:b7,x:b2,y:b3,", "030000005e0400001907000000010000,X360 Wireless Controller,a:b0,b:b1,back:b6,dpdown:b14,dpleft:b11,dpright:b12,dpup:b13,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b10,righttrigger:a5,rightx:a3,righty:a4,start:b7,x:b2,y:b3,", From 42e0fb10f815c7f37191eab056893bd81575ea09 Mon Sep 17 00:00:00 2001 From: Frank Praznik Date: Sat, 18 Jan 2025 11:59:51 -0500 Subject: [PATCH 146/340] wayland: Set the mouse state before calling the hit test callback Update the mouse state before entering the hit test, in case the global state is queried, or the system menu opened, while in the client hit testing callback. --- src/video/wayland/SDL_waylandevents.c | 22 ++++++++++------------ src/video/wayland/SDL_waylandevents_c.h | 2 +- src/video/wayland/SDL_waylandmouse.c | 3 ++- 3 files changed, 13 insertions(+), 14 deletions(-) diff --git a/src/video/wayland/SDL_waylandevents.c b/src/video/wayland/SDL_waylandevents.c index 03982fbad4109..c6260b863bfb9 100644 --- a/src/video/wayland/SDL_waylandevents.c +++ b/src/video/wayland/SDL_waylandevents.c @@ -597,6 +597,7 @@ static void pointer_handle_leave(void *data, struct wl_pointer *pointer, // Clear the capture flag and raise all buttons wind->sdlwindow->flags &= ~SDL_WINDOW_MOUSE_CAPTURE; + input->buttons_pressed = 0; SDL_SendMouseButton(Wayland_GetPointerTimestamp(input, 0), wind->sdlwindow, input->pointer_id, SDL_BUTTON_LEFT, false); SDL_SendMouseButton(Wayland_GetPointerTimestamp(input, 0), wind->sdlwindow, input->pointer_id, SDL_BUTTON_RIGHT, false); SDL_SendMouseButton(Wayland_GetPointerTimestamp(input, 0), wind->sdlwindow, input->pointer_id, SDL_BUTTON_MIDDLE, false); @@ -604,7 +605,6 @@ static void pointer_handle_leave(void *data, struct wl_pointer *pointer, SDL_SendMouseButton(Wayland_GetPointerTimestamp(input, 0), wind->sdlwindow, input->pointer_id, SDL_BUTTON_X2, false); } - /* A pointer leave event may be emitted if the compositor hides the pointer in response to receiving a touch event. * Don't relinquish focus if the surface has active touches, as the compositor is just transitioning from mouse to touch mode. */ @@ -728,6 +728,13 @@ static void pointer_handle_button_common(struct SDL_WaylandInput *input, uint32_ SDL_VideoData *viddata = window->waylandData; bool ignore_click = false; + if (state) { + Wayland_UpdateImplicitGrabSerial(input, serial); + input->buttons_pressed |= SDL_BUTTON_MASK(sdl_button); + } else { + input->buttons_pressed &= ~(SDL_BUTTON_MASK(sdl_button)); + } + if (sdl_button == SDL_BUTTON_LEFT && ProcessHitTest(input->pointer_focus, input->seat, input->sx_w, input->sy_w, serial)) { return; // don't pass this event on to app. @@ -747,14 +754,9 @@ static void pointer_handle_button_common(struct SDL_WaylandInput *input, uint32_ * the mouse outside the window if you drag outside of it, until you let go * of all buttons (even if you add or remove presses outside the window, as * long as any button is still down, the capture remains). + * + * The mouse is not captured in relative mode. */ - if (state) { // update our mask of currently-pressed buttons - input->buttons_pressed |= SDL_BUTTON_MASK(sdl_button); - } else { - input->buttons_pressed &= ~(SDL_BUTTON_MASK(sdl_button)); - } - - // Don't modify the capture flag in relative mode. if (!viddata->relative_mouse_mode) { if (input->buttons_pressed != 0) { window->sdlwindow->flags |= SDL_WINDOW_MOUSE_CAPTURE; @@ -763,10 +765,6 @@ static void pointer_handle_button_common(struct SDL_WaylandInput *input, uint32_ } } - if (state) { - Wayland_UpdateImplicitGrabSerial(input, serial); - } - if (!ignore_click) { SDL_SendMouseButton(timestamp, window->sdlwindow, input->pointer_id, sdl_button, down); } diff --git a/src/video/wayland/SDL_waylandevents_c.h b/src/video/wayland/SDL_waylandevents_c.h index 2f11fe5087df6..6158882ac5b66 100644 --- a/src/video/wayland/SDL_waylandevents_c.h +++ b/src/video/wayland/SDL_waylandevents_c.h @@ -94,7 +94,7 @@ struct SDL_WaylandInput wl_fixed_t sx_w; wl_fixed_t sy_w; - uint32_t buttons_pressed; + SDL_MouseButtonFlags buttons_pressed; // The serial of the last implicit grab event for window activation and selection data. Uint32 last_implicit_grab_serial; diff --git a/src/video/wayland/SDL_waylandmouse.c b/src/video/wayland/SDL_waylandmouse.c index f8827cc089c4b..968cb6f0ffdfe 100644 --- a/src/video/wayland/SDL_waylandmouse.c +++ b/src/video/wayland/SDL_waylandmouse.c @@ -892,9 +892,10 @@ static SDL_MouseButtonFlags SDLCALL Wayland_GetGlobalMouseState(float *x, float SDL_MouseButtonFlags result = 0; if (focus) { + SDL_VideoData *viddata = SDL_GetVideoDevice()->internal; int off_x, off_y; - result = SDL_GetMouseState(x, y); + result = viddata->input->buttons_pressed; SDL_RelativeToGlobalForWindow(focus, focus->x, focus->y, &off_x, &off_y); *x += off_x; *y += off_y; From ba95c54f9983f143623ae8b3d022556b3723cc59 Mon Sep 17 00:00:00 2001 From: Sam Lantinga Date: Sat, 18 Jan 2025 09:38:15 -0800 Subject: [PATCH 147/340] macOS: get the correct display name on macOS 10.15+ --- src/video/cocoa/SDL_cocoamodes.m | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/video/cocoa/SDL_cocoamodes.m b/src/video/cocoa/SDL_cocoamodes.m index 4fd245a21f683..7de75729c1746 100644 --- a/src/video/cocoa/SDL_cocoamodes.m +++ b/src/video/cocoa/SDL_cocoamodes.m @@ -283,6 +283,16 @@ static bool GetDisplayMode(CGDisplayModeRef vidmode, bool vidmodeCurrent, CFArra static char *Cocoa_GetDisplayName(CGDirectDisplayID displayID) { + if (@available(macOS 10.15, *)) { + NSScreen *screen = GetNSScreenForDisplayID(displayID); + if (screen) { + const char *name = [screen.localizedName UTF8String]; + if (name) { + return SDL_strdup(name); + } + } + } + // This API is deprecated in 10.9 with no good replacement (as of 10.15). io_service_t servicePort = CGDisplayIOServicePort(displayID); CFDictionaryRef deviceInfo = IODisplayCreateInfoDictionary(servicePort, kIODisplayOnlyPreferredName); From b79ada6aa584f16b3f9f2c3d542570505100bae4 Mon Sep 17 00:00:00 2001 From: Semphris Date: Thu, 16 Jan 2025 21:51:38 -0500 Subject: [PATCH 148/340] Windows trays: Fix ParentEntry & Enabling The test/testtray program would crash on Windows when adding any item and then removing it, because a submenu's parent_entry field was not set. Additionally, I noticed that some extraneous code copied from the {G,S}etTrayEntryChecked made {G,S}etTrayEntryEnabled work only for checkboxes, which is not the desired behavior. Both issues were fixed in this commit. --- src/tray/windows/SDL_tray.c | 11 +---------- 1 file changed, 1 insertion(+), 10 deletions(-) diff --git a/src/tray/windows/SDL_tray.c b/src/tray/windows/SDL_tray.c index f5eb6da261571..88a35a7ec499e 100644 --- a/src/tray/windows/SDL_tray.c +++ b/src/tray/windows/SDL_tray.c @@ -420,6 +420,7 @@ SDL_TrayEntry *SDL_InsertTrayEntryAt(SDL_TrayMenu *menu, int pos, const char *la entry->submenu->hMenu = CreatePopupMenu(); entry->submenu->nEntries = 0; entry->submenu->entries = NULL; + entry->submenu->parent_entry = entry; entry->id = (UINT_PTR) entry->submenu->hMenu; } else { @@ -528,21 +529,11 @@ bool SDL_GetTrayEntryChecked(SDL_TrayEntry *entry) void SDL_SetTrayEntryEnabled(SDL_TrayEntry *entry, bool enabled) { - if (!(entry->flags & SDL_TRAYENTRY_CHECKBOX)) { - SDL_SetError("Cannot update check for entry not created with SDL_TRAYENTRY_CHECKBOX"); - return; - } - EnableMenuItem(entry->parent->hMenu, (UINT) entry->id, MF_BYCOMMAND | (enabled ? MF_ENABLED : (MF_DISABLED | MF_GRAYED))); } bool SDL_GetTrayEntryEnabled(SDL_TrayEntry *entry) { - if (!(entry->flags & SDL_TRAYENTRY_CHECKBOX)) { - SDL_SetError("Cannot fetch check for entry not created with SDL_TRAYENTRY_CHECKBOX"); - return false; - } - MENUITEMINFOW mii; mii.cbSize = sizeof(MENUITEMINFOW); mii.fMask = MIIM_STATE; From 354d2c390c6ec0be661fc146eca98aad6c910261 Mon Sep 17 00:00:00 2001 From: Semphris Date: Thu, 16 Jan 2025 22:07:57 -0500 Subject: [PATCH 149/340] Initialize invalid parent_{tray,entry} to NULL The API states that the related functions must return NULL if the function called (get the parent tray, or get the parent entry) is invalid for this menu. Initialising the fields to NULL makes that API correct for Windows. --- src/tray/windows/SDL_tray.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/tray/windows/SDL_tray.c b/src/tray/windows/SDL_tray.c index 88a35a7ec499e..256f3436e5e27 100644 --- a/src/tray/windows/SDL_tray.c +++ b/src/tray/windows/SDL_tray.c @@ -304,6 +304,7 @@ SDL_TrayMenu *SDL_CreateTrayMenu(SDL_Tray *tray) tray->menu->hMenu = CreatePopupMenu(); tray->menu->parent_tray = tray; + tray->menu->parent_entry = NULL; return tray->menu; } @@ -395,6 +396,8 @@ SDL_TrayEntry *SDL_InsertTrayEntryAt(SDL_TrayMenu *menu, int pos, const char *la return NULL; } + SDL_memset((void *) entry, 0, sizeof(*entry)); + wchar_t *label_w = NULL; if (label && (label_w = escape_label(label)) == NULL) { @@ -417,10 +420,13 @@ SDL_TrayEntry *SDL_InsertTrayEntryAt(SDL_TrayMenu *menu, int pos, const char *la return NULL; } + SDL_memset((void *) entry->submenu, 0, sizeof(*entry->submenu)); + entry->submenu->hMenu = CreatePopupMenu(); entry->submenu->nEntries = 0; entry->submenu->entries = NULL; entry->submenu->parent_entry = entry; + entry->submenu->parent_tray = NULL; entry->id = (UINT_PTR) entry->submenu->hMenu; } else { From 049a8f0e524c0e426ac5e778888b279005299358 Mon Sep 17 00:00:00 2001 From: Sam Lantinga Date: Sat, 18 Jan 2025 13:41:23 -0800 Subject: [PATCH 150/340] Use SDL_calloc() instead of SDL_malloc() This automatically initializes memory to zero so you don't have uninitialized memory bugs --- src/tray/unix/SDL_tray.c | 10 ++++------ src/tray/windows/SDL_tray.c | 14 ++++---------- 2 files changed, 8 insertions(+), 16 deletions(-) diff --git a/src/tray/unix/SDL_tray.c b/src/tray/unix/SDL_tray.c index 39deab4e5db64..e1bd27c095a02 100644 --- a/src/tray/unix/SDL_tray.c +++ b/src/tray/unix/SDL_tray.c @@ -407,12 +407,11 @@ SDL_Tray *SDL_CreateTray(SDL_Surface *icon, const char *tooltip) gtk_thread_active = true; } - SDL_Tray *tray = (SDL_Tray *)SDL_malloc(sizeof(*tray)); + SDL_Tray *tray = (SDL_Tray *)SDL_calloc(1, sizeof(*tray)); if (!tray) { return NULL; } - SDL_memset((void *) tray, 0, sizeof(*tray)); /* On success, g_mkdtemp edits its argument in-place to replace the Xs * with a random directory name, which it creates safely and atomically. * On failure, it sets errno. */ @@ -464,7 +463,7 @@ void SDL_SetTrayTooltip(SDL_Tray *tray, const char *tooltip) SDL_TrayMenu *SDL_CreateTrayMenu(SDL_Tray *tray) { - tray->menu = (SDL_TrayMenu *)SDL_malloc(sizeof(*tray->menu)); + tray->menu = (SDL_TrayMenu *)SDL_calloc(1, sizeof(*tray->menu)); if (!tray->menu) { return NULL; } @@ -497,7 +496,7 @@ SDL_TrayMenu *SDL_CreateTraySubmenu(SDL_TrayEntry *entry) return NULL; } - entry->submenu = (SDL_TrayMenu *)SDL_malloc(sizeof(*entry->submenu)); + entry->submenu = (SDL_TrayMenu *)SDL_calloc(1, sizeof(*entry->submenu)); if (!entry->submenu) { return NULL; } @@ -573,12 +572,11 @@ SDL_TrayEntry *SDL_InsertTrayEntryAt(SDL_TrayMenu *menu, int pos, const char *la pos = menu->nEntries; } - SDL_TrayEntry *entry = (SDL_TrayEntry *)SDL_malloc(sizeof(*entry)); + SDL_TrayEntry *entry = (SDL_TrayEntry *)SDL_calloc(1, sizeof(*entry)); if (!entry) { return NULL; } - SDL_memset((void *) entry, 0, sizeof(*entry)); entry->parent = menu; entry->item = NULL; entry->ignore_signal = false; diff --git a/src/tray/windows/SDL_tray.c b/src/tray/windows/SDL_tray.c index 256f3436e5e27..fe072eb017c0f 100644 --- a/src/tray/windows/SDL_tray.c +++ b/src/tray/windows/SDL_tray.c @@ -211,7 +211,7 @@ static HICON load_default_icon() SDL_Tray *SDL_CreateTray(SDL_Surface *icon, const char *tooltip) { - SDL_Tray *tray = (SDL_Tray *)SDL_malloc(sizeof(*tray)); + SDL_Tray *tray = (SDL_Tray *)SDL_calloc(1, sizeof(*tray)); if (!tray) { return NULL; @@ -294,14 +294,12 @@ void SDL_SetTrayTooltip(SDL_Tray *tray, const char *tooltip) SDL_TrayMenu *SDL_CreateTrayMenu(SDL_Tray *tray) { - tray->menu = (SDL_TrayMenu *)SDL_malloc(sizeof(*tray->menu)); + tray->menu = (SDL_TrayMenu *)SDL_calloc(1, sizeof(*tray->menu)); if (!tray->menu) { return NULL; } - SDL_memset((void *) tray->menu, 0, sizeof(*tray->menu)); - tray->menu->hMenu = CreatePopupMenu(); tray->menu->parent_tray = tray; tray->menu->parent_entry = NULL; @@ -391,13 +389,11 @@ SDL_TrayEntry *SDL_InsertTrayEntryAt(SDL_TrayMenu *menu, int pos, const char *la windows_compatible_pos = -1; } - SDL_TrayEntry *entry = (SDL_TrayEntry *)SDL_malloc(sizeof(*entry)); + SDL_TrayEntry *entry = (SDL_TrayEntry *)SDL_calloc(1, sizeof(*entry)); if (!entry) { return NULL; } - SDL_memset((void *) entry, 0, sizeof(*entry)); - wchar_t *label_w = NULL; if (label && (label_w = escape_label(label)) == NULL) { @@ -413,15 +409,13 @@ SDL_TrayEntry *SDL_InsertTrayEntryAt(SDL_TrayMenu *menu, int pos, const char *la SDL_snprintf(entry->label_cache, sizeof(entry->label_cache), "%s", label ? label : ""); if (label != NULL && flags & SDL_TRAYENTRY_SUBMENU) { - entry->submenu = (SDL_TrayMenu *)SDL_malloc(sizeof(*entry->submenu)); + entry->submenu = (SDL_TrayMenu *)SDL_calloc(1, sizeof(*entry->submenu)); if (!entry->submenu) { SDL_free(entry); SDL_free(label_w); return NULL; } - SDL_memset((void *) entry->submenu, 0, sizeof(*entry->submenu)); - entry->submenu->hMenu = CreatePopupMenu(); entry->submenu->nEntries = 0; entry->submenu->entries = NULL; From cd269730eb4aa0518affc7b33b780d30e9a3ef1b Mon Sep 17 00:00:00 2001 From: Semphris Date: Thu, 16 Jan 2025 18:09:45 -0500 Subject: [PATCH 151/340] Fix Windows dialog memory management --- src/dialog/windows/SDL_windowsdialog.c | 163 ++++++++++++++++--------- 1 file changed, 102 insertions(+), 61 deletions(-) diff --git a/src/dialog/windows/SDL_windowsdialog.c b/src/dialog/windows/SDL_windowsdialog.c index dbfac920e9c90..06a9b31c04788 100644 --- a/src/dialog/windows/SDL_windowsdialog.c +++ b/src/dialog/windows/SDL_windowsdialog.c @@ -34,29 +34,49 @@ typedef struct { bool is_save; - const SDL_DialogFileFilter *filters; - int nfilters; - const char* default_file; + wchar_t *filters_str; + char* default_file; SDL_Window* parent; DWORD flags; SDL_DialogFileCallback callback; void* userdata; - const char* title; - const char* accept; - const char* cancel; + char* title; + char* accept; + char* cancel; } winArgs; typedef struct { SDL_Window* parent; SDL_DialogFileCallback callback; - const char* default_folder; + char* default_folder; void* userdata; - const char* title; - const char* accept; - const char* cancel; + char* title; + char* accept; + char* cancel; } winFArgs; +void freeWinArgs(winArgs *args) +{ + SDL_free(args->default_file); + SDL_free(args->filters_str); + SDL_free(args->title); + SDL_free(args->accept); + SDL_free(args->cancel); + + SDL_free(args); +} + +void freeWinFArgs(winFArgs *args) +{ + SDL_free(args->default_folder); + SDL_free(args->title); + SDL_free(args->accept); + SDL_free(args->cancel); + + SDL_free(args); +} + /** Converts dialog.nFilterIndex to SDL-compatible value */ int getFilterIndex(int as_reported_by_windows) { @@ -86,14 +106,13 @@ void windows_ShowFileDialog(void *ptr) { winArgs *args = (winArgs *) ptr; bool is_save = args->is_save; - const SDL_DialogFileFilter *filters = args->filters; - int nfilters = args->nfilters; const char* default_file = args->default_file; SDL_Window* parent = args->parent; DWORD flags = args->flags; SDL_DialogFileCallback callback = args->callback; void* userdata = args->userdata; const char *title = args->title; + wchar_t *filter_wchar = args->filters_str; /* GetOpenFileName and GetSaveFileName have the same signature (yes, LPOPENFILENAMEW even for the save dialog) */ @@ -109,18 +128,21 @@ void windows_ShowFileDialog(void *ptr) } else { SDL_SetError("Couldn't load Comdlg32.dll"); callback(userdata, NULL, -1); + freeWinArgs(args); return; } if (!pGetAnyFileName) { SDL_SetError("Couldn't load GetOpenFileName/GetSaveFileName from library"); callback(userdata, NULL, -1); + freeWinArgs(args); return; } if (!pCommDlgExtendedError) { SDL_SetError("Couldn't load CommDlgExtendedError from library"); callback(userdata, NULL, -1); + freeWinArgs(args); return; } @@ -174,43 +196,6 @@ void windows_ShowFileDialog(void *ptr) } } - wchar_t *filter_wchar = NULL; - - if (filters) { - // '\x01' is used in place of a null byte - // suffix needs two null bytes in case the filter list is empty - char *filterlist = convert_filters(filters, nfilters, clear_filt_names, "", "", - "\x01\x01", "", "\x01", "\x01", - "*.", ";*.", ""); - - if (!filterlist) { - callback(userdata, NULL, -1); - SDL_free(filebuffer); - return; - } - - int filter_len = (int)SDL_strlen(filterlist); - - for (char *c = filterlist; *c; c++) { - if (*c == '\x01') { - *c = '\0'; - } - } - - int filter_wlen = MultiByteToWideChar(CP_UTF8, 0, filterlist, filter_len, NULL, 0); - filter_wchar = (wchar_t *)SDL_malloc(filter_wlen * sizeof(wchar_t)); - if (!filter_wchar) { - SDL_free(filterlist); - callback(userdata, NULL, -1); - SDL_free(filebuffer); - return; - } - - MultiByteToWideChar(CP_UTF8, 0, filterlist, filter_len, filter_wchar, filter_wlen); - - SDL_free(filterlist); - } - wchar_t *title_w = NULL; if (title) { @@ -230,9 +215,9 @@ void windows_ShowFileDialog(void *ptr) title_w = (wchar_t *)SDL_malloc(title_wlen * sizeof(wchar_t)); if (!title_w) { - SDL_free(filter_wchar); SDL_free(filebuffer); callback(userdata, NULL, -1); + freeWinArgs(args); return; } @@ -264,7 +249,6 @@ void windows_ShowFileDialog(void *ptr) BOOL result = pGetAnyFileName(&dialog); - SDL_free(filter_wchar); SDL_free(title_w); if (result) { @@ -292,6 +276,7 @@ void windows_ShowFileDialog(void *ptr) if (!chosen_files_list) { callback(userdata, NULL, -1); SDL_free(filebuffer); + freeWinArgs(args); return; } @@ -302,6 +287,7 @@ void windows_ShowFileDialog(void *ptr) SDL_free(chosen_files_list); callback(userdata, NULL, -1); SDL_free(filebuffer); + freeWinArgs(args); return; } @@ -323,6 +309,7 @@ void windows_ShowFileDialog(void *ptr) SDL_free(chosen_files_list); callback(userdata, NULL, -1); SDL_free(filebuffer); + freeWinArgs(args); return; } @@ -341,6 +328,7 @@ void windows_ShowFileDialog(void *ptr) SDL_free(chosen_files_list); callback(userdata, NULL, -1); SDL_free(filebuffer); + freeWinArgs(args); return; } @@ -356,6 +344,7 @@ void windows_ShowFileDialog(void *ptr) SDL_free(chosen_files_list); callback(userdata, NULL, -1); SDL_free(filebuffer); + freeWinArgs(args); return; } } @@ -369,6 +358,7 @@ void windows_ShowFileDialog(void *ptr) SDL_free(chosen_files_list); callback(userdata, NULL, -1); SDL_free(filebuffer); + freeWinArgs(args); return; } @@ -380,6 +370,7 @@ void windows_ShowFileDialog(void *ptr) SDL_free(chosen_files_list); callback(userdata, NULL, -1); SDL_free(filebuffer); + freeWinArgs(args); return; } } @@ -409,6 +400,7 @@ void windows_ShowFileDialog(void *ptr) } SDL_free(filebuffer); + freeWinArgs(args); } int windows_file_dialog_thread(void* ptr) @@ -469,6 +461,7 @@ void windows_ShowFolderDialog(void* ptr) if (!title_w) { callback(userdata, NULL, -1); + freeWinFArgs(args); return; } @@ -501,6 +494,8 @@ void windows_ShowFolderDialog(void* ptr) const char *files[1] = { NULL }; callback(userdata, (const char * const*) files, -1); } + + freeWinFArgs(args); } int windows_folder_dialog_thread(void* ptr) @@ -510,10 +505,49 @@ int windows_folder_dialog_thread(void* ptr) return 0; } +wchar_t *win_get_filters(const SDL_DialogFileFilter *filters, int nfilters) +{ + wchar_t *filter_wchar = NULL; + + if (filters) { + // '\x01' is used in place of a null byte + // suffix needs two null bytes in case the filter list is empty + char *filterlist = convert_filters(filters, nfilters, clear_filt_names, + "", "", "\x01\x01", "", "\x01", + "\x01", "*.", ";*.", ""); + + if (!filterlist) { + return NULL; + } + + int filter_len = (int)SDL_strlen(filterlist); + + for (char *c = filterlist; *c; c++) { + if (*c == '\x01') { + *c = '\0'; + } + } + + int filter_wlen = MultiByteToWideChar(CP_UTF8, 0, filterlist, filter_len, NULL, 0); + filter_wchar = (wchar_t *)SDL_malloc(filter_wlen * sizeof(wchar_t)); + if (!filter_wchar) { + SDL_free(filterlist); + return NULL; + } + + MultiByteToWideChar(CP_UTF8, 0, filterlist, filter_len, filter_wchar, filter_wlen); + + SDL_free(filterlist); + } + + return filter_wchar; +} + static void ShowFileDialog(SDL_DialogFileCallback callback, void* userdata, SDL_Window* window, const SDL_DialogFileFilter *filters, int nfilters, const char* default_location, bool allow_many, bool is_save, const char* title, const char* accept, const char* cancel) { winArgs *args; SDL_Thread *thread; + wchar_t *filters_str; if (SDL_GetHint(SDL_HINT_FILE_DIALOG_DRIVER) != NULL) { SDL_SetError("File dialog driver unsupported"); @@ -527,17 +561,24 @@ static void ShowFileDialog(SDL_DialogFileCallback callback, void* userdata, SDL_ return; } + filters_str = win_get_filters(filters, nfilters); + + if (!filters_str && filters) { + callback(userdata, NULL, -1); + SDL_free(args); + return; + } + args->is_save = is_save; - args->filters = filters; - args->nfilters = nfilters; - args->default_file = default_location; + args->filters_str = filters_str; + args->default_file = default_location ? SDL_strdup(default_location) : NULL; args->parent = window; args->flags = allow_many ? OFN_ALLOWMULTISELECT : 0; args->callback = callback; args->userdata = userdata; - args->title = title; - args->accept = accept; - args->cancel = cancel; + args->title = title ? SDL_strdup(title) : NULL; + args->accept = accept ? SDL_strdup(accept) : NULL; + args->cancel = cancel ? SDL_strdup(cancel) : NULL; thread = SDL_CreateThread(windows_file_dialog_thread, "SDL_Windows_ShowFileDialog", (void *) args); @@ -569,11 +610,11 @@ void ShowFolderDialog(SDL_DialogFileCallback callback, void* userdata, SDL_Windo args->parent = window; args->callback = callback; - args->default_folder = default_location; + args->default_folder = default_location ? SDL_strdup(default_location) : NULL; args->userdata = userdata; - args->title = title; - args->accept = accept; - args->cancel = cancel; + args->title = title ? SDL_strdup(title) : NULL; + args->accept = accept ? SDL_strdup(accept) : NULL; + args->cancel = cancel ? SDL_strdup(cancel) : NULL; thread = SDL_CreateThread(windows_folder_dialog_thread, "SDL_Windows_ShowFolderDialog", (void *) args); From 721fc7de0bf43b4f15a127716fff6d20da1d95a3 Mon Sep 17 00:00:00 2001 From: Semphris Date: Thu, 16 Jan 2025 19:22:27 -0500 Subject: [PATCH 152/340] Correct spacing of pointers ('a* b;' -> 'a *b;') --- src/dialog/windows/SDL_windowsdialog.c | 54 +++++++++++++------------- 1 file changed, 27 insertions(+), 27 deletions(-) diff --git a/src/dialog/windows/SDL_windowsdialog.c b/src/dialog/windows/SDL_windowsdialog.c index 06a9b31c04788..04c046cb77e4d 100644 --- a/src/dialog/windows/SDL_windowsdialog.c +++ b/src/dialog/windows/SDL_windowsdialog.c @@ -35,25 +35,25 @@ typedef struct { bool is_save; wchar_t *filters_str; - char* default_file; - SDL_Window* parent; + char *default_file; + SDL_Window *parent; DWORD flags; SDL_DialogFileCallback callback; - void* userdata; - char* title; - char* accept; - char* cancel; + void *userdata; + char *title; + char *accept; + char *cancel; } winArgs; typedef struct { - SDL_Window* parent; + SDL_Window *parent; SDL_DialogFileCallback callback; - char* default_folder; - void* userdata; - char* title; - char* accept; - char* cancel; + char *default_folder; + void *userdata; + char *title; + char *accept; + char *cancel; } winFArgs; void freeWinArgs(winArgs *args) @@ -106,11 +106,11 @@ void windows_ShowFileDialog(void *ptr) { winArgs *args = (winArgs *) ptr; bool is_save = args->is_save; - const char* default_file = args->default_file; - SDL_Window* parent = args->parent; + const char *default_file = args->default_file; + SDL_Window *parent = args->parent; DWORD flags = args->flags; SDL_DialogFileCallback callback = args->callback; - void* userdata = args->userdata; + void *userdata = args->userdata; const char *title = args->title; wchar_t *filter_wchar = args->filters_str; @@ -255,7 +255,7 @@ void windows_ShowFileDialog(void *ptr) if (!(flags & OFN_ALLOWMULTISELECT)) { // File is a C string stored in dialog.lpstrFile char *chosen_file = WIN_StringToUTF8W(dialog.lpstrFile); - const char* opts[2] = { chosen_file, NULL }; + const char *opts[2] = { chosen_file, NULL }; callback(userdata, opts, getFilterIndex(dialog.nFilterIndex)); SDL_free(chosen_file); } else { @@ -391,7 +391,7 @@ void windows_ShowFileDialog(void *ptr) code to 0 after calling GetOpenFileName if another Windows function before set a different error code, so it's safe to check for success. */ - const char* opts[1] = { NULL }; + const char *opts[1] = { NULL }; callback(userdata, opts, getFilterIndex(dialog.nFilterIndex)); } else { SDL_SetError("Windows error, CommDlgExtendedError: %ld", pCommDlgExtendedError()); @@ -403,7 +403,7 @@ void windows_ShowFileDialog(void *ptr) freeWinArgs(args); } -int windows_file_dialog_thread(void* ptr) +int windows_file_dialog_thread(void *ptr) { windows_ShowFileDialog(ptr); SDL_free(ptr); @@ -428,7 +428,7 @@ int CALLBACK browse_callback_proc(HWND hwnd, UINT uMsg, LPARAM lParam, LPARAM lp return 0; } -void windows_ShowFolderDialog(void* ptr) +void windows_ShowFolderDialog(void *ptr) { winFArgs *args = (winFArgs *) ptr; SDL_Window *window = args->parent; @@ -498,7 +498,7 @@ void windows_ShowFolderDialog(void* ptr) freeWinFArgs(args); } -int windows_folder_dialog_thread(void* ptr) +int windows_folder_dialog_thread(void *ptr) { windows_ShowFolderDialog(ptr); SDL_free(ptr); @@ -543,7 +543,7 @@ wchar_t *win_get_filters(const SDL_DialogFileFilter *filters, int nfilters) return filter_wchar; } -static void ShowFileDialog(SDL_DialogFileCallback callback, void* userdata, SDL_Window* window, const SDL_DialogFileFilter *filters, int nfilters, const char* default_location, bool allow_many, bool is_save, const char* title, const char* accept, const char* cancel) +static void ShowFileDialog(SDL_DialogFileCallback callback, void *userdata, SDL_Window *window, const SDL_DialogFileFilter *filters, int nfilters, const char *default_location, bool allow_many, bool is_save, const char *title, const char *accept, const char *cancel) { winArgs *args; SDL_Thread *thread; @@ -591,7 +591,7 @@ static void ShowFileDialog(SDL_DialogFileCallback callback, void* userdata, SDL_ SDL_DetachThread(thread); } -void ShowFolderDialog(SDL_DialogFileCallback callback, void* userdata, SDL_Window* window, const char* default_location, bool allow_many, const char* title, const char* accept, const char* cancel) +void ShowFolderDialog(SDL_DialogFileCallback callback, void *userdata, SDL_Window *window, const char *default_location, bool allow_many, const char *title, const char *accept, const char *cancel) { winFArgs *args; SDL_Thread *thread; @@ -631,14 +631,14 @@ void SDL_SYS_ShowFileDialogWithProperties(SDL_FileDialogType type, SDL_DialogFil { /* The internal functions will start threads, and the properties may be freed as soon as this function returns. Save a copy of what we need before invoking the functions and starting the threads. */ - SDL_Window* window = SDL_GetPointerProperty(props, SDL_PROP_FILE_DIALOG_WINDOW_POINTER, NULL); + SDL_Window *window = SDL_GetPointerProperty(props, SDL_PROP_FILE_DIALOG_WINDOW_POINTER, NULL); SDL_DialogFileFilter *filters = SDL_GetPointerProperty(props, SDL_PROP_FILE_DIALOG_FILTERS_POINTER, NULL); int nfilters = (int) SDL_GetNumberProperty(props, SDL_PROP_FILE_DIALOG_NFILTERS_NUMBER, 0); bool allow_many = SDL_GetBooleanProperty(props, SDL_PROP_FILE_DIALOG_MANY_BOOLEAN, false); - const char* default_location = SDL_GetStringProperty(props, SDL_PROP_FILE_DIALOG_LOCATION_STRING, NULL); - const char* title = SDL_GetStringProperty(props, SDL_PROP_FILE_DIALOG_TITLE_STRING, NULL); - const char* accept = SDL_GetStringProperty(props, SDL_PROP_FILE_DIALOG_ACCEPT_STRING, NULL); - const char* cancel = SDL_GetStringProperty(props, SDL_PROP_FILE_DIALOG_CANCEL_STRING, NULL); + const char *default_location = SDL_GetStringProperty(props, SDL_PROP_FILE_DIALOG_LOCATION_STRING, NULL); + const char *title = SDL_GetStringProperty(props, SDL_PROP_FILE_DIALOG_TITLE_STRING, NULL); + const char *accept = SDL_GetStringProperty(props, SDL_PROP_FILE_DIALOG_ACCEPT_STRING, NULL); + const char *cancel = SDL_GetStringProperty(props, SDL_PROP_FILE_DIALOG_CANCEL_STRING, NULL); bool is_save = false; switch (type) { From 19f42094bb0141f2096ce3e7b724a1c744ab0f1f Mon Sep 17 00:00:00 2001 From: Semphris Date: Sat, 18 Jan 2025 11:35:33 -0500 Subject: [PATCH 153/340] Fix Windows fie dialog args freeing --- src/dialog/windows/SDL_windowsdialog.c | 25 ++++++------------------- 1 file changed, 6 insertions(+), 19 deletions(-) diff --git a/src/dialog/windows/SDL_windowsdialog.c b/src/dialog/windows/SDL_windowsdialog.c index 04c046cb77e4d..fc25a194fb9a5 100644 --- a/src/dialog/windows/SDL_windowsdialog.c +++ b/src/dialog/windows/SDL_windowsdialog.c @@ -128,21 +128,18 @@ void windows_ShowFileDialog(void *ptr) } else { SDL_SetError("Couldn't load Comdlg32.dll"); callback(userdata, NULL, -1); - freeWinArgs(args); return; } if (!pGetAnyFileName) { SDL_SetError("Couldn't load GetOpenFileName/GetSaveFileName from library"); callback(userdata, NULL, -1); - freeWinArgs(args); return; } if (!pCommDlgExtendedError) { SDL_SetError("Couldn't load CommDlgExtendedError from library"); callback(userdata, NULL, -1); - freeWinArgs(args); return; } @@ -217,7 +214,6 @@ void windows_ShowFileDialog(void *ptr) if (!title_w) { SDL_free(filebuffer); callback(userdata, NULL, -1); - freeWinArgs(args); return; } @@ -276,7 +272,6 @@ void windows_ShowFileDialog(void *ptr) if (!chosen_files_list) { callback(userdata, NULL, -1); SDL_free(filebuffer); - freeWinArgs(args); return; } @@ -287,7 +282,6 @@ void windows_ShowFileDialog(void *ptr) SDL_free(chosen_files_list); callback(userdata, NULL, -1); SDL_free(filebuffer); - freeWinArgs(args); return; } @@ -309,7 +303,6 @@ void windows_ShowFileDialog(void *ptr) SDL_free(chosen_files_list); callback(userdata, NULL, -1); SDL_free(filebuffer); - freeWinArgs(args); return; } @@ -328,7 +321,6 @@ void windows_ShowFileDialog(void *ptr) SDL_free(chosen_files_list); callback(userdata, NULL, -1); SDL_free(filebuffer); - freeWinArgs(args); return; } @@ -344,7 +336,6 @@ void windows_ShowFileDialog(void *ptr) SDL_free(chosen_files_list); callback(userdata, NULL, -1); SDL_free(filebuffer); - freeWinArgs(args); return; } } @@ -358,7 +349,6 @@ void windows_ShowFileDialog(void *ptr) SDL_free(chosen_files_list); callback(userdata, NULL, -1); SDL_free(filebuffer); - freeWinArgs(args); return; } @@ -370,7 +360,6 @@ void windows_ShowFileDialog(void *ptr) SDL_free(chosen_files_list); callback(userdata, NULL, -1); SDL_free(filebuffer); - freeWinArgs(args); return; } } @@ -400,13 +389,12 @@ void windows_ShowFileDialog(void *ptr) } SDL_free(filebuffer); - freeWinArgs(args); } int windows_file_dialog_thread(void *ptr) { windows_ShowFileDialog(ptr); - SDL_free(ptr); + freeWinArgs(ptr); return 0; } @@ -461,7 +449,6 @@ void windows_ShowFolderDialog(void *ptr) if (!title_w) { callback(userdata, NULL, -1); - freeWinFArgs(args); return; } @@ -494,14 +481,12 @@ void windows_ShowFolderDialog(void *ptr) const char *files[1] = { NULL }; callback(userdata, (const char * const*) files, -1); } - - freeWinFArgs(args); } int windows_folder_dialog_thread(void *ptr) { windows_ShowFolderDialog(ptr); - SDL_free(ptr); + freeWinFArgs((winFArgs *)ptr); return 0; } @@ -584,7 +569,8 @@ static void ShowFileDialog(SDL_DialogFileCallback callback, void *userdata, SDL_ if (thread == NULL) { callback(userdata, NULL, -1); - SDL_free(args); + // The thread won't have run, therefore the data won't have been freed + freeWinArgs(args); return; } @@ -620,7 +606,8 @@ void ShowFolderDialog(SDL_DialogFileCallback callback, void *userdata, SDL_Windo if (thread == NULL) { callback(userdata, NULL, -1); - SDL_free(args); + // The thread won't have run, therefore the data won't have been freed + freeWinFArgs(args); return; } From 5da9d4ecc2b163487a5d82cc2aac188bb61340a6 Mon Sep 17 00:00:00 2001 From: "Ryan C. Gordon" Date: Sat, 18 Jan 2025 17:01:46 -0500 Subject: [PATCH 154/340] cocoa: Slightly better display hotplugging detection. Fixes #12016. --- src/video/cocoa/SDL_cocoamodes.m | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/video/cocoa/SDL_cocoamodes.m b/src/video/cocoa/SDL_cocoamodes.m index 7de75729c1746..b4e151b916f5a 100644 --- a/src/video/cocoa/SDL_cocoamodes.m +++ b/src/video/cocoa/SDL_cocoamodes.m @@ -405,8 +405,15 @@ static void Cocoa_DisplayReconfigurationCallback(CGDirectDisplayID displayid, CG } if ((flags & kCGDisplayAddFlag) && (flags & kCGDisplayRemoveFlag)) { - // both adding _and_ removing? Treat it as a remove exclusively. This can happen if a display is unmirroring because it's being disabled, etc. - flags &= ~kCGDisplayAddFlag; + // sometimes you get a removed device that gets Add and Remove flags at the same time but the display dimensions are 0x0 or 1x1, hence the `> 1` test. + // Mirrored things are always removed, since they don't represent a discrete display in this state. + if (((flags & kCGDisplayMirrorFlag) == 0) && (CGDisplayPixelsWide(displayid) > 1)) { + // Final state is connected + flags &= ~kCGDisplayRemoveFlag; + } else { + // Final state is disconnected + flags &= ~kCGDisplayAddFlag; + } } if (flags & kCGDisplayAddFlag) { From 32965b4bf11c6d0490294e7a6f7cecda22b909bc Mon Sep 17 00:00:00 2001 From: "Ryan C. Gordon" Date: Sat, 18 Jan 2025 21:51:03 -0500 Subject: [PATCH 155/340] pen: Send virtual mouse motion without a button press when a pen is hovering. Fixes #11470. --- src/events/SDL_pen.c | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/src/events/SDL_pen.c b/src/events/SDL_pen.c index 6db1b0ee14413..afc2ea031daa7 100644 --- a/src/events/SDL_pen.c +++ b/src/events/SDL_pen.c @@ -488,17 +488,22 @@ void SDL_SendPenMotion(Uint64 timestamp, SDL_PenID instance_id, SDL_Window *wind event.pmotion.y = y; SDL_PushEvent(&event); - if (window && (pen_touching == instance_id)) { + if (window) { SDL_Mouse *mouse = SDL_GetMouse(); if (mouse) { - if (mouse->pen_mouse_events) { - SDL_SendMouseMotion(timestamp, window, SDL_PEN_MOUSEID, false, x, y); - } + if (pen_touching == instance_id) { + if (mouse->pen_mouse_events) { + SDL_SendMouseMotion(timestamp, window, SDL_PEN_MOUSEID, false, x, y); + } - if (mouse->pen_touch_events) { - const float normalized_x = x / (float)window->w; - const float normalized_y = y / (float)window->h; - SDL_SendTouchMotion(timestamp, SDL_PEN_TOUCHID, SDL_BUTTON_LEFT, window, normalized_x, normalized_y, pen->axes[SDL_PEN_AXIS_PRESSURE]); + if (mouse->pen_touch_events) { + const float normalized_x = x / (float)window->w; + const float normalized_y = y / (float)window->h; + SDL_SendTouchMotion(timestamp, SDL_PEN_TOUCHID, SDL_BUTTON_LEFT, window, normalized_x, normalized_y, pen->axes[SDL_PEN_AXIS_PRESSURE]); + } + } else if (pen_touching == 0) { // send mouse motion (without a pressed button) for pens that aren't touching. + // this might cause a little chaos if you have multiple pens hovering at the same time, but this seems unlikely in the real world, and also something you did to yourself. :) + SDL_SendMouseMotion(timestamp, window, SDL_PEN_MOUSEID, false, x, y); } } } From 43b54b3d721003455021ac61f98eb014633a19da Mon Sep 17 00:00:00 2001 From: Semphris Date: Sat, 18 Jan 2025 18:37:49 -0500 Subject: [PATCH 156/340] Fix Windows dialog folder titles Same fix as in cf946e32ba0977a87bc5c7096c304538b4f42337, which was not done for the folder implementation. --- src/dialog/windows/SDL_windowsdialog.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/dialog/windows/SDL_windowsdialog.c b/src/dialog/windows/SDL_windowsdialog.c index fc25a194fb9a5..b52e8b3ba4b04 100644 --- a/src/dialog/windows/SDL_windowsdialog.c +++ b/src/dialog/windows/SDL_windowsdialog.c @@ -439,7 +439,7 @@ void windows_ShowFolderDialog(void *ptr) title_len = 0; } - int title_wlen = MultiByteToWideChar(CP_UTF8, 0, title, title_len, NULL, 0); + int title_wlen = MultiByteToWideChar(CP_UTF8, 0, title, -1, NULL, 0); if (title_wlen < 0) { title_wlen = 0; @@ -452,7 +452,7 @@ void windows_ShowFolderDialog(void *ptr) return; } - MultiByteToWideChar(CP_UTF8, 0, title, title_len, title_w, title_wlen); + MultiByteToWideChar(CP_UTF8, 0, title, -1, title_w, title_wlen); } wchar_t buffer[MAX_PATH]; From 0851322fb1d3af03c3637062cb2ee03043f05214 Mon Sep 17 00:00:00 2001 From: "Ryan C. Gordon" Date: Sun, 19 Jan 2025 12:11:16 -0500 Subject: [PATCH 157/340] include: Add category documentation to SDL_power.h. Reference Issue #11847. --- include/SDL3/SDL_power.h | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/include/SDL3/SDL_power.h b/include/SDL3/SDL_power.h index 720b1066ba2c4..bec9391f06ce2 100644 --- a/include/SDL3/SDL_power.h +++ b/include/SDL3/SDL_power.h @@ -26,6 +26,15 @@ * # CategoryPower * * SDL power management routines. + * + * There is a single function in this category: SDL_GetPowerInfo(). + * + * This function is useful for games on the go. This allows an app + * to know if it's running on a draining battery, which can be useful if + * the app wants to reduce processing, or perhaps framerate, to extend the + * duration of the battery's charge. Perhaps the app just wants to show + * a battery meter when fullscreen, or alert the user when the power is + * getting extremely low, so they can save their game. */ #include From b088e8919189ea85326cd0cd9a933c8c7f05e5af Mon Sep 17 00:00:00 2001 From: SDL Wiki Bot Date: Sun, 19 Jan 2025 17:12:43 +0000 Subject: [PATCH 158/340] Sync SDL3 wiki -> header [ci skip] --- include/SDL3/SDL_power.h | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/include/SDL3/SDL_power.h b/include/SDL3/SDL_power.h index bec9391f06ce2..1df471b9f8e80 100644 --- a/include/SDL3/SDL_power.h +++ b/include/SDL3/SDL_power.h @@ -29,12 +29,12 @@ * * There is a single function in this category: SDL_GetPowerInfo(). * - * This function is useful for games on the go. This allows an app - * to know if it's running on a draining battery, which can be useful if - * the app wants to reduce processing, or perhaps framerate, to extend the - * duration of the battery's charge. Perhaps the app just wants to show - * a battery meter when fullscreen, or alert the user when the power is - * getting extremely low, so they can save their game. + * This function is useful for games on the go. This allows an app to know if + * it's running on a draining battery, which can be useful if the app wants to + * reduce processing, or perhaps framerate, to extend the duration of the + * battery's charge. Perhaps the app just wants to show a battery meter when + * fullscreen, or alert the user when the power is getting extremely low, so + * they can save their game. */ #include From 34c12d0db8a198d987bb18649a50dfd8091ac14a Mon Sep 17 00:00:00 2001 From: "Ryan C. Gordon" Date: Sun, 19 Jan 2025 12:18:46 -0500 Subject: [PATCH 159/340] include: Add category documentation to SDL_timer.h. Reference Issue #11847. --- include/SDL3/SDL_timer.h | 24 +++++++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) diff --git a/include/SDL3/SDL_timer.h b/include/SDL3/SDL_timer.h index c0b6bd3f57a62..a92a5ffc7dfeb 100644 --- a/include/SDL3/SDL_timer.h +++ b/include/SDL3/SDL_timer.h @@ -25,7 +25,20 @@ /** * # CategoryTimer * - * SDL time management routines. + * SDL provides time management functionality. It is useful for dealing with + * (usually) small durations of time. + * + * This is not to be confused with _calendar time_ management, which is + * provided by [CategoryTime](CategoryTime). + * + * This category covers measuring time elapsed (SDL_GetTicks(), + * SDL_GetPerformanceCounter()), putting a thread to sleep for a certain + * amount of time (SDL_Delay(), SDL_DelayNS(), SDL_DelayPrecise()), and + * firing a callback function after a certain amount of time has elasped + * (SDL_AddTimer(), etc). + * + * There are also useful macros to convert between time units, like + * SDL_SECONDS_TO_NS() and such. */ #include @@ -239,6 +252,9 @@ extern SDL_DECLSPEC Uint64 SDLCALL SDL_GetPerformanceFrequency(void); * \threadsafety It is safe to call this function from any thread. * * \since This function is available since SDL 3.1.3. + * + * \sa SDL_DelayNS + * \sa SDL_DelayPrecise */ extern SDL_DECLSPEC void SDLCALL SDL_Delay(Uint32 ms); @@ -254,6 +270,9 @@ extern SDL_DECLSPEC void SDLCALL SDL_Delay(Uint32 ms); * \threadsafety It is safe to call this function from any thread. * * \since This function is available since SDL 3.1.3. + * + * \sa SDL_Delay + * \sa SDL_DelayPrecise */ extern SDL_DECLSPEC void SDLCALL SDL_DelayNS(Uint64 ns); @@ -269,6 +288,9 @@ extern SDL_DECLSPEC void SDLCALL SDL_DelayNS(Uint64 ns); * \threadsafety It is safe to call this function from any thread. * * \since This function is available since SDL 3.1.6. + * + * \sa SDL_Delay + * \sa SDL_DelayNS */ extern SDL_DECLSPEC void SDLCALL SDL_DelayPrecise(Uint64 ns); From 78023500fa9c5b1d5b08b8a242f7c59b872827c0 Mon Sep 17 00:00:00 2001 From: SDL Wiki Bot Date: Sun, 19 Jan 2025 23:59:37 +0000 Subject: [PATCH 160/340] Sync SDL3 wiki -> header [ci skip] --- include/SDL3/SDL_timer.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/include/SDL3/SDL_timer.h b/include/SDL3/SDL_timer.h index a92a5ffc7dfeb..24815880db159 100644 --- a/include/SDL3/SDL_timer.h +++ b/include/SDL3/SDL_timer.h @@ -33,8 +33,8 @@ * * This category covers measuring time elapsed (SDL_GetTicks(), * SDL_GetPerformanceCounter()), putting a thread to sleep for a certain - * amount of time (SDL_Delay(), SDL_DelayNS(), SDL_DelayPrecise()), and - * firing a callback function after a certain amount of time has elasped + * amount of time (SDL_Delay(), SDL_DelayNS(), SDL_DelayPrecise()), and firing + * a callback function after a certain amount of time has elasped * (SDL_AddTimer(), etc). * * There are also useful macros to convert between time units, like From 3afd1e7eaa5a4a0d2e4161641d8859bc7aa053c0 Mon Sep 17 00:00:00 2001 From: Sam Lantinga Date: Sun, 19 Jan 2025 08:35:04 -0800 Subject: [PATCH 161/340] windows: use WIN_UTF8ToStringW() for dialog titles --- src/dialog/windows/SDL_windowsdialog.c | 36 ++------------------------ 1 file changed, 2 insertions(+), 34 deletions(-) diff --git a/src/dialog/windows/SDL_windowsdialog.c b/src/dialog/windows/SDL_windowsdialog.c index b52e8b3ba4b04..2de224feba642 100644 --- a/src/dialog/windows/SDL_windowsdialog.c +++ b/src/dialog/windows/SDL_windowsdialog.c @@ -196,28 +196,12 @@ void windows_ShowFileDialog(void *ptr) wchar_t *title_w = NULL; if (title) { - int title_len = (int) SDL_strlen(title); - - /* If the title is longer than 2GB, it might be exploitable. */ - if (title_len < 0) { - title_len = 0; - } - - int title_wlen = MultiByteToWideChar(CP_UTF8, 0, title, -1, NULL, 0); - - if (title_wlen < 0) { - title_wlen = 0; - } - - title_w = (wchar_t *)SDL_malloc(title_wlen * sizeof(wchar_t)); - + title_w = WIN_UTF8ToStringW(title); if (!title_w) { SDL_free(filebuffer); callback(userdata, NULL, -1); return; } - - MultiByteToWideChar(CP_UTF8, 0, title, -1, title_w, title_wlen); } OPENFILENAMEW dialog; @@ -432,27 +416,11 @@ void windows_ShowFolderDialog(void *ptr) wchar_t *title_w = NULL; if (title) { - int title_len = (int) SDL_strlen(title); - - /* If the title is longer than 2GB, it might be exploitable. */ - if (title_len < 0) { - title_len = 0; - } - - int title_wlen = MultiByteToWideChar(CP_UTF8, 0, title, -1, NULL, 0); - - if (title_wlen < 0) { - title_wlen = 0; - } - - title_w = (wchar_t *)SDL_malloc(title_wlen * sizeof(wchar_t)); - + title_w = WIN_UTF8ToStringW(title); if (!title_w) { callback(userdata, NULL, -1); return; } - - MultiByteToWideChar(CP_UTF8, 0, title, -1, title_w, title_wlen); } wchar_t buffer[MAX_PATH]; From b716eeefef14f167d80b9369880ea725e2efc1ef Mon Sep 17 00:00:00 2001 From: Sam Lantinga Date: Sun, 19 Jan 2025 16:45:12 -0800 Subject: [PATCH 162/340] testtray: minor cleanup --- test/testtray.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/test/testtray.c b/test/testtray.c index 71533bac7a651..f3cf8ba406402 100644 --- a/test/testtray.c +++ b/test/testtray.c @@ -19,8 +19,6 @@ static void SDLCALL tray_close(void *ptr, SDL_TrayEntry *entry) SDL_DestroyTray(trays[0]); SDL_DestroyTray(trays[1]); - - SDL_free(trays); } static void SDLCALL apply_icon(void *ptr, const char * const *filelist, int filter) @@ -485,6 +483,7 @@ static void SDLCALL append_submenu_to(void *ptr, SDL_TrayEntry *entry) int main(int argc, char **argv) { + SDL_Tray **trays = NULL; SDLTest_CommonState *state; int i; @@ -514,7 +513,7 @@ int main(int argc, char **argv) return 1; } - SDL_Window *w = SDL_CreateWindow("", 640, 480, 0); + SDL_Window *w = SDL_CreateWindow("testtray", 640, 480, 0); if (!w) { SDL_Log("Couldn't create window: %s", SDL_GetError()); @@ -570,7 +569,7 @@ int main(int argc, char **argv) CHECK(entry_close); /* TODO: Track memory! */ - SDL_Tray **trays = SDL_malloc(sizeof(SDL_Tray *) * 2); + trays = SDL_malloc(sizeof(SDL_Tray *) * 2); if (!trays) { goto clean_all; } @@ -631,6 +630,7 @@ int main(int argc, char **argv) if (!trays_destroyed) { SDL_DestroyTray(tray); } + SDL_free(trays); clean_window: if (w) { From 7570ab106da5888803bb4269144c0a687f849614 Mon Sep 17 00:00:00 2001 From: Sam Lantinga Date: Sun, 19 Jan 2025 09:59:12 -0800 Subject: [PATCH 163/340] tray: improved error checking Also clean up any existing trays when the program quits Fixes https://github.com/libsdl-org/SDL/issues/11893 --- src/SDL.c | 2 + src/SDL_utils.c | 19 ++++++ src/SDL_utils_c.h | 2 + src/tray/SDL_tray_utils.c | 57 +++++++++++----- src/tray/SDL_tray_utils.h | 5 +- src/tray/cocoa/SDL_tray.m | 130 ++++++++++++++++++++++++++++-------- src/tray/dummy/SDL_tray.c | 32 +++------ src/tray/unix/SDL_tray.c | 81 +++++++++++++++++++--- src/tray/windows/SDL_tray.c | 89 +++++++++++++++++++++--- 9 files changed, 334 insertions(+), 83 deletions(-) diff --git a/src/SDL.c b/src/SDL.c index 90191d1b0c4d6..e9c9fb1a2353f 100644 --- a/src/SDL.c +++ b/src/SDL.c @@ -51,6 +51,7 @@ #include "sensor/SDL_sensor_c.h" #include "stdlib/SDL_getenv_c.h" #include "thread/SDL_thread_c.h" +#include "tray/SDL_tray_utils.h" #include "video/SDL_pixels_c.h" #include "video/SDL_surface_c.h" #include "video/SDL_video_c.h" @@ -642,6 +643,7 @@ void SDL_Quit(void) SDL_HelperWindowDestroy(); #endif SDL_QuitSubSystem(SDL_INIT_EVERYTHING); + SDL_CleanupTrays(); #ifdef SDL_USE_LIBDBUS SDL_DBus_Quit(); diff --git a/src/SDL_utils.c b/src/SDL_utils.c index d061becb4faea..a877360f6218d 100644 --- a/src/SDL_utils.c +++ b/src/SDL_utils.c @@ -178,6 +178,22 @@ bool SDL_ObjectValid(void *object, SDL_ObjectType type) return (((SDL_ObjectType)(uintptr_t)object_type) == type); } +int SDL_GetObjects(SDL_ObjectType type, void **objects, int count) +{ + const void *object, *object_type; + void *iter = NULL; + int num_objects = 0; + while (SDL_IterateHashTable(SDL_objects, &object, &object_type, &iter)) { + if ((SDL_ObjectType)(uintptr_t)object_type == type) { + if (num_objects < count) { + objects[num_objects] = (void *)object; + } + ++num_objects; + } + } + return num_objects; +} + void SDL_SetObjectsInvalid(void) { if (SDL_ShouldQuit(&SDL_objects_init)) { @@ -217,6 +233,9 @@ void SDL_SetObjectsInvalid(void) case SDL_OBJECT_TYPE_THREAD: type = "thread"; break; + case SDL_OBJECT_TYPE_TRAY: + type = "SDL_Tray"; + break; default: type = "unknown object"; break; diff --git a/src/SDL_utils_c.h b/src/SDL_utils_c.h index 68dfcec327cba..557dad49a59d0 100644 --- a/src/SDL_utils_c.h +++ b/src/SDL_utils_c.h @@ -61,12 +61,14 @@ typedef enum SDL_OBJECT_TYPE_HIDAPI_DEVICE, SDL_OBJECT_TYPE_HIDAPI_JOYSTICK, SDL_OBJECT_TYPE_THREAD, + SDL_OBJECT_TYPE_TRAY, } SDL_ObjectType; extern Uint32 SDL_GetNextObjectID(void); extern void SDL_SetObjectValid(void *object, SDL_ObjectType type, bool valid); extern bool SDL_ObjectValid(void *object, SDL_ObjectType type); +extern int SDL_GetObjects(SDL_ObjectType type, void **objects, int count); extern void SDL_SetObjectsInvalid(void); extern const char *SDL_GetPersistentString(const char *string); diff --git a/src/tray/SDL_tray_utils.c b/src/tray/SDL_tray_utils.c index b21d40cd652ea..ce792adc479a7 100644 --- a/src/tray/SDL_tray_utils.c +++ b/src/tray/SDL_tray_utils.c @@ -27,38 +27,65 @@ static int active_trays = 0; -extern void SDL_IncrementTrayCount(void) +void SDL_RegisterTray(SDL_Tray *tray) { - if (++active_trays < 1) { - SDL_Log("Active tray count corrupted (%d < 1), this is a bug. The app may close or fail to close unexpectedly.", active_trays); - } + SDL_SetObjectValid(tray, SDL_OBJECT_TYPE_TRAY, true); + + ++active_trays; } -extern void SDL_DecrementTrayCount(void) +void SDL_UnregisterTray(SDL_Tray *tray) { - int toplevel_count = 0; - SDL_Window *n; + SDL_assert(SDL_ObjectValid(tray, SDL_OBJECT_TYPE_TRAY)); + + SDL_SetObjectValid(tray, SDL_OBJECT_TYPE_TRAY, false); - if (--active_trays < 0) { - SDL_Log("Active tray count corrupted (%d < 0), this is a bug. The app may close or fail to close unexpectedly.", active_trays); + --active_trays; + if (active_trays > 0) { + return; } if (!SDL_GetHintBoolean(SDL_HINT_QUIT_ON_LAST_WINDOW_CLOSE, true)) { return; } - for (n = SDL_GetVideoDevice()->windows; n; n = n->next) { - if (!n->parent && !(n->flags & SDL_WINDOW_HIDDEN)) { - ++toplevel_count; + int toplevel_count = 0; + SDL_Window **windows = SDL_GetWindows(NULL); + if (windows) { + for (int i = 0; windows[i]; ++i) { + SDL_Window *window = windows[i]; + if (!window->parent && !(window->flags & SDL_WINDOW_HIDDEN)) { + ++toplevel_count; + } } + SDL_free(windows); } - if (toplevel_count < 1) { + if (toplevel_count == 0) { SDL_SendQuit(); } } -extern bool SDL_HasNoActiveTrays(void) +void SDL_CleanupTrays(void) +{ + if (active_trays == 0) { + return; + } + + void **trays = (void **)SDL_malloc(active_trays * sizeof(*trays)); + if (!trays) { + return; + } + + int count = SDL_GetObjects(SDL_OBJECT_TYPE_TRAY, trays, active_trays); + SDL_assert(count == active_trays); + for (int i = 0; i < count; ++i) { + SDL_DestroyTray((SDL_Tray *)trays[i]); + } + SDL_free(trays); +} + +bool SDL_HasNoActiveTrays(void) { - return active_trays < 1; + return active_trays == 0; } diff --git a/src/tray/SDL_tray_utils.h b/src/tray/SDL_tray_utils.h index f8f7a7058b963..8dc2249d2231a 100644 --- a/src/tray/SDL_tray_utils.h +++ b/src/tray/SDL_tray_utils.h @@ -20,6 +20,7 @@ */ #include "SDL_internal.h" -extern void SDL_IncrementTrayCount(void); -extern void SDL_DecrementTrayCount(void); +extern void SDL_RegisterTray(SDL_Tray *tray); +extern void SDL_UnregisterTray(SDL_Tray *tray); +extern void SDL_CleanupTrays(void); extern bool SDL_HasNoActiveTrays(void); diff --git a/src/tray/cocoa/SDL_tray.m b/src/tray/cocoa/SDL_tray.m index 66f99a2b28a5a..15de54b24e9a6 100644 --- a/src/tray/cocoa/SDL_tray.m +++ b/src/tray/cocoa/SDL_tray.m @@ -80,8 +80,16 @@ static void DestroySDLMenu(SDL_TrayMenu *menu) SDL_Tray *SDL_CreateTray(SDL_Surface *icon, const char *tooltip) { + if (icon) { + icon = SDL_ConvertSurface(icon, SDL_PIXELFORMAT_RGBA32); + if (!icon) { + return NULL; + } + } + SDL_Tray *tray = (SDL_Tray *)SDL_calloc(1, sizeof(*tray)); if (!tray) { + SDL_DestroySurface(icon); return NULL; } @@ -97,22 +105,17 @@ static void DestroySDLMenu(SDL_TrayMenu *menu) } if (icon) { - SDL_Surface *iconfmt = SDL_ConvertSurface(icon, SDL_PIXELFORMAT_RGBA32); - if (!iconfmt) { - goto skip_putting_an_icon; - } - - NSBitmapImageRep *bitmap = [[NSBitmapImageRep alloc] initWithBitmapDataPlanes:(unsigned char **)&iconfmt->pixels - pixelsWide:iconfmt->w - pixelsHigh:iconfmt->h + NSBitmapImageRep *bitmap = [[NSBitmapImageRep alloc] initWithBitmapDataPlanes:(unsigned char **)&icon->pixels + pixelsWide:icon->w + pixelsHigh:icon->h bitsPerSample:8 samplesPerPixel:4 hasAlpha:YES isPlanar:NO colorSpaceName:NSCalibratedRGBColorSpace - bytesPerRow:iconfmt->pitch + bytesPerRow:icon->pitch bitsPerPixel:32]; - NSImage *iconimg = [[NSImage alloc] initWithSize:NSMakeSize(iconfmt->w, iconfmt->h)]; + NSImage *iconimg = [[NSImage alloc] initWithSize:NSMakeSize(icon->w, icon->h)]; [iconimg addRepresentation:bitmap]; /* A typical icon size is 22x22 on macOS. Failing to resize the icon @@ -125,39 +128,42 @@ static void DestroySDLMenu(SDL_TrayMenu *menu) tray->statusItem.button.image = iconimg22; - SDL_DestroySurface(iconfmt); + SDL_DestroySurface(icon); } -skip_putting_an_icon: - SDL_IncrementTrayCount(); + SDL_RegisterTray(tray); return tray; } void SDL_SetTrayIcon(SDL_Tray *tray, SDL_Surface *icon) { + if (!SDL_ObjectValid(tray, SDL_OBJECT_TYPE_TRAY)) { + return; + } + if (!icon) { tray->statusItem.button.image = nil; return; } - SDL_Surface *iconfmt = SDL_ConvertSurface(icon, SDL_PIXELFORMAT_RGBA32); - if (!iconfmt) { + icon = SDL_ConvertSurface(icon, SDL_PIXELFORMAT_RGBA32); + if (!icon) { tray->statusItem.button.image = nil; return; } - NSBitmapImageRep *bitmap = [[NSBitmapImageRep alloc] initWithBitmapDataPlanes:(unsigned char **)&iconfmt->pixels - pixelsWide:iconfmt->w - pixelsHigh:iconfmt->h + NSBitmapImageRep *bitmap = [[NSBitmapImageRep alloc] initWithBitmapDataPlanes:(unsigned char **)&icon->pixels + pixelsWide:icon->w + pixelsHigh:icon->h bitsPerSample:8 samplesPerPixel:4 hasAlpha:YES isPlanar:NO colorSpaceName:NSCalibratedRGBColorSpace - bytesPerRow:iconfmt->pitch + bytesPerRow:icon->pitch bitsPerPixel:32]; - NSImage *iconimg = [[NSImage alloc] initWithSize:NSMakeSize(iconfmt->w, iconfmt->h)]; + NSImage *iconimg = [[NSImage alloc] initWithSize:NSMakeSize(icon->w, icon->h)]; [iconimg addRepresentation:bitmap]; /* A typical icon size is 22x22 on macOS. Failing to resize the icon @@ -170,11 +176,15 @@ void SDL_SetTrayIcon(SDL_Tray *tray, SDL_Surface *icon) tray->statusItem.button.image = iconimg22; - SDL_DestroySurface(iconfmt); + SDL_DestroySurface(icon); } void SDL_SetTrayTooltip(SDL_Tray *tray, const char *tooltip) { + if (!SDL_ObjectValid(tray, SDL_OBJECT_TYPE_TRAY)) { + return; + } + if (tooltip) { tray->statusItem.button.toolTip = [NSString stringWithUTF8String:tooltip]; } else { @@ -184,6 +194,11 @@ void SDL_SetTrayTooltip(SDL_Tray *tray, const char *tooltip) SDL_TrayMenu *SDL_CreateTrayMenu(SDL_Tray *tray) { + if (!SDL_ObjectValid(tray, SDL_OBJECT_TYPE_TRAY)) { + SDL_InvalidParamError("tray"); + return NULL; + } + SDL_TrayMenu *menu = (SDL_TrayMenu *)SDL_calloc(1, sizeof(*menu)); if (!menu) { return NULL; @@ -206,11 +221,21 @@ void SDL_SetTrayTooltip(SDL_Tray *tray, const char *tooltip) SDL_TrayMenu *SDL_GetTrayMenu(SDL_Tray *tray) { + if (!SDL_ObjectValid(tray, SDL_OBJECT_TYPE_TRAY)) { + SDL_InvalidParamError("tray"); + return NULL; + } + return tray->menu; } SDL_TrayMenu *SDL_CreateTraySubmenu(SDL_TrayEntry *entry) { + if (!entry) { + SDL_InvalidParamError("entry"); + return NULL; + } + if (entry->submenu) { SDL_SetError("Tray entry submenu already exists"); return NULL; @@ -243,11 +268,21 @@ void SDL_SetTrayTooltip(SDL_Tray *tray, const char *tooltip) SDL_TrayMenu *SDL_GetTraySubmenu(SDL_TrayEntry *entry) { + if (!entry) { + SDL_InvalidParamError("entry"); + return NULL; + } + return entry->submenu; } const SDL_TrayEntry **SDL_GetTrayEntries(SDL_TrayMenu *menu, int *size) { + if (!menu) { + SDL_InvalidParamError("menu"); + return NULL; + } + if (size) { *size = menu->nEntries; } @@ -293,6 +328,11 @@ void SDL_RemoveTrayEntry(SDL_TrayEntry *entry) SDL_TrayEntry *SDL_InsertTrayEntryAt(SDL_TrayMenu *menu, int pos, const char *label, SDL_TrayEntryFlags flags) { + if (!menu) { + SDL_InvalidParamError("menu"); + return NULL; + } + if (pos < -1 || pos > menu->nEntries) { SDL_InvalidParamError("pos"); return NULL; @@ -347,28 +387,44 @@ void SDL_RemoveTrayEntry(SDL_TrayEntry *entry) void SDL_SetTrayEntryLabel(SDL_TrayEntry *entry, const char *label) { + if (!entry) { + return; + } + [entry->nsitem setTitle:[NSString stringWithUTF8String:label]]; } const char *SDL_GetTrayEntryLabel(SDL_TrayEntry *entry) { + if (!entry) { + SDL_InvalidParamError("entry"); + return NULL; + } + return [[entry->nsitem title] UTF8String]; } void SDL_SetTrayEntryChecked(SDL_TrayEntry *entry, bool checked) { + if (!entry) { + return; + } + [entry->nsitem setState:(checked ? NSControlStateValueOn : NSControlStateValueOff)]; } bool SDL_GetTrayEntryChecked(SDL_TrayEntry *entry) { + if (!entry) { + return false; + } + return entry->nsitem.state == NSControlStateValueOn; } void SDL_SetTrayEntryEnabled(SDL_TrayEntry *entry, bool enabled) { - if (!(entry->flags & SDL_TRAYENTRY_CHECKBOX)) { - SDL_SetError("Cannot update check for entry not created with SDL_TRAYENTRY_CHECKBOX"); + if (!entry || !(entry->flags & SDL_TRAYENTRY_CHECKBOX)) { return; } @@ -377,8 +433,7 @@ void SDL_SetTrayEntryEnabled(SDL_TrayEntry *entry, bool enabled) bool SDL_GetTrayEntryEnabled(SDL_TrayEntry *entry) { - if (!(entry->flags & SDL_TRAYENTRY_CHECKBOX)) { - SDL_SetError("Cannot fetch check for entry not created with SDL_TRAYENTRY_CHECKBOX"); + if (!entry || !(entry->flags & SDL_TRAYENTRY_CHECKBOX)) { return false; } @@ -387,6 +442,10 @@ bool SDL_GetTrayEntryEnabled(SDL_TrayEntry *entry) void SDL_SetTrayEntryCallback(SDL_TrayEntry *entry, SDL_TrayCallback callback, void *userdata) { + if (!entry) { + return; + } + entry->callback = callback; entry->userdata = userdata; } @@ -408,25 +467,42 @@ void SDL_ClickTrayEntry(SDL_TrayEntry *entry) SDL_TrayMenu *SDL_GetTrayEntryParent(SDL_TrayEntry *entry) { + if (!entry) { + SDL_InvalidParamError("entry"); + return NULL; + } + return entry->parent; } SDL_TrayEntry *SDL_GetTrayMenuParentEntry(SDL_TrayMenu *menu) { + if (!menu) { + SDL_InvalidParamError("menu"); + return NULL; + } + return menu->parent_entry; } SDL_Tray *SDL_GetTrayMenuParentTray(SDL_TrayMenu *menu) { + if (!menu) { + SDL_InvalidParamError("menu"); + return NULL; + } + return menu->parent_tray; } void SDL_DestroyTray(SDL_Tray *tray) { - if (!tray) { + if (!SDL_ObjectValid(tray, SDL_OBJECT_TYPE_TRAY)) { return; } + SDL_UnregisterTray(tray); + [[NSStatusBar systemStatusBar] removeStatusItem:tray->statusItem]; if (tray->menu) { @@ -434,8 +510,6 @@ void SDL_DestroyTray(SDL_Tray *tray) } SDL_free(tray); - - SDL_DecrementTrayCount(); } #endif // SDL_PLATFORM_MACOS diff --git a/src/tray/dummy/SDL_tray.c b/src/tray/dummy/SDL_tray.c index 59d7e8a7bb0cf..55a1e645586f4 100644 --- a/src/tray/dummy/SDL_tray.c +++ b/src/tray/dummy/SDL_tray.c @@ -33,29 +33,27 @@ SDL_Tray *SDL_CreateTray(SDL_Surface *icon, const char *tooltip) void SDL_SetTrayIcon(SDL_Tray *tray, SDL_Surface *icon) { - SDL_Unsupported(); } void SDL_SetTrayTooltip(SDL_Tray *tray, const char *tooltip) { - SDL_Unsupported(); } SDL_TrayMenu *SDL_CreateTrayMenu(SDL_Tray *tray) { - SDL_Unsupported(); + SDL_InvalidParamError("tray"); return NULL; } SDL_TrayMenu *SDL_GetTrayMenu(SDL_Tray *tray) { - SDL_Unsupported(); + SDL_InvalidParamError("tray"); return NULL; } SDL_TrayMenu *SDL_CreateTraySubmenu(SDL_TrayEntry *entry) { - SDL_Unsupported(); + SDL_InvalidParamError("entry"); return NULL; } @@ -66,57 +64,50 @@ SDL_TrayMenu *SDL_GetTraySubmenu(SDL_TrayEntry *entry) const SDL_TrayEntry **SDL_GetTrayEntries(SDL_TrayMenu *menu, int *size) { - SDL_Unsupported(); + SDL_InvalidParamError("menu"); return NULL; } void SDL_RemoveTrayEntry(SDL_TrayEntry *entry) { - SDL_Unsupported(); } SDL_TrayEntry *SDL_InsertTrayEntryAt(SDL_TrayMenu *menu, int pos, const char *label, SDL_TrayEntryFlags flags) { - SDL_Unsupported(); + SDL_InvalidParamError("menu"); return NULL; } void SDL_SetTrayEntryLabel(SDL_TrayEntry *entry, const char *label) { - SDL_Unsupported(); } const char *SDL_GetTrayEntryLabel(SDL_TrayEntry *entry) { - SDL_Unsupported(); + SDL_InvalidParamError("entry"); return NULL; } void SDL_SetTrayEntryChecked(SDL_TrayEntry *entry, bool checked) { - SDL_Unsupported(); } bool SDL_GetTrayEntryChecked(SDL_TrayEntry *entry) { - SDL_Unsupported(); - return false; + return SDL_InvalidParamError("entry"); } void SDL_SetTrayEntryEnabled(SDL_TrayEntry *entry, bool enabled) { - SDL_Unsupported(); } bool SDL_GetTrayEntryEnabled(SDL_TrayEntry *entry) { - SDL_Unsupported(); - return false; + return SDL_InvalidParamError("entry"); } void SDL_SetTrayEntryCallback(SDL_TrayEntry *entry, SDL_TrayCallback callback, void *userdata) { - SDL_Unsupported(); } void SDL_ClickTrayEntry(SDL_TrayEntry *entry) @@ -125,25 +116,24 @@ void SDL_ClickTrayEntry(SDL_TrayEntry *entry) SDL_TrayMenu *SDL_GetTrayEntryParent(SDL_TrayEntry *entry) { - SDL_Unsupported(); + SDL_InvalidParamError("entry"); return NULL; } SDL_TrayEntry *SDL_GetTrayMenuParentEntry(SDL_TrayMenu *menu) { - SDL_Unsupported(); + SDL_InvalidParamError("menu"); return NULL; } SDL_Tray *SDL_GetTrayMenuParentTray(SDL_TrayMenu *menu) { - SDL_Unsupported(); + SDL_InvalidParamError("menu"); return NULL; } void SDL_DestroyTray(SDL_Tray *tray) { - SDL_Unsupported(); } #endif // !SDL_PLATFORM_MACOS diff --git a/src/tray/unix/SDL_tray.c b/src/tray/unix/SDL_tray.c index e1bd27c095a02..3d5fafab0c5c5 100644 --- a/src/tray/unix/SDL_tray.c +++ b/src/tray/unix/SDL_tray.c @@ -144,7 +144,7 @@ static void quit_gtk(void) static bool init_gtk(void) { - + return true; } #else @@ -434,13 +434,17 @@ SDL_Tray *SDL_CreateTray(SDL_Surface *icon, const char *tooltip) app_indicator_set_status(tray->indicator, APP_INDICATOR_STATUS_ACTIVE); - SDL_IncrementTrayCount(); + SDL_RegisterTray(tray); return tray; } void SDL_SetTrayIcon(SDL_Tray *tray, SDL_Surface *icon) { + if (!SDL_ObjectValid(tray, SDL_OBJECT_TYPE_TRAY)) { + return; + } + if (*tray->icon_path) { SDL_RemovePath(tray->icon_path); } @@ -463,6 +467,11 @@ void SDL_SetTrayTooltip(SDL_Tray *tray, const char *tooltip) SDL_TrayMenu *SDL_CreateTrayMenu(SDL_Tray *tray) { + if (!SDL_ObjectValid(tray, SDL_OBJECT_TYPE_TRAY)) { + SDL_InvalidParamError("tray"); + return NULL; + } + tray->menu = (SDL_TrayMenu *)SDL_calloc(1, sizeof(*tray->menu)); if (!tray->menu) { return NULL; @@ -481,11 +490,21 @@ SDL_TrayMenu *SDL_CreateTrayMenu(SDL_Tray *tray) SDL_TrayMenu *SDL_GetTrayMenu(SDL_Tray *tray) { + if (!SDL_ObjectValid(tray, SDL_OBJECT_TYPE_TRAY)) { + SDL_InvalidParamError("tray"); + return NULL; + } + return tray->menu; } SDL_TrayMenu *SDL_CreateTraySubmenu(SDL_TrayEntry *entry) { + if (!entry) { + SDL_InvalidParamError("entry"); + return NULL; + } + if (entry->submenu) { SDL_SetError("Tray entry submenu already exists"); return NULL; @@ -514,11 +533,21 @@ SDL_TrayMenu *SDL_CreateTraySubmenu(SDL_TrayEntry *entry) SDL_TrayMenu *SDL_GetTraySubmenu(SDL_TrayEntry *entry) { + if (!entry) { + SDL_InvalidParamError("entry"); + return NULL; + } + return entry->submenu; } const SDL_TrayEntry **SDL_GetTrayEntries(SDL_TrayMenu *menu, int *size) { + if (!menu) { + SDL_InvalidParamError("menu"); + return NULL; + } + if (size) { *size = menu->nEntries; } @@ -563,6 +592,11 @@ void SDL_RemoveTrayEntry(SDL_TrayEntry *entry) SDL_TrayEntry *SDL_InsertTrayEntryAt(SDL_TrayMenu *menu, int pos, const char *label, SDL_TrayEntryFlags flags) { + if (!menu) { + SDL_InvalidParamError("menu"); + return NULL; + } + if (pos < -1 || pos > menu->nEntries) { SDL_InvalidParamError("pos"); return NULL; @@ -625,18 +659,26 @@ SDL_TrayEntry *SDL_InsertTrayEntryAt(SDL_TrayMenu *menu, int pos, const char *la void SDL_SetTrayEntryLabel(SDL_TrayEntry *entry, const char *label) { + if (!entry) { + return; + } + gtk_menu_item_set_label(GTK_MENU_ITEM(entry->item), label); } const char *SDL_GetTrayEntryLabel(SDL_TrayEntry *entry) { + if (!entry) { + SDL_InvalidParamError("entry"); + return NULL; + } + return gtk_menu_item_get_label(GTK_MENU_ITEM(entry->item)); } void SDL_SetTrayEntryChecked(SDL_TrayEntry *entry, bool checked) { - if (!(entry->flags & SDL_TRAYENTRY_CHECKBOX)) { - SDL_SetError("Cannot update check for entry not created with SDL_TRAYENTRY_CHECKBOX"); + if (!entry || !(entry->flags & SDL_TRAYENTRY_CHECKBOX)) { return; } @@ -647,8 +689,7 @@ void SDL_SetTrayEntryChecked(SDL_TrayEntry *entry, bool checked) bool SDL_GetTrayEntryChecked(SDL_TrayEntry *entry) { - if (!(entry->flags & SDL_TRAYENTRY_CHECKBOX)) { - SDL_SetError("Cannot fetch check for entry not created with SDL_TRAYENTRY_CHECKBOX"); + if (!entry || !(entry->flags & SDL_TRAYENTRY_CHECKBOX)) { return false; } @@ -657,16 +698,28 @@ bool SDL_GetTrayEntryChecked(SDL_TrayEntry *entry) void SDL_SetTrayEntryEnabled(SDL_TrayEntry *entry, bool enabled) { + if (!entry) { + return; + } + gtk_widget_set_sensitive(entry->item, enabled); } bool SDL_GetTrayEntryEnabled(SDL_TrayEntry *entry) { + if (!entry) { + return false; + } + return gtk_widget_get_sensitive(entry->item); } void SDL_SetTrayEntryCallback(SDL_TrayEntry *entry, SDL_TrayCallback callback, void *userdata) { + if (!entry) { + return; + } + entry->callback = callback; entry->userdata = userdata; } @@ -688,6 +741,11 @@ void SDL_ClickTrayEntry(SDL_TrayEntry *entry) SDL_TrayMenu *SDL_GetTrayEntryParent(SDL_TrayEntry *entry) { + if (!entry) { + SDL_InvalidParamError("entry"); + return NULL; + } + return entry->parent; } @@ -698,15 +756,22 @@ SDL_TrayEntry *SDL_GetTrayMenuParentEntry(SDL_TrayMenu *menu) SDL_Tray *SDL_GetTrayMenuParentTray(SDL_TrayMenu *menu) { + if (!menu) { + SDL_InvalidParamError("menu"); + return NULL; + } + return menu->parent_tray; } void SDL_DestroyTray(SDL_Tray *tray) { - if (!tray) { + if (!SDL_ObjectValid(tray, SDL_OBJECT_TYPE_TRAY)) { return; } + SDL_UnregisterTray(tray); + if (tray->menu) { DestroySDLMenu(tray->menu); } @@ -725,8 +790,6 @@ void SDL_DestroyTray(SDL_Tray *tray) SDL_free(tray); - SDL_DecrementTrayCount(); - if (SDL_HasNoActiveTrays()) { gtk_main_quit(); gtk_thread_active = false; diff --git a/src/tray/windows/SDL_tray.c b/src/tray/windows/SDL_tray.c index fe072eb017c0f..dbfbabafa27a6 100644 --- a/src/tray/windows/SDL_tray.c +++ b/src/tray/windows/SDL_tray.c @@ -252,13 +252,17 @@ SDL_Tray *SDL_CreateTray(SDL_Surface *icon, const char *tooltip) SetWindowLongPtr(tray->hwnd, GWLP_USERDATA, (LONG_PTR) tray); - SDL_IncrementTrayCount(); + SDL_RegisterTray(tray); return tray; } void SDL_SetTrayIcon(SDL_Tray *tray, SDL_Surface *icon) { + if (!SDL_ObjectValid(tray, SDL_OBJECT_TYPE_TRAY)) { + return; + } + if (tray->icon) { DestroyIcon(tray->icon); } @@ -281,6 +285,10 @@ void SDL_SetTrayIcon(SDL_Tray *tray, SDL_Surface *icon) void SDL_SetTrayTooltip(SDL_Tray *tray, const char *tooltip) { + if (!SDL_ObjectValid(tray, SDL_OBJECT_TYPE_TRAY)) { + return; + } + if (tooltip) { wchar_t *tooltipw = WIN_UTF8ToStringW(tooltip); SDL_wcslcpy(tray->nid.szTip, tooltipw, sizeof(tray->nid.szTip) / sizeof(*tray->nid.szTip)); @@ -294,6 +302,11 @@ void SDL_SetTrayTooltip(SDL_Tray *tray, const char *tooltip) SDL_TrayMenu *SDL_CreateTrayMenu(SDL_Tray *tray) { + if (!SDL_ObjectValid(tray, SDL_OBJECT_TYPE_TRAY)) { + SDL_InvalidParamError("tray"); + return NULL; + } + tray->menu = (SDL_TrayMenu *)SDL_calloc(1, sizeof(*tray->menu)); if (!tray->menu) { @@ -309,13 +322,24 @@ SDL_TrayMenu *SDL_CreateTrayMenu(SDL_Tray *tray) SDL_TrayMenu *SDL_GetTrayMenu(SDL_Tray *tray) { + if (!SDL_ObjectValid(tray, SDL_OBJECT_TYPE_TRAY)) { + SDL_InvalidParamError("tray"); + return NULL; + } + return tray->menu; } SDL_TrayMenu *SDL_CreateTraySubmenu(SDL_TrayEntry *entry) { + if (!entry) { + SDL_InvalidParamError("entry"); + return NULL; + } + if (!entry->submenu) { SDL_SetError("Cannot create submenu for entry not created with SDL_TRAYENTRY_SUBMENU"); + return NULL; } return entry->submenu; @@ -323,11 +347,21 @@ SDL_TrayMenu *SDL_CreateTraySubmenu(SDL_TrayEntry *entry) SDL_TrayMenu *SDL_GetTraySubmenu(SDL_TrayEntry *entry) { + if (!entry) { + SDL_InvalidParamError("entry"); + return NULL; + } + return entry->submenu; } const SDL_TrayEntry **SDL_GetTrayEntries(SDL_TrayMenu *menu, int *size) { + if (!menu) { + SDL_InvalidParamError("menu"); + return NULL; + } + if (size) { *size = menu->nEntries; } @@ -376,6 +410,11 @@ void SDL_RemoveTrayEntry(SDL_TrayEntry *entry) SDL_TrayEntry *SDL_InsertTrayEntryAt(SDL_TrayMenu *menu, int pos, const char *label, SDL_TrayEntryFlags flags) { + if (!menu) { + SDL_InvalidParamError("menu"); + return NULL; + } + if (pos < -1 || pos > menu->nEntries) { SDL_InvalidParamError("pos"); return NULL; @@ -474,6 +513,10 @@ SDL_TrayEntry *SDL_InsertTrayEntryAt(SDL_TrayMenu *menu, int pos, const char *la void SDL_SetTrayEntryLabel(SDL_TrayEntry *entry, const char *label) { + if (!entry) { + return; + } + SDL_snprintf(entry->label_cache, sizeof(entry->label_cache), "%s", label); wchar_t *label_w = escape_label(label); @@ -498,13 +541,17 @@ void SDL_SetTrayEntryLabel(SDL_TrayEntry *entry, const char *label) const char *SDL_GetTrayEntryLabel(SDL_TrayEntry *entry) { + if (!entry) { + SDL_InvalidParamError("entry"); + return NULL; + } + return entry->label_cache; } void SDL_SetTrayEntryChecked(SDL_TrayEntry *entry, bool checked) { - if (!(entry->flags & SDL_TRAYENTRY_CHECKBOX)) { - SDL_SetError("Can't check/uncheck tray entry not created with SDL_TRAYENTRY_CHECKBOX"); + if (!entry || !(entry->flags & SDL_TRAYENTRY_CHECKBOX)) { return; } @@ -513,8 +560,7 @@ void SDL_SetTrayEntryChecked(SDL_TrayEntry *entry, bool checked) bool SDL_GetTrayEntryChecked(SDL_TrayEntry *entry) { - if (!(entry->flags & SDL_TRAYENTRY_CHECKBOX)) { - SDL_SetError("Can't get check status of tray entry not created with SDL_TRAYENTRY_CHECKBOX"); + if (!entry || !(entry->flags & SDL_TRAYENTRY_CHECKBOX)) { return false; } @@ -529,11 +575,19 @@ bool SDL_GetTrayEntryChecked(SDL_TrayEntry *entry) void SDL_SetTrayEntryEnabled(SDL_TrayEntry *entry, bool enabled) { + if (!entry) { + return; + } + EnableMenuItem(entry->parent->hMenu, (UINT) entry->id, MF_BYCOMMAND | (enabled ? MF_ENABLED : (MF_DISABLED | MF_GRAYED))); } bool SDL_GetTrayEntryEnabled(SDL_TrayEntry *entry) { + if (!entry) { + return false; + } + MENUITEMINFOW mii; mii.cbSize = sizeof(MENUITEMINFOW); mii.fMask = MIIM_STATE; @@ -545,6 +599,10 @@ bool SDL_GetTrayEntryEnabled(SDL_TrayEntry *entry) void SDL_SetTrayEntryCallback(SDL_TrayEntry *entry, SDL_TrayCallback callback, void *userdata) { + if (!entry) { + return; + } + entry->callback = callback; entry->userdata = userdata; } @@ -566,25 +624,42 @@ void SDL_ClickTrayEntry(SDL_TrayEntry *entry) SDL_TrayMenu *SDL_GetTrayEntryParent(SDL_TrayEntry *entry) { + if (!entry) { + SDL_InvalidParamError("entry"); + return NULL; + } + return entry->parent; } SDL_TrayEntry *SDL_GetTrayMenuParentEntry(SDL_TrayMenu *menu) { + if (!menu) { + SDL_InvalidParamError("menu"); + return NULL; + } + return menu->parent_entry; } SDL_Tray *SDL_GetTrayMenuParentTray(SDL_TrayMenu *menu) { + if (!menu) { + SDL_InvalidParamError("menu"); + return NULL; + } + return menu->parent_tray; } void SDL_DestroyTray(SDL_Tray *tray) { - if (!tray) { + if (!SDL_ObjectValid(tray, SDL_OBJECT_TYPE_TRAY)) { return; } + SDL_UnregisterTray(tray); + Shell_NotifyIconW(NIM_DELETE, &tray->nid); if (tray->menu) { @@ -600,6 +675,4 @@ void SDL_DestroyTray(SDL_Tray *tray) } SDL_free(tray); - - SDL_DecrementTrayCount(); } From a974888aad348512b42b8057ca4619c6ab854e22 Mon Sep 17 00:00:00 2001 From: Sam Lantinga Date: Sun, 19 Jan 2025 10:47:30 -0800 Subject: [PATCH 164/340] tray: fixed icon colors on Windows --- src/video/windows/SDL_surface_utils.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/video/windows/SDL_surface_utils.c b/src/video/windows/SDL_surface_utils.c index e6a071f0cdee9..7f9245c1e054b 100644 --- a/src/video/windows/SDL_surface_utils.c +++ b/src/video/windows/SDL_surface_utils.c @@ -27,7 +27,7 @@ #if !(defined(SDL_PLATFORM_XBOXONE) || defined(SDL_PLATFORM_XBOXSERIES)) HICON CreateIconFromSurface(SDL_Surface *surface) { - SDL_Surface *s = SDL_ConvertSurface(surface, SDL_PIXELFORMAT_RGBA32); + SDL_Surface *s = SDL_ConvertSurface(surface, SDL_PIXELFORMAT_ARGB8888); if (!s) { return NULL; } From d4cda5105779b34201be7ef2b3e5e2bf85a78876 Mon Sep 17 00:00:00 2001 From: Sam Lantinga Date: Sun, 19 Jan 2025 16:29:58 -0800 Subject: [PATCH 165/340] tray: renamed SDL_HasNoActiveTrays() to SDL_HasActiveTrays() --- src/events/SDL_windowevents.c | 2 +- src/tray/SDL_tray_utils.c | 4 ++-- src/tray/SDL_tray_utils.h | 2 +- src/tray/unix/SDL_tray.c | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/events/SDL_windowevents.c b/src/events/SDL_windowevents.c index 0c7ab79660bab..2258ce793c837 100644 --- a/src/events/SDL_windowevents.c +++ b/src/events/SDL_windowevents.c @@ -247,7 +247,7 @@ bool SDL_SendWindowEvent(SDL_Window *window, SDL_EventType windowevent, int data break; } - if (windowevent == SDL_EVENT_WINDOW_CLOSE_REQUESTED && !window->parent && SDL_HasNoActiveTrays()) { + if (windowevent == SDL_EVENT_WINDOW_CLOSE_REQUESTED && !window->parent && !SDL_HasActiveTrays()) { int toplevel_count = 0; SDL_Window *n; for (n = SDL_GetVideoDevice()->windows; n; n = n->next) { diff --git a/src/tray/SDL_tray_utils.c b/src/tray/SDL_tray_utils.c index ce792adc479a7..35cf5593b0be6 100644 --- a/src/tray/SDL_tray_utils.c +++ b/src/tray/SDL_tray_utils.c @@ -85,7 +85,7 @@ void SDL_CleanupTrays(void) SDL_free(trays); } -bool SDL_HasNoActiveTrays(void) +bool SDL_HasActiveTrays(void) { - return active_trays == 0; + return (active_trays > 0); } diff --git a/src/tray/SDL_tray_utils.h b/src/tray/SDL_tray_utils.h index 8dc2249d2231a..e9e64fc6862fc 100644 --- a/src/tray/SDL_tray_utils.h +++ b/src/tray/SDL_tray_utils.h @@ -23,4 +23,4 @@ extern void SDL_RegisterTray(SDL_Tray *tray); extern void SDL_UnregisterTray(SDL_Tray *tray); extern void SDL_CleanupTrays(void); -extern bool SDL_HasNoActiveTrays(void); +extern bool SDL_HasActiveTrays(void); diff --git a/src/tray/unix/SDL_tray.c b/src/tray/unix/SDL_tray.c index 3d5fafab0c5c5..c543ed5ba026d 100644 --- a/src/tray/unix/SDL_tray.c +++ b/src/tray/unix/SDL_tray.c @@ -790,7 +790,7 @@ void SDL_DestroyTray(SDL_Tray *tray) SDL_free(tray); - if (SDL_HasNoActiveTrays()) { + if (!SDL_HasActiveTrays()) { gtk_main_quit(); gtk_thread_active = false; } From dfdc120268e4b2875bb958fcdace54297fa73703 Mon Sep 17 00:00:00 2001 From: Sam Lantinga Date: Sun, 19 Jan 2025 10:42:49 -0800 Subject: [PATCH 166/340] tray: document thread-safety --- include/SDL3/SDL_tray.h | 46 ++++++++++++++++++++++++++++++++++++- src/tray/cocoa/SDL_tray.m | 5 ++++ src/tray/unix/SDL_tray.c | 5 ++++ src/tray/windows/SDL_tray.c | 5 ++++ 4 files changed, 60 insertions(+), 1 deletion(-) diff --git a/include/SDL3/SDL_tray.h b/include/SDL3/SDL_tray.h index b001169856de4..54123b5020342 100644 --- a/include/SDL3/SDL_tray.h +++ b/include/SDL3/SDL_tray.h @@ -108,6 +108,8 @@ typedef void (SDLCALL *SDL_TrayCallback)(void *userdata, SDL_TrayEntry *entry); * * \since This function is available since SDL 3.1.8. * + * \threadsafety This function should only be called on the main thread. + * * \sa SDL_CreateTrayMenu * \sa SDL_GetTrayMenu * \sa SDL_DestroyTray @@ -122,6 +124,8 @@ extern SDL_DECLSPEC SDL_Tray *SDLCALL SDL_CreateTray(SDL_Surface *icon, const ch * * \since This function is available since SDL 3.1.8. * + * \threadsafety This function should be called on the thread that created the tray. + * * \sa SDL_CreateTray */ extern SDL_DECLSPEC void SDLCALL SDL_SetTrayIcon(SDL_Tray *tray, SDL_Surface *icon); @@ -134,6 +138,8 @@ extern SDL_DECLSPEC void SDLCALL SDL_SetTrayIcon(SDL_Tray *tray, SDL_Surface *ic * * \since This function is available since SDL 3.1.8. * + * \threadsafety This function should be called on the thread that created the tray. + * * \sa SDL_CreateTray */ extern SDL_DECLSPEC void SDLCALL SDL_SetTrayTooltip(SDL_Tray *tray, const char *tooltip); @@ -153,6 +159,8 @@ extern SDL_DECLSPEC void SDLCALL SDL_SetTrayTooltip(SDL_Tray *tray, const char * * * \since This function is available since SDL 3.1.8. * + * \threadsafety This function should be called on the thread that created the tray. + * * \sa SDL_CreateTray * \sa SDL_GetTrayMenu * \sa SDL_GetTrayMenuParentTray @@ -174,6 +182,8 @@ extern SDL_DECLSPEC SDL_TrayMenu *SDLCALL SDL_CreateTrayMenu(SDL_Tray *tray); * * \since This function is available since SDL 3.1.8. * + * \threadsafety This function should be called on the thread that created the tray. + * * \sa SDL_InsertTrayEntryAt * \sa SDL_GetTraySubmenu * \sa SDL_GetTrayMenuParentEntry @@ -196,6 +206,8 @@ extern SDL_DECLSPEC SDL_TrayMenu *SDLCALL SDL_CreateTraySubmenu(SDL_TrayEntry *e * * \since This function is available since SDL 3.1.8. * + * \threadsafety This function should be called on the thread that created the tray. + * * \sa SDL_CreateTray * \sa SDL_CreateTrayMenu */ @@ -217,6 +229,8 @@ extern SDL_DECLSPEC SDL_TrayMenu *SDLCALL SDL_GetTrayMenu(SDL_Tray *tray); * * \since This function is available since SDL 3.1.8. * + * \threadsafety This function should be called on the thread that created the tray. + * * \sa SDL_InsertTrayEntryAt * \sa SDL_CreateTraySubmenu */ @@ -234,6 +248,8 @@ extern SDL_DECLSPEC SDL_TrayMenu *SDLCALL SDL_GetTraySubmenu(SDL_TrayEntry *entr * * \since This function is available since SDL 3.1.8. * + * \threadsafety This function should be called on the thread that created the tray. + * * \sa SDL_RemoveTrayEntry * \sa SDL_InsertTrayEntryAt */ @@ -246,6 +262,8 @@ extern SDL_DECLSPEC const SDL_TrayEntry **SDLCALL SDL_GetTrayEntries(SDL_TrayMen * * \since This function is available since SDL 3.1.8. * + * \threadsafety This function should be called on the thread that created the tray. + * * \sa SDL_GetTrayEntries * \sa SDL_InsertTrayEntryAt */ @@ -269,6 +287,8 @@ extern SDL_DECLSPEC void SDLCALL SDL_RemoveTrayEntry(SDL_TrayEntry *entry); * * \since This function is available since SDL 3.1.8. * + * \threadsafety This function should be called on the thread that created the tray. + * * \sa SDL_TrayEntryFlags * \sa SDL_GetTrayEntries * \sa SDL_RemoveTrayEntry @@ -289,6 +309,8 @@ extern SDL_DECLSPEC SDL_TrayEntry *SDLCALL SDL_InsertTrayEntryAt(SDL_TrayMenu *m * * \since This function is available since SDL 3.1.8. * + * \threadsafety This function should be called on the thread that created the tray. + * * \sa SDL_GetTrayEntries * \sa SDL_InsertTrayEntryAt * \sa SDL_GetTrayEntryLabel @@ -305,6 +327,8 @@ extern SDL_DECLSPEC void SDLCALL SDL_SetTrayEntryLabel(SDL_TrayEntry *entry, con * * \since This function is available since SDL 3.1.8. * + * \threadsafety This function should be called on the thread that created the tray. + * * \sa SDL_GetTrayEntries * \sa SDL_InsertTrayEntryAt * \sa SDL_SetTrayEntryLabel @@ -321,6 +345,8 @@ extern SDL_DECLSPEC const char *SDLCALL SDL_GetTrayEntryLabel(SDL_TrayEntry *ent * * \since This function is available since SDL 3.1.8. * + * \threadsafety This function should be called on the thread that created the tray. + * * \sa SDL_GetTrayEntries * \sa SDL_InsertTrayEntryAt * \sa SDL_GetTrayEntryChecked @@ -337,6 +363,8 @@ extern SDL_DECLSPEC void SDLCALL SDL_SetTrayEntryChecked(SDL_TrayEntry *entry, b * * \since This function is available since SDL 3.1.8. * + * \threadsafety This function should be called on the thread that created the tray. + * * \sa SDL_GetTrayEntries * \sa SDL_InsertTrayEntryAt * \sa SDL_SetTrayEntryChecked @@ -351,6 +379,8 @@ extern SDL_DECLSPEC bool SDLCALL SDL_GetTrayEntryChecked(SDL_TrayEntry *entry); * * \since This function is available since SDL 3.1.8. * + * \threadsafety This function should be called on the thread that created the tray. + * * \sa SDL_GetTrayEntries * \sa SDL_InsertTrayEntryAt * \sa SDL_GetTrayEntryEnabled @@ -365,6 +395,8 @@ extern SDL_DECLSPEC void SDLCALL SDL_SetTrayEntryEnabled(SDL_TrayEntry *entry, b * * \since This function is available since SDL 3.1.8. * + * \threadsafety This function should be called on the thread that created the tray. + * * \sa SDL_GetTrayEntries * \sa SDL_InsertTrayEntryAt * \sa SDL_SetTrayEntryEnabled @@ -381,6 +413,8 @@ extern SDL_DECLSPEC bool SDLCALL SDL_GetTrayEntryEnabled(SDL_TrayEntry *entry); * * \since This function is available since SDL 3.1.8. * + * \threadsafety This function should be called on the thread that created the tray. + * * \sa SDL_GetTrayEntries * \sa SDL_InsertTrayEntryAt */ @@ -392,6 +426,8 @@ extern SDL_DECLSPEC void SDLCALL SDL_SetTrayEntryCallback(SDL_TrayEntry *entry, * \param entry The entry to activate. * * \since This function is available since SDL 3.1.10. + * + * \threadsafety This function should be called on the thread that created the tray. */ extern SDL_DECLSPEC void SDLCALL SDL_ClickTrayEntry(SDL_TrayEntry *entry); @@ -404,18 +440,22 @@ extern SDL_DECLSPEC void SDLCALL SDL_ClickTrayEntry(SDL_TrayEntry *entry); * * \since This function is available since SDL 3.1.8. * + * \threadsafety This function should be called on the thread that created the tray. + * * \sa SDL_CreateTray */ extern SDL_DECLSPEC void SDLCALL SDL_DestroyTray(SDL_Tray *tray); /** - * Gets the menu contianing a certain tray entry. + * Gets the menu containing a certain tray entry. * * \param entry the entry for which to get the parent menu. * \returns the parent menu. * * \since This function is available since SDL 3.1.8. * + * \threadsafety This function should be called on the thread that created the tray. + * * \sa SDL_InsertTrayEntryAt */ extern SDL_DECLSPEC SDL_TrayMenu *SDLCALL SDL_GetTrayEntryParent(SDL_TrayEntry *entry); @@ -432,6 +472,8 @@ extern SDL_DECLSPEC SDL_TrayMenu *SDLCALL SDL_GetTrayEntryParent(SDL_TrayEntry * * * \since This function is available since SDL 3.1.8. * + * \threadsafety This function should be called on the thread that created the tray. + * * \sa SDL_CreateTraySubmenu * \sa SDL_GetTrayMenuParentTray */ @@ -449,6 +491,8 @@ extern SDL_DECLSPEC SDL_TrayEntry *SDLCALL SDL_GetTrayMenuParentEntry(SDL_TrayMe * * \since This function is available since SDL 3.1.8. * + * \threadsafety This function should be called on the thread that created the tray. + * * \sa SDL_CreateTrayMenu * \sa SDL_GetTrayMenuParentEntry */ diff --git a/src/tray/cocoa/SDL_tray.m b/src/tray/cocoa/SDL_tray.m index 15de54b24e9a6..9d2f55e2db347 100644 --- a/src/tray/cocoa/SDL_tray.m +++ b/src/tray/cocoa/SDL_tray.m @@ -80,6 +80,11 @@ static void DestroySDLMenu(SDL_TrayMenu *menu) SDL_Tray *SDL_CreateTray(SDL_Surface *icon, const char *tooltip) { + if (!SDL_IsMainThread()) { + SDL_SetError("This function should be called on the main thread"); + return NULL; + } + if (icon) { icon = SDL_ConvertSurface(icon, SDL_PIXELFORMAT_RGBA32); if (!icon) { diff --git a/src/tray/unix/SDL_tray.c b/src/tray/unix/SDL_tray.c index c543ed5ba026d..c26da85a58a61 100644 --- a/src/tray/unix/SDL_tray.c +++ b/src/tray/unix/SDL_tray.c @@ -398,6 +398,11 @@ static void DestroySDLMenu(SDL_TrayMenu *menu) SDL_Tray *SDL_CreateTray(SDL_Surface *icon, const char *tooltip) { + if (!SDL_IsMainThread()) { + SDL_SetError("This function should be called on the main thread"); + return NULL; + } + if (init_gtk() != true) { return NULL; } diff --git a/src/tray/windows/SDL_tray.c b/src/tray/windows/SDL_tray.c index dbfbabafa27a6..0afd62768f0e3 100644 --- a/src/tray/windows/SDL_tray.c +++ b/src/tray/windows/SDL_tray.c @@ -211,6 +211,11 @@ static HICON load_default_icon() SDL_Tray *SDL_CreateTray(SDL_Surface *icon, const char *tooltip) { + if (!SDL_IsMainThread()) { + SDL_SetError("This function should be called on the main thread"); + return NULL; + } + SDL_Tray *tray = (SDL_Tray *)SDL_calloc(1, sizeof(*tray)); if (!tray) { From 5f2dd5f04efdeda65a52b77edfc7ee8748b34901 Mon Sep 17 00:00:00 2001 From: Sam Lantinga Date: Sun, 19 Jan 2025 16:33:05 -0800 Subject: [PATCH 167/340] tray: fixed multi-threading issues with GTk implementation GTK+ documentation states that all GDK and GTK+ calls should be made from the main thread. Fixes https://github.com/libsdl-org/SDL/issues/11984 --- include/SDL3/SDL_tray.h | 11 ++++ src/dynapi/SDL_dynapi.sym | 1 + src/dynapi/SDL_dynapi_overrides.h | 1 + src/dynapi/SDL_dynapi_procs.h | 1 + src/events/SDL_events.c | 2 + src/tray/cocoa/SDL_tray.m | 4 ++ src/tray/dummy/SDL_tray.c | 4 ++ src/tray/unix/SDL_tray.c | 83 ++++++++++++++----------------- src/tray/windows/SDL_tray.c | 4 ++ 9 files changed, 64 insertions(+), 47 deletions(-) diff --git a/include/SDL3/SDL_tray.h b/include/SDL3/SDL_tray.h index 54123b5020342..f1fbc01cb5c94 100644 --- a/include/SDL3/SDL_tray.h +++ b/include/SDL3/SDL_tray.h @@ -498,6 +498,17 @@ extern SDL_DECLSPEC SDL_TrayEntry *SDLCALL SDL_GetTrayMenuParentEntry(SDL_TrayMe */ extern SDL_DECLSPEC SDL_Tray *SDLCALL SDL_GetTrayMenuParentTray(SDL_TrayMenu *menu); +/** + * Update the trays. + * + * This is called automatically by the event loop and is only needed if you're using trays but aren't handling SDL events. + * + * \since This function is available since SDL 3.2.0. + * + * \threadsafety This function should only be called on the main thread. + */ +extern SDL_DECLSPEC void SDLCALL SDL_UpdateTrays(void); + /* Ends C function definitions when using C++ */ #ifdef __cplusplus } diff --git a/src/dynapi/SDL_dynapi.sym b/src/dynapi/SDL_dynapi.sym index f0e66fc8348d8..b4dcc38396bb1 100644 --- a/src/dynapi/SDL_dynapi.sym +++ b/src/dynapi/SDL_dynapi.sym @@ -1232,6 +1232,7 @@ SDL3_0.0.0 { SDL_GetThreadState; SDL_AudioStreamDevicePaused; SDL_ClickTrayEntry; + SDL_UpdateTrays; # extra symbols go here (don't modify this line) local: *; }; diff --git a/src/dynapi/SDL_dynapi_overrides.h b/src/dynapi/SDL_dynapi_overrides.h index e23fe2ed2841b..d90b6fd074b54 100644 --- a/src/dynapi/SDL_dynapi_overrides.h +++ b/src/dynapi/SDL_dynapi_overrides.h @@ -1257,3 +1257,4 @@ #define SDL_GetThreadState SDL_GetThreadState_REAL #define SDL_AudioStreamDevicePaused SDL_AudioStreamDevicePaused_REAL #define SDL_ClickTrayEntry SDL_ClickTrayEntry_REAL +#define SDL_UpdateTrays SDL_UpdateTrays_REAL diff --git a/src/dynapi/SDL_dynapi_procs.h b/src/dynapi/SDL_dynapi_procs.h index d74f9597c694a..e57603d185522 100644 --- a/src/dynapi/SDL_dynapi_procs.h +++ b/src/dynapi/SDL_dynapi_procs.h @@ -1265,3 +1265,4 @@ SDL_DYNAPI_PROC(SDL_Tray*,SDL_GetTrayMenuParentTray,(SDL_TrayMenu *a),(a),return SDL_DYNAPI_PROC(SDL_ThreadState,SDL_GetThreadState,(SDL_Thread *a),(a),return) SDL_DYNAPI_PROC(bool,SDL_AudioStreamDevicePaused,(SDL_AudioStream *a),(a),return) SDL_DYNAPI_PROC(void,SDL_ClickTrayEntry,(SDL_TrayEntry *a),(a),) +SDL_DYNAPI_PROC(void,SDL_UpdateTrays,(void),(),) diff --git a/src/events/SDL_events.c b/src/events/SDL_events.c index f7b598304b3ab..c82fed18b7a48 100644 --- a/src/events/SDL_events.c +++ b/src/events/SDL_events.c @@ -1399,6 +1399,8 @@ static void SDL_PumpEventsInternal(bool push_sentinel) } #endif + SDL_UpdateTrays(); + SDL_SendPendingSignalEvents(); // in case we had a signal handler fire, etc. if (push_sentinel && SDL_EventEnabled(SDL_EVENT_POLL_SENTINEL)) { diff --git a/src/tray/cocoa/SDL_tray.m b/src/tray/cocoa/SDL_tray.m index 9d2f55e2db347..ae8d6be835f27 100644 --- a/src/tray/cocoa/SDL_tray.m +++ b/src/tray/cocoa/SDL_tray.m @@ -78,6 +78,10 @@ static void DestroySDLMenu(SDL_TrayMenu *menu) SDL_free(menu); } +void SDL_UpdateTrays(void) +{ +} + SDL_Tray *SDL_CreateTray(SDL_Surface *icon, const char *tooltip) { if (!SDL_IsMainThread()) { diff --git a/src/tray/dummy/SDL_tray.c b/src/tray/dummy/SDL_tray.c index 55a1e645586f4..db76db25269bf 100644 --- a/src/tray/dummy/SDL_tray.c +++ b/src/tray/dummy/SDL_tray.c @@ -25,6 +25,10 @@ #include "../SDL_tray_utils.h" +void SDL_UpdateTrays(void) +{ +} + SDL_Tray *SDL_CreateTray(SDL_Surface *icon, const char *tooltip) { SDL_Unsupported(); diff --git a/src/tray/unix/SDL_tray.c b/src/tray/unix/SDL_tray.c index c26da85a58a61..5f017c2f59c20 100644 --- a/src/tray/unix/SDL_tray.c +++ b/src/tray/unix/SDL_tray.c @@ -54,9 +54,10 @@ typedef enum G_CONNECT_AFTER = 1 << 0, G_CONNECT_SWAPPED = 1 << 1 } GConnectFlags; -gulong (*g_signal_connect_data)(gpointer instance, const gchar *detailed_signal, GCallback c_handler, gpointer data, GClosureNotify destroy_data, GConnectFlags connect_flags); -void (*g_object_unref)(gpointer object); -gchar *(*g_mkdtemp)(gchar *template); + +static gulong (*g_signal_connect_data)(gpointer instance, const gchar *detailed_signal, GCallback c_handler, gpointer data, GClosureNotify destroy_data, GConnectFlags connect_flags); +static void (*g_object_unref)(gpointer object); +static gchar *(*g_mkdtemp)(gchar *template); #define g_signal_connect(instance, detailed_signal, c_handler, data) \ g_signal_connect_data ((instance), (detailed_signal), (c_handler), (data), NULL, (GConnectFlags) 0) @@ -78,24 +79,23 @@ typedef struct _GtkMenuShell GtkMenuShell; typedef struct _GtkWidget GtkWidget; typedef struct _GtkCheckMenuItem GtkCheckMenuItem; -gboolean (*gtk_init_check)(int *argc, char ***argv); -void (*gtk_main)(void); -void (*gtk_main_quit)(void); -GtkWidget* (*gtk_menu_new)(void); -GtkWidget* (*gtk_separator_menu_item_new)(void); -GtkWidget* (*gtk_menu_item_new_with_label)(const gchar *label); -void (*gtk_menu_item_set_submenu)(GtkMenuItem *menu_item, GtkWidget *submenu); -GtkWidget* (*gtk_check_menu_item_new_with_label)(const gchar *label); -void (*gtk_check_menu_item_set_active)(GtkCheckMenuItem *check_menu_item, gboolean is_active); -void (*gtk_widget_set_sensitive)(GtkWidget *widget, gboolean sensitive); -void (*gtk_widget_show)(GtkWidget *widget); -void (*gtk_menu_shell_append)(GtkMenuShell *menu_shell, GtkWidget *child); -void (*gtk_menu_shell_insert)(GtkMenuShell *menu_shell, GtkWidget *child, gint position); -void (*gtk_widget_destroy)(GtkWidget *widget); -const gchar *(*gtk_menu_item_get_label)(GtkMenuItem *menu_item); -void (*gtk_menu_item_set_label)(GtkMenuItem *menu_item, const gchar *label); -gboolean (*gtk_check_menu_item_get_active)(GtkCheckMenuItem *check_menu_item); -gboolean (*gtk_widget_get_sensitive)(GtkWidget *widget); +static gboolean (*gtk_init_check)(int *argc, char ***argv); +static gboolean (*gtk_main_iteration_do)(gboolean blocking); +static GtkWidget* (*gtk_menu_new)(void); +static GtkWidget* (*gtk_separator_menu_item_new)(void); +static GtkWidget* (*gtk_menu_item_new_with_label)(const gchar *label); +static void (*gtk_menu_item_set_submenu)(GtkMenuItem *menu_item, GtkWidget *submenu); +static GtkWidget* (*gtk_check_menu_item_new_with_label)(const gchar *label); +static void (*gtk_check_menu_item_set_active)(GtkCheckMenuItem *check_menu_item, gboolean is_active); +static void (*gtk_widget_set_sensitive)(GtkWidget *widget, gboolean sensitive); +static void (*gtk_widget_show)(GtkWidget *widget); +static void (*gtk_menu_shell_append)(GtkMenuShell *menu_shell, GtkWidget *child); +static void (*gtk_menu_shell_insert)(GtkMenuShell *menu_shell, GtkWidget *child, gint position); +static void (*gtk_widget_destroy)(GtkWidget *widget); +static const gchar *(*gtk_menu_item_get_label)(GtkMenuItem *menu_item); +static void (*gtk_menu_item_set_label)(GtkMenuItem *menu_item, const gchar *label); +static gboolean (*gtk_check_menu_item_get_active)(GtkCheckMenuItem *check_menu_item); +static gboolean (*gtk_widget_get_sensitive)(GtkWidget *widget); #define GTK_MENU_ITEM(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GTK_TYPE_MENU_ITEM, GtkMenuItem)) #define GTK_WIDGET(widget) (G_TYPE_CHECK_INSTANCE_CAST ((widget), GTK_TYPE_WIDGET, GtkWidget)) @@ -119,23 +119,17 @@ typedef enum { } AppIndicatorStatus; typedef struct _AppIndicator AppIndicator; -AppIndicator *(*app_indicator_new)(const gchar *id, const gchar *icon_name, AppIndicatorCategory category); -void (*app_indicator_set_status)(AppIndicator *self, AppIndicatorStatus status); -void (*app_indicator_set_icon)(AppIndicator *self, const gchar *icon_name); -void (*app_indicator_set_menu)(AppIndicator *self, GtkMenu *menu); + +static AppIndicator *(*app_indicator_new)(const gchar *id, const gchar *icon_name, AppIndicatorCategory category); +static void (*app_indicator_set_status)(AppIndicator *self, AppIndicatorStatus status); +static void (*app_indicator_set_icon)(AppIndicator *self, const gchar *icon_name); +static void (*app_indicator_set_menu)(AppIndicator *self, GtkMenu *menu); + /* ------------------------------------------------------------------------- */ /* END THIRD-PARTY HEADER CONTENT */ /* ------------------------------------------------------------------------- */ #endif -static int main_gtk_thread(void *data) -{ - gtk_main(); - return 0; -} - -static bool gtk_thread_active = false; - #ifdef APPINDICATOR_HEADER static void quit_gtk(void) @@ -232,8 +226,7 @@ static bool init_gtk(void) } gtk_init_check = dlsym(libgtk, "gtk_init_check"); - gtk_main = dlsym(libgtk, "gtk_main"); - gtk_main_quit = dlsym(libgtk, "gtk_main_quit"); + gtk_main_iteration_do = dlsym(libgtk, "gtk_main_iteration_do"); gtk_menu_new = dlsym(libgtk, "gtk_menu_new"); gtk_separator_menu_item_new = dlsym(libgtk, "gtk_separator_menu_item_new"); gtk_menu_item_new_with_label = dlsym(libgtk, "gtk_menu_item_new_with_label"); @@ -262,8 +255,7 @@ static bool init_gtk(void) app_indicator_set_menu = dlsym(libappindicator, "app_indicator_set_menu"); if (!gtk_init_check || - !gtk_main || - !gtk_main_quit || + !gtk_main_iteration_do || !gtk_menu_new || !gtk_separator_menu_item_new || !gtk_menu_item_new_with_label || @@ -396,6 +388,13 @@ static void DestroySDLMenu(SDL_TrayMenu *menu) SDL_free(menu); } +void SDL_UpdateTrays(void) +{ + if (SDL_HasActiveTrays()) { + gtk_main_iteration_do(FALSE); + } +} + SDL_Tray *SDL_CreateTray(SDL_Surface *icon, const char *tooltip) { if (!SDL_IsMainThread()) { @@ -407,11 +406,6 @@ SDL_Tray *SDL_CreateTray(SDL_Surface *icon, const char *tooltip) return NULL; } - if (!gtk_thread_active) { - SDL_DetachThread(SDL_CreateThread(main_gtk_thread, "tray gtk", NULL)); - gtk_thread_active = true; - } - SDL_Tray *tray = (SDL_Tray *)SDL_calloc(1, sizeof(*tray)); if (!tray) { return NULL; @@ -794,9 +788,4 @@ void SDL_DestroyTray(SDL_Tray *tray) } SDL_free(tray); - - if (!SDL_HasActiveTrays()) { - gtk_main_quit(); - gtk_thread_active = false; - } } diff --git a/src/tray/windows/SDL_tray.c b/src/tray/windows/SDL_tray.c index 0afd62768f0e3..a7e27c069914d 100644 --- a/src/tray/windows/SDL_tray.c +++ b/src/tray/windows/SDL_tray.c @@ -209,6 +209,10 @@ static HICON load_default_icon() return LoadIcon(NULL, IDI_APPLICATION); } +void SDL_UpdateTrays(void) +{ +} + SDL_Tray *SDL_CreateTray(SDL_Surface *icon, const char *tooltip) { if (!SDL_IsMainThread()) { From 53a53502921d7c46258babb99ed51fdca00c2aad Mon Sep 17 00:00:00 2001 From: SDL Wiki Bot Date: Mon, 20 Jan 2025 02:54:44 +0000 Subject: [PATCH 168/340] Sync SDL3 wiki -> header [ci skip] --- include/SDL3/SDL_tray.h | 116 ++++++++++++++++++++++++---------------- 1 file changed, 69 insertions(+), 47 deletions(-) diff --git a/include/SDL3/SDL_tray.h b/include/SDL3/SDL_tray.h index f1fbc01cb5c94..ba96c3f6f206d 100644 --- a/include/SDL3/SDL_tray.h +++ b/include/SDL3/SDL_tray.h @@ -106,10 +106,10 @@ typedef void (SDLCALL *SDL_TrayCallback)(void *userdata, SDL_TrayEntry *entry); * UTF-8 encoding. Not supported on all platforms. May be NULL. * \returns The newly created system tray icon. * - * \since This function is available since SDL 3.1.8. - * * \threadsafety This function should only be called on the main thread. * + * \since This function is available since SDL 3.1.8. + * * \sa SDL_CreateTrayMenu * \sa SDL_GetTrayMenu * \sa SDL_DestroyTray @@ -122,9 +122,10 @@ extern SDL_DECLSPEC SDL_Tray *SDLCALL SDL_CreateTray(SDL_Surface *icon, const ch * \param tray the tray icon to be updated. * \param icon the new icon. May be NULL. * - * \since This function is available since SDL 3.1.8. + * \threadsafety This function should be called on the thread that created the + * tray. * - * \threadsafety This function should be called on the thread that created the tray. + * \since This function is available since SDL 3.1.8. * * \sa SDL_CreateTray */ @@ -136,9 +137,10 @@ extern SDL_DECLSPEC void SDLCALL SDL_SetTrayIcon(SDL_Tray *tray, SDL_Surface *ic * \param tray the tray icon to be updated. * \param tooltip the new tooltip in UTF-8 encoding. May be NULL. * - * \since This function is available since SDL 3.1.8. + * \threadsafety This function should be called on the thread that created the + * tray. * - * \threadsafety This function should be called on the thread that created the tray. + * \since This function is available since SDL 3.1.8. * * \sa SDL_CreateTray */ @@ -157,9 +159,10 @@ extern SDL_DECLSPEC void SDLCALL SDL_SetTrayTooltip(SDL_Tray *tray, const char * * \param tray the tray to bind the menu to. * \returns the newly created menu. * - * \since This function is available since SDL 3.1.8. + * \threadsafety This function should be called on the thread that created the + * tray. * - * \threadsafety This function should be called on the thread that created the tray. + * \since This function is available since SDL 3.1.8. * * \sa SDL_CreateTray * \sa SDL_GetTrayMenu @@ -180,9 +183,10 @@ extern SDL_DECLSPEC SDL_TrayMenu *SDLCALL SDL_CreateTrayMenu(SDL_Tray *tray); * \param entry the tray entry to bind the menu to. * \returns the newly created menu. * - * \since This function is available since SDL 3.1.8. + * \threadsafety This function should be called on the thread that created the + * tray. * - * \threadsafety This function should be called on the thread that created the tray. + * \since This function is available since SDL 3.1.8. * * \sa SDL_InsertTrayEntryAt * \sa SDL_GetTraySubmenu @@ -204,9 +208,10 @@ extern SDL_DECLSPEC SDL_TrayMenu *SDLCALL SDL_CreateTraySubmenu(SDL_TrayEntry *e * \param tray the tray entry to bind the menu to. * \returns the newly created menu. * - * \since This function is available since SDL 3.1.8. + * \threadsafety This function should be called on the thread that created the + * tray. * - * \threadsafety This function should be called on the thread that created the tray. + * \since This function is available since SDL 3.1.8. * * \sa SDL_CreateTray * \sa SDL_CreateTrayMenu @@ -227,9 +232,10 @@ extern SDL_DECLSPEC SDL_TrayMenu *SDLCALL SDL_GetTrayMenu(SDL_Tray *tray); * \param entry the tray entry to bind the menu to. * \returns the newly created menu. * - * \since This function is available since SDL 3.1.8. + * \threadsafety This function should be called on the thread that created the + * tray. * - * \threadsafety This function should be called on the thread that created the tray. + * \since This function is available since SDL 3.1.8. * * \sa SDL_InsertTrayEntryAt * \sa SDL_CreateTraySubmenu @@ -246,9 +252,10 @@ extern SDL_DECLSPEC SDL_TrayMenu *SDLCALL SDL_GetTraySubmenu(SDL_TrayEntry *entr * pointer becomes invalid when any function that inserts or deletes * entries in the menu is called. * - * \since This function is available since SDL 3.1.8. + * \threadsafety This function should be called on the thread that created the + * tray. * - * \threadsafety This function should be called on the thread that created the tray. + * \since This function is available since SDL 3.1.8. * * \sa SDL_RemoveTrayEntry * \sa SDL_InsertTrayEntryAt @@ -260,9 +267,10 @@ extern SDL_DECLSPEC const SDL_TrayEntry **SDLCALL SDL_GetTrayEntries(SDL_TrayMen * * \param entry The entry to be deleted. * - * \since This function is available since SDL 3.1.8. + * \threadsafety This function should be called on the thread that created the + * tray. * - * \threadsafety This function should be called on the thread that created the tray. + * \since This function is available since SDL 3.1.8. * * \sa SDL_GetTrayEntries * \sa SDL_InsertTrayEntryAt @@ -285,9 +293,10 @@ extern SDL_DECLSPEC void SDLCALL SDL_RemoveTrayEntry(SDL_TrayEntry *entry); * \param flags a combination of flags, some of which are mandatory. * \returns the newly created entry, or NULL if pos is out of bounds. * - * \since This function is available since SDL 3.1.8. + * \threadsafety This function should be called on the thread that created the + * tray. * - * \threadsafety This function should be called on the thread that created the tray. + * \since This function is available since SDL 3.1.8. * * \sa SDL_TrayEntryFlags * \sa SDL_GetTrayEntries @@ -307,9 +316,10 @@ extern SDL_DECLSPEC SDL_TrayEntry *SDLCALL SDL_InsertTrayEntryAt(SDL_TrayMenu *m * \param entry the entry to be updated. * \param label the new label for the entry in UTF-8 encoding. * - * \since This function is available since SDL 3.1.8. + * \threadsafety This function should be called on the thread that created the + * tray. * - * \threadsafety This function should be called on the thread that created the tray. + * \since This function is available since SDL 3.1.8. * * \sa SDL_GetTrayEntries * \sa SDL_InsertTrayEntryAt @@ -325,9 +335,10 @@ extern SDL_DECLSPEC void SDLCALL SDL_SetTrayEntryLabel(SDL_TrayEntry *entry, con * \param entry the entry to be read. * \returns the label of the entry in UTF-8 encoding. * - * \since This function is available since SDL 3.1.8. + * \threadsafety This function should be called on the thread that created the + * tray. * - * \threadsafety This function should be called on the thread that created the tray. + * \since This function is available since SDL 3.1.8. * * \sa SDL_GetTrayEntries * \sa SDL_InsertTrayEntryAt @@ -343,9 +354,10 @@ extern SDL_DECLSPEC const char *SDLCALL SDL_GetTrayEntryLabel(SDL_TrayEntry *ent * \param entry the entry to be updated. * \param checked true if the entry should be checked; false otherwise. * - * \since This function is available since SDL 3.1.8. + * \threadsafety This function should be called on the thread that created the + * tray. * - * \threadsafety This function should be called on the thread that created the tray. + * \since This function is available since SDL 3.1.8. * * \sa SDL_GetTrayEntries * \sa SDL_InsertTrayEntryAt @@ -361,9 +373,10 @@ extern SDL_DECLSPEC void SDLCALL SDL_SetTrayEntryChecked(SDL_TrayEntry *entry, b * \param entry the entry to be read. * \returns true if the entry is checked; false otherwise. * - * \since This function is available since SDL 3.1.8. + * \threadsafety This function should be called on the thread that created the + * tray. * - * \threadsafety This function should be called on the thread that created the tray. + * \since This function is available since SDL 3.1.8. * * \sa SDL_GetTrayEntries * \sa SDL_InsertTrayEntryAt @@ -377,9 +390,10 @@ extern SDL_DECLSPEC bool SDLCALL SDL_GetTrayEntryChecked(SDL_TrayEntry *entry); * \param entry the entry to be updated. * \param enabled true if the entry should be enabled; false otherwise. * - * \since This function is available since SDL 3.1.8. + * \threadsafety This function should be called on the thread that created the + * tray. * - * \threadsafety This function should be called on the thread that created the tray. + * \since This function is available since SDL 3.1.8. * * \sa SDL_GetTrayEntries * \sa SDL_InsertTrayEntryAt @@ -393,9 +407,10 @@ extern SDL_DECLSPEC void SDLCALL SDL_SetTrayEntryEnabled(SDL_TrayEntry *entry, b * \param entry the entry to be read. * \returns true if the entry is enabled; false otherwise. * - * \since This function is available since SDL 3.1.8. + * \threadsafety This function should be called on the thread that created the + * tray. * - * \threadsafety This function should be called on the thread that created the tray. + * \since This function is available since SDL 3.1.8. * * \sa SDL_GetTrayEntries * \sa SDL_InsertTrayEntryAt @@ -411,9 +426,10 @@ extern SDL_DECLSPEC bool SDLCALL SDL_GetTrayEntryEnabled(SDL_TrayEntry *entry); * \param userdata an optional pointer to pass extra data to the callback when * it will be invoked. * - * \since This function is available since SDL 3.1.8. + * \threadsafety This function should be called on the thread that created the + * tray. * - * \threadsafety This function should be called on the thread that created the tray. + * \since This function is available since SDL 3.1.8. * * \sa SDL_GetTrayEntries * \sa SDL_InsertTrayEntryAt @@ -425,9 +441,10 @@ extern SDL_DECLSPEC void SDLCALL SDL_SetTrayEntryCallback(SDL_TrayEntry *entry, * * \param entry The entry to activate. * - * \since This function is available since SDL 3.1.10. + * \threadsafety This function should be called on the thread that created the + * tray. * - * \threadsafety This function should be called on the thread that created the tray. + * \since This function is available since SDL 3.1.10. */ extern SDL_DECLSPEC void SDLCALL SDL_ClickTrayEntry(SDL_TrayEntry *entry); @@ -438,9 +455,10 @@ extern SDL_DECLSPEC void SDLCALL SDL_ClickTrayEntry(SDL_TrayEntry *entry); * * \param tray the tray icon to be destroyed. * - * \since This function is available since SDL 3.1.8. + * \threadsafety This function should be called on the thread that created the + * tray. * - * \threadsafety This function should be called on the thread that created the tray. + * \since This function is available since SDL 3.1.8. * * \sa SDL_CreateTray */ @@ -452,9 +470,10 @@ extern SDL_DECLSPEC void SDLCALL SDL_DestroyTray(SDL_Tray *tray); * \param entry the entry for which to get the parent menu. * \returns the parent menu. * - * \since This function is available since SDL 3.1.8. + * \threadsafety This function should be called on the thread that created the + * tray. * - * \threadsafety This function should be called on the thread that created the tray. + * \since This function is available since SDL 3.1.8. * * \sa SDL_InsertTrayEntryAt */ @@ -470,9 +489,10 @@ extern SDL_DECLSPEC SDL_TrayMenu *SDLCALL SDL_GetTrayEntryParent(SDL_TrayEntry * * \param menu the menu for which to get the parent entry. * \returns the parent entry, or NULL if this menu is not a submenu. * - * \since This function is available since SDL 3.1.8. + * \threadsafety This function should be called on the thread that created the + * tray. * - * \threadsafety This function should be called on the thread that created the tray. + * \since This function is available since SDL 3.1.8. * * \sa SDL_CreateTraySubmenu * \sa SDL_GetTrayMenuParentTray @@ -489,9 +509,10 @@ extern SDL_DECLSPEC SDL_TrayEntry *SDLCALL SDL_GetTrayMenuParentEntry(SDL_TrayMe * \param menu the menu for which to get the parent enttrayry. * \returns the parent tray, or NULL if this menu is a submenu. * - * \since This function is available since SDL 3.1.8. + * \threadsafety This function should be called on the thread that created the + * tray. * - * \threadsafety This function should be called on the thread that created the tray. + * \since This function is available since SDL 3.1.8. * * \sa SDL_CreateTrayMenu * \sa SDL_GetTrayMenuParentEntry @@ -501,11 +522,12 @@ extern SDL_DECLSPEC SDL_Tray *SDLCALL SDL_GetTrayMenuParentTray(SDL_TrayMenu *me /** * Update the trays. * - * This is called automatically by the event loop and is only needed if you're using trays but aren't handling SDL events. - * - * \since This function is available since SDL 3.2.0. + * This is called automatically by the event loop and is only needed if you're + * using trays but aren't handling SDL events. * * \threadsafety This function should only be called on the main thread. + * + * \since This function is available since SDL 3.2.0. */ extern SDL_DECLSPEC void SDLCALL SDL_UpdateTrays(void); From 7133969e3a5ce2a4457eb3243420bdccacac49d1 Mon Sep 17 00:00:00 2001 From: William Hou <83525937+williamhCode@users.noreply.github.com> Date: Sun, 19 Jan 2025 23:34:04 -0500 Subject: [PATCH 169/340] Feature add hint to remap option as alt key (#12021) --- include/SDL3/SDL_hints.h | 25 ++++++++++ src/video/cocoa/SDL_cocoakeyboard.m | 71 +++++++++++++++++++++++++++++ src/video/cocoa/SDL_cocoavideo.h | 9 ++++ 3 files changed, 105 insertions(+) diff --git a/include/SDL3/SDL_hints.h b/include/SDL3/SDL_hints.h index 994143cc1c496..e5af037469c7f 100644 --- a/include/SDL3/SDL_hints.h +++ b/include/SDL3/SDL_hints.h @@ -2348,6 +2348,31 @@ extern "C" { */ #define SDL_HINT_MAC_OPENGL_ASYNC_DISPATCH "SDL_MAC_OPENGL_ASYNC_DISPATCH" +/** + * A variable controlling whether the Option (⌥) key on macOS should be remapped + * to act as the Alt key. + * + * The variable can be set to the following values: + * + * - "none": The Option key is not remapped to Alt. (default) + * - "only_left": Only the left Option key is remapped to Alt. + * - "only_right": Only the right Option key is remapped to Alt. + * - "both": Both Option keys are remapped to Alt. + * + * This will prevent the triggering of key compositions that rely on the Option + * key, but will still send the Alt modifier for keyboard events. In the case + * that both Alt and Option are pressed, the Option key will be ignored. This is + * particularly useful for applications like terminal emulators and graphical + * user interfaces (GUIs) that rely on Alt key functionality for shortcuts or + * navigation. This does not apply to SDL_GetKeyFromScancode and only has an + * effect if IME is enabled. + * + * This hint can be set anytime. + * + * \since This hint is available since 3.2.0 + */ +#define SDL_HINT_MAC_OPTION_AS_ALT "SDL_MAC_OPTION_AS_ALT" + /** * A variable controlling whether SDL_EVENT_MOUSE_WHEEL event values will have * momentum on macOS. diff --git a/src/video/cocoa/SDL_cocoakeyboard.m b/src/video/cocoa/SDL_cocoakeyboard.m index f73572da59c4a..550f533f18d4a 100644 --- a/src/video/cocoa/SDL_cocoakeyboard.m +++ b/src/video/cocoa/SDL_cocoakeyboard.m @@ -369,6 +369,26 @@ static void UpdateKeymap(SDL_CocoaVideoData *data, bool send_event) SDL_SetKeymap(keymap, send_event); } +static void SDLCALL SDL_MacOptionAsAltChanged(void *userdata, const char *name, const char *oldValue, const char *hint) +{ + SDL_VideoDevice *_this = (SDL_VideoDevice *)userdata; + SDL_CocoaVideoData *data = (__bridge SDL_CocoaVideoData *)_this->internal; + + if (hint && *hint) { + if (SDL_strcmp(hint, "none") == 0) { + data.option_as_alt = OptionAsAltNone; + } else if (SDL_strcmp(hint, "only_left") == 0) { + data.option_as_alt = OptionAsAltOnlyLeft; + } else if (SDL_strcmp(hint, "only_right") == 0) { + data.option_as_alt = OptionAsAltOnlyRight; + } else if (SDL_strcmp(hint, "both") == 0) { + data.option_as_alt = OptionAsAltBoth; + } + } else { + data.option_as_alt = OptionAsAltNone; + } +} + void Cocoa_InitKeyboard(SDL_VideoDevice *_this) { SDL_CocoaVideoData *data = (__bridge SDL_CocoaVideoData *)_this->internal; @@ -385,6 +405,8 @@ void Cocoa_InitKeyboard(SDL_VideoDevice *_this) data.modifierFlags = (unsigned int)[NSEvent modifierFlags]; SDL_ToggleModState(SDL_KMOD_CAPS, (data.modifierFlags & NSEventModifierFlagCapsLock) ? true : false); + + SDL_AddHintCallback(SDL_HINT_MAC_OPTION_AS_ALT, SDL_MacOptionAsAltChanged, _this); } bool Cocoa_StartTextInput(SDL_VideoDevice *_this, SDL_Window *window, SDL_PropertiesID props) @@ -437,6 +459,51 @@ bool Cocoa_UpdateTextInputArea(SDL_VideoDevice *_this, SDL_Window *window) return true; } +static NSEvent *ReplaceEvent(NSEvent *event, OptionAsAlt option_as_alt) +{ + if (option_as_alt == OptionAsAltNone) { + return event; + } + + const unsigned int modflags = (unsigned int)[event modifierFlags]; + + bool ignore_alt_characters = false; + + bool lalt_pressed = IsModifierKeyPressed(modflags, NX_DEVICELALTKEYMASK, + NX_DEVICERALTKEYMASK, NX_ALTERNATEMASK); + bool ralt_pressed = IsModifierKeyPressed(modflags, NX_DEVICERALTKEYMASK, + NX_DEVICELALTKEYMASK, NX_ALTERNATEMASK); + + if (option_as_alt == OptionAsAltOnlyLeft && lalt_pressed) { + ignore_alt_characters = true; + } else if (option_as_alt == OptionAsAltOnlyRight && ralt_pressed) { + ignore_alt_characters = true; + } else if (option_as_alt == OptionAsAltBoth && (lalt_pressed || ralt_pressed)) { + ignore_alt_characters = true; + } + + bool cmd_pressed = modflags & NX_COMMANDMASK; + bool ctrl_pressed = modflags & NX_CONTROLMASK; + + ignore_alt_characters = ignore_alt_characters && !cmd_pressed && !ctrl_pressed; + + if (ignore_alt_characters) { + NSString *charactersIgnoringModifiers = [event charactersIgnoringModifiers]; + return [NSEvent keyEventWithType:[event type] + location:[event locationInWindow] + modifierFlags:modflags + timestamp:[event timestamp] + windowNumber:[event windowNumber] + context:nil + characters:charactersIgnoringModifiers + charactersIgnoringModifiers:charactersIgnoringModifiers + isARepeat:[event isARepeat] + keyCode:[event keyCode]]; + } + + return event; +} + void Cocoa_HandleKeyEvent(SDL_VideoDevice *_this, NSEvent *event) { unsigned short scancode; @@ -446,6 +513,10 @@ void Cocoa_HandleKeyEvent(SDL_VideoDevice *_this, NSEvent *event) return; // can happen when returning from fullscreen Space on shutdown } + if ([event type] == NSEventTypeKeyDown || [event type] == NSEventTypeKeyUp) { + event = ReplaceEvent(event, data.option_as_alt); + } + scancode = [event keyCode]; if ((scancode == 10 || scancode == 50) && KBGetLayoutType(LMGetKbdType()) == kKeyboardISO) { diff --git a/src/video/cocoa/SDL_cocoavideo.h b/src/video/cocoa/SDL_cocoavideo.h index 75c1ec79f0490..353fb43509d2c 100644 --- a/src/video/cocoa/SDL_cocoavideo.h +++ b/src/video/cocoa/SDL_cocoavideo.h @@ -44,6 +44,14 @@ @class SDL3TranslatorResponder; +typedef enum +{ + OptionAsAltNone, + OptionAsAltOnlyLeft, + OptionAsAltOnlyRight, + OptionAsAltBoth, +} OptionAsAlt; + @interface SDL_CocoaVideoData : NSObject @property(nonatomic) int allow_spaces; @property(nonatomic) int trackpad_is_touch_only; @@ -53,6 +61,7 @@ @property(nonatomic) NSInteger clipboard_count; @property(nonatomic) IOPMAssertionID screensaver_assertion; @property(nonatomic) SDL_Mutex *swaplock; +@property(nonatomic) OptionAsAlt option_as_alt; @end // Utility functions From c4c0bfdfb12d858b7df5e13e49326582b8be864e Mon Sep 17 00:00:00 2001 From: SDL Wiki Bot Date: Mon, 20 Jan 2025 04:34:56 +0000 Subject: [PATCH 170/340] Sync SDL3 wiki -> header [ci skip] --- include/SDL3/SDL_hints.h | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/include/SDL3/SDL_hints.h b/include/SDL3/SDL_hints.h index e5af037469c7f..9f6b58ba4bdef 100644 --- a/include/SDL3/SDL_hints.h +++ b/include/SDL3/SDL_hints.h @@ -2349,8 +2349,8 @@ extern "C" { #define SDL_HINT_MAC_OPENGL_ASYNC_DISPATCH "SDL_MAC_OPENGL_ASYNC_DISPATCH" /** - * A variable controlling whether the Option (⌥) key on macOS should be remapped - * to act as the Alt key. + * A variable controlling whether the Option (⌥) key on macOS should be + * remapped to act as the Alt key. * * The variable can be set to the following values: * @@ -2359,13 +2359,13 @@ extern "C" { * - "only_right": Only the right Option key is remapped to Alt. * - "both": Both Option keys are remapped to Alt. * - * This will prevent the triggering of key compositions that rely on the Option - * key, but will still send the Alt modifier for keyboard events. In the case - * that both Alt and Option are pressed, the Option key will be ignored. This is - * particularly useful for applications like terminal emulators and graphical - * user interfaces (GUIs) that rely on Alt key functionality for shortcuts or - * navigation. This does not apply to SDL_GetKeyFromScancode and only has an - * effect if IME is enabled. + * This will prevent the triggering of key compositions that rely on the + * Option key, but will still send the Alt modifier for keyboard events. In + * the case that both Alt and Option are pressed, the Option key will be + * ignored. This is particularly useful for applications like terminal + * emulators and graphical user interfaces (GUIs) that rely on Alt key + * functionality for shortcuts or navigation. This does not apply to + * SDL_GetKeyFromScancode and only has an effect if IME is enabled. * * This hint can be set anytime. * From b809da52fd22d30c164f6c8e98debb108748aa25 Mon Sep 17 00:00:00 2001 From: "Ryan C. Gordon" Date: Mon, 20 Jan 2025 00:36:42 -0500 Subject: [PATCH 171/340] assert: Try using __builtin_trap() for SDL_TriggerBreakpoint(). This was necessary on an arm64 install of Raspberry Pi OS. --- include/SDL3/SDL_assert.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/include/SDL3/SDL_assert.h b/include/SDL3/SDL_assert.h index c7cb19676ab6a..edc69cd7e38c5 100644 --- a/include/SDL3/SDL_assert.h +++ b/include/SDL3/SDL_assert.h @@ -137,6 +137,8 @@ extern "C" { #define SDL_TriggerBreakpoint() assert(0) #elif SDL_HAS_BUILTIN(__builtin_debugtrap) #define SDL_TriggerBreakpoint() __builtin_debugtrap() +#elif SDL_HAS_BUILTIN(__builtin_trap) + #define SDL_TriggerBreakpoint() __builtin_trap() #elif (defined(__GNUC__) || defined(__clang__)) && (defined(__i386__) || defined(__x86_64__)) #define SDL_TriggerBreakpoint() __asm__ __volatile__ ( "int $3\n\t" ) #elif (defined(__GNUC__) || defined(__clang__)) && defined(__riscv) From d5766bc4b83afa0891e142c0b8b3dc694f3da579 Mon Sep 17 00:00:00 2001 From: "Ryan C. Gordon" Date: Mon, 20 Jan 2025 00:39:02 -0500 Subject: [PATCH 172/340] include: More category documentation. Reference Issue #11847. --- include/SDL3/SDL_time.h | 8 ++++++++ include/SDL3/SDL_touch.h | 13 ++++++++++++- include/SDL3/SDL_tray.h | 6 +++++- 3 files changed, 25 insertions(+), 2 deletions(-) diff --git a/include/SDL3/SDL_time.h b/include/SDL3/SDL_time.h index c1880dce7ee33..cc611984de56f 100644 --- a/include/SDL3/SDL_time.h +++ b/include/SDL3/SDL_time.h @@ -26,6 +26,14 @@ freely, subject to the following restrictions: * # CategoryTime * * SDL realtime clock and date/time routines. + * + * There are two data types that are used in this category: SDL_Time, which + * represents the nanoseconds since a specific moment (an "epoch"), and + * SDL_DateTime, which breaks time down into human-understandable components: + * years, months, days, hours, etc. + * + * Much of the functionality is involved in converting those two types to + * other useful forms. */ #include diff --git a/include/SDL3/SDL_touch.h b/include/SDL3/SDL_touch.h index 0f32e11eb7218..1260f573d2f18 100644 --- a/include/SDL3/SDL_touch.h +++ b/include/SDL3/SDL_touch.h @@ -22,7 +22,18 @@ /** * # CategoryTouch * - * SDL touch management. + * SDL offers touch input, on platforms that support it. It can manage + * multiple touch devices and track multiple fingers on those devices. + * + * Touches are mostly dealt with through the event system, in the + * SDL_EVENT_FINGER_DOWN, SDL_EVENT_FINGER_MOTION, and SDL_EVENT_FINGER_UP + * events, but there are also functions to query for hardware details, etc. + * + * The touch system, by default, will also send virtual mouse events; this can + * be useful for making a some desktop apps work on a phone without + * significant changes. For apps that care about mouse and touch input + * separately, they should ignore mouse events that have a `which` field of + * SDL_TOUCH_MOUSEID. */ #ifndef SDL_touch_h_ diff --git a/include/SDL3/SDL_tray.h b/include/SDL3/SDL_tray.h index ba96c3f6f206d..83bd3b787c632 100644 --- a/include/SDL3/SDL_tray.h +++ b/include/SDL3/SDL_tray.h @@ -22,7 +22,11 @@ /** * # CategoryTray * - * System tray menu support. + * SDL offers a way to add items to the "system tray" (more correctly called + * the "notification area" on Windows). On platforms that offer this concept, + * an SDL app can add a tray icon, submenus, checkboxes, and clickable + * entries, and register a callback that is fired when the user clicks on + * these pieces. */ #ifndef SDL_tray_h_ From 642262e30e1340ad0dd386a2e40875edf2c79bca Mon Sep 17 00:00:00 2001 From: "Ryan C. Gordon" Date: Mon, 20 Jan 2025 00:39:43 -0500 Subject: [PATCH 173/340] cocoa: Fix mousegrab when going fullscreen. When going into a fullscreen space, update mouseConfinementRect once the transition is done. When going exclusive fullscreen, force a window sync so the transition is complete before we do the update. Fixes #9088. --- src/video/cocoa/SDL_cocoawindow.m | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/video/cocoa/SDL_cocoawindow.m b/src/video/cocoa/SDL_cocoawindow.m index c58e851b30129..06ba56ad4dd19 100644 --- a/src/video/cocoa/SDL_cocoawindow.m +++ b/src/video/cocoa/SDL_cocoawindow.m @@ -1377,6 +1377,8 @@ - (void)windowDidEnterFullScreen:(NSNotification *)aNotification window->h = 0; [self windowDidMove:aNotification]; [self windowDidResize:aNotification]; + + Cocoa_UpdateClipCursor(window); } } @@ -1516,6 +1518,8 @@ when returning to windowed mode from a space (instead of using a pending if (!(window->flags & SDL_WINDOW_HIDDEN)) { Cocoa_ShowWindow(SDL_GetVideoDevice(), window); } + + Cocoa_UpdateClipCursor(window); } } @@ -2935,6 +2939,8 @@ SDL_FullscreenResult Cocoa_SetWindowFullscreen(SDL_VideoDevice *_this, SDL_Windo } ScheduleContextUpdates(data); + Cocoa_SyncWindow(_this, window); + Cocoa_UpdateClipCursor(window); } return SDL_FULLSCREEN_SUCCEEDED; From 2be749b23badd95393e5c53050e609c17181dd15 Mon Sep 17 00:00:00 2001 From: "Ryan C. Gordon" Date: Mon, 20 Jan 2025 01:37:25 -0500 Subject: [PATCH 174/340] include: More category documentation. Reference Issue #11847. --- include/SDL3/SDL_mutex.h | 14 +++++++++++++- include/SDL3/SDL_thread.h | 14 +++++++++++++- 2 files changed, 26 insertions(+), 2 deletions(-) diff --git a/include/SDL3/SDL_mutex.h b/include/SDL3/SDL_mutex.h index 8e2c8651b4bf3..b60d8421a7eea 100644 --- a/include/SDL3/SDL_mutex.h +++ b/include/SDL3/SDL_mutex.h @@ -25,7 +25,19 @@ /** * # CategoryMutex * - * Functions to provide thread synchronization primitives. + * SDL offers several thread synchronization primitives. This document can't + * cover the complicated topic of thread safety, but reading up on what each + * of these primitives are, why they are useful, and how to correctly use them + * is vital to writing correct and safe multithreaded programs. + * + * - Mutexes: SDL_CreateMutex() + * - Read/Write locks: SDL_CreateRWLock() + * - Semaphores: SDL_CreateSemaphore() + * - Condition variables: SDL_CreateCondition() + * + * SDL also offers a datatype, SDL_InitState, which can be used to make sure + * only one thread initializes/deinitializes some resource that several + * threads might try to use for the first time simultaneously. */ #include diff --git a/include/SDL3/SDL_thread.h b/include/SDL3/SDL_thread.h index d7d83edb51dcd..240812db1717e 100644 --- a/include/SDL3/SDL_thread.h +++ b/include/SDL3/SDL_thread.h @@ -25,7 +25,19 @@ /** * # CategoryThread * - * SDL thread management routines. + * SDL offers cross-platform thread management functions. These are mostly + * concerned with starting threads, setting their priority, and dealing with + * their termination. + * + * In addition, there is support for Thread Local Storage (data that is unique + * to each thread, but accessed from a single key). + * + * On platforms without thread support (such as Emscripten when built without + * pthreads), these functions still exist, but things like SDL_CreateThread() + * will report failure without doing anything. + * + * If you're going to work with threads, you almost certainly need to have a + * good understanding of [CategoryMutex](CategoryMutex) as well. */ #include From 90b2e2527eeb6614cedd15f61062f62680252be6 Mon Sep 17 00:00:00 2001 From: "Ryan C. Gordon" Date: Mon, 20 Jan 2025 01:39:37 -0500 Subject: [PATCH 175/340] include: Added a tiny bit to SDL_sensor.h's category documentation. Reference Issue #11847. --- include/SDL3/SDL_sensor.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/include/SDL3/SDL_sensor.h b/include/SDL3/SDL_sensor.h index 1377c10219b9a..83e70839b3250 100644 --- a/include/SDL3/SDL_sensor.h +++ b/include/SDL3/SDL_sensor.h @@ -24,6 +24,8 @@ * * SDL sensor management. * + * These APIs grant access to gyros and accelerometers on various platforms. + * * In order to use these functions, SDL_Init() must have been called with the * SDL_INIT_SENSOR flag. This causes SDL to scan the system for sensors, and * load appropriate drivers. From f8040b2e0111c7811f36e6084e37b401e24db995 Mon Sep 17 00:00:00 2001 From: Sam Lantinga Date: Mon, 20 Jan 2025 09:09:57 -0800 Subject: [PATCH 176/340] Use UIKeyboardTypeDecimalPad for number fields on iOS Fixes https://github.com/libsdl-org/SDL/issues/12025 --- src/video/uikit/SDL_uikitviewcontroller.m | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/video/uikit/SDL_uikitviewcontroller.m b/src/video/uikit/SDL_uikitviewcontroller.m index 1059ed061dbeb..45f2d64f08600 100644 --- a/src/video/uikit/SDL_uikitviewcontroller.m +++ b/src/video/uikit/SDL_uikitviewcontroller.m @@ -411,7 +411,7 @@ - (void)setTextFieldProperties:(SDL_PropertiesID) props textField.textContentType = UITextContentTypePassword; break; case SDL_TEXTINPUT_TYPE_NUMBER: - textField.keyboardType = UIKeyboardTypeNumberPad; + textField.keyboardType = UIKeyboardTypeDecimalPad; textField.textContentType = nil; break; case SDL_TEXTINPUT_TYPE_NUMBER_PASSWORD_HIDDEN: From 362f96a6cff0b3c2482294bda95bf90db84cb6e2 Mon Sep 17 00:00:00 2001 From: Sam Lantinga Date: Mon, 20 Jan 2025 09:43:21 -0800 Subject: [PATCH 177/340] testcontroller: use SDL_MAIN_USE_CALLBACKS so updates happen during live resizing --- test/testcontroller.c | 681 +++++++++++++++++++++--------------------- 1 file changed, 337 insertions(+), 344 deletions(-) diff --git a/test/testcontroller.c b/test/testcontroller.c index 4cf35c9d9a590..da87c72778301 100644 --- a/test/testcontroller.c +++ b/test/testcontroller.c @@ -12,6 +12,7 @@ /* Simple program to test the SDL controller routines */ +#define SDL_MAIN_USE_CALLBACKS #include #include #include @@ -64,6 +65,7 @@ typedef struct int trigger_effect; } Controller; +static SDLTest_CommonState *state; static SDL_Window *window = NULL; static SDL_Renderer *screen = NULL; static ControllerDisplayMode display_mode = CONTROLLER_MODE_TESTING; @@ -194,47 +196,47 @@ typedef struct static void CyclePS5AudioRoute(Controller *device) { - DS5EffectsState_t state; + DS5EffectsState_t effects; device->audio_route = (device->audio_route + 1) % 4; - SDL_zero(state); + SDL_zero(effects); switch (device->audio_route) { case 0: /* Audio disabled */ - state.ucEnableBits1 |= (0x80 | 0x20 | 0x10); /* Modify audio route and speaker / headphone volume */ - state.ucSpeakerVolume = 0; /* Minimum volume */ - state.ucHeadphoneVolume = 0; /* Minimum volume */ - state.ucAudioEnableBits = 0x00; /* Output to headphones */ + effects.ucEnableBits1 |= (0x80 | 0x20 | 0x10); /* Modify audio route and speaker / headphone volume */ + effects.ucSpeakerVolume = 0; /* Minimum volume */ + effects.ucHeadphoneVolume = 0; /* Minimum volume */ + effects.ucAudioEnableBits = 0x00; /* Output to headphones */ break; case 1: /* Headphones */ - state.ucEnableBits1 |= (0x80 | 0x10); /* Modify audio route and headphone volume */ - state.ucHeadphoneVolume = 50; /* 50% volume - don't blast into the ears */ - state.ucAudioEnableBits = 0x00; /* Output to headphones */ + effects.ucEnableBits1 |= (0x80 | 0x10); /* Modify audio route and headphone volume */ + effects.ucHeadphoneVolume = 50; /* 50% volume - don't blast into the ears */ + effects.ucAudioEnableBits = 0x00; /* Output to headphones */ break; case 2: /* Speaker */ - state.ucEnableBits1 |= (0x80 | 0x20); /* Modify audio route and speaker volume */ - state.ucSpeakerVolume = 100; /* Maximum volume */ - state.ucAudioEnableBits = 0x30; /* Output to speaker */ + effects.ucEnableBits1 |= (0x80 | 0x20); /* Modify audio route and speaker volume */ + effects.ucSpeakerVolume = 100; /* Maximum volume */ + effects.ucAudioEnableBits = 0x30; /* Output to speaker */ break; case 3: /* Both */ - state.ucEnableBits1 |= (0x80 | 0x20 | 0x10); /* Modify audio route and speaker / headphone volume */ - state.ucSpeakerVolume = 100; /* Maximum volume */ - state.ucHeadphoneVolume = 50; /* 50% volume - don't blast into the ears */ - state.ucAudioEnableBits = 0x20; /* Output to both speaker and headphones */ + effects.ucEnableBits1 |= (0x80 | 0x20 | 0x10); /* Modify audio route and speaker / headphone volume */ + effects.ucSpeakerVolume = 100; /* Maximum volume */ + effects.ucHeadphoneVolume = 50; /* 50% volume - don't blast into the ears */ + effects.ucAudioEnableBits = 0x20; /* Output to both speaker and headphones */ break; } - SDL_SendGamepadEffect(device->gamepad, &state, sizeof(state)); + SDL_SendGamepadEffect(device->gamepad, &effects, sizeof(effects)); } static void CyclePS5TriggerEffect(Controller *device) { - DS5EffectsState_t state; + DS5EffectsState_t effects; - Uint8 effects[3][11] = { + Uint8 trigger_effects[3][11] = { /* Clear trigger effect */ { 0x05, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, /* Constant resistance across entire trigger pull */ @@ -243,13 +245,13 @@ static void CyclePS5TriggerEffect(Controller *device) { 0x06, 15, 63, 128, 0, 0, 0, 0, 0, 0, 0 }, }; - device->trigger_effect = (device->trigger_effect + 1) % SDL_arraysize(effects); + device->trigger_effect = (device->trigger_effect + 1) % SDL_arraysize(trigger_effects); - SDL_zero(state); - state.ucEnableBits1 |= (0x04 | 0x08); /* Modify right and left trigger effect respectively */ - SDL_memcpy(state.rgucRightTriggerEffect, effects[device->trigger_effect], sizeof(effects[0])); - SDL_memcpy(state.rgucLeftTriggerEffect, effects[device->trigger_effect], sizeof(effects[0])); - SDL_SendGamepadEffect(device->gamepad, &state, sizeof(state)); + SDL_zero(effects); + effects.ucEnableBits1 |= (0x04 | 0x08); /* Modify right and left trigger effect respectively */ + SDL_memcpy(effects.rgucRightTriggerEffect, trigger_effects[device->trigger_effect], sizeof(trigger_effects[0])); + SDL_memcpy(effects.rgucLeftTriggerEffect, trigger_effects[device->trigger_effect], sizeof(trigger_effects[0])); + SDL_SendGamepadEffect(device->gamepad, &effects, sizeof(effects)); } static void ClearButtonHighlights(void) @@ -1573,358 +1575,359 @@ static void UpdateGamepadEffects(void) } } -static void loop(void *arg) +SDL_AppResult SDLCALL SDL_AppEvent(void *appstate, SDL_Event *event) { - SDL_Event event; + SDL_ConvertEventToRenderCoordinates(screen, event); - /* If we have a virtual controller, send a virtual accelerometer sensor reading */ - if (virtual_joystick) { - float data[3] = { 0.0f, SDL_STANDARD_GRAVITY, 0.0f }; - SDL_SendJoystickVirtualSensorData(virtual_joystick, SDL_SENSOR_ACCEL, SDL_GetTicksNS(), data, SDL_arraysize(data)); - } - - /* Update to get the current event state */ - SDL_PumpEvents(); - - /* Process all currently pending events */ - while (SDL_PeepEvents(&event, 1, SDL_GETEVENT, SDL_EVENT_FIRST, SDL_EVENT_LAST) == 1) { - SDL_ConvertEventToRenderCoordinates(screen, &event); - - switch (event.type) { - case SDL_EVENT_JOYSTICK_ADDED: - AddController(event.jdevice.which, true); - break; + switch (event->type) { + case SDL_EVENT_JOYSTICK_ADDED: + AddController(event->jdevice.which, true); + break; - case SDL_EVENT_JOYSTICK_REMOVED: - DelController(event.jdevice.which); - break; + case SDL_EVENT_JOYSTICK_REMOVED: + DelController(event->jdevice.which); + break; - case SDL_EVENT_JOYSTICK_AXIS_MOTION: - if (display_mode == CONTROLLER_MODE_TESTING) { - if (event.jaxis.value <= (-SDL_JOYSTICK_AXIS_MAX / 2) || event.jaxis.value >= (SDL_JOYSTICK_AXIS_MAX / 2)) { - SetController(event.jaxis.which); - } - } else if (display_mode == CONTROLLER_MODE_BINDING && - event.jaxis.which == controller->id && - event.jaxis.axis < controller->num_axes && - binding_element != SDL_GAMEPAD_ELEMENT_INVALID) { - const int MAX_ALLOWED_JITTER = SDL_JOYSTICK_AXIS_MAX / 80; /* ShanWan PS3 gamepad needed 96 */ - AxisState *pAxisState = &controller->axis_state[event.jaxis.axis]; - int nValue = event.jaxis.value; - int nCurrentDistance, nFarthestDistance; - if (!pAxisState->m_bMoving) { - Sint16 nInitialValue; - pAxisState->m_bMoving = SDL_GetJoystickAxisInitialState(controller->joystick, event.jaxis.axis, &nInitialValue); - pAxisState->m_nLastValue = nValue; - pAxisState->m_nStartingValue = nInitialValue; - pAxisState->m_nFarthestValue = nInitialValue; - } else if (SDL_abs(nValue - pAxisState->m_nLastValue) <= MAX_ALLOWED_JITTER) { - break; - } else { - pAxisState->m_nLastValue = nValue; - } - nCurrentDistance = SDL_abs(nValue - pAxisState->m_nStartingValue); + case SDL_EVENT_JOYSTICK_AXIS_MOTION: + if (display_mode == CONTROLLER_MODE_TESTING) { + if (event->jaxis.value <= (-SDL_JOYSTICK_AXIS_MAX / 2) || event->jaxis.value >= (SDL_JOYSTICK_AXIS_MAX / 2)) { + SetController(event->jaxis.which); + } + } else if (display_mode == CONTROLLER_MODE_BINDING && + event->jaxis.which == controller->id && + event->jaxis.axis < controller->num_axes && + binding_element != SDL_GAMEPAD_ELEMENT_INVALID) { + const int MAX_ALLOWED_JITTER = SDL_JOYSTICK_AXIS_MAX / 80; /* ShanWan PS3 gamepad needed 96 */ + AxisState *pAxisState = &controller->axis_state[event->jaxis.axis]; + int nValue = event->jaxis.value; + int nCurrentDistance, nFarthestDistance; + if (!pAxisState->m_bMoving) { + Sint16 nInitialValue; + pAxisState->m_bMoving = SDL_GetJoystickAxisInitialState(controller->joystick, event->jaxis.axis, &nInitialValue); + pAxisState->m_nLastValue = nValue; + pAxisState->m_nStartingValue = nInitialValue; + pAxisState->m_nFarthestValue = nInitialValue; + } else if (SDL_abs(nValue - pAxisState->m_nLastValue) <= MAX_ALLOWED_JITTER) { + break; + } else { + pAxisState->m_nLastValue = nValue; + } + nCurrentDistance = SDL_abs(nValue - pAxisState->m_nStartingValue); + nFarthestDistance = SDL_abs(pAxisState->m_nFarthestValue - pAxisState->m_nStartingValue); + if (nCurrentDistance > nFarthestDistance) { + pAxisState->m_nFarthestValue = nValue; nFarthestDistance = SDL_abs(pAxisState->m_nFarthestValue - pAxisState->m_nStartingValue); - if (nCurrentDistance > nFarthestDistance) { - pAxisState->m_nFarthestValue = nValue; - nFarthestDistance = SDL_abs(pAxisState->m_nFarthestValue - pAxisState->m_nStartingValue); - } + } #ifdef DEBUG_AXIS_MAPPING - SDL_Log("AXIS %d nValue %d nCurrentDistance %d nFarthestDistance %d\n", event.jaxis.axis, nValue, nCurrentDistance, nFarthestDistance); + SDL_Log("AXIS %d nValue %d nCurrentDistance %d nFarthestDistance %d\n", event->jaxis.axis, nValue, nCurrentDistance, nFarthestDistance); #endif - /* If we've gone out far enough and started to come back, let's bind this axis */ - if (nFarthestDistance >= 16000 && nCurrentDistance <= 10000) { - char binding[12]; - int axis_min = StandardizeAxisValue(pAxisState->m_nStartingValue); - int axis_max = StandardizeAxisValue(pAxisState->m_nFarthestValue); - - if (axis_min == 0 && axis_max == SDL_JOYSTICK_AXIS_MIN) { - /* The negative half axis */ - (void)SDL_snprintf(binding, sizeof(binding), "-a%d", event.jaxis.axis); - } else if (axis_min == 0 && axis_max == SDL_JOYSTICK_AXIS_MAX) { - /* The positive half axis */ - (void)SDL_snprintf(binding, sizeof(binding), "+a%d", event.jaxis.axis); - } else { - (void)SDL_snprintf(binding, sizeof(binding), "a%d", event.jaxis.axis); - if (axis_min > axis_max) { - /* Invert the axis */ - SDL_strlcat(binding, "~", SDL_arraysize(binding)); - } + /* If we've gone out far enough and started to come back, let's bind this axis */ + if (nFarthestDistance >= 16000 && nCurrentDistance <= 10000) { + char binding[12]; + int axis_min = StandardizeAxisValue(pAxisState->m_nStartingValue); + int axis_max = StandardizeAxisValue(pAxisState->m_nFarthestValue); + + if (axis_min == 0 && axis_max == SDL_JOYSTICK_AXIS_MIN) { + /* The negative half axis */ + (void)SDL_snprintf(binding, sizeof(binding), "-a%d", event->jaxis.axis); + } else if (axis_min == 0 && axis_max == SDL_JOYSTICK_AXIS_MAX) { + /* The positive half axis */ + (void)SDL_snprintf(binding, sizeof(binding), "+a%d", event->jaxis.axis); + } else { + (void)SDL_snprintf(binding, sizeof(binding), "a%d", event->jaxis.axis); + if (axis_min > axis_max) { + /* Invert the axis */ + SDL_strlcat(binding, "~", SDL_arraysize(binding)); } + } #ifdef DEBUG_AXIS_MAPPING - SDL_Log("AXIS %d axis_min = %d, axis_max = %d, binding = %s\n", event.jaxis.axis, axis_min, axis_max, binding); + SDL_Log("AXIS %d axis_min = %d, axis_max = %d, binding = %s\n", event->jaxis.axis, axis_min, axis_max, binding); #endif - CommitBindingElement(binding, false); - } + CommitBindingElement(binding, false); } - break; + } + break; - case SDL_EVENT_JOYSTICK_BUTTON_DOWN: - if (display_mode == CONTROLLER_MODE_TESTING) { - SetController(event.jbutton.which); - } - break; + case SDL_EVENT_JOYSTICK_BUTTON_DOWN: + if (display_mode == CONTROLLER_MODE_TESTING) { + SetController(event->jbutton.which); + } + break; - case SDL_EVENT_JOYSTICK_BUTTON_UP: - if (display_mode == CONTROLLER_MODE_BINDING && - event.jbutton.which == controller->id && - binding_element != SDL_GAMEPAD_ELEMENT_INVALID) { - char binding[12]; + case SDL_EVENT_JOYSTICK_BUTTON_UP: + if (display_mode == CONTROLLER_MODE_BINDING && + event->jbutton.which == controller->id && + binding_element != SDL_GAMEPAD_ELEMENT_INVALID) { + char binding[12]; - SDL_snprintf(binding, sizeof(binding), "b%d", event.jbutton.button); - CommitBindingElement(binding, false); - } - break; + SDL_snprintf(binding, sizeof(binding), "b%d", event->jbutton.button); + CommitBindingElement(binding, false); + } + break; - case SDL_EVENT_JOYSTICK_HAT_MOTION: - if (display_mode == CONTROLLER_MODE_BINDING && - event.jhat.which == controller->id && - event.jhat.value != SDL_HAT_CENTERED && - binding_element != SDL_GAMEPAD_ELEMENT_INVALID) { - char binding[12]; + case SDL_EVENT_JOYSTICK_HAT_MOTION: + if (display_mode == CONTROLLER_MODE_BINDING && + event->jhat.which == controller->id && + event->jhat.value != SDL_HAT_CENTERED && + binding_element != SDL_GAMEPAD_ELEMENT_INVALID) { + char binding[12]; - SDL_snprintf(binding, sizeof(binding), "h%d.%d", event.jhat.hat, event.jhat.value); - CommitBindingElement(binding, false); - } - break; + SDL_snprintf(binding, sizeof(binding), "h%d.%d", event->jhat.hat, event->jhat.value); + CommitBindingElement(binding, false); + } + break; - case SDL_EVENT_GAMEPAD_ADDED: - HandleGamepadAdded(event.gdevice.which, true); - break; + case SDL_EVENT_GAMEPAD_ADDED: + HandleGamepadAdded(event->gdevice.which, true); + break; - case SDL_EVENT_GAMEPAD_REMOVED: - HandleGamepadRemoved(event.gdevice.which); - break; + case SDL_EVENT_GAMEPAD_REMOVED: + HandleGamepadRemoved(event->gdevice.which); + break; - case SDL_EVENT_GAMEPAD_REMAPPED: - HandleGamepadRemapped(event.gdevice.which); - break; + case SDL_EVENT_GAMEPAD_REMAPPED: + HandleGamepadRemapped(event->gdevice.which); + break; - case SDL_EVENT_GAMEPAD_STEAM_HANDLE_UPDATED: - RefreshControllerName(); - break; + case SDL_EVENT_GAMEPAD_STEAM_HANDLE_UPDATED: + RefreshControllerName(); + break; #ifdef VERBOSE_TOUCHPAD - case SDL_EVENT_GAMEPAD_TOUCHPAD_DOWN: - case SDL_EVENT_GAMEPAD_TOUCHPAD_MOTION: - case SDL_EVENT_GAMEPAD_TOUCHPAD_UP: - SDL_Log("Gamepad %" SDL_PRIu32 " touchpad %" SDL_PRIs32 " finger %" SDL_PRIs32 " %s %.2f, %.2f, %.2f\n", - event.gtouchpad.which, - event.gtouchpad.touchpad, - event.gtouchpad.finger, - (event.type == SDL_EVENT_GAMEPAD_TOUCHPAD_DOWN ? "pressed at" : (event.type == SDL_EVENT_GAMEPAD_TOUCHPAD_UP ? "released at" : "moved to")), - event.gtouchpad.x, - event.gtouchpad.y, - event.gtouchpad.pressure); - break; + case SDL_EVENT_GAMEPAD_TOUCHPAD_DOWN: + case SDL_EVENT_GAMEPAD_TOUCHPAD_MOTION: + case SDL_EVENT_GAMEPAD_TOUCHPAD_UP: + SDL_Log("Gamepad %" SDL_PRIu32 " touchpad %" SDL_PRIs32 " finger %" SDL_PRIs32 " %s %.2f, %.2f, %.2f\n", + event->gtouchpad.which, + event->gtouchpad.touchpad, + event->gtouchpad.finger, + (event->type == SDL_EVENT_GAMEPAD_TOUCHPAD_DOWN ? "pressed at" : (event->type == SDL_EVENT_GAMEPAD_TOUCHPAD_UP ? "released at" : "moved to")), + event->gtouchpad.x, + event->gtouchpad.y, + event->gtouchpad.pressure); + break; #endif /* VERBOSE_TOUCHPAD */ #ifdef VERBOSE_SENSORS - case SDL_EVENT_GAMEPAD_SENSOR_UPDATE: - SDL_Log("Gamepad %" SDL_PRIu32 " sensor %s: %.2f, %.2f, %.2f (%" SDL_PRIu64 ")\n", - event.gsensor.which, - GetSensorName((SDL_SensorType) event.gsensor.sensor), - event.gsensor.data[0], - event.gsensor.data[1], - event.gsensor.data[2], - event.gsensor.sensor_timestamp); - break; + case SDL_EVENT_GAMEPAD_SENSOR_UPDATE: + SDL_Log("Gamepad %" SDL_PRIu32 " sensor %s: %.2f, %.2f, %.2f (%" SDL_PRIu64 ")\n", + event->gsensor.which, + GetSensorName((SDL_SensorType) event->gsensor.sensor), + event->gsensor.data[0], + event->gsensor.data[1], + event->gsensor.data[2], + event->gsensor.sensor_timestamp); + break; #endif /* VERBOSE_SENSORS */ #ifdef VERBOSE_AXES - case SDL_EVENT_GAMEPAD_AXIS_MOTION: - if (display_mode == CONTROLLER_MODE_TESTING) { - if (event.gaxis.value <= (-SDL_JOYSTICK_AXIS_MAX / 2) || event.gaxis.value >= (SDL_JOYSTICK_AXIS_MAX / 2)) { - SetController(event.gaxis.which); - } + case SDL_EVENT_GAMEPAD_AXIS_MOTION: + if (display_mode == CONTROLLER_MODE_TESTING) { + if (event->gaxis.value <= (-SDL_JOYSTICK_AXIS_MAX / 2) || event->gaxis.value >= (SDL_JOYSTICK_AXIS_MAX / 2)) { + SetController(event->gaxis.which); } - SDL_Log("Gamepad %" SDL_PRIu32 " axis %s changed to %d\n", - event.gaxis.which, - SDL_GetGamepadStringForAxis((SDL_GamepadAxis) event.gaxis.axis), - event.gaxis.value); - break; + } + SDL_Log("Gamepad %" SDL_PRIu32 " axis %s changed to %d\n", + event->gaxis.which, + SDL_GetGamepadStringForAxis((SDL_GamepadAxis) event->gaxis.axis), + event->gaxis.value); + break; #endif /* VERBOSE_AXES */ - case SDL_EVENT_GAMEPAD_BUTTON_DOWN: - case SDL_EVENT_GAMEPAD_BUTTON_UP: - if (display_mode == CONTROLLER_MODE_TESTING) { - if (event.type == SDL_EVENT_GAMEPAD_BUTTON_DOWN) { - SetController(event.gbutton.which); - } + case SDL_EVENT_GAMEPAD_BUTTON_DOWN: + case SDL_EVENT_GAMEPAD_BUTTON_UP: + if (display_mode == CONTROLLER_MODE_TESTING) { + if (event->type == SDL_EVENT_GAMEPAD_BUTTON_DOWN) { + SetController(event->gbutton.which); } + } #ifdef VERBOSE_BUTTONS - SDL_Log("Gamepad %" SDL_PRIu32 " button %s %s\n", - event.gbutton.which, - SDL_GetGamepadStringForButton((SDL_GamepadButton) event.gbutton.button), - event.gbutton.state ? "pressed" : "released"); + SDL_Log("Gamepad %" SDL_PRIu32 " button %s %s\n", + event->gbutton.which, + SDL_GetGamepadStringForButton((SDL_GamepadButton) event->gbutton.button), + event->gbutton.state ? "pressed" : "released"); #endif /* VERBOSE_BUTTONS */ - if (display_mode == CONTROLLER_MODE_TESTING) { - if (event.type == SDL_EVENT_GAMEPAD_BUTTON_DOWN && - controller && SDL_GetGamepadType(controller->gamepad) == SDL_GAMEPAD_TYPE_PS5) { - /* Cycle PS5 audio routing when the microphone button is pressed */ - if (event.gbutton.button == SDL_GAMEPAD_BUTTON_MISC1) { - CyclePS5AudioRoute(controller); - } + if (display_mode == CONTROLLER_MODE_TESTING) { + if (event->type == SDL_EVENT_GAMEPAD_BUTTON_DOWN && + controller && SDL_GetGamepadType(controller->gamepad) == SDL_GAMEPAD_TYPE_PS5) { + /* Cycle PS5 audio routing when the microphone button is pressed */ + if (event->gbutton.button == SDL_GAMEPAD_BUTTON_MISC1) { + CyclePS5AudioRoute(controller); + } - /* Cycle PS5 trigger effects when the triangle button is pressed */ - if (event.gbutton.button == SDL_GAMEPAD_BUTTON_NORTH) { - CyclePS5TriggerEffect(controller); - } + /* Cycle PS5 trigger effects when the triangle button is pressed */ + if (event->gbutton.button == SDL_GAMEPAD_BUTTON_NORTH) { + CyclePS5TriggerEffect(controller); } } - break; + } + break; - case SDL_EVENT_MOUSE_BUTTON_DOWN: - if (virtual_joystick && controller && controller->joystick == virtual_joystick) { - VirtualGamepadMouseDown(event.button.x, event.button.y); - } - UpdateButtonHighlights(event.button.x, event.button.y, event.button.down); - break; + case SDL_EVENT_MOUSE_BUTTON_DOWN: + if (virtual_joystick && controller && controller->joystick == virtual_joystick) { + VirtualGamepadMouseDown(event->button.x, event->button.y); + } + UpdateButtonHighlights(event->button.x, event->button.y, event->button.down); + break; - case SDL_EVENT_MOUSE_BUTTON_UP: - if (virtual_joystick && controller && controller->joystick == virtual_joystick) { - VirtualGamepadMouseUp(event.button.x, event.button.y); - } + case SDL_EVENT_MOUSE_BUTTON_UP: + if (virtual_joystick && controller && controller->joystick == virtual_joystick) { + VirtualGamepadMouseUp(event->button.x, event->button.y); + } - if (display_mode == CONTROLLER_MODE_TESTING) { - if (GamepadButtonContains(setup_mapping_button, event.button.x, event.button.y)) { - SetDisplayMode(CONTROLLER_MODE_BINDING); + if (display_mode == CONTROLLER_MODE_TESTING) { + if (GamepadButtonContains(setup_mapping_button, event->button.x, event->button.y)) { + SetDisplayMode(CONTROLLER_MODE_BINDING); + } + } else if (display_mode == CONTROLLER_MODE_BINDING) { + if (GamepadButtonContains(done_mapping_button, event->button.x, event->button.y)) { + if (controller->mapping) { + SDL_Log("Mapping complete:\n"); + SDL_Log("%s\n", controller->mapping); } - } else if (display_mode == CONTROLLER_MODE_BINDING) { - if (GamepadButtonContains(done_mapping_button, event.button.x, event.button.y)) { - if (controller->mapping) { - SDL_Log("Mapping complete:\n"); - SDL_Log("%s\n", controller->mapping); - } - SetDisplayMode(CONTROLLER_MODE_TESTING); - } else if (GamepadButtonContains(cancel_button, event.button.x, event.button.y)) { - CancelMapping(); - } else if (GamepadButtonContains(clear_button, event.button.x, event.button.y)) { - ClearMapping(); - } else if (controller->has_bindings && - GamepadButtonContains(copy_button, event.button.x, event.button.y)) { - CopyMapping(); - } else if (GamepadButtonContains(paste_button, event.button.x, event.button.y)) { - PasteMapping(); - } else if (title_pressed) { - SetCurrentBindingElement(SDL_GAMEPAD_ELEMENT_NAME, false); - } else if (type_pressed) { - SetCurrentBindingElement(SDL_GAMEPAD_ELEMENT_TYPE, false); - } else if (binding_element == SDL_GAMEPAD_ELEMENT_TYPE) { - int type = GetGamepadTypeDisplayAt(gamepad_type, event.button.x, event.button.y); - if (type != SDL_GAMEPAD_TYPE_UNSELECTED) { - CommitGamepadType((SDL_GamepadType)type); - StopBinding(); - } - } else { - int gamepad_element = SDL_GAMEPAD_ELEMENT_INVALID; - char *joystick_element; + SetDisplayMode(CONTROLLER_MODE_TESTING); + } else if (GamepadButtonContains(cancel_button, event->button.x, event->button.y)) { + CancelMapping(); + } else if (GamepadButtonContains(clear_button, event->button.x, event->button.y)) { + ClearMapping(); + } else if (controller->has_bindings && + GamepadButtonContains(copy_button, event->button.x, event->button.y)) { + CopyMapping(); + } else if (GamepadButtonContains(paste_button, event->button.x, event->button.y)) { + PasteMapping(); + } else if (title_pressed) { + SetCurrentBindingElement(SDL_GAMEPAD_ELEMENT_NAME, false); + } else if (type_pressed) { + SetCurrentBindingElement(SDL_GAMEPAD_ELEMENT_TYPE, false); + } else if (binding_element == SDL_GAMEPAD_ELEMENT_TYPE) { + int type = GetGamepadTypeDisplayAt(gamepad_type, event->button.x, event->button.y); + if (type != SDL_GAMEPAD_TYPE_UNSELECTED) { + CommitGamepadType((SDL_GamepadType)type); + StopBinding(); + } + } else { + int gamepad_element = SDL_GAMEPAD_ELEMENT_INVALID; + char *joystick_element; - if (controller->joystick != virtual_joystick) { - gamepad_element = GetGamepadImageElementAt(image, event.button.x, event.button.y); - } - if (gamepad_element == SDL_GAMEPAD_ELEMENT_INVALID) { - gamepad_element = GetGamepadDisplayElementAt(gamepad_elements, controller->gamepad, event.button.x, event.button.y); - } - if (gamepad_element != SDL_GAMEPAD_ELEMENT_INVALID) { - /* Set this to false if you don't want to start the binding flow at this point */ - const bool should_start_flow = true; - SetCurrentBindingElement(gamepad_element, should_start_flow); - } + if (controller->joystick != virtual_joystick) { + gamepad_element = GetGamepadImageElementAt(image, event->button.x, event->button.y); + } + if (gamepad_element == SDL_GAMEPAD_ELEMENT_INVALID) { + gamepad_element = GetGamepadDisplayElementAt(gamepad_elements, controller->gamepad, event->button.x, event->button.y); + } + if (gamepad_element != SDL_GAMEPAD_ELEMENT_INVALID) { + /* Set this to false if you don't want to start the binding flow at this point */ + const bool should_start_flow = true; + SetCurrentBindingElement(gamepad_element, should_start_flow); + } - joystick_element = GetJoystickDisplayElementAt(joystick_elements, controller->joystick, event.button.x, event.button.y); - if (joystick_element) { - CommitBindingElement(joystick_element, true); - SDL_free(joystick_element); - } + joystick_element = GetJoystickDisplayElementAt(joystick_elements, controller->joystick, event->button.x, event->button.y); + if (joystick_element) { + CommitBindingElement(joystick_element, true); + SDL_free(joystick_element); } } - UpdateButtonHighlights(event.button.x, event.button.y, event.button.down); - break; + } + UpdateButtonHighlights(event->button.x, event->button.y, event->button.down); + break; - case SDL_EVENT_MOUSE_MOTION: - if (virtual_joystick && controller && controller->joystick == virtual_joystick) { - VirtualGamepadMouseMotion(event.motion.x, event.motion.y); - } - UpdateButtonHighlights(event.motion.x, event.motion.y, event.motion.state ? true : false); - break; + case SDL_EVENT_MOUSE_MOTION: + if (virtual_joystick && controller && controller->joystick == virtual_joystick) { + VirtualGamepadMouseMotion(event->motion.x, event->motion.y); + } + UpdateButtonHighlights(event->motion.x, event->motion.y, event->motion.state ? true : false); + break; - case SDL_EVENT_KEY_DOWN: - if (display_mode == CONTROLLER_MODE_TESTING) { - if (event.key.key >= SDLK_0 && event.key.key <= SDLK_9) { - if (controller && controller->gamepad) { - int player_index = (event.key.key - SDLK_0); + case SDL_EVENT_KEY_DOWN: + if (display_mode == CONTROLLER_MODE_TESTING) { + if (event->key.key >= SDLK_0 && event->key.key <= SDLK_9) { + if (controller && controller->gamepad) { + int player_index = (event->key.key - SDLK_0); - SDL_SetGamepadPlayerIndex(controller->gamepad, player_index); - } - break; - } else if (event.key.key == SDLK_A) { - OpenVirtualGamepad(); - } else if (event.key.key == SDLK_D) { - CloseVirtualGamepad(); - } else if (event.key.key == SDLK_R && (event.key.mod & SDL_KMOD_CTRL)) { - SDL_ReloadGamepadMappings(); - } else if (event.key.key == SDLK_ESCAPE) { - done = true; - } - } else if (display_mode == CONTROLLER_MODE_BINDING) { - if (event.key.key == SDLK_C && (event.key.mod & SDL_KMOD_CTRL)) { - if (binding_element == SDL_GAMEPAD_ELEMENT_NAME) { - CopyControllerName(); - } else { - CopyMapping(); - } - } else if (event.key.key == SDLK_V && (event.key.mod & SDL_KMOD_CTRL)) { - if (binding_element == SDL_GAMEPAD_ELEMENT_NAME) { - ClearControllerName(); - PasteControllerName(); - } else { - PasteMapping(); - } - } else if (event.key.key == SDLK_X && (event.key.mod & SDL_KMOD_CTRL)) { - if (binding_element == SDL_GAMEPAD_ELEMENT_NAME) { - CopyControllerName(); - ClearControllerName(); - } else { - CopyMapping(); - ClearMapping(); - } - } else if (event.key.key == SDLK_SPACE) { - if (binding_element != SDL_GAMEPAD_ELEMENT_NAME) { - ClearBinding(); - } - } else if (event.key.key == SDLK_BACKSPACE) { - if (binding_element == SDL_GAMEPAD_ELEMENT_NAME) { - BackspaceControllerName(); - } - } else if (event.key.key == SDLK_RETURN) { - if (binding_element == SDL_GAMEPAD_ELEMENT_NAME) { - StopBinding(); - } - } else if (event.key.key == SDLK_ESCAPE) { - if (binding_element != SDL_GAMEPAD_ELEMENT_INVALID) { - StopBinding(); - } else { - CancelMapping(); - } + SDL_SetGamepadPlayerIndex(controller->gamepad, player_index); } + break; + } else if (event->key.key == SDLK_A) { + OpenVirtualGamepad(); + } else if (event->key.key == SDLK_D) { + CloseVirtualGamepad(); + } else if (event->key.key == SDLK_R && (event->key.mod & SDL_KMOD_CTRL)) { + SDL_ReloadGamepadMappings(); + } else if (event->key.key == SDLK_ESCAPE) { + done = true; } - break; - case SDL_EVENT_TEXT_INPUT: - if (display_mode == CONTROLLER_MODE_BINDING) { + } else if (display_mode == CONTROLLER_MODE_BINDING) { + if (event->key.key == SDLK_C && (event->key.mod & SDL_KMOD_CTRL)) { + if (binding_element == SDL_GAMEPAD_ELEMENT_NAME) { + CopyControllerName(); + } else { + CopyMapping(); + } + } else if (event->key.key == SDLK_V && (event->key.mod & SDL_KMOD_CTRL)) { + if (binding_element == SDL_GAMEPAD_ELEMENT_NAME) { + ClearControllerName(); + PasteControllerName(); + } else { + PasteMapping(); + } + } else if (event->key.key == SDLK_X && (event->key.mod & SDL_KMOD_CTRL)) { + if (binding_element == SDL_GAMEPAD_ELEMENT_NAME) { + CopyControllerName(); + ClearControllerName(); + } else { + CopyMapping(); + ClearMapping(); + } + } else if (event->key.key == SDLK_SPACE) { + if (binding_element != SDL_GAMEPAD_ELEMENT_NAME) { + ClearBinding(); + } + } else if (event->key.key == SDLK_BACKSPACE) { + if (binding_element == SDL_GAMEPAD_ELEMENT_NAME) { + BackspaceControllerName(); + } + } else if (event->key.key == SDLK_RETURN) { if (binding_element == SDL_GAMEPAD_ELEMENT_NAME) { - AddControllerNameText(event.text.text); + StopBinding(); + } + } else if (event->key.key == SDLK_ESCAPE) { + if (binding_element != SDL_GAMEPAD_ELEMENT_INVALID) { + StopBinding(); + } else { + CancelMapping(); } } - break; - case SDL_EVENT_QUIT: - done = true; - break; - default: - break; } + break; + case SDL_EVENT_TEXT_INPUT: + if (display_mode == CONTROLLER_MODE_BINDING) { + if (binding_element == SDL_GAMEPAD_ELEMENT_NAME) { + AddControllerNameText(event->text.text); + } + } + break; + case SDL_EVENT_QUIT: + done = true; + break; + default: + break; + } + + if (done) { + return SDL_APP_SUCCESS; + } else { + return SDL_APP_CONTINUE; + } +} + +SDL_AppResult SDLCALL SDL_AppIterate(void *appstate) +{ + /* If we have a virtual controller, send a virtual accelerometer sensor reading */ + if (virtual_joystick) { + float data[3] = { 0.0f, SDL_STANDARD_GRAVITY, 0.0f }; + SDL_SendJoystickVirtualSensorData(virtual_joystick, SDL_SENSOR_ACCEL, SDL_GetTicksNS(), data, SDL_arraysize(data)); } /* Wait 30 ms for joystick events to stop coming in, @@ -1982,14 +1985,10 @@ static void loop(void *arg) SDL_Delay(16); SDL_RenderPresent(screen); -#ifdef SDL_PLATFORM_EMSCRIPTEN - if (done) { - emscripten_cancel_main_loop(); - } -#endif + return SDL_APP_CONTINUE; } -int main(int argc, char *argv[]) +SDL_AppResult SDLCALL SDL_AppInit(void **appstate, int argc, char *argv[]) { bool show_mappings = false; int i; @@ -1997,12 +1996,11 @@ int main(int argc, char *argv[]) int screen_width, screen_height; SDL_FRect area; int gamepad_index = -1; - SDLTest_CommonState *state; /* Initialize test framework */ state = SDLTest_CommonCreateState(argv, 0); if (!state) { - return 1; + return SDL_APP_FAILURE; } SDL_SetHint(SDL_HINT_JOYSTICK_HIDAPI, "1"); @@ -2038,7 +2036,7 @@ int main(int argc, char *argv[]) if (consumed <= 0) { static const char *options[] = { "[--mappings]", "[--virtual]", "[index]", NULL }; SDLTest_CommonLogUsage(state, argv[0], options); - return 1; + return SDL_APP_FAILURE; } i += consumed; @@ -2050,7 +2048,7 @@ int main(int argc, char *argv[]) /* Initialize SDL (Note: video is required to start event loop) */ if (!SDL_Init(SDL_INIT_VIDEO | SDL_INIT_JOYSTICK | SDL_INIT_GAMEPAD)) { SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't initialize SDL: %s\n", SDL_GetError()); - return 1; + return SDL_APP_FAILURE; } SDL_AddGamepadMappingsFromFile("gamecontrollerdb.txt"); @@ -2077,14 +2075,14 @@ int main(int argc, char *argv[]) window = SDL_CreateWindow("SDL Controller Test", screen_width, screen_height, 0); if (!window) { SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't create window: %s\n", SDL_GetError()); - return 2; + return SDL_APP_FAILURE; } screen = SDL_CreateRenderer(window, NULL); if (!screen) { SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't create renderer: %s\n", SDL_GetError()); SDL_DestroyWindow(window); - return 2; + return SDL_APP_FAILURE; } SDL_SetRenderDrawColor(screen, 0x00, 0x00, 0x00, SDL_ALPHA_OPAQUE); @@ -2110,7 +2108,7 @@ int main(int argc, char *argv[]) if (!image) { SDL_DestroyRenderer(screen); SDL_DestroyWindow(window); - return 2; + return SDL_APP_FAILURE; } SetGamepadImagePosition(image, PANEL_WIDTH + PANEL_SPACING, TITLE_HEIGHT); @@ -2178,7 +2176,7 @@ int main(int argc, char *argv[]) SetGamepadButtonArea(done_mapping_button, &area); /* Process the initial gamepad list */ - loop(NULL); + SDL_AppIterate(NULL); if (gamepad_index < num_controllers) { SetController(controllers[gamepad_index].id); @@ -2186,15 +2184,11 @@ int main(int argc, char *argv[]) SetController(controllers[0].id); } - /* Loop, getting gamepad events! */ -#ifdef SDL_PLATFORM_EMSCRIPTEN - emscripten_set_main_loop_arg(loop, NULL, 0, 1); -#else - while (!done) { - loop(NULL); - } -#endif + return SDL_APP_CONTINUE; +} +void SDLCALL SDL_AppQuit(void *appstate, SDL_AppResult result) +{ CloseVirtualGamepad(); while (num_controllers > 0) { HandleGamepadRemoved(controllers[0].id); @@ -2217,5 +2211,4 @@ int main(int argc, char *argv[]) SDL_DestroyWindow(window); SDL_Quit(); SDLTest_CommonDestroyState(state); - return 0; } From c975f77b0fd3c73ba70100db76771b2638638cc0 Mon Sep 17 00:00:00 2001 From: Sam Lantinga Date: Mon, 20 Jan 2025 09:45:23 -0800 Subject: [PATCH 178/340] Update joysticks and so forth during live resize Fixes https://github.com/libsdl-org/SDL/issues/12022 --- src/events/SDL_events.c | 49 +++++++++++++++++++++------------------ src/events/SDL_events_c.h | 2 ++ src/video/SDL_video.c | 6 +++-- 3 files changed, 33 insertions(+), 24 deletions(-) diff --git a/src/events/SDL_events.c b/src/events/SDL_events.c index c82fed18b7a48..ca11afffa36af 100644 --- a/src/events/SDL_events.c +++ b/src/events/SDL_events.c @@ -1354,29 +1354,8 @@ bool SDL_RunOnMainThread(SDL_MainThreadCallback callback, void *userdata, bool w } } -// Run the system dependent event loops -static void SDL_PumpEventsInternal(bool push_sentinel) +void SDL_PumpEventMaintenance(void) { - // Free any temporary memory from old events - SDL_FreeTemporaryMemory(); - - // Release any keys held down from last frame - SDL_ReleaseAutoReleaseKeys(); - - // Run any pending main thread callbacks - SDL_RunMainThreadCallbacks(); - -#ifdef SDL_PLATFORM_ANDROID - // Android event processing is independent of the video subsystem - Android_PumpEvents(0); -#else - // Get events from the video subsystem - SDL_VideoDevice *_this = SDL_GetVideoDevice(); - if (_this) { - _this->PumpEvents(_this); - } -#endif - #ifndef SDL_AUDIO_DISABLED SDL_UpdateAudio(); #endif @@ -1402,6 +1381,32 @@ static void SDL_PumpEventsInternal(bool push_sentinel) SDL_UpdateTrays(); SDL_SendPendingSignalEvents(); // in case we had a signal handler fire, etc. +} + +// Run the system dependent event loops +static void SDL_PumpEventsInternal(bool push_sentinel) +{ + // Free any temporary memory from old events + SDL_FreeTemporaryMemory(); + + // Release any keys held down from last frame + SDL_ReleaseAutoReleaseKeys(); + + // Run any pending main thread callbacks + SDL_RunMainThreadCallbacks(); + +#ifdef SDL_PLATFORM_ANDROID + // Android event processing is independent of the video subsystem + Android_PumpEvents(0); +#else + // Get events from the video subsystem + SDL_VideoDevice *_this = SDL_GetVideoDevice(); + if (_this) { + _this->PumpEvents(_this); + } +#endif + + SDL_PumpEventMaintenance(); if (push_sentinel && SDL_EventEnabled(SDL_EVENT_POLL_SENTINEL)) { SDL_Event sentinel; diff --git a/src/events/SDL_events_c.h b/src/events/SDL_events_c.h index 041d714f51c12..e56ac475e5a20 100644 --- a/src/events/SDL_events_c.h +++ b/src/events/SDL_events_c.h @@ -51,6 +51,8 @@ extern const char *SDL_CreateTemporaryString(const char *string); extern void *SDL_ClaimTemporaryMemory(const void *mem); extern void SDL_FreeTemporaryMemory(void); +extern void SDL_PumpEventMaintenance(void); + extern void SDL_SendQuit(void); extern bool SDL_InitEvents(void); diff --git a/src/video/SDL_video.c b/src/video/SDL_video.c index b896e99875b62..6acd400e0ef29 100644 --- a/src/video/SDL_video.c +++ b/src/video/SDL_video.c @@ -3951,6 +3951,8 @@ void SDL_OnWindowLiveResizeUpdate(SDL_Window *window) // Send an expose event so the application can redraw SDL_SendWindowEvent(window, SDL_EVENT_WINDOW_EXPOSED, 0, 0); } + + SDL_PumpEventMaintenance(); } static void SDL_CheckWindowSafeAreaChanged(SDL_Window *window) @@ -4922,12 +4924,12 @@ bool SDL_GL_GetAttribute(SDL_GLAttr attr, int *value) if (glBindFramebufferFunc && (current_fbo != 0)) { glBindFramebufferFunc(GL_DRAW_FRAMEBUFFER, 0); } - // glGetFramebufferAttachmentParameterivFunc may cause GL_INVALID_OPERATION when querying depth/stencil size if the + // glGetFramebufferAttachmentParameterivFunc may cause GL_INVALID_OPERATION when querying depth/stencil size if the // bits is 0. From the GL docs: // If the value of GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE is GL_NONE, then either no framebuffer is bound to target; // or a default framebuffer is queried, attachment is GL_DEPTH or GL_STENCIL, and the number of depth or stencil bits, // respectively, is zero. In this case querying pname GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME will return zero, and all - // other queries will generate an error. + // other queries will generate an error. GLint fbo_type = GL_FRAMEBUFFER_DEFAULT; if (attachment == GL_DEPTH || attachment == GL_STENCIL) { glGetFramebufferAttachmentParameterivFunc(GL_FRAMEBUFFER, attachment, GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE, &fbo_type); From c698c61f03401d164429557d08075ebb9ffcd82d Mon Sep 17 00:00:00 2001 From: Sam Lantinga Date: Mon, 20 Jan 2025 10:48:13 -0800 Subject: [PATCH 179/340] renderer: initialize the surface colorspace correctly Fixes https://github.com/libsdl-org/SDL/issues/12027 --- src/render/SDL_render.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/render/SDL_render.c b/src/render/SDL_render.c index 06c0381ca89b2..eed84156130c8 100644 --- a/src/render/SDL_render.c +++ b/src/render/SDL_render.c @@ -1634,7 +1634,7 @@ SDL_Texture *SDL_CreateTextureFromSurface(SDL_Renderer *renderer, SDL_Surface *s } } - texture_colorspace = SDL_GetSurfaceColorspace(surface); + surface_colorspace = SDL_GetSurfaceColorspace(surface); // Try to have the best pixel format for the texture // No alpha, but a colorkey => promote to alpha From 759e01bd649ed60e1fd4f801b23d37a0a915fbae Mon Sep 17 00:00:00 2001 From: Sam Lantinga Date: Mon, 20 Jan 2025 11:29:41 -0800 Subject: [PATCH 180/340] testautomation: don't validate alpha values on XRGB formats The results are not defined, and some renderers set 0xFF always and other renderers set the alpha to blend results, even though it won't be used when rendering. Fixes --filter render_testBlendModes with D3D renderers --- test/testautomation_render.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/test/testautomation_render.c b/test/testautomation_render.c index 25572ee001a6c..0b85cfd3b89e7 100644 --- a/test/testautomation_render.c +++ b/test/testautomation_render.c @@ -897,7 +897,12 @@ static void testBlendModeOperation(TestRenderOperation op, int mode, SDL_PixelFo deltaR = SDL_abs((int)actualR - expectedR); deltaG = SDL_abs((int)actualG - expectedG); deltaB = SDL_abs((int)actualB - expectedB); - deltaA = SDL_abs((int)actualA - expectedA); + if (SDL_ISPIXELFORMAT_ALPHA(dst_format)) { + deltaA = SDL_abs((int)actualA - expectedA); + } else { + // The alpha channel is ignored in non-alpha formats, so don't validate it + deltaA = 0; + } SDLTest_AssertCheck( deltaR <= MAXIMUM_ERROR && deltaG <= MAXIMUM_ERROR && From 819628c6bf8e6c3e5357d7ee4bd2d3d43ddfe052 Mon Sep 17 00:00:00 2001 From: Frank Praznik Date: Mon, 20 Jan 2025 14:49:35 -0500 Subject: [PATCH 181/340] testautomation: Remove Win32 borderless resizable hint This defaults to 'true' now, so setting it manually is no longer necessary. --- test/testautomation_video.c | 7 ------- 1 file changed, 7 deletions(-) diff --git a/test/testautomation_video.c b/test/testautomation_video.c index c457ef17f04d4..09c55e7850b6f 100644 --- a/test/testautomation_video.c +++ b/test/testautomation_video.c @@ -1006,10 +1006,6 @@ static int SDLCALL video_getSetWindowSize(void *arg) int referenceW, referenceH; int currentW, currentH; int desiredW, desiredH; - const bool restoreHint = SDL_GetHintBoolean("SDL_BORDERLESS_RESIZABLE_STYLE", true); - - /* Win32 borderless windows are not resizable by default and need this undocumented hint */ - SDL_SetHint("SDL_BORDERLESS_RESIZABLE_STYLE", "1"); /* Get display bounds for size range */ result = SDL_GetDisplayUsableBounds(SDL_GetPrimaryDisplay(), &display); @@ -1188,9 +1184,6 @@ static int SDLCALL video_getSetWindowSize(void *arg) SDLTest_AssertPass("Call to SDL_SetWindowSize(window=NULL)"); checkInvalidWindowError(); - /* Restore the hint to the previous value */ - SDL_SetHint("SDL_BORDERLESS_RESIZABLE_STYLE", restoreHint ? "1" : "0"); - return TEST_COMPLETED; } From adb91fd3dbe763566c6e5d088767091ec8205a4d Mon Sep 17 00:00:00 2001 From: "Ryan C. Gordon" Date: Mon, 20 Jan 2025 15:51:02 -0500 Subject: [PATCH 182/340] process: Don't use vfork() on Apple platforms. They want you to use fork(), which is almost-identical in their implementation. They mark vfork() usage with a big scary deprecation warning. --- src/process/posix/SDL_posixprocess.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/process/posix/SDL_posixprocess.c b/src/process/posix/SDL_posixprocess.c index 8dc01603408d8..98b9f75bca8e8 100644 --- a/src/process/posix/SDL_posixprocess.c +++ b/src/process/posix/SDL_posixprocess.c @@ -309,10 +309,16 @@ bool SDL_SYS_CreateProcessWithProperties(SDL_Process *process, SDL_PropertiesID // Spawn the new process if (process->background) { int status = -1; - pid_t pid = vfork(); + #ifdef SDL_PLATFORM_APPLE // Apple has vfork marked as deprecated and (as of macOS 10.12) is almost identical to calling fork() anyhow. + const pid_t pid = fork(); + const char *forkname = "fork"; + #else + const pid_t pid = vfork(); + const char *forkname = "vfork"; + #endif switch (pid) { case -1: - SDL_SetError("vfork() failed: %s", strerror(errno)); + SDL_SetError("%s() failed: %s", forkname, strerror(errno)); goto posix_spawn_fail_all; case 0: From dcadd23ba14d7c70e9b790fecd90385626efa050 Mon Sep 17 00:00:00 2001 From: "Ryan C. Gordon" Date: Mon, 20 Jan 2025 15:38:09 -0500 Subject: [PATCH 183/340] render: Prevent division by zero if logical presentation is 0 pixels. --- src/render/SDL_render.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/src/render/SDL_render.c b/src/render/SDL_render.c index eed84156130c8..9c24d559a4c59 100644 --- a/src/render/SDL_render.c +++ b/src/render/SDL_render.c @@ -2571,7 +2571,12 @@ static void UpdateLogicalPresentation(SDL_Renderer *renderer) renderer->logical_src_rect.w = logical_w; renderer->logical_src_rect.h = logical_h; - if (renderer->logical_presentation_mode == SDL_LOGICAL_PRESENTATION_INTEGER_SCALE) { + if ((logical_w <= 0.0f) || (logical_h <= 0.0f)) { + renderer->logical_dst_rect.x = 0.0f; + renderer->logical_dst_rect.y = 0.0f; + renderer->logical_dst_rect.w = output_w; + renderer->logical_dst_rect.h = output_h; + } else if (renderer->logical_presentation_mode == SDL_LOGICAL_PRESENTATION_INTEGER_SCALE) { float scale; if (want_aspect > real_aspect) { scale = (float)((int)output_w / (int)logical_w); // This an integer division! @@ -2635,8 +2640,8 @@ static void UpdateLogicalPresentation(SDL_Renderer *renderer) } } - renderer->main_view.logical_scale.x = (logical_w != 0.0f) ? renderer->logical_dst_rect.w / logical_w : 0.0f; - renderer->main_view.logical_scale.y = (logical_h != 0.0f) ? renderer->logical_dst_rect.h / logical_h : 0.0f; + renderer->main_view.logical_scale.x = (logical_w > 0.0f) ? renderer->logical_dst_rect.w / logical_w : 0.0f; + renderer->main_view.logical_scale.y = (logical_h > 0.0f) ? renderer->logical_dst_rect.h / logical_h : 0.0f; renderer->main_view.current_scale.x = renderer->main_view.scale.x * renderer->main_view.logical_scale.x; renderer->main_view.current_scale.y = renderer->main_view.scale.y * renderer->main_view.logical_scale.y; renderer->main_view.logical_offset.x = renderer->logical_dst_rect.x; From 9b454a762c188abb4a191ded6f95e6afc7411d74 Mon Sep 17 00:00:00 2001 From: Sam Lantinga Date: Mon, 20 Jan 2025 11:40:04 -0800 Subject: [PATCH 184/340] Revert "testautomation: don't validate alpha values on XRGB formats" This reverts commit 759e01bd649ed60e1fd4f801b23d37a0a915fbae. It's better to return the expected format from SDL_RenderReadPixels() than skip alpha testing. --- src/render/SDL_render.c | 18 ++++++++++++++++-- test/testautomation_render.c | 7 +------ 2 files changed, 17 insertions(+), 8 deletions(-) diff --git a/src/render/SDL_render.c b/src/render/SDL_render.c index 9c24d559a4c59..4d21bade893d2 100644 --- a/src/render/SDL_render.c +++ b/src/render/SDL_render.c @@ -5006,8 +5006,22 @@ SDL_Surface *SDL_RenderReadPixels(SDL_Renderer *renderer, const SDL_Rect *rect) SDL_PropertiesID props = SDL_GetSurfaceProperties(surface); if (renderer->target) { - SDL_SetFloatProperty(props, SDL_PROP_SURFACE_SDR_WHITE_POINT_FLOAT, renderer->target->SDR_white_point); - SDL_SetFloatProperty(props, SDL_PROP_SURFACE_HDR_HEADROOM_FLOAT, renderer->target->HDR_headroom); + SDL_Texture *target = renderer->target; + SDL_Texture *parent = SDL_GetPointerProperty(SDL_GetTextureProperties(target), SDL_PROP_TEXTURE_PARENT_POINTER, NULL); + SDL_PixelFormat expected_format = (parent ? parent->format : target->format); + + SDL_SetFloatProperty(props, SDL_PROP_SURFACE_SDR_WHITE_POINT_FLOAT, target->SDR_white_point); + SDL_SetFloatProperty(props, SDL_PROP_SURFACE_HDR_HEADROOM_FLOAT, target->HDR_headroom); + + // Set the expected surface format + if ((surface->format == SDL_PIXELFORMAT_ARGB8888 && expected_format == SDL_PIXELFORMAT_XRGB8888) || + (surface->format == SDL_PIXELFORMAT_RGBA8888 && expected_format == SDL_PIXELFORMAT_RGBX8888) || + (surface->format == SDL_PIXELFORMAT_ABGR8888 && expected_format == SDL_PIXELFORMAT_XBGR8888) || + (surface->format == SDL_PIXELFORMAT_BGRA8888 && expected_format == SDL_PIXELFORMAT_BGRX8888)) { +printf("changing format\n"); + surface->format = expected_format; + surface->fmt = SDL_GetPixelFormatDetails(expected_format); + } } else { SDL_SetFloatProperty(props, SDL_PROP_SURFACE_SDR_WHITE_POINT_FLOAT, renderer->SDR_white_point); SDL_SetFloatProperty(props, SDL_PROP_SURFACE_HDR_HEADROOM_FLOAT, renderer->HDR_headroom); diff --git a/test/testautomation_render.c b/test/testautomation_render.c index 0b85cfd3b89e7..25572ee001a6c 100644 --- a/test/testautomation_render.c +++ b/test/testautomation_render.c @@ -897,12 +897,7 @@ static void testBlendModeOperation(TestRenderOperation op, int mode, SDL_PixelFo deltaR = SDL_abs((int)actualR - expectedR); deltaG = SDL_abs((int)actualG - expectedG); deltaB = SDL_abs((int)actualB - expectedB); - if (SDL_ISPIXELFORMAT_ALPHA(dst_format)) { - deltaA = SDL_abs((int)actualA - expectedA); - } else { - // The alpha channel is ignored in non-alpha formats, so don't validate it - deltaA = 0; - } + deltaA = SDL_abs((int)actualA - expectedA); SDLTest_AssertCheck( deltaR <= MAXIMUM_ERROR && deltaG <= MAXIMUM_ERROR && From a036aeda3b27ce7e115ebf25e717adf0bdabe91e Mon Sep 17 00:00:00 2001 From: Sam Lantinga Date: Mon, 20 Jan 2025 13:09:49 -0800 Subject: [PATCH 185/340] The Vulkan renderer doesn't actually support RGB texture formats Fixes https://github.com/libsdl-org/SDL/issues/10400 --- src/render/vulkan/SDL_render_vulkan.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/src/render/vulkan/SDL_render_vulkan.c b/src/render/vulkan/SDL_render_vulkan.c index c8fa59479236c..e61a88f58ba26 100644 --- a/src/render/vulkan/SDL_render_vulkan.c +++ b/src/render/vulkan/SDL_render_vulkan.c @@ -399,7 +399,7 @@ static SDL_PixelFormat VULKAN_VkFormatToSDLPixelFormat(VkFormat vkFormat) case VK_FORMAT_B8G8R8A8_UNORM: return SDL_PIXELFORMAT_ARGB8888; case VK_FORMAT_A2R10G10B10_UNORM_PACK32: - return SDL_PIXELFORMAT_XBGR2101010; + return SDL_PIXELFORMAT_ABGR2101010; case VK_FORMAT_R16G16B16A16_SFLOAT: return SDL_PIXELFORMAT_RGBA64_FLOAT; default: @@ -445,10 +445,9 @@ static VkFormat SDLPixelFormatToVkTextureFormat(Uint32 format, Uint32 output_col switch (format) { case SDL_PIXELFORMAT_RGBA64_FLOAT: return VK_FORMAT_R16G16B16A16_SFLOAT; - case SDL_PIXELFORMAT_XBGR2101010: + case SDL_PIXELFORMAT_ABGR2101010: return VK_FORMAT_A2B10G10R10_UNORM_PACK32; case SDL_PIXELFORMAT_ARGB8888: - case SDL_PIXELFORMAT_XRGB8888: if (output_colorspace == SDL_COLORSPACE_SRGB_LINEAR) { return VK_FORMAT_B8G8R8A8_SRGB; } @@ -4304,8 +4303,7 @@ static bool VULKAN_CreateRenderer(SDL_Renderer *renderer, SDL_Window *window, SD renderer->name = VULKAN_RenderDriver.name; SDL_AddSupportedTextureFormat(renderer, SDL_PIXELFORMAT_ARGB8888); - SDL_AddSupportedTextureFormat(renderer, SDL_PIXELFORMAT_XRGB8888); - SDL_AddSupportedTextureFormat(renderer, SDL_PIXELFORMAT_XBGR2101010); + SDL_AddSupportedTextureFormat(renderer, SDL_PIXELFORMAT_ABGR2101010); SDL_AddSupportedTextureFormat(renderer, SDL_PIXELFORMAT_RGBA64_FLOAT); SDL_SetNumberProperty(SDL_GetRendererProperties(renderer), SDL_PROP_RENDERER_MAX_TEXTURE_SIZE_NUMBER, 16384); From 075c0337cdf69f4ba26ea4d90746a59b57fb1ba3 Mon Sep 17 00:00:00 2001 From: Sam Lantinga Date: Mon, 20 Jan 2025 13:11:19 -0800 Subject: [PATCH 186/340] Removed debug print statement --- src/render/SDL_render.c | 1 - 1 file changed, 1 deletion(-) diff --git a/src/render/SDL_render.c b/src/render/SDL_render.c index 4d21bade893d2..9774abe169751 100644 --- a/src/render/SDL_render.c +++ b/src/render/SDL_render.c @@ -5018,7 +5018,6 @@ SDL_Surface *SDL_RenderReadPixels(SDL_Renderer *renderer, const SDL_Rect *rect) (surface->format == SDL_PIXELFORMAT_RGBA8888 && expected_format == SDL_PIXELFORMAT_RGBX8888) || (surface->format == SDL_PIXELFORMAT_ABGR8888 && expected_format == SDL_PIXELFORMAT_XBGR8888) || (surface->format == SDL_PIXELFORMAT_BGRA8888 && expected_format == SDL_PIXELFORMAT_BGRX8888)) { -printf("changing format\n"); surface->format = expected_format; surface->fmt = SDL_GetPixelFormatDetails(expected_format); } From 6449339ae353de91440a05305222c56ed328602c Mon Sep 17 00:00:00 2001 From: Frank Praznik Date: Mon, 20 Jan 2025 14:04:33 -0500 Subject: [PATCH 187/340] win32: Restore the base size of a window when leaving fullscreen Always restore the base floating size of a window before possibly entering the maximized state, as base size can be lost during the fullscreen transition, resulting in the window de-maximizing to the wrong size. --- src/video/windows/SDL_windowsevents.c | 28 ++++++++++++++------------- src/video/windows/SDL_windowswindow.c | 17 +++++++++------- src/video/windows/SDL_windowswindow.h | 1 + 3 files changed, 26 insertions(+), 20 deletions(-) diff --git a/src/video/windows/SDL_windowsevents.c b/src/video/windows/SDL_windowsevents.c index 459f43dfa5202..3ef492ec5679b 100644 --- a/src/video/windows/SDL_windowsevents.c +++ b/src/video/windows/SDL_windowsevents.c @@ -1633,23 +1633,25 @@ LRESULT CALLBACK WIN_WindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lPara break; } - if (GetClientRect(hwnd, &rect) && !WIN_IsRectEmpty(&rect)) { - ClientToScreen(hwnd, (LPPOINT) &rect); - ClientToScreen(hwnd, (LPPOINT) &rect + 1); + if (!data->disable_move_size_events) { + if (GetClientRect(hwnd, &rect) && !WIN_IsRectEmpty(&rect)) { + ClientToScreen(hwnd, (LPPOINT) &rect); + ClientToScreen(hwnd, (LPPOINT) &rect + 1); - x = rect.left; - y = rect.top; + x = rect.left; + y = rect.top; - SDL_GlobalToRelativeForWindow(data->window, x, y, &x, &y); - SDL_SendWindowEvent(data->window, SDL_EVENT_WINDOW_MOVED, x, y); - } + SDL_GlobalToRelativeForWindow(data->window, x, y, &x, &y); + SDL_SendWindowEvent(data->window, SDL_EVENT_WINDOW_MOVED, x, y); + } - // Moving the window from one display to another can change the size of the window (in the handling of SDL_EVENT_WINDOW_MOVED), so we need to re-query the bounds - if (GetClientRect(hwnd, &rect) && !WIN_IsRectEmpty(&rect)) { - w = rect.right; - h = rect.bottom; + // Moving the window from one display to another can change the size of the window (in the handling of SDL_EVENT_WINDOW_MOVED), so we need to re-query the bounds + if (GetClientRect(hwnd, &rect) && !WIN_IsRectEmpty(&rect)) { + w = rect.right; + h = rect.bottom; - SDL_SendWindowEvent(data->window, SDL_EVENT_WINDOW_RESIZED, w, h); + SDL_SendWindowEvent(data->window, SDL_EVENT_WINDOW_RESIZED, w, h); + } } WIN_UpdateClipCursor(data->window); diff --git a/src/video/windows/SDL_windowswindow.c b/src/video/windows/SDL_windowswindow.c index b3d2d69f23b9f..6ca0bfde57bc6 100644 --- a/src/video/windows/SDL_windowswindow.c +++ b/src/video/windows/SDL_windowswindow.c @@ -1377,28 +1377,31 @@ SDL_FullscreenResult WIN_SetWindowFullscreen(SDL_VideoDevice *_this, SDL_Window https://bugzilla.libsdl.org/show_bug.cgi?id=3215 can reproduce! */ if (data->windowed_mode_was_maximized && !data->in_window_deactivation) { - style |= WS_MAXIMIZE; enterMaximized = true; + data->disable_move_size_events = true; } menu = (style & WS_CHILDWINDOW) ? FALSE : (GetMenu(hwnd) != NULL); WIN_AdjustWindowRectWithStyle(window, style, styleEx, menu, &x, &y, &w, &h, - data->windowed_mode_was_maximized ? SDL_WINDOWRECT_WINDOWED : SDL_WINDOWRECT_FLOATING); + SDL_WINDOWRECT_FLOATING); data->windowed_mode_was_maximized = false; } + + /* Always reset the window to the base floating size before possibly re-applying the maximized state, + * otherwise, the base floating size can seemingly be lost in some cases. + */ SetWindowLong(hwnd, GWL_STYLE, style); data->expected_resize = true; + SetWindowPos(hwnd, top, x, y, w, h, data->copybits_flag | SWP_NOACTIVATE); + data->expected_resize = false; + data->disable_move_size_events = false; - if (!enterMaximized) { - SetWindowPos(hwnd, top, x, y, w, h, data->copybits_flag | SWP_NOACTIVATE); - } else { + if (enterMaximized) { WIN_MaximizeWindow(_this, window); } - data->expected_resize = false; - #ifdef HIGHDPI_DEBUG SDL_Log("WIN_SetWindowFullscreen: %d finished. Set window to %d,%d, %dx%d", (int)fullscreen, x, y, w, h); #endif diff --git a/src/video/windows/SDL_windowswindow.h b/src/video/windows/SDL_windowswindow.h index 467c5b893fffa..1430dee572b08 100644 --- a/src/video/windows/SDL_windowswindow.h +++ b/src/video/windows/SDL_windowswindow.h @@ -82,6 +82,7 @@ struct SDL_WindowData bool windowed_mode_was_maximized; bool in_window_deactivation; bool force_resizable; + bool disable_move_size_events; RECT initial_size_rect; RECT cursor_clipped_rect; // last successfully committed clipping rect for this window RECT cursor_ctrlock_rect; // this is Windows-specific, but probably does not need to be per-window From 10a5b388df7102e1fc089b689c4a8a0b6b8da572 Mon Sep 17 00:00:00 2001 From: Frank Praznik Date: Mon, 20 Jan 2025 14:17:39 -0500 Subject: [PATCH 188/340] win32: Retain the WS_MAXIMIZEDBOX style while in fullscreen This needs to be preserved while in fullscreen, or leaving fullscreen for the maximized state can cause the taskbar to disappear with borderless windows. --- src/video/windows/SDL_windowsevents.c | 14 +++++++++----- src/video/windows/SDL_windowswindow.c | 16 +++++++++------- src/video/windows/SDL_windowswindow.h | 2 +- 3 files changed, 19 insertions(+), 13 deletions(-) diff --git a/src/video/windows/SDL_windowsevents.c b/src/video/windows/SDL_windowsevents.c index 3ef492ec5679b..0fcb08b00c27e 100644 --- a/src/video/windows/SDL_windowsevents.c +++ b/src/video/windows/SDL_windowsevents.c @@ -1611,13 +1611,17 @@ LRESULT CALLBACK WIN_WindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lPara SDL_SendWindowEvent(data->window, SDL_EVENT_WINDOW_RESTORED, 0, 0); } SDL_SendWindowEvent(data->window, SDL_EVENT_WINDOW_MAXIMIZED, 0, 0); - data->force_resizable = true; + data->force_ws_maximizebox = true; } else if (data->window->flags & (SDL_WINDOW_MAXIMIZED | SDL_WINDOW_MINIMIZED)) { SDL_SendWindowEvent(data->window, SDL_EVENT_WINDOW_RESTORED, 0, 0); - // If resizable was forced on for the maximized window, clear the style flags now. - data->force_resizable = false; - WIN_SetWindowResizable(SDL_GetVideoDevice(), data->window, !!(data->window->flags & SDL_WINDOW_RESIZABLE)); + /* If resizable was forced on for the maximized window, clear the style flags now, + * but not if the window is fullscreen, as this needs to be preserved in that case. + */ + if (!(data->window->flags & SDL_WINDOW_FULLSCREEN)) { + data->force_ws_maximizebox = false; + WIN_SetWindowResizable(SDL_GetVideoDevice(), data->window, !!(data->window->flags & SDL_WINDOW_RESIZABLE)); + } } if (windowpos->flags & SWP_HIDEWINDOW) { @@ -2038,7 +2042,7 @@ LRESULT CALLBACK WIN_WindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lPara params->rgrc[0] = info.rcWork; } } - } else if (!(window_flags & SDL_WINDOW_RESIZABLE) && !data->force_resizable) { + } else if (!(window_flags & SDL_WINDOW_RESIZABLE) && !data->force_ws_maximizebox) { int w, h; if (data->window->last_size_pending) { w = data->window->pending.w; diff --git a/src/video/windows/SDL_windowswindow.c b/src/video/windows/SDL_windowswindow.c index 6ca0bfde57bc6..1711fc0a597c0 100644 --- a/src/video/windows/SDL_windowswindow.c +++ b/src/video/windows/SDL_windowswindow.c @@ -185,22 +185,24 @@ static DWORD GetWindowStyle(SDL_Window *window) /* The WS_MAXIMIZEBOX style flag needs to be retained for as long as the window is maximized, * or restoration from minimized can fail, and leaving maximized can result in an odd size. */ - if ((window->flags & SDL_WINDOW_RESIZABLE) || (window->internal && window->internal->force_resizable)) { + if (window->flags & SDL_WINDOW_RESIZABLE) { /* You can have a borderless resizable window, but Windows doesn't always draw it correctly, see https://bugzilla.libsdl.org/show_bug.cgi?id=4466 */ if (!(window->flags & SDL_WINDOW_BORDERLESS) || SDL_GetHintBoolean("SDL_BORDERLESS_RESIZABLE_STYLE", true)) { style |= STYLE_RESIZABLE; - } else if (window->flags & SDL_WINDOW_BORDERLESS) { - /* Even if the resizable style hint isn't set, WS_MAXIMIZEBOX is still needed, or - * maximizing the window will make it fullscreen and cover the taskbar, instead - * of entering a normal maximized state that fills the usable desktop area. - */ - style |= WS_MAXIMIZEBOX; } } + if (window->internal && window->internal->force_ws_maximizebox) { + /* Even if the resizable flag is cleared, WS_MAXIMIZEBOX is still needed as long + * as the window is maximized, or de-maximizing or minimizing and restoring the + * maximized window can result in the window disappearing or being the wrong size. + */ + style |= WS_MAXIMIZEBOX; + } + // Need to set initialize minimize style, or when we call ShowWindow with WS_MINIMIZE it will activate a random window if (window->flags & SDL_WINDOW_MINIMIZED) { style |= WS_MINIMIZE; diff --git a/src/video/windows/SDL_windowswindow.h b/src/video/windows/SDL_windowswindow.h index 1430dee572b08..d8165d0b52e03 100644 --- a/src/video/windows/SDL_windowswindow.h +++ b/src/video/windows/SDL_windowswindow.h @@ -81,7 +81,7 @@ struct SDL_WindowData bool skip_update_clipcursor; bool windowed_mode_was_maximized; bool in_window_deactivation; - bool force_resizable; + bool force_ws_maximizebox; bool disable_move_size_events; RECT initial_size_rect; RECT cursor_clipped_rect; // last successfully committed clipping rect for this window From aa10e51c745d26a15dca9f772cbba97c95e572b7 Mon Sep 17 00:00:00 2001 From: "Ryan C. Gordon" Date: Mon, 20 Jan 2025 17:29:15 -0500 Subject: [PATCH 189/340] audio: Added some minor missing comments in struct SDL_AudioDevice. --- src/audio/SDL_sysaudio.h | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/audio/SDL_sysaudio.h b/src/audio/SDL_sysaudio.h index d36c63ad87f46..c5cce0e4c6db2 100644 --- a/src/audio/SDL_sysaudio.h +++ b/src/audio/SDL_sysaudio.h @@ -305,8 +305,11 @@ struct SDL_AudioDevice // The device's current audio specification SDL_AudioSpec spec; + + // The size, in bytes, of the device's playback/recording buffer. int buffer_size; + // The device's channel map, or NULL for SDL default layout. int *chmap; // The device's default audio specification From b6d0bc043149f61059285a9069a62a4b78123ba8 Mon Sep 17 00:00:00 2001 From: "Ryan C. Gordon" Date: Mon, 20 Jan 2025 18:30:02 -0500 Subject: [PATCH 190/340] coreaudio: Use three buffers for the audioqueue, not two. This doesn't affect latency much, but it makes the system usable if the system drops you down from the bluetooth a2dp profile (headphones) to the handsfree (I think...?) profile because the bluetooth audio device is also recording, which would be extremely common in a VoIP app, but also if you're talking in a different app while also playing audio. Fixes #8192. --- src/audio/coreaudio/SDL_coreaudio.m | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/audio/coreaudio/SDL_coreaudio.m b/src/audio/coreaudio/SDL_coreaudio.m index 3652709e06da1..af54bebcce91d 100644 --- a/src/audio/coreaudio/SDL_coreaudio.m +++ b/src/audio/coreaudio/SDL_coreaudio.m @@ -817,7 +817,7 @@ static bool PrepareAudioQueue(SDL_AudioDevice *device) } #endif - int numAudioBuffers = 2; + int numAudioBuffers = 3; const double msecs = (device->sample_frames / ((double)device->spec.freq)) * 1000.0; if (msecs < MINIMUM_AUDIO_BUFFER_TIME_MS) { // use more buffers if we have a VERY small sample set. numAudioBuffers = ((int)SDL_ceil(MINIMUM_AUDIO_BUFFER_TIME_MS / msecs) * 2); From b476695e677ef6893e0224d434aad5bff37bce7f Mon Sep 17 00:00:00 2001 From: Sam Lantinga Date: Mon, 20 Jan 2025 15:07:39 -0800 Subject: [PATCH 191/340] Call the windows message hook while inside a modal message loop Fixes https://github.com/libsdl-org/SDL/issues/12029 --- src/video/windows/SDL_windowsevents.c | 65 ++++++++++++++++++++------- src/video/windows/SDL_windowswindow.h | 1 + 2 files changed, 50 insertions(+), 16 deletions(-) diff --git a/src/video/windows/SDL_windowsevents.c b/src/video/windows/SDL_windowsevents.c index 0fcb08b00c27e..b65d81ac5ff13 100644 --- a/src/video/windows/SDL_windowsevents.c +++ b/src/video/windows/SDL_windowsevents.c @@ -174,6 +174,16 @@ static Uint64 WIN_GetEventTimestamp(void) return timestamp; } +// A message hook called before TranslateMessage() +static SDL_WindowsMessageHook g_WindowsMessageHook = NULL; +static void *g_WindowsMessageHookData = NULL; + +void SDL_SetWindowsMessageHook(SDL_WindowsMessageHook callback, void *userdata) +{ + g_WindowsMessageHook = callback; + g_WindowsMessageHookData = userdata; +} + static SDL_Scancode WindowsScanCodeToSDLScanCode(LPARAM lParam, WPARAM wParam, Uint16 *rawcode, bool *virtual_key) { SDL_Scancode code; @@ -1042,6 +1052,25 @@ static bool SkipAltGrLeftControl(WPARAM wParam, LPARAM lParam) return false; } +static bool DispatchModalLoopMessageHook(HWND *hwnd, UINT *msg, WPARAM *wParam, LPARAM *lParam) +{ + MSG dummy; + + SDL_zero(dummy); + dummy.hwnd = *hwnd; + dummy.message = *msg; + dummy.wParam = *wParam; + dummy.lParam = *lParam; + if (g_WindowsMessageHook(g_WindowsMessageHookData, &dummy)) { + // Can't modify the hwnd, but everything else is fair game + *msg = dummy.message; + *wParam = dummy.wParam; + *lParam = dummy.lParam; + return true; + } + return false; +} + LRESULT CALLBACK WIN_WindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) { SDL_WindowData *data; @@ -1071,6 +1100,14 @@ LRESULT CALLBACK WIN_WindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lPara } #endif // WMMSG_DEBUG + + if (g_WindowsMessageHook && data->in_modal_loop) { + // Synthesize a message for window hooks so they can modify the message if desired + if (!DispatchModalLoopMessageHook(&hwnd, &msg, &wParam, &lParam)) { + return 0; + } + } + #if !defined(SDL_PLATFORM_XBOXONE) && !defined(SDL_PLATFORM_XBOXSERIES) if (WIN_HandleIMEMessage(hwnd, msg, wParam, &lParam, data->videodata)) { return 0; @@ -1684,12 +1721,15 @@ LRESULT CALLBACK WIN_WindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lPara case WM_ENTERSIZEMOVE: case WM_ENTERMENULOOP: { - data->initial_size_rect.left = data->window->x; - data->initial_size_rect.right = data->window->x + data->window->w; - data->initial_size_rect.top = data->window->y; - data->initial_size_rect.bottom = data->window->y + data->window->h; + ++data->in_modal_loop; + if (data->in_modal_loop == 1) { + data->initial_size_rect.left = data->window->x; + data->initial_size_rect.right = data->window->x + data->window->w; + data->initial_size_rect.top = data->window->y; + data->initial_size_rect.bottom = data->window->y + data->window->h; - SetTimer(hwnd, (UINT_PTR)SDL_IterateMainCallbacks, USER_TIMER_MINIMUM, NULL); + SetTimer(hwnd, (UINT_PTR)SDL_IterateMainCallbacks, USER_TIMER_MINIMUM, NULL); + } } break; case WM_TIMER: @@ -1703,7 +1743,10 @@ LRESULT CALLBACK WIN_WindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lPara case WM_EXITSIZEMOVE: case WM_EXITMENULOOP: { - KillTimer(hwnd, (UINT_PTR)SDL_IterateMainCallbacks); + --data->in_modal_loop; + if (data->in_modal_loop == 0) { + KillTimer(hwnd, (UINT_PTR)SDL_IterateMainCallbacks); + } } break; case WM_SIZING: @@ -2305,16 +2348,6 @@ static void WIN_UpdateMouseCapture(void) } #endif // !defined(SDL_PLATFORM_XBOXONE) && !defined(SDL_PLATFORM_XBOXSERIES) -// A message hook called before TranslateMessage() -static SDL_WindowsMessageHook g_WindowsMessageHook = NULL; -static void *g_WindowsMessageHookData = NULL; - -void SDL_SetWindowsMessageHook(SDL_WindowsMessageHook callback, void *userdata) -{ - g_WindowsMessageHook = callback; - g_WindowsMessageHookData = userdata; -} - int WIN_WaitEventTimeout(SDL_VideoDevice *_this, Sint64 timeoutNS) { if (g_WindowsEnableMessageLoop) { diff --git a/src/video/windows/SDL_windowswindow.h b/src/video/windows/SDL_windowswindow.h index d8165d0b52e03..a2c9a2110fe3d 100644 --- a/src/video/windows/SDL_windowswindow.h +++ b/src/video/windows/SDL_windowswindow.h @@ -83,6 +83,7 @@ struct SDL_WindowData bool in_window_deactivation; bool force_ws_maximizebox; bool disable_move_size_events; + int in_modal_loop; RECT initial_size_rect; RECT cursor_clipped_rect; // last successfully committed clipping rect for this window RECT cursor_ctrlock_rect; // this is Windows-specific, but probably does not need to be per-window From c6c7469708e5dc9f265cf359fc0a8982b448544e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tomasz=20Paku=C5=82a?= Date: Mon, 20 Jan 2025 23:15:42 +0100 Subject: [PATCH 192/340] Translate conditional effect direction instead of hardcoding it to 0 Provious code wrongly assumed that direction is not an important part of conditional effect. Moreover, if there's need to hardcode polar direction, the default should be 0x4000 (north). For one axis affects, a direction of 0 means complete lack of force, if a FFB-enabled device takes direction into force calculation. A sine function graph can be used to represent the resulting forces where X is the input direction and Y is the force multiplier (360 degrees equals to 1). This fixes conditional effect playback on Moza Racing devices, which do not ignore direction field. --- include/SDL3/SDL_haptic.h | 2 +- src/haptic/linux/SDL_syshaptic.c | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/include/SDL3/SDL_haptic.h b/include/SDL3/SDL_haptic.h index bb6d606551670..84f8c0c4f7695 100644 --- a/include/SDL3/SDL_haptic.h +++ b/include/SDL3/SDL_haptic.h @@ -710,7 +710,7 @@ typedef struct SDL_HapticCondition /* Header */ Uint16 type; /**< SDL_HAPTIC_SPRING, SDL_HAPTIC_DAMPER, SDL_HAPTIC_INERTIA or SDL_HAPTIC_FRICTION */ - SDL_HapticDirection direction; /**< Direction of the effect - Not used ATM. */ + SDL_HapticDirection direction; /**< Direction of the effect. */ /* Replay */ Uint32 length; /**< Duration of the effect. */ diff --git a/src/haptic/linux/SDL_syshaptic.c b/src/haptic/linux/SDL_syshaptic.c index 1e38b9aabf4b9..c9775d2eba0a6 100644 --- a/src/haptic/linux/SDL_syshaptic.c +++ b/src/haptic/linux/SDL_syshaptic.c @@ -824,7 +824,9 @@ static bool SDL_SYS_ToFFEffect(struct ff_effect *dest, const SDL_HapticEffect *s dest->type = FF_FRICTION; } - dest->direction = 0; // Handled by the condition-specifics. + if (!SDL_SYS_ToDirection(&dest->direction, &condition->direction)) { + return false; + } // Replay dest->replay.length = (condition->length == SDL_HAPTIC_INFINITY) ? 0 : CLAMP(condition->length); From 10c9fbf4114eacc2c863efeeb98b5eed28982a0d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tomasz=20Paku=C5=82a?= Date: Tue, 21 Jan 2025 01:43:53 +0100 Subject: [PATCH 193/340] Use proper polar direction when creating FF_RUMBLE effect Uses proper polar direction of 90 degrees. Previous value probably came from mistakenly using spherical system default. --- src/haptic/linux/SDL_syshaptic.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/haptic/linux/SDL_syshaptic.c b/src/haptic/linux/SDL_syshaptic.c index c9775d2eba0a6..842f577cfa82f 100644 --- a/src/haptic/linux/SDL_syshaptic.c +++ b/src/haptic/linux/SDL_syshaptic.c @@ -892,7 +892,7 @@ static bool SDL_SYS_ToFFEffect(struct ff_effect *dest, const SDL_HapticEffect *s // Header dest->type = FF_RUMBLE; - dest->direction = 0; + dest->direction = 0x4000; // Replay dest->replay.length = (leftright->length == SDL_HAPTIC_INFINITY) ? 0 : CLAMP(leftright->length); From abe6d9db97e17d734b66dc3b1a1599022f5ee4a3 Mon Sep 17 00:00:00 2001 From: Caleb Cornett Date: Mon, 20 Jan 2025 18:18:53 -0500 Subject: [PATCH 194/340] Automatically detect SDL_main_private.h --- include/SDL3/SDL_main.h | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/include/SDL3/SDL_main.h b/include/SDL3/SDL_main.h index 88813b6e8bd71..66ed481e8c9b1 100644 --- a/include/SDL3/SDL_main.h +++ b/include/SDL3/SDL_main.h @@ -133,6 +133,12 @@ #endif +#if defined(__has_include) + #if __has_include("SDL_main_private.h") && __has_include("SDL_main_impl_private.h") + #define SDL_PLATFORM_PRIVATE_MAIN + #endif +#endif + #ifndef SDL_MAIN_HANDLED #if defined(SDL_PLATFORM_PRIVATE_MAIN) /* Private platforms may have their own ideas about entry points. */ From 37140aa9f724f2c5a7350f39108f0566cfd89d2b Mon Sep 17 00:00:00 2001 From: Anonymous Maarten Date: Tue, 21 Jan 2025 01:29:52 +0100 Subject: [PATCH 195/340] cmake: expand libunwind --- cmake/sdlchecks.cmake | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/cmake/sdlchecks.cmake b/cmake/sdlchecks.cmake index 890e9186b751b..d95cbfa3a1a8a 100644 --- a/cmake/sdlchecks.cmake +++ b/cmake/sdlchecks.cmake @@ -1245,7 +1245,21 @@ endmacro() macro(CheckLibUnwind) if(TARGET SDL3_test) set(found_libunwind FALSE) - set(_libunwind_src "#include \nint main() {unw_context_t context; unw_getcontext(&context); return 0;}") + set(_libunwind_src [==[ + #include + int main(int argc, char *argv[]) { + (void)argc; (void)argv; + unw_context_t context; + unw_cursor_t cursor; + unw_word_t pc; + char sym[256]; + unw_word_t offset; + unw_getcontext(&context); + unw_step(&cursor); + unw_get_reg(&cursor, UNW_REG_IP, &pc); + unw_get_proc_name(&cursor, sym, sizeof(sym), &offset); + return 0; + }]==]) if(NOT found_libunwind) cmake_push_check_state() From 7bff36e4b25e5794b5a4e6e4630f11fe6f41a59c Mon Sep 17 00:00:00 2001 From: Anonymous Maarten Date: Tue, 21 Jan 2025 01:12:57 +0100 Subject: [PATCH 196/340] ci: add ubuntu arm job f --- .github/workflows/create-test-plan.py | 83 ++++++++++++++------------- 1 file changed, 43 insertions(+), 40 deletions(-) diff --git a/.github/workflows/create-test-plan.py b/.github/workflows/create-test-plan.py index 860355dbc4882..2ac30fbabaee9 100755 --- a/.github/workflows/create-test-plan.py +++ b/.github/workflows/create-test-plan.py @@ -31,6 +31,7 @@ class JobOs(Enum): Ubuntu20_04 = "ubuntu-20.04" Ubuntu22_04 = "ubuntu-22.04" Ubuntu24_04 = "ubuntu-24.04" + Ubuntu24_04_arm = "ubuntu-24.04-arm" Macos13 = "macos-13" @@ -101,45 +102,46 @@ class JobSpec: JOB_SPECS = { - "msys2-mingw32": JobSpec(name="Windows (msys2, mingw32)", os=JobOs.WindowsLatest, platform=SdlPlatform.Msys2, artifact="SDL-mingw32", msys2_platform=Msys2Platform.Mingw32, ), - "msys2-mingw64": JobSpec(name="Windows (msys2, mingw64)", os=JobOs.WindowsLatest, platform=SdlPlatform.Msys2, artifact="SDL-mingw64", msys2_platform=Msys2Platform.Mingw64, ), - "msys2-clang32": JobSpec(name="Windows (msys2, clang32)", os=JobOs.WindowsLatest, platform=SdlPlatform.Msys2, artifact="SDL-mingw32-clang", msys2_platform=Msys2Platform.Clang32, ), - "msys2-clang64": JobSpec(name="Windows (msys2, clang64)", os=JobOs.WindowsLatest, platform=SdlPlatform.Msys2, artifact="SDL-mingw64-clang", msys2_platform=Msys2Platform.Clang64, ), - "msys2-ucrt64": JobSpec(name="Windows (msys2, ucrt64)", os=JobOs.WindowsLatest, platform=SdlPlatform.Msys2, artifact="SDL-mingw64-ucrt", msys2_platform=Msys2Platform.Ucrt64, ), - "msvc-x64": JobSpec(name="Windows (MSVC, x64)", os=JobOs.WindowsLatest, platform=SdlPlatform.Msvc, artifact="SDL-VC-x64", msvc_arch=MsvcArch.X64, msvc_project="VisualC/SDL.sln", ), - "msvc-x86": JobSpec(name="Windows (MSVC, x86)", os=JobOs.WindowsLatest, platform=SdlPlatform.Msvc, artifact="SDL-VC-x86", msvc_arch=MsvcArch.X86, msvc_project="VisualC/SDL.sln", ), - "msvc-clang-x64": JobSpec(name="Windows (MSVC, clang-cl x64)", os=JobOs.WindowsLatest, platform=SdlPlatform.Msvc, artifact="SDL-clang-cl-x64", msvc_arch=MsvcArch.X64, clang_cl=True, ), - "msvc-clang-x86": JobSpec(name="Windows (MSVC, clang-cl x86)", os=JobOs.WindowsLatest, platform=SdlPlatform.Msvc, artifact="SDL-clang-cl-x86", msvc_arch=MsvcArch.X86, clang_cl=True, ), - "msvc-arm32": JobSpec(name="Windows (MSVC, ARM)", os=JobOs.WindowsLatest, platform=SdlPlatform.Msvc, artifact="SDL-VC-arm32", msvc_arch=MsvcArch.Arm32, ), - "msvc-arm64": JobSpec(name="Windows (MSVC, ARM64)", os=JobOs.WindowsLatest, platform=SdlPlatform.Msvc, artifact="SDL-VC-arm64", msvc_arch=MsvcArch.Arm64, ), - "msvc-gdk-x64": JobSpec(name="GDK (MSVC, x64)", os=JobOs.WindowsLatest, platform=SdlPlatform.Msvc, artifact="SDL-VC-GDK", msvc_arch=MsvcArch.X64, msvc_project="VisualC-GDK/SDL.sln", gdk=True, no_cmake=True, ), - "ubuntu-20.04": JobSpec(name="Ubuntu 20.04", os=JobOs.Ubuntu20_04, platform=SdlPlatform.Linux, artifact="SDL-ubuntu20.04", ), - "ubuntu-22.04": JobSpec(name="Ubuntu 22.04", os=JobOs.Ubuntu22_04, platform=SdlPlatform.Linux, artifact="SDL-ubuntu22.04", ), - "steamrt-sniper": JobSpec(name="Steam Linux Runtime (Sniper)", os=JobOs.UbuntuLatest, platform=SdlPlatform.Linux, artifact="SDL-slrsniper", container="registry.gitlab.steamos.cloud/steamrt/sniper/sdk:beta", ), - "ubuntu-intel-icx": JobSpec(name="Ubuntu 20.04 (Intel oneAPI)", os=JobOs.Ubuntu20_04, platform=SdlPlatform.Linux, artifact="SDL-ubuntu20.04-oneapi", intel=IntelCompiler.Icx, ), - "ubuntu-intel-icc": JobSpec(name="Ubuntu 20.04 (Intel Compiler)", os=JobOs.Ubuntu20_04, platform=SdlPlatform.Linux, artifact="SDL-ubuntu20.04-icc", intel=IntelCompiler.Icc, ), - "macos-framework-x64": JobSpec(name="MacOS (Framework) (x64)", os=JobOs.Macos13, platform=SdlPlatform.MacOS, artifact="SDL-macos-framework", apple_framework=True, apple_archs={AppleArch.Aarch64, AppleArch.X86_64, }, xcode=True, ), - "macos-framework-arm64": JobSpec(name="MacOS (Framework) (arm64)", os=JobOs.MacosLatest, platform=SdlPlatform.MacOS, artifact=None, apple_framework=True, apple_archs={AppleArch.Aarch64, AppleArch.X86_64, }, ), - "macos-gnu-arm64": JobSpec(name="MacOS (GNU prefix)", os=JobOs.MacosLatest, platform=SdlPlatform.MacOS, artifact="SDL-macos-arm64-gnu", apple_framework=False, apple_archs={AppleArch.Aarch64, }, ), - "ios": JobSpec(name="iOS (CMake & xcode)", os=JobOs.MacosLatest, platform=SdlPlatform.Ios, artifact="SDL-ios-arm64", xcode=True, ), - "tvos": JobSpec(name="tvOS (CMake & xcode)", os=JobOs.MacosLatest, platform=SdlPlatform.Tvos, artifact="SDL-tvos-arm64", xcode=True, ), - "android-cmake": JobSpec(name="Android (CMake)", os=JobOs.UbuntuLatest, platform=SdlPlatform.Android, artifact="SDL-android-arm64", android_abi="arm64-v8a", android_arch="aarch64", android_platform=23, ), - "android-cmake-lean": JobSpec(name="Android (CMake, lean)", os=JobOs.UbuntuLatest, platform=SdlPlatform.Android, artifact="SDL-lean-android-arm64", android_abi="arm64-v8a", android_arch="aarch64", android_platform=23, lean=True, ), - "android-mk": JobSpec(name="Android (Android.mk)", os=JobOs.UbuntuLatest, platform=SdlPlatform.Android, artifact=None, no_cmake=True, android_mk=True, ), - "android-gradle": JobSpec(name="Android (Gradle)", os=JobOs.UbuntuLatest, platform=SdlPlatform.Android, artifact=None, no_cmake=True, android_gradle=True, ), - "emscripten": JobSpec(name="Emscripten", os=JobOs.Ubuntu22_04, platform=SdlPlatform.Emscripten, artifact="SDL-emscripten", ), - "haiku": JobSpec(name="Haiku", os=JobOs.UbuntuLatest, platform=SdlPlatform.Haiku, artifact="SDL-haiku-x64", container="ghcr.io/haiku/cross-compiler:x86_64-r1beta5", ), - "loongarch64": JobSpec(name="LoongArch64", os=JobOs.UbuntuLatest, platform=SdlPlatform.LoongArch64, artifact="SDL-loongarch64", ), - "n3ds": JobSpec(name="Nintendo 3DS", os=JobOs.UbuntuLatest, platform=SdlPlatform.N3ds, artifact="SDL-n3ds", container="devkitpro/devkitarm:latest", ), - "ppc": JobSpec(name="PowerPC", os=JobOs.UbuntuLatest, platform=SdlPlatform.PowerPC, artifact="SDL-ppc", container="dockcross/linux-ppc:latest", ), - "ppc64": JobSpec(name="PowerPC64", os=JobOs.UbuntuLatest, platform=SdlPlatform.PowerPC64, artifact="SDL-ppc64le", container="dockcross/linux-ppc64le:latest", ), - "ps2": JobSpec(name="Sony PlayStation 2", os=JobOs.UbuntuLatest, platform=SdlPlatform.Ps2, artifact="SDL-ps2", container="ps2dev/ps2dev:latest", ), - "psp": JobSpec(name="Sony PlayStation Portable", os=JobOs.UbuntuLatest, platform=SdlPlatform.Psp, artifact="SDL-psp", container="pspdev/pspdev:latest", ), - "vita-pib": JobSpec(name="Sony PlayStation Vita (GLES w/ pib)", os=JobOs.UbuntuLatest, platform=SdlPlatform.Vita, artifact="SDL-vita-pib", container="vitasdk/vitasdk:latest", vita_gles=VitaGLES.Pib, ), - "vita-pvr": JobSpec(name="Sony PlayStation Vita (GLES w/ PVR_PSP2)", os=JobOs.UbuntuLatest, platform=SdlPlatform.Vita, artifact="SDL-vita-pvr", container="vitasdk/vitasdk:latest", vita_gles=VitaGLES.Pvr, ), - "riscos": JobSpec(name="RISC OS", os=JobOs.UbuntuLatest, platform=SdlPlatform.Riscos, artifact="SDL-riscos", container="riscosdotinfo/riscos-gccsdk-4.7:latest", ), - "netbsd": JobSpec(name="NetBSD", os=JobOs.UbuntuLatest, platform=SdlPlatform.NetBSD, artifact="SDL-netbsd-x64", ), - "freebsd": JobSpec(name="FreeBSD", os=JobOs.UbuntuLatest, platform=SdlPlatform.FreeBSD, artifact="SDL-freebsd-x64", ), + "msys2-mingw32": JobSpec(name="Windows (msys2, mingw32)", os=JobOs.WindowsLatest, platform=SdlPlatform.Msys2, artifact="SDL-mingw32", msys2_platform=Msys2Platform.Mingw32, ), + "msys2-mingw64": JobSpec(name="Windows (msys2, mingw64)", os=JobOs.WindowsLatest, platform=SdlPlatform.Msys2, artifact="SDL-mingw64", msys2_platform=Msys2Platform.Mingw64, ), + "msys2-clang32": JobSpec(name="Windows (msys2, clang32)", os=JobOs.WindowsLatest, platform=SdlPlatform.Msys2, artifact="SDL-mingw32-clang", msys2_platform=Msys2Platform.Clang32, ), + "msys2-clang64": JobSpec(name="Windows (msys2, clang64)", os=JobOs.WindowsLatest, platform=SdlPlatform.Msys2, artifact="SDL-mingw64-clang", msys2_platform=Msys2Platform.Clang64, ), + "msys2-ucrt64": JobSpec(name="Windows (msys2, ucrt64)", os=JobOs.WindowsLatest, platform=SdlPlatform.Msys2, artifact="SDL-mingw64-ucrt", msys2_platform=Msys2Platform.Ucrt64, ), + "msvc-x64": JobSpec(name="Windows (MSVC, x64)", os=JobOs.WindowsLatest, platform=SdlPlatform.Msvc, artifact="SDL-VC-x64", msvc_arch=MsvcArch.X64, msvc_project="VisualC/SDL.sln", ), + "msvc-x86": JobSpec(name="Windows (MSVC, x86)", os=JobOs.WindowsLatest, platform=SdlPlatform.Msvc, artifact="SDL-VC-x86", msvc_arch=MsvcArch.X86, msvc_project="VisualC/SDL.sln", ), + "msvc-clang-x64": JobSpec(name="Windows (MSVC, clang-cl x64)", os=JobOs.WindowsLatest, platform=SdlPlatform.Msvc, artifact="SDL-clang-cl-x64", msvc_arch=MsvcArch.X64, clang_cl=True, ), + "msvc-clang-x86": JobSpec(name="Windows (MSVC, clang-cl x86)", os=JobOs.WindowsLatest, platform=SdlPlatform.Msvc, artifact="SDL-clang-cl-x86", msvc_arch=MsvcArch.X86, clang_cl=True, ), + "msvc-arm32": JobSpec(name="Windows (MSVC, ARM)", os=JobOs.WindowsLatest, platform=SdlPlatform.Msvc, artifact="SDL-VC-arm32", msvc_arch=MsvcArch.Arm32, ), + "msvc-arm64": JobSpec(name="Windows (MSVC, ARM64)", os=JobOs.WindowsLatest, platform=SdlPlatform.Msvc, artifact="SDL-VC-arm64", msvc_arch=MsvcArch.Arm64, ), + "msvc-gdk-x64": JobSpec(name="GDK (MSVC, x64)", os=JobOs.WindowsLatest, platform=SdlPlatform.Msvc, artifact="SDL-VC-GDK", msvc_arch=MsvcArch.X64, msvc_project="VisualC-GDK/SDL.sln", gdk=True, no_cmake=True, ), + "ubuntu-20.04": JobSpec(name="Ubuntu 20.04", os=JobOs.Ubuntu20_04, platform=SdlPlatform.Linux, artifact="SDL-ubuntu20.04", ), + "ubuntu-22.04": JobSpec(name="Ubuntu 22.04", os=JobOs.Ubuntu22_04, platform=SdlPlatform.Linux, artifact="SDL-ubuntu22.04", ), + "ubuntu-24.04-arm64": JobSpec(name="Ubuntu 24.04 (ARM64)", os=JobOs.Ubuntu24_04_arm, platform=SdlPlatform.Linux, artifact="SDL-ubuntu24.04-arm64", ), + "steamrt-sniper": JobSpec(name="Steam Linux Runtime (Sniper)", os=JobOs.UbuntuLatest, platform=SdlPlatform.Linux, artifact="SDL-slrsniper", container="registry.gitlab.steamos.cloud/steamrt/sniper/sdk:beta", ), + "ubuntu-intel-icx": JobSpec(name="Ubuntu 20.04 (Intel oneAPI)", os=JobOs.Ubuntu20_04, platform=SdlPlatform.Linux, artifact="SDL-ubuntu20.04-oneapi", intel=IntelCompiler.Icx, ), + "ubuntu-intel-icc": JobSpec(name="Ubuntu 20.04 (Intel Compiler)", os=JobOs.Ubuntu20_04, platform=SdlPlatform.Linux, artifact="SDL-ubuntu20.04-icc", intel=IntelCompiler.Icc, ), + "macos-framework-x64": JobSpec(name="MacOS (Framework) (x64)", os=JobOs.Macos13, platform=SdlPlatform.MacOS, artifact="SDL-macos-framework", apple_framework=True, apple_archs={AppleArch.Aarch64, AppleArch.X86_64, }, xcode=True, ), + "macos-framework-arm64": JobSpec(name="MacOS (Framework) (arm64)", os=JobOs.MacosLatest, platform=SdlPlatform.MacOS, artifact=None, apple_framework=True, apple_archs={AppleArch.Aarch64, AppleArch.X86_64, }, ), + "macos-gnu-arm64": JobSpec(name="MacOS (GNU prefix)", os=JobOs.MacosLatest, platform=SdlPlatform.MacOS, artifact="SDL-macos-arm64-gnu", apple_framework=False, apple_archs={AppleArch.Aarch64, }, ), + "ios": JobSpec(name="iOS (CMake & xcode)", os=JobOs.MacosLatest, platform=SdlPlatform.Ios, artifact="SDL-ios-arm64", xcode=True, ), + "tvos": JobSpec(name="tvOS (CMake & xcode)", os=JobOs.MacosLatest, platform=SdlPlatform.Tvos, artifact="SDL-tvos-arm64", xcode=True, ), + "android-cmake": JobSpec(name="Android (CMake)", os=JobOs.UbuntuLatest, platform=SdlPlatform.Android, artifact="SDL-android-arm64", android_abi="arm64-v8a", android_arch="aarch64", android_platform=23, ), + "android-cmake-lean": JobSpec(name="Android (CMake, lean)", os=JobOs.UbuntuLatest, platform=SdlPlatform.Android, artifact="SDL-lean-android-arm64", android_abi="arm64-v8a", android_arch="aarch64", android_platform=23, lean=True, ), + "android-mk": JobSpec(name="Android (Android.mk)", os=JobOs.UbuntuLatest, platform=SdlPlatform.Android, artifact=None, no_cmake=True, android_mk=True, ), + "android-gradle": JobSpec(name="Android (Gradle)", os=JobOs.UbuntuLatest, platform=SdlPlatform.Android, artifact=None, no_cmake=True, android_gradle=True, ), + "emscripten": JobSpec(name="Emscripten", os=JobOs.Ubuntu22_04, platform=SdlPlatform.Emscripten, artifact="SDL-emscripten", ), + "haiku": JobSpec(name="Haiku", os=JobOs.UbuntuLatest, platform=SdlPlatform.Haiku, artifact="SDL-haiku-x64", container="ghcr.io/haiku/cross-compiler:x86_64-r1beta5", ), + "loongarch64": JobSpec(name="LoongArch64", os=JobOs.UbuntuLatest, platform=SdlPlatform.LoongArch64, artifact="SDL-loongarch64", ), + "n3ds": JobSpec(name="Nintendo 3DS", os=JobOs.UbuntuLatest, platform=SdlPlatform.N3ds, artifact="SDL-n3ds", container="devkitpro/devkitarm:latest", ), + "ppc": JobSpec(name="PowerPC", os=JobOs.UbuntuLatest, platform=SdlPlatform.PowerPC, artifact="SDL-ppc", container="dockcross/linux-ppc:latest", ), + "ppc64": JobSpec(name="PowerPC64", os=JobOs.UbuntuLatest, platform=SdlPlatform.PowerPC64, artifact="SDL-ppc64le", container="dockcross/linux-ppc64le:latest", ), + "ps2": JobSpec(name="Sony PlayStation 2", os=JobOs.UbuntuLatest, platform=SdlPlatform.Ps2, artifact="SDL-ps2", container="ps2dev/ps2dev:latest", ), + "psp": JobSpec(name="Sony PlayStation Portable", os=JobOs.UbuntuLatest, platform=SdlPlatform.Psp, artifact="SDL-psp", container="pspdev/pspdev:latest", ), + "vita-pib": JobSpec(name="Sony PlayStation Vita (GLES w/ pib)", os=JobOs.UbuntuLatest, platform=SdlPlatform.Vita, artifact="SDL-vita-pib", container="vitasdk/vitasdk:latest", vita_gles=VitaGLES.Pib, ), + "vita-pvr": JobSpec(name="Sony PlayStation Vita (GLES w/ PVR_PSP2)", os=JobOs.UbuntuLatest, platform=SdlPlatform.Vita, artifact="SDL-vita-pvr", container="vitasdk/vitasdk:latest", vita_gles=VitaGLES.Pvr, ), + "riscos": JobSpec(name="RISC OS", os=JobOs.UbuntuLatest, platform=SdlPlatform.Riscos, artifact="SDL-riscos", container="riscosdotinfo/riscos-gccsdk-4.7:latest", ), + "netbsd": JobSpec(name="NetBSD", os=JobOs.UbuntuLatest, platform=SdlPlatform.NetBSD, artifact="SDL-netbsd-x64", ), + "freebsd": JobSpec(name="FreeBSD", os=JobOs.UbuntuLatest, platform=SdlPlatform.FreeBSD, artifact="SDL-freebsd-x64", ), } @@ -441,7 +443,8 @@ def spec_to_job(spec: JobSpec, key: str, trackmem_symbol_names: bool) -> JobDeta "libudev-dev", "fcitx-libs-dev", )) - ubuntu_year, ubuntu_month = [int(v) for v in spec.os.value.removeprefix("ubuntu-").split(".", 1)] + match = re.match(r"ubuntu-(?P[0-9]+)\.(?P[0-9]+).*", spec.os.value) + ubuntu_year, ubuntu_month = [int(match["year"]), int(match["month"])] if ubuntu_year >= 22: job.apt_packages.extend(("libpipewire-0.3-dev", "libdecor-0-dev")) job.apt_packages.extend(( From 3e530c6db19a3b6d334b09248aa9b6e96a54b257 Mon Sep 17 00:00:00 2001 From: Anonymous Maarten Date: Tue, 21 Jan 2025 02:05:49 +0100 Subject: [PATCH 197/340] cmake: remove superfluous cmake_minimum_required --- CMakeLists.txt | 1 - 1 file changed, 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 8eda4c518adb4..da1de314b6324 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -3246,7 +3246,6 @@ else() endif() if(SDL_CLANG_TIDY) - cmake_minimum_required(VERSION 3.6) find_program(CLANG_TIDY_BINARY clang-tidy) if(CLANG_TIDY_BINARY) From 6b7dad7d82801e5aa1ec6c733913c6e3c86971d7 Mon Sep 17 00:00:00 2001 From: Katelyn Gadd Date: Mon, 20 Jan 2025 22:25:16 -0500 Subject: [PATCH 198/340] vulkan: move temporary pointer to its own field to prevent a bad dereference. Reference Issue #11075. --- src/gpu/vulkan/SDL_gpu_vulkan.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/gpu/vulkan/SDL_gpu_vulkan.c b/src/gpu/vulkan/SDL_gpu_vulkan.c index 6bf12b0f23d51..bf300a1a8d3aa 100644 --- a/src/gpu/vulkan/SDL_gpu_vulkan.c +++ b/src/gpu/vulkan/SDL_gpu_vulkan.c @@ -479,6 +479,7 @@ static VkSamplerAddressMode SDLToVK_SamplerAddressMode[] = { typedef struct VulkanMemoryAllocation VulkanMemoryAllocation; typedef struct VulkanBuffer VulkanBuffer; typedef struct VulkanBufferContainer VulkanBufferContainer; +typedef struct VulkanUniformBuffer VulkanUniformBuffer; typedef struct VulkanTexture VulkanTexture; typedef struct VulkanTextureContainer VulkanTextureContainer; @@ -573,6 +574,7 @@ struct VulkanBuffer SDL_AtomicInt referenceCount; bool transitioned; bool markedForDestroy; // so that defrag doesn't double-free + VulkanUniformBuffer *uniformBufferForDefrag; }; struct VulkanBufferContainer @@ -6811,7 +6813,7 @@ static VulkanUniformBuffer *VULKAN_INTERNAL_CreateUniformBuffer( uniformBuffer->drawOffset = 0; uniformBuffer->writeOffset = 0; - uniformBuffer->buffer->container = (VulkanBufferContainer *)uniformBuffer; // little hack for defrag + uniformBuffer->buffer->uniformBufferForDefrag = uniformBuffer; return uniformBuffer; } @@ -10691,7 +10693,7 @@ static bool VULKAN_INTERNAL_DefragmentMemory( newBuffer->container = currentRegion->vulkanBuffer->container; newBuffer->containerIndex = currentRegion->vulkanBuffer->containerIndex; if (newBuffer->type == VULKAN_BUFFER_TYPE_UNIFORM) { - ((VulkanUniformBuffer *)newBuffer->container)->buffer = newBuffer; + currentRegion->vulkanBuffer->uniformBufferForDefrag->buffer = newBuffer; } else { newBuffer->container->buffers[newBuffer->containerIndex] = newBuffer; if (newBuffer->container->activeBuffer == currentRegion->vulkanBuffer) { From 6d5815db526757b8b2008ef2c9a6c1a4fb19ce3d Mon Sep 17 00:00:00 2001 From: "Ryan C. Gordon" Date: Mon, 20 Jan 2025 22:31:09 -0500 Subject: [PATCH 199/340] vulkan: Deal with VK_ERROR_OUT_OF_DATE_KHR returns from vkAcquireNextImageKHR. Fixes #11075. --- src/gpu/vulkan/SDL_gpu_vulkan.c | 32 +++++++++++++------------------- 1 file changed, 13 insertions(+), 19 deletions(-) diff --git a/src/gpu/vulkan/SDL_gpu_vulkan.c b/src/gpu/vulkan/SDL_gpu_vulkan.c index bf300a1a8d3aa..47cc2d69d13c1 100644 --- a/src/gpu/vulkan/SDL_gpu_vulkan.c +++ b/src/gpu/vulkan/SDL_gpu_vulkan.c @@ -9858,24 +9858,7 @@ static bool VULKAN_INTERNAL_AcquireSwapchainTexture( } // Finally, try to acquire! - acquireResult = renderer->vkAcquireNextImageKHR( - renderer->logicalDevice, - windowData->swapchain, - SDL_MAX_UINT64, - windowData->imageAvailableSemaphore[windowData->frameCounter], - VK_NULL_HANDLE, - &swapchainImageIndex); - - // Acquisition is invalid, let's try to recreate - if (acquireResult != VK_SUCCESS && acquireResult != VK_SUBOPTIMAL_KHR) { - Uint32 recreateSwapchainResult = VULKAN_INTERNAL_RecreateSwapchain(renderer, windowData); - if (!recreateSwapchainResult) { - return false; - } else if (recreateSwapchainResult == VULKAN_INTERNAL_TRY_AGAIN) { - // Edge case, texture is filled in with NULL but not an error - return true; - } - + while (true) { acquireResult = renderer->vkAcquireNextImageKHR( renderer->logicalDevice, windowData->swapchain, @@ -9884,8 +9867,19 @@ static bool VULKAN_INTERNAL_AcquireSwapchainTexture( VK_NULL_HANDLE, &swapchainImageIndex); - if (acquireResult != VK_SUCCESS && acquireResult != VK_SUBOPTIMAL_KHR) { + //if (acquireResult == VK_ERROR_OUT_OF_DATE_KHR) { SDL_Log("VULKAN SWAPCHAIN OUT OF DATE"); } + + if (acquireResult == VK_SUCCESS || acquireResult == VK_SUBOPTIMAL_KHR) { + break; // we got the next image! + } + + // If acquisition is invalid, let's try to recreate + Uint32 recreateSwapchainResult = VULKAN_INTERNAL_RecreateSwapchain(renderer, windowData); + if (!recreateSwapchainResult) { return false; + } else if (recreateSwapchainResult == VULKAN_INTERNAL_TRY_AGAIN) { + // Edge case, texture is filled in with NULL but not an error + return true; } } From bcf7ead6e4790be0afd66627431b95570b174e50 Mon Sep 17 00:00:00 2001 From: "Quinn X. J." Date: Tue, 21 Jan 2025 13:13:52 +1000 Subject: [PATCH 200/340] documentation typo: SFLOAT -> FLOAT --- include/SDL3/SDL_gpu.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/include/SDL3/SDL_gpu.h b/include/SDL3/SDL_gpu.h index 59315a1be6ee3..2a2e74f75fd89 100644 --- a/include/SDL3/SDL_gpu.h +++ b/include/SDL3/SDL_gpu.h @@ -660,9 +660,9 @@ typedef enum SDL_GPUIndexElementSize * supported: * * - D16_UNORM - * - Either (but not necessarily both!) D24_UNORM or D32_SFLOAT + * - Either (but not necessarily both!) D24_UNORM or D32_FLOAT * - Either (but not necessarily both!) D24_UNORM_S8_UINT or - * D32_SFLOAT_S8_UINT + * D32_FLOAT_S8_UINT * * Unless D16_UNORM is sufficient for your purposes, always check which of * D24/D32 is supported before creating a depth-stencil texture! @@ -1262,7 +1262,7 @@ typedef enum SDL_GPUPresentMode * - SDR_LINEAR: B8G8R8A8_SRGB or R8G8B8A8_SRGB swapchain. Pixel values are * stored in memory in sRGB encoding but accessed in shaders in "linear * sRGB" encoding which is sRGB but with a linear transfer function. - * - HDR_EXTENDED_LINEAR: R16G16B16A16_SFLOAT swapchain. Pixel values are in + * - HDR_EXTENDED_LINEAR: R16G16B16A16_FLOAT swapchain. Pixel values are in * extended linear sRGB encoding and permits values outside of the [0, 1] * range. * - HDR10_ST2084: A2R10G10B10 or A2B10G10R10 swapchain. Pixel values are in From ea9880b760609eab135ec808c526f7b3b7483106 Mon Sep 17 00:00:00 2001 From: SDL Wiki Bot Date: Tue, 21 Jan 2025 04:01:28 +0000 Subject: [PATCH 201/340] Sync SDL3 wiki -> header [ci skip] --- include/SDL3/SDL_gpu.h | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/include/SDL3/SDL_gpu.h b/include/SDL3/SDL_gpu.h index 2a2e74f75fd89..00e7b9ad8bb5e 100644 --- a/include/SDL3/SDL_gpu.h +++ b/include/SDL3/SDL_gpu.h @@ -661,8 +661,7 @@ typedef enum SDL_GPUIndexElementSize * * - D16_UNORM * - Either (but not necessarily both!) D24_UNORM or D32_FLOAT - * - Either (but not necessarily both!) D24_UNORM_S8_UINT or - * D32_FLOAT_S8_UINT + * - Either (but not necessarily both!) D24_UNORM_S8_UINT or D32_FLOAT_S8_UINT * * Unless D16_UNORM is sufficient for your purposes, always check which of * D24/D32 is supported before creating a depth-stencil texture! From c0a9d220b9ba2b256e5e8d3ad1490f9f13501415 Mon Sep 17 00:00:00 2001 From: Katelyn Gadd Date: Mon, 20 Jan 2025 23:16:38 -0500 Subject: [PATCH 202/340] vulkan: Fixes for swapchain resize crash on X11. Fixes #11075. --- src/gpu/vulkan/SDL_gpu_vulkan.c | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/src/gpu/vulkan/SDL_gpu_vulkan.c b/src/gpu/vulkan/SDL_gpu_vulkan.c index 47cc2d69d13c1..d684ff9d11c3b 100644 --- a/src/gpu/vulkan/SDL_gpu_vulkan.c +++ b/src/gpu/vulkan/SDL_gpu_vulkan.c @@ -4104,7 +4104,7 @@ static VulkanBuffer *VULKAN_INTERNAL_CreateBuffer( vulkanUsageFlags |= VK_BUFFER_USAGE_TRANSFER_SRC_BIT | VK_BUFFER_USAGE_TRANSFER_DST_BIT; } - buffer = SDL_malloc(sizeof(VulkanBuffer)); + buffer = SDL_calloc(1, sizeof(VulkanBuffer)); buffer->size = size; buffer->usage = usageFlags; @@ -4196,7 +4196,7 @@ static VulkanBufferContainer *VULKAN_INTERNAL_CreateBufferContainer( return NULL; } - bufferContainer = SDL_malloc(sizeof(VulkanBufferContainer)); + bufferContainer = SDL_calloc(1, sizeof(VulkanBufferContainer)); bufferContainer->activeBuffer = buffer; buffer->container = bufferContainer; @@ -4204,8 +4204,7 @@ static VulkanBufferContainer *VULKAN_INTERNAL_CreateBufferContainer( bufferContainer->bufferCapacity = 1; bufferContainer->bufferCount = 1; - bufferContainer->buffers = SDL_malloc( - bufferContainer->bufferCapacity * sizeof(VulkanBuffer *)); + bufferContainer->buffers = SDL_calloc(bufferContainer->bufferCapacity, sizeof(VulkanBuffer *)); bufferContainer->buffers[0] = bufferContainer->activeBuffer; bufferContainer->dedicated = dedicated; bufferContainer->debugName = NULL; @@ -6801,7 +6800,7 @@ static VulkanUniformBuffer *VULKAN_INTERNAL_CreateUniformBuffer( VulkanRenderer *renderer, Uint32 size) { - VulkanUniformBuffer *uniformBuffer = SDL_malloc(sizeof(VulkanUniformBuffer)); + VulkanUniformBuffer *uniformBuffer = SDL_calloc(1, sizeof(VulkanUniformBuffer)); uniformBuffer->buffer = VULKAN_INTERNAL_CreateBuffer( renderer, @@ -6928,6 +6927,7 @@ static void VULKAN_INTERNAL_ReleaseBuffer( renderer->buffersToDestroyCount += 1; vulkanBuffer->markedForDestroy = 1; + vulkanBuffer->container = NULL; SDL_UnlockMutex(renderer->disposeLock); } @@ -6947,6 +6947,7 @@ static void VULKAN_INTERNAL_ReleaseBufferContainer( // Containers are just client handles, so we can free immediately if (bufferContainer->debugName != NULL) { SDL_free(bufferContainer->debugName); + bufferContainer->debugName = NULL; } SDL_free(bufferContainer->buffers); SDL_free(bufferContainer); @@ -10695,6 +10696,10 @@ static bool VULKAN_INTERNAL_DefragmentMemory( } } + if (currentRegion->vulkanBuffer->uniformBufferForDefrag) { + newBuffer->uniformBufferForDefrag = currentRegion->vulkanBuffer->uniformBufferForDefrag; + } + VULKAN_INTERNAL_ReleaseBuffer(renderer, currentRegion->vulkanBuffer); } else if (!currentRegion->isBuffer && !currentRegion->vulkanTexture->markedForDestroy) { newTexture = VULKAN_INTERNAL_CreateTexture( From 071bebf235955ae0fdfcce53e0203f34ed83a193 Mon Sep 17 00:00:00 2001 From: "Ryan C. Gordon" Date: Mon, 20 Jan 2025 23:29:53 -0500 Subject: [PATCH 203/340] coreaudio: Add a note about why this uses 3 buffers instead of 2. --- src/audio/coreaudio/SDL_coreaudio.m | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/audio/coreaudio/SDL_coreaudio.m b/src/audio/coreaudio/SDL_coreaudio.m index af54bebcce91d..cfa0616da1800 100644 --- a/src/audio/coreaudio/SDL_coreaudio.m +++ b/src/audio/coreaudio/SDL_coreaudio.m @@ -817,6 +817,10 @@ static bool PrepareAudioQueue(SDL_AudioDevice *device) } #endif + // we use THREE audio buffers by default, unlike most things that would + // choose two alternating buffers, because it helps with issues on + // Bluetooth headsets when recording and playing at the same time. + // See conversation in #8192 for details. int numAudioBuffers = 3; const double msecs = (device->sample_frames / ((double)device->spec.freq)) * 1000.0; if (msecs < MINIMUM_AUDIO_BUFFER_TIME_MS) { // use more buffers if we have a VERY small sample set. From 8526868563eddbd9df99530c4625fe0fb1d6b07c Mon Sep 17 00:00:00 2001 From: Sam Lantinga Date: Mon, 20 Jan 2025 22:34:58 -0800 Subject: [PATCH 204/340] dialog: cleaned up D-Bus portal implementation Fixes https://github.com/libsdl-org/SDL/issues/12036 --- src/dialog/unix/SDL_portaldialog.c | 70 +++++++++++++++++------------- 1 file changed, 39 insertions(+), 31 deletions(-) diff --git a/src/dialog/unix/SDL_portaldialog.c b/src/dialog/unix/SDL_portaldialog.c index f8bdc7d998614..1d068ff20fa76 100644 --- a/src/dialog/unix/SDL_portaldialog.c +++ b/src/dialog/unix/SDL_portaldialog.c @@ -153,49 +153,54 @@ static void DBus_AppendByteArray(SDL_DBusContext *dbus, DBusMessageIter *options dbus->message_iter_close_container(options, &options_pair); } -static DBusHandlerResult DBus_MessageFilter(DBusConnection *conn, DBusMessage *msg, void *data) { +static DBusHandlerResult DBus_MessageFilter(DBusConnection *conn, DBusMessage *msg, void *data) +{ SDL_DBusContext *dbus = SDL_DBus_GetContext(); SignalCallback *signal_data = (SignalCallback *)data; - if (dbus->message_is_signal(msg, SIGNAL_INTERFACE, SIGNAL_NAME) - && dbus->message_has_path(msg, signal_data->path)) { + if (dbus->message_is_signal(msg, SIGNAL_INTERFACE, SIGNAL_NAME) && + dbus->message_has_path(msg, signal_data->path)) { DBusMessageIter signal_iter, result_array, array_entry, value_entry, uri_entry; uint32_t result; size_t length = 2, current = 0; - const char **path; + const char **path = NULL; dbus->message_iter_init(msg, &signal_iter); // Check if the parameters are what we expect - if (dbus->message_iter_get_arg_type(&signal_iter) != DBUS_TYPE_UINT32) + if (dbus->message_iter_get_arg_type(&signal_iter) != DBUS_TYPE_UINT32) { goto not_our_signal; + } dbus->message_iter_get_basic(&signal_iter, &result); if (result == 1 || result == 2) { // cancelled const char *result_data[] = { NULL }; signal_data->callback(signal_data->userdata, result_data, -1); // TODO: Set this to the last selected filter - goto handled; - } - else if (result) { + goto done; + + } else if (result) { // some error occurred signal_data->callback(signal_data->userdata, NULL, -1); - goto handled; + goto done; } - if (!dbus->message_iter_next(&signal_iter)) + if (!dbus->message_iter_next(&signal_iter)) { goto not_our_signal; + } - if (dbus->message_iter_get_arg_type(&signal_iter) != DBUS_TYPE_ARRAY) + if (dbus->message_iter_get_arg_type(&signal_iter) != DBUS_TYPE_ARRAY) { goto not_our_signal; + } + dbus->message_iter_recurse(&signal_iter, &result_array); - while (dbus->message_iter_get_arg_type(&result_array) == DBUS_TYPE_DICT_ENTRY) - { + while (dbus->message_iter_get_arg_type(&result_array) == DBUS_TYPE_DICT_ENTRY) { const char *method; dbus->message_iter_recurse(&result_array, &array_entry); - if (dbus->message_iter_get_arg_type(&array_entry) != DBUS_TYPE_STRING) + if (dbus->message_iter_get_arg_type(&array_entry) != DBUS_TYPE_STRING) { goto not_our_signal; + } dbus->message_iter_get_basic(&array_entry, &method); if (!SDL_strcmp(method, "uris")) { @@ -203,38 +208,42 @@ static DBusHandlerResult DBus_MessageFilter(DBusConnection *conn, DBusMessage *m break; } - if (!dbus->message_iter_next(&result_array)) + if (!dbus->message_iter_next(&result_array)) { goto not_our_signal; + } } - if (!dbus->message_iter_next(&array_entry)) + if (!dbus->message_iter_next(&array_entry)) { goto not_our_signal; + } - if (dbus->message_iter_get_arg_type(&array_entry) != DBUS_TYPE_VARIANT) + if (dbus->message_iter_get_arg_type(&array_entry) != DBUS_TYPE_VARIANT) { goto not_our_signal; + } dbus->message_iter_recurse(&array_entry, &value_entry); - if (dbus->message_iter_get_arg_type(&value_entry) != DBUS_TYPE_ARRAY) + if (dbus->message_iter_get_arg_type(&value_entry) != DBUS_TYPE_ARRAY) { goto not_our_signal; + } dbus->message_iter_recurse(&value_entry, &uri_entry); - path = SDL_malloc(sizeof(const char *) * length); + path = SDL_malloc(length * sizeof(const char *)); if (!path) { signal_data->callback(signal_data->userdata, NULL, -1); - goto cleanup; + goto done; } - while (dbus->message_iter_get_arg_type(&uri_entry) == DBUS_TYPE_STRING) - { + while (dbus->message_iter_get_arg_type(&uri_entry) == DBUS_TYPE_STRING) { const char *uri = NULL; if (current >= length - 1) { ++length; - path = SDL_realloc(path, sizeof(const char *) * length); - if (!path) { + const char **newpath = SDL_realloc(path, length * sizeof(const char *)); + if (!newpath) { signal_data->callback(signal_data->userdata, NULL, -1); - goto cleanup; + goto done; } + path = newpath; } dbus->message_iter_get_basic(&uri_entry, &uri); @@ -248,29 +257,28 @@ static DBusHandlerResult DBus_MessageFilter(DBusConnection *conn, DBusMessage *m SDL_free(decoded_uri); SDL_SetError("Portal dialogs: Unsupported protocol: %s", uri); signal_data->callback(signal_data->userdata, NULL, -1); - goto cleanup; + goto done; } dbus->message_iter_next(&uri_entry); ++current; } - path[length - 1] = NULL; + path[current] = NULL; signal_data->callback(signal_data->userdata, path, -1); // TODO: Fetch the index of the filter that was used -cleanup: +done: dbus->connection_remove_filter(conn, &DBus_MessageFilter, signal_data); if (path) { for (size_t i = 0; i < current; ++i) { SDL_free((char *)path[i]); } + SDL_free(path); } - - SDL_free(path); SDL_free((void *)signal_data->path); SDL_free(signal_data); -handled: return DBUS_HANDLER_RESULT_HANDLED; } + not_our_signal: return DBUS_HANDLER_RESULT_NOT_YET_HANDLED; } From 8a67896d9af57086523198b7a7ee8f7ac6954b9a Mon Sep 17 00:00:00 2001 From: Frank Praznik Date: Tue, 21 Jan 2025 11:05:05 -0500 Subject: [PATCH 205/340] docs: Note the preferred function for getting the content scale of a window SDL_GetWindowDisplayScale() should be preferred over SDL_GetDisplayForWindow() + SDL_GetDisplayContentScale() for querying the per-window content scale, as the former provides a more accurate and current value for individual windows, as the per-window value can differ from the base display scale value, particularly on high-DPI and multi-monitor desktops. --- include/SDL3/SDL_video.h | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/include/SDL3/SDL_video.h b/include/SDL3/SDL_video.h index 43e471799ef03..bcf6f4d16efad 100644 --- a/include/SDL3/SDL_video.h +++ b/include/SDL3/SDL_video.h @@ -729,6 +729,12 @@ extern SDL_DECLSPEC SDL_DisplayOrientation SDLCALL SDL_GetCurrentDisplayOrientat * display scale, which means that the user expects UI elements to be twice as * big on this display, to aid in readability. * + * After window creation, SDL_GetWindowDisplayScale() should be used to query + * the content scale factor for individual windows instead of querying the display + * for a window and calling this function, as the per-window content scale factor + * may differ from the base value of the display it is on, particularly on + * high-DPI and/or multi-monitor desktop configurations. + * * \param displayID the instance ID of the display to query. * \returns the content scale of the display, or 0.0f on failure; call * SDL_GetError() for more information. @@ -737,6 +743,7 @@ extern SDL_DECLSPEC SDL_DisplayOrientation SDLCALL SDL_GetCurrentDisplayOrientat * * \since This function is available since SDL 3.1.3. * + * \sa SDL_GetWindowDisplayScale * \sa SDL_GetDisplays */ extern SDL_DECLSPEC float SDLCALL SDL_GetDisplayContentScale(SDL_DisplayID displayID); From 670a7d8126ce181973b78e488fe9e45152eaf516 Mon Sep 17 00:00:00 2001 From: SDL Wiki Bot Date: Tue, 21 Jan 2025 16:11:20 +0000 Subject: [PATCH 206/340] Sync SDL3 wiki -> header [ci skip] --- include/SDL3/SDL_video.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/include/SDL3/SDL_video.h b/include/SDL3/SDL_video.h index bcf6f4d16efad..180526f708957 100644 --- a/include/SDL3/SDL_video.h +++ b/include/SDL3/SDL_video.h @@ -730,10 +730,10 @@ extern SDL_DECLSPEC SDL_DisplayOrientation SDLCALL SDL_GetCurrentDisplayOrientat * big on this display, to aid in readability. * * After window creation, SDL_GetWindowDisplayScale() should be used to query - * the content scale factor for individual windows instead of querying the display - * for a window and calling this function, as the per-window content scale factor - * may differ from the base value of the display it is on, particularly on - * high-DPI and/or multi-monitor desktop configurations. + * the content scale factor for individual windows instead of querying the + * display for a window and calling this function, as the per-window content + * scale factor may differ from the base value of the display it is on, + * particularly on high-DPI and/or multi-monitor desktop configurations. * * \param displayID the instance ID of the display to query. * \returns the content scale of the display, or 0.0f on failure; call From c45c4a5e5167bf0d0f2df8a4076d80b6e8a044da Mon Sep 17 00:00:00 2001 From: "Ryan C. Gordon" Date: Tue, 21 Jan 2025 11:23:04 -0500 Subject: [PATCH 207/340] render: SDL_HINT_RENDER_DRIVER now accepts a comma-separated list. Fixes #11077. --- include/SDL3/SDL_hints.h | 8 +++++++ include/SDL3/SDL_render.h | 3 +++ src/render/SDL_render.c | 46 ++++++++++++++++++++++----------------- 3 files changed, 37 insertions(+), 20 deletions(-) diff --git a/include/SDL3/SDL_hints.h b/include/SDL3/SDL_hints.h index 9f6b58ba4bdef..58a2fc5dffdf7 100644 --- a/include/SDL3/SDL_hints.h +++ b/include/SDL3/SDL_hints.h @@ -2900,6 +2900,10 @@ extern "C" { * - "gpu" * - "software" * + * This hint accepts a comma-separated list of driver names, and each will + * be tried in the order listed when creating a renderer until one succeeds + * or all of them fail. + * * The default varies by platform, but it's the first one in the list that is * available on the current platform. * @@ -3289,6 +3293,10 @@ extern "C" { * force a specific target, such as "x11" if, say, you are on Wayland but want * to try talking to the X server instead. * + * This hint accepts a comma-separated list of driver names, and each will + * be tried in the order listed during init, until one succeeds or all of them + * fail. + * * This hint should be set before SDL is initialized. * * \since This hint is available since SDL 3.1.3. diff --git a/include/SDL3/SDL_render.h b/include/SDL3/SDL_render.h index 56a6770f97a05..5cd37654ed759 100644 --- a/include/SDL3/SDL_render.h +++ b/include/SDL3/SDL_render.h @@ -219,6 +219,9 @@ extern SDL_DECLSPEC bool SDLCALL SDL_CreateWindowAndRenderer(const char *title, * don't need a specific renderer, specify NULL and SDL will attempt to choose * the best option for you, based on what is available on the user's system. * + * If `name` is a comma-separated list, SDL will try each name, in the order + * listed, until one succeeds or all of them fail. + * * By default the rendering size matches the window size in pixels, but you * can call SDL_SetRenderLogicalPresentation() to change the content size and * scaling options. diff --git a/src/render/SDL_render.c b/src/render/SDL_render.c index 9774abe169751..45f3686a31380 100644 --- a/src/render/SDL_render.c +++ b/src/render/SDL_render.c @@ -958,10 +958,8 @@ SDL_Renderer *SDL_CreateRendererWithProperties(SDL_PropertiesID props) #ifndef SDL_RENDER_DISABLED SDL_Window *window = (SDL_Window *)SDL_GetPointerProperty(props, SDL_PROP_RENDERER_CREATE_WINDOW_POINTER, NULL); SDL_Surface *surface = (SDL_Surface *)SDL_GetPointerProperty(props, SDL_PROP_RENDERER_CREATE_SURFACE_POINTER, NULL); - const char *name = SDL_GetStringProperty(props, SDL_PROP_RENDERER_CREATE_NAME_STRING, NULL); - const int n = SDL_GetNumRenderDrivers(); + const char *driver_name = SDL_GetStringProperty(props, SDL_PROP_RENDERER_CREATE_NAME_STRING, NULL); const char *hint; - int i, attempted = 0; SDL_PropertiesID new_props; #ifdef SDL_PLATFORM_ANDROID @@ -1008,28 +1006,34 @@ SDL_Renderer *SDL_CreateRendererWithProperties(SDL_PropertiesID props) } } else { bool rc = false; - if (!name) { - name = SDL_GetHint(SDL_HINT_RENDER_DRIVER); - } - - if (name) { - for (i = 0; i < n; i++) { - const SDL_RenderDriver *driver = render_drivers[i]; - if (SDL_strcasecmp(name, driver->name) == 0) { - // Create a new renderer instance - ++attempted; - rc = driver->CreateRenderer(renderer, window, props); - break; + if (!driver_name) { + driver_name = SDL_GetHint(SDL_HINT_RENDER_DRIVER); + } + + if (driver_name && *driver_name != 0) { + const char *driver_attempt = driver_name; + while (driver_attempt && *driver_attempt != 0 && !rc) { + const char *driver_attempt_end = SDL_strchr(driver_attempt, ','); + const size_t driver_attempt_len = (driver_attempt_end) ? (driver_attempt_end - driver_attempt) : SDL_strlen(driver_attempt); + + for (int i = 0; render_drivers[i]; i++) { + const SDL_RenderDriver *driver = render_drivers[i]; + if ((driver_attempt_len == SDL_strlen(driver->name)) && (SDL_strncasecmp(driver->name, driver_attempt, driver_attempt_len) == 0)) { + rc = driver->CreateRenderer(renderer, window, props); + if (rc) { + break; + } + } } + + driver_attempt = (driver_attempt_end) ? (driver_attempt_end + 1) : NULL; } } else { - for (i = 0; i < n; i++) { + for (int i = 0; render_drivers[i]; i++) { const SDL_RenderDriver *driver = render_drivers[i]; - // Create a new renderer instance - ++attempted; rc = driver->CreateRenderer(renderer, window, props); if (rc) { - break; // Yay, we got one! + break; } SDL_DestroyRendererWithoutFreeing(renderer); SDL_zerop(renderer); // make sure we don't leave function pointers from a previous CreateRenderer() in this struct. @@ -1037,7 +1041,9 @@ SDL_Renderer *SDL_CreateRendererWithProperties(SDL_PropertiesID props) } if (!rc) { - if (!name || !attempted) { + if (driver_name) { + SDL_SetError("%s not available", driver_name); + } else { SDL_SetError("Couldn't find matching render driver"); } goto error; From 90bda6548f28cf8ec936c94e08f79181f008f5ed Mon Sep 17 00:00:00 2001 From: "Ryan C. Gordon" Date: Tue, 21 Jan 2025 11:27:40 -0500 Subject: [PATCH 208/340] video: Don't let SDL_CreateWindowTexture use the software renderer. It used to check for "software" in the hint, but now it has to parse a comma-separated list. If it tries to use the software renderer here, you'll end up in an infinite recursion. --- src/video/SDL_video.c | 35 ++++++++++++++++++++++++++++++----- 1 file changed, 30 insertions(+), 5 deletions(-) diff --git a/src/video/SDL_video.c b/src/video/SDL_video.c index 6acd400e0ef29..dc856746dcb83 100644 --- a/src/video/SDL_video.c +++ b/src/video/SDL_video.c @@ -321,10 +321,9 @@ static bool SDL_CreateWindowTexture(SDL_VideoDevice *_this, SDL_Window *window, if (!data) { SDL_Renderer *renderer = NULL; const char *render_driver = NULL; - const char *hint; // See if there's a render driver being requested - hint = SDL_GetHint(SDL_HINT_FRAMEBUFFER_ACCELERATION); + const char *hint = SDL_GetHint(SDL_HINT_FRAMEBUFFER_ACCELERATION); if (hint && *hint != '0' && *hint != '1' && SDL_strcasecmp(hint, "true") != 0 && SDL_strcasecmp(hint, "false") != 0 && @@ -333,20 +332,46 @@ static bool SDL_CreateWindowTexture(SDL_VideoDevice *_this, SDL_Window *window, } if (!render_driver) { - hint = SDL_GetHint(SDL_HINT_RENDER_DRIVER); - if (hint && *hint && SDL_strcasecmp(hint, SDL_SOFTWARE_RENDERER) != 0) { - render_driver = hint; + render_driver = SDL_GetHint(SDL_HINT_RENDER_DRIVER); + } + + char *render_driver_copy = NULL; + if (render_driver && *render_driver) { + render_driver_copy = SDL_strdup(render_driver); + render_driver = render_driver_copy; + if (render_driver_copy) { // turn any "software" requests into "xxxxxxxx" so we don't end up in infinite recursion. + char *prev = render_driver_copy; + char *ptr = prev; + while ((ptr = SDL_strchr(ptr, ',')) != NULL) { + *ptr = '\0'; + const bool is_sw = (SDL_strcasecmp(prev, SDL_SOFTWARE_RENDERER) == 0); + *ptr = ','; + if (is_sw) { + SDL_memset(prev, 'x', SDL_strlen(SDL_SOFTWARE_RENDERER)); + ptr = prev; + } else { + ptr++; + prev = ptr; + } + } + + if (SDL_strcasecmp(prev, SDL_SOFTWARE_RENDERER) == 0) { + SDL_memset(prev, 'x', SDL_strlen(SDL_SOFTWARE_RENDERER)); + } } } + SDL_Log("render_driver == '%s'", render_driver); // Check to see if there's a specific driver requested if (render_driver) { renderer = SDL_CreateRenderer(window, render_driver); + SDL_free(render_driver_copy); if (!renderer) { // The error for this specific renderer has already been set return false; } } else { + SDL_assert(render_driver_copy == NULL); const int total = SDL_GetNumRenderDrivers(); for (i = 0; i < total; ++i) { const char *name = SDL_GetRenderDriver(i); From f16c67115db5f9c653e97e6f4edb4112633c690c Mon Sep 17 00:00:00 2001 From: SDL Wiki Bot Date: Tue, 21 Jan 2025 16:29:55 +0000 Subject: [PATCH 209/340] Sync SDL3 wiki -> header [ci skip] --- include/SDL3/SDL_hints.h | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/include/SDL3/SDL_hints.h b/include/SDL3/SDL_hints.h index 58a2fc5dffdf7..dd25fb9c19839 100644 --- a/include/SDL3/SDL_hints.h +++ b/include/SDL3/SDL_hints.h @@ -2900,9 +2900,9 @@ extern "C" { * - "gpu" * - "software" * - * This hint accepts a comma-separated list of driver names, and each will - * be tried in the order listed when creating a renderer until one succeeds - * or all of them fail. + * This hint accepts a comma-separated list of driver names, and each will be + * tried in the order listed when creating a renderer until one succeeds or + * all of them fail. * * The default varies by platform, but it's the first one in the list that is * available on the current platform. @@ -3293,8 +3293,8 @@ extern "C" { * force a specific target, such as "x11" if, say, you are on Wayland but want * to try talking to the X server instead. * - * This hint accepts a comma-separated list of driver names, and each will - * be tried in the order listed during init, until one succeeds or all of them + * This hint accepts a comma-separated list of driver names, and each will be + * tried in the order listed during init, until one succeeds or all of them * fail. * * This hint should be set before SDL is initialized. From a52fc209bb8eeef94ab75f58d3c1dc77054bdfe1 Mon Sep 17 00:00:00 2001 From: Sam Lantinga Date: Tue, 21 Jan 2025 08:52:28 -0800 Subject: [PATCH 210/340] Updated to version 3.2.0 for release --- CMakeLists.txt | 2 +- Xcode/SDL/Info-Framework.plist | 4 ++-- Xcode/SDL/SDL.xcodeproj/project.pbxproj | 12 ++++++------ Xcode/SDL/pkg-support/SDL.info | 2 +- .../src/main/java/org/libsdl/app/SDLActivity.java | 4 ++-- include/SDL3/SDL.h | 2 +- include/SDL3/SDL_version.h | 4 ++-- src/core/windows/version.rc | 8 ++++---- 8 files changed, 19 insertions(+), 19 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index da1de314b6324..ef42f644d741b 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -5,7 +5,7 @@ if(NOT DEFINED CMAKE_BUILD_TYPE) endif() # See docs/release_checklist.md -project(SDL3 LANGUAGES C VERSION "3.1.11") +project(SDL3 LANGUAGES C VERSION "3.2.0") if(CMAKE_SOURCE_DIR STREQUAL PROJECT_SOURCE_DIR) set(SDL3_MAINPROJECT ON) diff --git a/Xcode/SDL/Info-Framework.plist b/Xcode/SDL/Info-Framework.plist index 306991e7b4726..c9cb1e5c1304a 100644 --- a/Xcode/SDL/Info-Framework.plist +++ b/Xcode/SDL/Info-Framework.plist @@ -19,10 +19,10 @@ CFBundlePackageType FMWK CFBundleShortVersionString - 3.1.11 + 3.2.0 CFBundleSignature SDLX CFBundleVersion - 3.1.11 + 3.2.0 diff --git a/Xcode/SDL/SDL.xcodeproj/project.pbxproj b/Xcode/SDL/SDL.xcodeproj/project.pbxproj index 3fee5496cd69d..73bd920af8c0c 100644 --- a/Xcode/SDL/SDL.xcodeproj/project.pbxproj +++ b/Xcode/SDL/SDL.xcodeproj/project.pbxproj @@ -3045,8 +3045,8 @@ CLANG_ENABLE_MODULES = YES; CLANG_ENABLE_OBJC_ARC = YES; DEPLOYMENT_POSTPROCESSING = YES; - DYLIB_COMPATIBILITY_VERSION = 112.0.0; - DYLIB_CURRENT_VERSION = 112.0.0; + DYLIB_COMPATIBILITY_VERSION = 201.0.0; + DYLIB_CURRENT_VERSION = 201.0.0; DYLIB_INSTALL_NAME_BASE = "@rpath"; ENABLE_STRICT_OBJC_MSGSEND = YES; GCC_ALTIVEC_EXTENSIONS = YES; @@ -3081,7 +3081,7 @@ "@loader_path/Frameworks", ); MACOSX_DEPLOYMENT_TARGET = 10.13; - MARKETING_VERSION = 3.1.11; + MARKETING_VERSION = 3.2.0; OTHER_LDFLAGS = "$(CONFIG_FRAMEWORK_LDFLAGS)"; PRODUCT_BUNDLE_IDENTIFIER = org.libsdl.SDL3; PRODUCT_NAME = SDL3; @@ -3109,8 +3109,8 @@ ALLOW_TARGET_PLATFORM_SPECIALIZATION = YES; CLANG_ENABLE_MODULES = YES; CLANG_ENABLE_OBJC_ARC = YES; - DYLIB_COMPATIBILITY_VERSION = 112.0.0; - DYLIB_CURRENT_VERSION = 112.0.0; + DYLIB_COMPATIBILITY_VERSION = 201.0.0; + DYLIB_CURRENT_VERSION = 201.0.0; DYLIB_INSTALL_NAME_BASE = "@rpath"; ENABLE_STRICT_OBJC_MSGSEND = YES; ENABLE_TESTABILITY = YES; @@ -3142,7 +3142,7 @@ "@loader_path/Frameworks", ); MACOSX_DEPLOYMENT_TARGET = 10.13; - MARKETING_VERSION = 3.1.11; + MARKETING_VERSION = 3.2.0; ONLY_ACTIVE_ARCH = YES; OTHER_LDFLAGS = "$(CONFIG_FRAMEWORK_LDFLAGS)"; PRODUCT_BUNDLE_IDENTIFIER = org.libsdl.SDL3; diff --git a/Xcode/SDL/pkg-support/SDL.info b/Xcode/SDL/pkg-support/SDL.info index e6efaf84cd007..b80d1f58e98c1 100644 --- a/Xcode/SDL/pkg-support/SDL.info +++ b/Xcode/SDL/pkg-support/SDL.info @@ -1,4 +1,4 @@ -Title SDL 3.1.11 +Title SDL 3.2.0 Version 1 Description SDL Library for macOS (http://www.libsdl.org) DefaultLocation /Library/Frameworks diff --git a/android-project/app/src/main/java/org/libsdl/app/SDLActivity.java b/android-project/app/src/main/java/org/libsdl/app/SDLActivity.java index 1999ea5b22b07..47bf3b31b1c17 100644 --- a/android-project/app/src/main/java/org/libsdl/app/SDLActivity.java +++ b/android-project/app/src/main/java/org/libsdl/app/SDLActivity.java @@ -59,8 +59,8 @@ public class SDLActivity extends Activity implements View.OnSystemUiVisibilityChangeListener { private static final String TAG = "SDL"; private static final int SDL_MAJOR_VERSION = 3; - private static final int SDL_MINOR_VERSION = 1; - private static final int SDL_MICRO_VERSION = 11; + private static final int SDL_MINOR_VERSION = 2; + private static final int SDL_MICRO_VERSION = 0; /* // Display InputType.SOURCE/CLASS of events and devices // diff --git a/include/SDL3/SDL.h b/include/SDL3/SDL.h index 65a85217604b9..861c404f50ed6 100644 --- a/include/SDL3/SDL.h +++ b/include/SDL3/SDL.h @@ -20,7 +20,7 @@ */ /** - * Main include header for the SDL library, version 3.1.11 + * Main include header for the SDL library, version 3.2.0 * * It is almost always best to include just this one header instead of * picking out individual headers included here. There are exceptions to diff --git a/include/SDL3/SDL_version.h b/include/SDL3/SDL_version.h index 57f7aca9c8606..6f10351aafa8a 100644 --- a/include/SDL3/SDL_version.h +++ b/include/SDL3/SDL_version.h @@ -53,7 +53,7 @@ extern "C" { * * \since This macro is available since SDL 3.1.3. */ -#define SDL_MINOR_VERSION 1 +#define SDL_MINOR_VERSION 2 /** * The current micro (or patchlevel) version of the SDL headers. @@ -62,7 +62,7 @@ extern "C" { * * \since This macro is available since SDL 3.1.3. */ -#define SDL_MICRO_VERSION 11 +#define SDL_MICRO_VERSION 0 /** * This macro turns the version numbers into a numeric value. diff --git a/src/core/windows/version.rc b/src/core/windows/version.rc index f8129abc7c85b..83c5f6371d58d 100644 --- a/src/core/windows/version.rc +++ b/src/core/windows/version.rc @@ -9,8 +9,8 @@ LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US // VS_VERSION_INFO VERSIONINFO - FILEVERSION 3,1,11,0 - PRODUCTVERSION 3,1,11,0 + FILEVERSION 3,2,0,0 + PRODUCTVERSION 3,2,0,0 FILEFLAGSMASK 0x3fL FILEFLAGS 0x0L FILEOS 0x40004L @@ -23,12 +23,12 @@ BEGIN BEGIN VALUE "CompanyName", "\0" VALUE "FileDescription", "SDL\0" - VALUE "FileVersion", "3, 1, 11, 0\0" + VALUE "FileVersion", "3, 2, 0, 0\0" VALUE "InternalName", "SDL\0" VALUE "LegalCopyright", "Copyright (C) 2025 Sam Lantinga\0" VALUE "OriginalFilename", "SDL3.dll\0" VALUE "ProductName", "Simple DirectMedia Layer\0" - VALUE "ProductVersion", "3, 1, 11, 0\0" + VALUE "ProductVersion", "3, 2, 0, 0\0" END END BLOCK "VarFileInfo" From b775135b4f00e21c7f02003e805081b0f374315b Mon Sep 17 00:00:00 2001 From: Sam Lantinga Date: Tue, 21 Jan 2025 08:57:08 -0800 Subject: [PATCH 211/340] Removed temporary debug code --- src/video/SDL_video.c | 1 - 1 file changed, 1 deletion(-) diff --git a/src/video/SDL_video.c b/src/video/SDL_video.c index dc856746dcb83..80b1bb025c0ca 100644 --- a/src/video/SDL_video.c +++ b/src/video/SDL_video.c @@ -360,7 +360,6 @@ static bool SDL_CreateWindowTexture(SDL_VideoDevice *_this, SDL_Window *window, } } } - SDL_Log("render_driver == '%s'", render_driver); // Check to see if there's a specific driver requested if (render_driver) { From 7e130e27ba75ea544ff8e65f02a5e35b3fde405c Mon Sep 17 00:00:00 2001 From: "Ryan C. Gordon" Date: Tue, 21 Jan 2025 13:10:57 -0500 Subject: [PATCH 212/340] fnsince.pl: Remove prerelease version tapdancing. --- build-scripts/fnsince.pl | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/build-scripts/fnsince.pl b/build-scripts/fnsince.pl index e815dfd5eca35..9d987fc4ba475 100755 --- a/build-scripts/fnsince.pl +++ b/build-scripts/fnsince.pl @@ -90,15 +90,9 @@ my $tag = $fulltags{$release}; my $blobname = "$tag:src/dynapi/SDL_dynapi_overrides.h"; - if ($release =~ /\A3\.(0\.\d+|1\.[0123]\Z)/) { # make everything up to the first SDL3 prerelease look like 3.1.3 (ABI lock version). - $release = '3.1.3'; - } - - # !!! FIXME: REMOVE ME WHEN 3.2.0 SHIPS! - elsif (not $release =~ /\A3\.1\.\d+/) { # a couple of releases after the initial 3.1.3, let them through. + if ($release =~ /\A3\.[01]\.\d+\Z/) { # make everything up to the first SDL3 official release look like 3.2.0. $release = '3.2.0'; } - # !!! FIXME: REMOVE ME WHEN 3.2.0 SHIPS! open(PIPEFH, '-|', "git show '$blobname'") or die "Failed to read git blob '$blobname': $!\n"; while () { From 7a5604cf0c54660d5c03ae61e55ca846388769b5 Mon Sep 17 00:00:00 2001 From: "Ryan C. Gordon" Date: Tue, 21 Jan 2025 13:12:25 -0500 Subject: [PATCH 213/340] Sync SDL3 wiki -> headers. --- include/SDL3/SDL_assert.h | 44 +-- include/SDL3/SDL_asyncio.h | 22 +- include/SDL3/SDL_atomic.h | 46 +-- include/SDL3/SDL_audio.h | 156 ++++----- include/SDL3/SDL_begin_code.h | 26 +- include/SDL3/SDL_bits.h | 4 +- include/SDL3/SDL_blendmode.h | 8 +- include/SDL3/SDL_camera.h | 38 +-- include/SDL3/SDL_clipboard.h | 26 +- include/SDL3/SDL_cpuinfo.h | 38 +-- include/SDL3/SDL_dialog.h | 14 +- include/SDL3/SDL_endian.h | 32 +- include/SDL3/SDL_error.h | 14 +- include/SDL3/SDL_events.h | 120 +++---- include/SDL3/SDL_filesystem.h | 34 +- include/SDL3/SDL_gamepad.h | 158 ++++----- include/SDL3/SDL_gpu.h | 340 ++++++++++---------- include/SDL3/SDL_guid.h | 6 +- include/SDL3/SDL_haptic.h | 132 ++++---- include/SDL3/SDL_hidapi.h | 50 +-- include/SDL3/SDL_hints.h | 476 +++++++++++++-------------- include/SDL3/SDL_init.h | 34 +- include/SDL3/SDL_intrin.h | 2 +- include/SDL3/SDL_iostream.h | 104 +++--- include/SDL3/SDL_joystick.h | 134 ++++---- include/SDL3/SDL_keyboard.h | 54 ++-- include/SDL3/SDL_keycode.h | 4 +- include/SDL3/SDL_loadso.h | 8 +- include/SDL3/SDL_locale.h | 4 +- include/SDL3/SDL_log.h | 42 +-- include/SDL3/SDL_main.h | 24 +- include/SDL3/SDL_messagebox.h | 16 +- include/SDL3/SDL_metal.h | 8 +- include/SDL3/SDL_misc.h | 2 +- include/SDL3/SDL_mouse.h | 54 ++-- include/SDL3/SDL_mutex.h | 108 +++---- include/SDL3/SDL_pen.h | 10 +- include/SDL3/SDL_pixels.h | 118 +++---- include/SDL3/SDL_platform.h | 2 +- include/SDL3/SDL_platform_defines.h | 68 ++-- include/SDL3/SDL_power.h | 4 +- include/SDL3/SDL_process.h | 22 +- include/SDL3/SDL_properties.h | 50 +-- include/SDL3/SDL_rect.h | 44 +-- include/SDL3/SDL_render.h | 190 +++++------ include/SDL3/SDL_revision.h | 2 +- include/SDL3/SDL_scancode.h | 2 +- include/SDL3/SDL_sensor.h | 36 +-- include/SDL3/SDL_stdinc.h | 480 ++++++++++++++-------------- include/SDL3/SDL_storage.h | 38 +-- include/SDL3/SDL_surface.h | 124 +++---- include/SDL3/SDL_system.h | 78 ++--- include/SDL3/SDL_thread.h | 38 +-- include/SDL3/SDL_time.h | 24 +- include/SDL3/SDL_timer.h | 48 +-- include/SDL3/SDL_touch.h | 20 +- include/SDL3/SDL_tray.h | 44 +-- include/SDL3/SDL_version.h | 22 +- include/SDL3/SDL_video.h | 280 ++++++++-------- include/SDL3/SDL_vulkan.h | 14 +- 60 files changed, 2070 insertions(+), 2070 deletions(-) diff --git a/include/SDL3/SDL_assert.h b/include/SDL3/SDL_assert.h index edc69cd7e38c5..09b3b478f0548 100644 --- a/include/SDL3/SDL_assert.h +++ b/include/SDL3/SDL_assert.h @@ -89,7 +89,7 @@ extern "C" { * - 3: Paranoid settings: All SDL assertion macros enabled, including * SDL_assert_paranoid. * - * \since This macro is available since SDL 3.1.3. + * \since This macro is available since SDL 3.2.0. */ #define SDL_ASSERT_LEVEL SomeNumberBasedOnVariousFactors @@ -122,7 +122,7 @@ extern "C" { * * \threadsafety It is safe to call this macro from any thread. * - * \since This macro is available since SDL 3.1.3. + * \since This macro is available since SDL 3.2.0. */ #define SDL_TriggerBreakpoint() TriggerABreakpointInAPlatformSpecificManner @@ -165,7 +165,7 @@ extern "C" { * * If SDL can't figure how the compiler reports this, it will use "???". * - * \since This macro is available since SDL 3.1.3. + * \since This macro is available since SDL 3.2.0. */ #define SDL_FUNCTION __FUNCTION__ @@ -180,14 +180,14 @@ extern "C" { /** * A macro that reports the current file being compiled. * - * \since This macro is available since SDL 3.1.3. + * \since This macro is available since SDL 3.2.0. */ #define SDL_FILE __FILE__ /** * A macro that reports the current line number of the file being compiled. * - * \since This macro is available since SDL 3.1.3. + * \since This macro is available since SDL 3.2.0. */ #define SDL_LINE __LINE__ @@ -224,7 +224,7 @@ disable assertions. * do { SomethingOnce(); } while (SDL_NULL_WHILE_LOOP_CONDITION (0)); * ``` * - * \since This macro is available since SDL 3.1.3. + * \since This macro is available since SDL 3.2.0. */ #define SDL_NULL_WHILE_LOOP_CONDITION (0) @@ -248,7 +248,7 @@ disable assertions. * * \param condition the condition to assert (but not actually run here). * - * \since This macro is available since SDL 3.1.3. + * \since This macro is available since SDL 3.2.0. */ #define SDL_disabled_assert(condition) \ do { (void) sizeof ((condition)); } while (SDL_NULL_WHILE_LOOP_CONDITION) @@ -264,7 +264,7 @@ disable assertions. * condition, try to break in a debugger, kill the program, or ignore the * problem). * - * \since This enum is available since SDL 3.1.3. + * \since This enum is available since SDL 3.2.0. */ typedef enum SDL_AssertState { @@ -282,7 +282,7 @@ typedef enum SDL_AssertState * used by the assertion handler, then added to the assertion report. This is * returned as a linked list from SDL_GetAssertionReport(). * - * \since This struct is available since SDL 3.1.3. + * \since This struct is available since SDL 3.2.0. */ typedef struct SDL_AssertData { @@ -308,7 +308,7 @@ typedef struct SDL_AssertData * * \threadsafety It is safe to call this function from any thread. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. */ extern SDL_DECLSPEC SDL_AssertState SDLCALL SDL_ReportAssertion(SDL_AssertData *data, const char *func, @@ -323,7 +323,7 @@ extern SDL_DECLSPEC SDL_AssertState SDLCALL SDL_ReportAssertion(SDL_AssertData * * This isn't for direct use by apps; use SDL_assert or SDL_TriggerBreakpoint * instead. * - * \since This macro is available since SDL 3.1.3. + * \since This macro is available since SDL 3.2.0. */ #define SDL_AssertBreakpoint() SDL_TriggerBreakpoint() @@ -355,7 +355,7 @@ extern SDL_DECLSPEC SDL_AssertState SDLCALL SDL_ReportAssertion(SDL_AssertData * * * \param condition the condition to assert. * - * \since This macro is available since SDL 3.1.3. + * \since This macro is available since SDL 3.2.0. */ #define SDL_enabled_assert(condition) \ do { \ @@ -401,7 +401,7 @@ extern SDL_DECLSPEC SDL_AssertState SDLCALL SDL_ReportAssertion(SDL_AssertData * * * \threadsafety It is safe to call this macro from any thread. * - * \since This macro is available since SDL 3.1.3. + * \since This macro is available since SDL 3.2.0. */ #define SDL_assert(condition) if (assertion_enabled && (condition)) { trigger_assertion; } @@ -434,7 +434,7 @@ extern SDL_DECLSPEC SDL_AssertState SDLCALL SDL_ReportAssertion(SDL_AssertData * * * \threadsafety It is safe to call this macro from any thread. * - * \since This macro is available since SDL 3.1.3. + * \since This macro is available since SDL 3.2.0. */ #define SDL_assert_release(condition) SDL_disabled_assert(condition) @@ -463,7 +463,7 @@ extern SDL_DECLSPEC SDL_AssertState SDLCALL SDL_ReportAssertion(SDL_AssertData * * * \threadsafety It is safe to call this macro from any thread. * - * \since This macro is available since SDL 3.1.3. + * \since This macro is available since SDL 3.2.0. */ #define SDL_assert_paranoid(condition) SDL_disabled_assert(condition) @@ -507,7 +507,7 @@ extern SDL_DECLSPEC SDL_AssertState SDLCALL SDL_ReportAssertion(SDL_AssertData * * * \threadsafety It is safe to call this macro from any thread. * - * \since This macro is available since SDL 3.1.3. + * \since This macro is available since SDL 3.2.0. */ #define SDL_assert_always(condition) SDL_enabled_assert(condition) @@ -523,7 +523,7 @@ extern SDL_DECLSPEC SDL_AssertState SDLCALL SDL_ReportAssertion(SDL_AssertData * * \threadsafety This callback may be called from any thread that triggers an * assert at any time. * - * \since This datatype is available since SDL 3.1.3. + * \since This datatype is available since SDL 3.2.0. */ typedef SDL_AssertState (SDLCALL *SDL_AssertionHandler)( const SDL_AssertData *data, void *userdata); @@ -547,7 +547,7 @@ typedef SDL_AssertState (SDLCALL *SDL_AssertionHandler)( * * \threadsafety It is safe to call this function from any thread. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_GetAssertionHandler */ @@ -568,7 +568,7 @@ extern SDL_DECLSPEC void SDLCALL SDL_SetAssertionHandler( * * \threadsafety It is safe to call this function from any thread. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_GetAssertionHandler */ @@ -593,7 +593,7 @@ extern SDL_DECLSPEC SDL_AssertionHandler SDLCALL SDL_GetDefaultAssertionHandler( * * \threadsafety It is safe to call this function from any thread. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_SetAssertionHandler */ @@ -627,7 +627,7 @@ extern SDL_DECLSPEC SDL_AssertionHandler SDLCALL SDL_GetAssertionHandler(void ** * SDL_ResetAssertionReport() simultaneously, may render the * returned pointer invalid. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_ResetAssertionReport */ @@ -645,7 +645,7 @@ extern SDL_DECLSPEC const SDL_AssertData * SDLCALL SDL_GetAssertionReport(void); * assertion, or simultaneously calling this function may cause * memory leaks or crashes. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_GetAssertionReport */ diff --git a/include/SDL3/SDL_asyncio.h b/include/SDL3/SDL_asyncio.h index 33124e93ff54c..b36cb071bcfb0 100644 --- a/include/SDL3/SDL_asyncio.h +++ b/include/SDL3/SDL_asyncio.h @@ -213,7 +213,7 @@ typedef struct SDL_AsyncIOQueue SDL_AsyncIOQueue; * \returns a pointer to the SDL_AsyncIO structure that is created or NULL on * failure; call SDL_GetError() for more information. * - * \since This function is available since SDL 3.1.8. + * \since This function is available since SDL 3.2.0. * * \sa SDL_CloseAsyncIO * \sa SDL_ReadAsyncIO @@ -234,7 +234,7 @@ extern SDL_DECLSPEC SDL_AsyncIO * SDLCALL SDL_AsyncIOFromFile(const char *file, * * \threadsafety It is safe to call this function from any thread. * - * \since This function is available since SDL 3.1.8. + * \since This function is available since SDL 3.2.0. */ extern SDL_DECLSPEC Sint64 SDLCALL SDL_GetAsyncIOSize(SDL_AsyncIO *asyncio); @@ -269,7 +269,7 @@ extern SDL_DECLSPEC Sint64 SDLCALL SDL_GetAsyncIOSize(SDL_AsyncIO *asyncio); * * \threadsafety It is safe to call this function from any thread. * - * \since This function is available since SDL 3.1.8. + * \since This function is available since SDL 3.2.0. * * \sa SDL_WriteAsyncIO * \sa SDL_CreateAsyncIOQueue @@ -306,7 +306,7 @@ extern SDL_DECLSPEC bool SDLCALL SDL_ReadAsyncIO(SDL_AsyncIO *asyncio, void *ptr * * \threadsafety It is safe to call this function from any thread. * - * \since This function is available since SDL 3.1.8. + * \since This function is available since SDL 3.2.0. * * \sa SDL_ReadAsyncIO * \sa SDL_CreateAsyncIOQueue @@ -358,7 +358,7 @@ extern SDL_DECLSPEC bool SDLCALL SDL_WriteAsyncIO(SDL_AsyncIO *asyncio, void *pt * \threadsafety It is safe to call this function from any thread, but two * threads should not attempt to close the same object. * - * \since This function is available since SDL 3.1.8. + * \since This function is available since SDL 3.2.0. */ extern SDL_DECLSPEC bool SDLCALL SDL_CloseAsyncIO(SDL_AsyncIO *asyncio, bool flush, SDL_AsyncIOQueue *queue, void *userdata); @@ -373,7 +373,7 @@ extern SDL_DECLSPEC bool SDLCALL SDL_CloseAsyncIO(SDL_AsyncIO *asyncio, bool flu * * \threadsafety It is safe to call this function from any thread. * - * \since This function is available since SDL 3.1.8. + * \since This function is available since SDL 3.2.0. * * \sa SDL_DestroyAsyncIOQueue * \sa SDL_GetAsyncIOResult @@ -407,7 +407,7 @@ extern SDL_DECLSPEC SDL_AsyncIOQueue * SDLCALL SDL_CreateAsyncIOQueue(void); * no other thread is waiting on the queue with * SDL_WaitAsyncIOResult. * - * \since This function is available since SDL 3.1.8. + * \since This function is available since SDL 3.2.0. */ extern SDL_DECLSPEC void SDLCALL SDL_DestroyAsyncIOQueue(SDL_AsyncIOQueue *queue); @@ -431,7 +431,7 @@ extern SDL_DECLSPEC void SDLCALL SDL_DestroyAsyncIOQueue(SDL_AsyncIOQueue *queue * * \threadsafety It is safe to call this function from any thread. * - * \since This function is available since SDL 3.1.8. + * \since This function is available since SDL 3.2.0. * * \sa SDL_WaitAsyncIOResult */ @@ -475,7 +475,7 @@ extern SDL_DECLSPEC bool SDLCALL SDL_GetAsyncIOResult(SDL_AsyncIOQueue *queue, S * * \threadsafety It is safe to call this function from any thread. * - * \since This function is available since SDL 3.1.8. + * \since This function is available since SDL 3.2.0. * * \sa SDL_SignalAsyncIOQueue */ @@ -499,7 +499,7 @@ extern SDL_DECLSPEC bool SDLCALL SDL_WaitAsyncIOResult(SDL_AsyncIOQueue *queue, * * \threadsafety It is safe to call this function from any thread. * - * \since This function is available since SDL 3.1.8. + * \since This function is available since SDL 3.2.0. * * \sa SDL_WaitAsyncIOResult */ @@ -531,7 +531,7 @@ extern SDL_DECLSPEC void SDLCALL SDL_SignalAsyncIOQueue(SDL_AsyncIOQueue *queue) * \returns true on success or false on failure; call SDL_GetError() for more * information. * - * \since This function is available since SDL 3.1.8. + * \since This function is available since SDL 3.2.0. * * \sa SDL_LoadFile_IO */ diff --git a/include/SDL3/SDL_atomic.h b/include/SDL3/SDL_atomic.h index 5fd449b0d68e8..03e3fb13441d7 100644 --- a/include/SDL3/SDL_atomic.h +++ b/include/SDL3/SDL_atomic.h @@ -92,7 +92,7 @@ typedef int SDL_SpinLock; * * \threadsafety It is safe to call this function from any thread. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_LockSpinlock * \sa SDL_UnlockSpinlock @@ -109,7 +109,7 @@ extern SDL_DECLSPEC bool SDLCALL SDL_TryLockSpinlock(SDL_SpinLock *lock); * * \threadsafety It is safe to call this function from any thread. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_TryLockSpinlock * \sa SDL_UnlockSpinlock @@ -128,7 +128,7 @@ extern SDL_DECLSPEC void SDLCALL SDL_LockSpinlock(SDL_SpinLock *lock); * * \threadsafety It is safe to call this function from any thread. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_LockSpinlock * \sa SDL_TryLockSpinlock @@ -152,7 +152,7 @@ extern SDL_DECLSPEC void SDLCALL SDL_UnlockSpinlock(SDL_SpinLock *lock); * time, but if you find yourself needing this, you are probably * dealing with some very sensitive code; be careful! * - * \since This macro is available since SDL 3.1.3. + * \since This macro is available since SDL 3.2.0. */ #define SDL_CompilerBarrier() DoCompilerSpecificReadWriteBarrier() @@ -185,7 +185,7 @@ extern __inline void SDL_CompilerBarrier(void); * time, but if you find yourself needing this, you are probably * dealing with some very sensitive code; be careful! * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_MemoryBarrierRelease */ @@ -205,7 +205,7 @@ extern SDL_DECLSPEC void SDLCALL SDL_MemoryBarrierReleaseFunction(void); * time, but if you find yourself needing this, you are probably * dealing with some very sensitive code; be careful! * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_MemoryBarrierAcquire */ @@ -245,7 +245,7 @@ extern SDL_DECLSPEC void SDLCALL SDL_MemoryBarrierAcquireFunction(void); * time, but if you find yourself needing this, you are probably * dealing with some very sensitive code; be careful! * - * \since This macro is available since SDL 3.1.3. + * \since This macro is available since SDL 3.2.0. * * \sa SDL_MemoryBarrierAcquire * \sa SDL_MemoryBarrierReleaseFunction @@ -268,7 +268,7 @@ extern SDL_DECLSPEC void SDLCALL SDL_MemoryBarrierAcquireFunction(void); * time, but if you find yourself needing this, you are probably * dealing with some very sensitive code; be careful! * - * \since This macro is available since SDL 3.1.3. + * \since This macro is available since SDL 3.2.0. * * \sa SDL_MemoryBarrierRelease * \sa SDL_MemoryBarrierAcquireFunction @@ -341,7 +341,7 @@ typedef void (*SDL_KernelMemoryBarrierFunc)(); * * \threadsafety This macro is safe to use from any thread. * - * \since This macro is available since SDL 3.1.3. + * \since This macro is available since SDL 3.2.0. */ #define SDL_CPUPauseInstruction() DoACPUPauseInACompilerAndArchitectureSpecificWay @@ -385,7 +385,7 @@ typedef void (*SDL_KernelMemoryBarrierFunc)(); * This is a struct so people don't accidentally use numeric operations on it * directly. You have to use SDL atomic functions. * - * \since This struct is available since SDL 3.1.3. + * \since This struct is available since SDL 3.2.0. * * \sa SDL_CompareAndSwapAtomicInt * \sa SDL_GetAtomicInt @@ -407,7 +407,7 @@ typedef struct SDL_AtomicInt { int value; } SDL_AtomicInt; * * \threadsafety It is safe to call this function from any thread. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_GetAtomicInt * \sa SDL_SetAtomicInt @@ -428,7 +428,7 @@ extern SDL_DECLSPEC bool SDLCALL SDL_CompareAndSwapAtomicInt(SDL_AtomicInt *a, i * * \threadsafety It is safe to call this function from any thread. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_GetAtomicInt */ @@ -445,7 +445,7 @@ extern SDL_DECLSPEC int SDLCALL SDL_SetAtomicInt(SDL_AtomicInt *a, int v); * * \threadsafety It is safe to call this function from any thread. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_SetAtomicInt */ @@ -465,7 +465,7 @@ extern SDL_DECLSPEC int SDLCALL SDL_GetAtomicInt(SDL_AtomicInt *a); * * \threadsafety It is safe to call this function from any thread. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_AtomicDecRef * \sa SDL_AtomicIncRef @@ -484,7 +484,7 @@ extern SDL_DECLSPEC int SDLCALL SDL_AddAtomicInt(SDL_AtomicInt *a, int v); * * \threadsafety It is safe to call this macro from any thread. * - * \since This macro is available since SDL 3.1.3. + * \since This macro is available since SDL 3.2.0. * * \sa SDL_AtomicDecRef */ @@ -504,7 +504,7 @@ extern SDL_DECLSPEC int SDLCALL SDL_AddAtomicInt(SDL_AtomicInt *a, int v); * * \threadsafety It is safe to call this macro from any thread. * - * \since This macro is available since SDL 3.1.3. + * \since This macro is available since SDL 3.2.0. * * \sa SDL_AtomicIncRef */ @@ -531,7 +531,7 @@ extern SDL_DECLSPEC int SDLCALL SDL_AddAtomicInt(SDL_AtomicInt *a, int v); * This is a struct so people don't accidentally use numeric operations on it * directly. You have to use SDL atomic functions. * - * \since This struct is available since SDL 3.1.3. + * \since This struct is available since SDL 3.2.0. * * \sa SDL_CompareAndSwapAtomicU32 * \sa SDL_GetAtomicU32 @@ -552,7 +552,7 @@ typedef struct SDL_AtomicU32 { Uint32 value; } SDL_AtomicU32; * * \threadsafety It is safe to call this function from any thread. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_GetAtomicU32 * \sa SDL_SetAtomicU32 @@ -573,7 +573,7 @@ extern SDL_DECLSPEC bool SDLCALL SDL_CompareAndSwapAtomicU32(SDL_AtomicU32 *a, U * * \threadsafety It is safe to call this function from any thread. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_GetAtomicU32 */ @@ -590,7 +590,7 @@ extern SDL_DECLSPEC Uint32 SDLCALL SDL_SetAtomicU32(SDL_AtomicU32 *a, Uint32 v); * * \threadsafety It is safe to call this function from any thread. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_SetAtomicU32 */ @@ -609,7 +609,7 @@ extern SDL_DECLSPEC Uint32 SDLCALL SDL_GetAtomicU32(SDL_AtomicU32 *a); * * \threadsafety It is safe to call this function from any thread. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_CompareAndSwapAtomicInt * \sa SDL_GetAtomicPointer @@ -629,7 +629,7 @@ extern SDL_DECLSPEC bool SDLCALL SDL_CompareAndSwapAtomicPointer(void **a, void * * \threadsafety It is safe to call this function from any thread. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_CompareAndSwapAtomicPointer * \sa SDL_GetAtomicPointer @@ -647,7 +647,7 @@ extern SDL_DECLSPEC void * SDLCALL SDL_SetAtomicPointer(void **a, void *v); * * \threadsafety It is safe to call this function from any thread. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_CompareAndSwapAtomicPointer * \sa SDL_SetAtomicPointer diff --git a/include/SDL3/SDL_audio.h b/include/SDL3/SDL_audio.h index 71457abbe6976..956938215bea7 100644 --- a/include/SDL3/SDL_audio.h +++ b/include/SDL3/SDL_audio.h @@ -146,7 +146,7 @@ extern "C" { * * Generally one should use SDL_AUDIO_BITSIZE instead of this macro directly. * - * \since This macro is available since SDL 3.1.3. + * \since This macro is available since SDL 3.2.0. */ #define SDL_AUDIO_MASK_BITSIZE (0xFFu) @@ -155,7 +155,7 @@ extern "C" { * * Generally one should use SDL_AUDIO_ISFLOAT instead of this macro directly. * - * \since This macro is available since SDL 3.1.3. + * \since This macro is available since SDL 3.2.0. */ #define SDL_AUDIO_MASK_FLOAT (1u<<8) @@ -165,7 +165,7 @@ extern "C" { * Generally one should use SDL_AUDIO_ISBIGENDIAN or SDL_AUDIO_ISLITTLEENDIAN * instead of this macro directly. * - * \since This macro is available since SDL 3.1.3. + * \since This macro is available since SDL 3.2.0. */ #define SDL_AUDIO_MASK_BIG_ENDIAN (1u<<12) @@ -174,7 +174,7 @@ extern "C" { * * Generally one should use SDL_AUDIO_ISSIGNED instead of this macro directly. * - * \since This macro is available since SDL 3.1.3. + * \since This macro is available since SDL 3.2.0. */ #define SDL_AUDIO_MASK_SIGNED (1u<<15) @@ -199,7 +199,7 @@ extern "C" { * * \threadsafety It is safe to call this macro from any thread. * - * \since This macro is available since SDL 3.1.3. + * \since This macro is available since SDL 3.2.0. */ #define SDL_DEFINE_AUDIO_FORMAT(signed, bigendian, flt, size) \ (((Uint16)(signed) << 15) | ((Uint16)(bigendian) << 12) | ((Uint16)(flt) << 8) | ((size) & SDL_AUDIO_MASK_BITSIZE)) @@ -207,7 +207,7 @@ extern "C" { /** * Audio format. * - * \since This enum is available since SDL 3.1.3. + * \since This enum is available since SDL 3.2.0. * * \sa SDL_AUDIO_BITSIZE * \sa SDL_AUDIO_BYTESIZE @@ -261,7 +261,7 @@ typedef enum SDL_AudioFormat * * \threadsafety It is safe to call this macro from any thread. * - * \since This macro is available since SDL 3.1.3. + * \since This macro is available since SDL 3.2.0. */ #define SDL_AUDIO_BITSIZE(x) ((x) & SDL_AUDIO_MASK_BITSIZE) @@ -275,7 +275,7 @@ typedef enum SDL_AudioFormat * * \threadsafety It is safe to call this macro from any thread. * - * \since This macro is available since SDL 3.1.3. + * \since This macro is available since SDL 3.2.0. */ #define SDL_AUDIO_BYTESIZE(x) (SDL_AUDIO_BITSIZE(x) / 8) @@ -289,7 +289,7 @@ typedef enum SDL_AudioFormat * * \threadsafety It is safe to call this macro from any thread. * - * \since This macro is available since SDL 3.1.3. + * \since This macro is available since SDL 3.2.0. */ #define SDL_AUDIO_ISFLOAT(x) ((x) & SDL_AUDIO_MASK_FLOAT) @@ -303,7 +303,7 @@ typedef enum SDL_AudioFormat * * \threadsafety It is safe to call this macro from any thread. * - * \since This macro is available since SDL 3.1.3. + * \since This macro is available since SDL 3.2.0. */ #define SDL_AUDIO_ISBIGENDIAN(x) ((x) & SDL_AUDIO_MASK_BIG_ENDIAN) @@ -317,7 +317,7 @@ typedef enum SDL_AudioFormat * * \threadsafety It is safe to call this macro from any thread. * - * \since This macro is available since SDL 3.1.3. + * \since This macro is available since SDL 3.2.0. */ #define SDL_AUDIO_ISLITTLEENDIAN(x) (!SDL_AUDIO_ISBIGENDIAN(x)) @@ -331,7 +331,7 @@ typedef enum SDL_AudioFormat * * \threadsafety It is safe to call this macro from any thread. * - * \since This macro is available since SDL 3.1.3. + * \since This macro is available since SDL 3.2.0. */ #define SDL_AUDIO_ISSIGNED(x) ((x) & SDL_AUDIO_MASK_SIGNED) @@ -345,7 +345,7 @@ typedef enum SDL_AudioFormat * * \threadsafety It is safe to call this macro from any thread. * - * \since This macro is available since SDL 3.1.3. + * \since This macro is available since SDL 3.2.0. */ #define SDL_AUDIO_ISINT(x) (!SDL_AUDIO_ISFLOAT(x)) @@ -359,7 +359,7 @@ typedef enum SDL_AudioFormat * * \threadsafety It is safe to call this macro from any thread. * - * \since This macro is available since SDL 3.1.3. + * \since This macro is available since SDL 3.2.0. */ #define SDL_AUDIO_ISUNSIGNED(x) (!SDL_AUDIO_ISSIGNED(x)) @@ -369,7 +369,7 @@ typedef enum SDL_AudioFormat * * Zero is used to signify an invalid/null device. * - * \since This datatype is available since SDL 3.1.3. + * \since This datatype is available since SDL 3.2.0. */ typedef Uint32 SDL_AudioDeviceID; @@ -380,7 +380,7 @@ typedef Uint32 SDL_AudioDeviceID; * to signify the app just wants the system to choose a default device instead * of the app providing a specific one. * - * \since This macro is available since SDL 3.1.3. + * \since This macro is available since SDL 3.2.0. */ #define SDL_AUDIO_DEVICE_DEFAULT_PLAYBACK ((SDL_AudioDeviceID) 0xFFFFFFFFu) @@ -391,14 +391,14 @@ typedef Uint32 SDL_AudioDeviceID; * to signify the app just wants the system to choose a default device instead * of the app providing a specific one. * - * \since This macro is available since SDL 3.1.3. + * \since This macro is available since SDL 3.2.0. */ #define SDL_AUDIO_DEVICE_DEFAULT_RECORDING ((SDL_AudioDeviceID) 0xFFFFFFFEu) /** * Format specifier for audio data. * - * \since This struct is available since SDL 3.1.3. + * \since This struct is available since SDL 3.2.0. * * \sa SDL_AudioFormat */ @@ -420,7 +420,7 @@ typedef struct SDL_AudioSpec * * \threadsafety It is safe to call this macro from any thread. * - * \since This macro is available since SDL 3.1.3. + * \since This macro is available since SDL 3.2.0. */ #define SDL_AUDIO_FRAMESIZE(x) (SDL_AUDIO_BYTESIZE((x).format) * (x).channels) @@ -444,7 +444,7 @@ typedef struct SDL_AudioSpec * more of them, bind them to an opened audio device, and feed data to them * (or for recording, consume data from them). * - * \since This struct is available since SDL 3.1.3. + * \since This struct is available since SDL 3.2.0. * * \sa SDL_CreateAudioStream */ @@ -470,7 +470,7 @@ typedef struct SDL_AudioStream SDL_AudioStream; * * \threadsafety It is safe to call this function from any thread. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_GetAudioDriver */ @@ -494,7 +494,7 @@ extern SDL_DECLSPEC int SDLCALL SDL_GetNumAudioDrivers(void); * * \threadsafety It is safe to call this function from any thread. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_GetNumAudioDrivers */ @@ -512,7 +512,7 @@ extern SDL_DECLSPEC const char * SDLCALL SDL_GetAudioDriver(int index); * * \threadsafety It is safe to call this function from any thread. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. */ extern SDL_DECLSPEC const char * SDLCALL SDL_GetCurrentAudioDriver(void); @@ -538,7 +538,7 @@ extern SDL_DECLSPEC const char * SDLCALL SDL_GetCurrentAudioDriver(void); * * \threadsafety It is safe to call this function from any thread. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_OpenAudioDevice * \sa SDL_GetAudioRecordingDevices @@ -567,7 +567,7 @@ extern SDL_DECLSPEC SDL_AudioDeviceID * SDLCALL SDL_GetAudioPlaybackDevices(int * * \threadsafety It is safe to call this function from any thread. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_OpenAudioDevice * \sa SDL_GetAudioPlaybackDevices @@ -583,7 +583,7 @@ extern SDL_DECLSPEC SDL_AudioDeviceID * SDLCALL SDL_GetAudioRecordingDevices(int * * \threadsafety It is safe to call this function from any thread. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_GetAudioPlaybackDevices * \sa SDL_GetAudioRecordingDevices @@ -621,7 +621,7 @@ extern SDL_DECLSPEC const char * SDLCALL SDL_GetAudioDeviceName(SDL_AudioDeviceI * * \threadsafety It is safe to call this function from any thread. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. */ extern SDL_DECLSPEC bool SDLCALL SDL_GetAudioDeviceFormat(SDL_AudioDeviceID devid, SDL_AudioSpec *spec, int *sample_frames); @@ -642,7 +642,7 @@ extern SDL_DECLSPEC bool SDLCALL SDL_GetAudioDeviceFormat(SDL_AudioDeviceID devi * * \threadsafety It is safe to call this function from any thread. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_SetAudioStreamInputChannelMap */ @@ -717,7 +717,7 @@ extern SDL_DECLSPEC int * SDLCALL SDL_GetAudioDeviceChannelMap(SDL_AudioDeviceID * * \threadsafety It is safe to call this function from any thread. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_CloseAudioDevice * \sa SDL_GetAudioDeviceFormat @@ -745,7 +745,7 @@ extern SDL_DECLSPEC SDL_AudioDeviceID SDLCALL SDL_OpenAudioDevice(SDL_AudioDevic * * \threadsafety It is safe to call this function from any thread. * - * \since This function is available since SDL 3.1.8. + * \since This function is available since SDL 3.2.0. */ extern SDL_DECLSPEC bool SDLCALL SDL_IsAudioDevicePhysical(SDL_AudioDeviceID devid); @@ -759,7 +759,7 @@ extern SDL_DECLSPEC bool SDLCALL SDL_IsAudioDevicePhysical(SDL_AudioDeviceID dev * * \threadsafety It is safe to call this function from any thread. * - * \since This function is available since SDL 3.1.8. + * \since This function is available since SDL 3.2.0. */ extern SDL_DECLSPEC bool SDLCALL SDL_IsAudioDevicePlayback(SDL_AudioDeviceID devid); @@ -787,7 +787,7 @@ extern SDL_DECLSPEC bool SDLCALL SDL_IsAudioDevicePlayback(SDL_AudioDeviceID dev * * \threadsafety It is safe to call this function from any thread. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_ResumeAudioDevice * \sa SDL_AudioDevicePaused @@ -815,7 +815,7 @@ extern SDL_DECLSPEC bool SDLCALL SDL_PauseAudioDevice(SDL_AudioDeviceID dev); * * \threadsafety It is safe to call this function from any thread. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_AudioDevicePaused * \sa SDL_PauseAudioDevice @@ -837,7 +837,7 @@ extern SDL_DECLSPEC bool SDLCALL SDL_ResumeAudioDevice(SDL_AudioDeviceID dev); * * \threadsafety It is safe to call this function from any thread. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_PauseAudioDevice * \sa SDL_ResumeAudioDevice @@ -861,7 +861,7 @@ extern SDL_DECLSPEC bool SDLCALL SDL_AudioDevicePaused(SDL_AudioDeviceID dev); * * \threadsafety It is safe to call this function from any thread. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_SetAudioDeviceGain */ @@ -896,7 +896,7 @@ extern SDL_DECLSPEC float SDLCALL SDL_GetAudioDeviceGain(SDL_AudioDeviceID devid * \threadsafety It is safe to call this function from any thread, as it holds * a stream-specific mutex while running. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_GetAudioDeviceGain */ @@ -917,7 +917,7 @@ extern SDL_DECLSPEC bool SDLCALL SDL_SetAudioDeviceGain(SDL_AudioDeviceID devid, * * \threadsafety It is safe to call this function from any thread. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_OpenAudioDevice */ @@ -952,7 +952,7 @@ extern SDL_DECLSPEC void SDLCALL SDL_CloseAudioDevice(SDL_AudioDeviceID devid); * * \threadsafety It is safe to call this function from any thread. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_BindAudioStreams * \sa SDL_UnbindAudioStream @@ -973,7 +973,7 @@ extern SDL_DECLSPEC bool SDLCALL SDL_BindAudioStreams(SDL_AudioDeviceID devid, S * * \threadsafety It is safe to call this function from any thread. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_BindAudioStreams * \sa SDL_UnbindAudioStream @@ -996,7 +996,7 @@ extern SDL_DECLSPEC bool SDLCALL SDL_BindAudioStream(SDL_AudioDeviceID devid, SD * * \threadsafety It is safe to call this function from any thread. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_BindAudioStreams */ @@ -1012,7 +1012,7 @@ extern SDL_DECLSPEC void SDLCALL SDL_UnbindAudioStreams(SDL_AudioStream * const * * \threadsafety It is safe to call this function from any thread. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_BindAudioStream */ @@ -1031,7 +1031,7 @@ extern SDL_DECLSPEC void SDLCALL SDL_UnbindAudioStream(SDL_AudioStream *stream); * * \threadsafety It is safe to call this function from any thread. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_BindAudioStream * \sa SDL_BindAudioStreams @@ -1048,7 +1048,7 @@ extern SDL_DECLSPEC SDL_AudioDeviceID SDLCALL SDL_GetAudioStreamDevice(SDL_Audio * * \threadsafety It is safe to call this function from any thread. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_PutAudioStreamData * \sa SDL_GetAudioStreamData @@ -1069,7 +1069,7 @@ extern SDL_DECLSPEC SDL_AudioStream * SDLCALL SDL_CreateAudioStream(const SDL_Au * * \threadsafety It is safe to call this function from any thread. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. */ extern SDL_DECLSPEC SDL_PropertiesID SDLCALL SDL_GetAudioStreamProperties(SDL_AudioStream *stream); @@ -1085,7 +1085,7 @@ extern SDL_DECLSPEC SDL_PropertiesID SDLCALL SDL_GetAudioStreamProperties(SDL_Au * \threadsafety It is safe to call this function from any thread, as it holds * a stream-specific mutex while running. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_SetAudioStreamFormat */ @@ -1121,7 +1121,7 @@ extern SDL_DECLSPEC bool SDLCALL SDL_GetAudioStreamFormat(SDL_AudioStream *strea * \threadsafety It is safe to call this function from any thread, as it holds * a stream-specific mutex while running. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_GetAudioStreamFormat * \sa SDL_SetAudioStreamFrequencyRatio @@ -1138,7 +1138,7 @@ extern SDL_DECLSPEC bool SDLCALL SDL_SetAudioStreamFormat(SDL_AudioStream *strea * \threadsafety It is safe to call this function from any thread, as it holds * a stream-specific mutex while running. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_SetAudioStreamFrequencyRatio */ @@ -1165,7 +1165,7 @@ extern SDL_DECLSPEC float SDLCALL SDL_GetAudioStreamFrequencyRatio(SDL_AudioStre * \threadsafety It is safe to call this function from any thread, as it holds * a stream-specific mutex while running. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_GetAudioStreamFrequencyRatio * \sa SDL_SetAudioStreamFormat @@ -1187,7 +1187,7 @@ extern SDL_DECLSPEC bool SDLCALL SDL_SetAudioStreamFrequencyRatio(SDL_AudioStrea * \threadsafety It is safe to call this function from any thread, as it holds * a stream-specific mutex while running. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_SetAudioStreamGain */ @@ -1212,7 +1212,7 @@ extern SDL_DECLSPEC float SDLCALL SDL_GetAudioStreamGain(SDL_AudioStream *stream * \threadsafety It is safe to call this function from any thread, as it holds * a stream-specific mutex while running. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_GetAudioStreamGain */ @@ -1236,7 +1236,7 @@ extern SDL_DECLSPEC bool SDLCALL SDL_SetAudioStreamGain(SDL_AudioStream *stream, * \threadsafety It is safe to call this function from any thread, as it holds * a stream-specific mutex while running. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_SetAudioStreamInputChannelMap */ @@ -1260,7 +1260,7 @@ extern SDL_DECLSPEC int * SDLCALL SDL_GetAudioStreamInputChannelMap(SDL_AudioStr * \threadsafety It is safe to call this function from any thread, as it holds * a stream-specific mutex while running. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_SetAudioStreamInputChannelMap */ @@ -1320,7 +1320,7 @@ extern SDL_DECLSPEC int * SDLCALL SDL_GetAudioStreamOutputChannelMap(SDL_AudioSt * stream's format to have a different number of channels from a * a different thread at the same time, though! * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_SetAudioStreamInputChannelMap */ @@ -1378,7 +1378,7 @@ extern SDL_DECLSPEC bool SDLCALL SDL_SetAudioStreamInputChannelMap(SDL_AudioStre * stream's format to have a different number of channels from a * a different thread at the same time, though! * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_SetAudioStreamInputChannelMap */ @@ -1405,7 +1405,7 @@ extern SDL_DECLSPEC bool SDLCALL SDL_SetAudioStreamOutputChannelMap(SDL_AudioStr * stream has a callback set, the caller might need to manage * extra locking. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_ClearAudioStream * \sa SDL_FlushAudioStream @@ -1436,7 +1436,7 @@ extern SDL_DECLSPEC bool SDLCALL SDL_PutAudioStreamData(SDL_AudioStream *stream, * stream has a callback set, the caller might need to manage * extra locking. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_ClearAudioStream * \sa SDL_GetAudioStreamAvailable @@ -1463,7 +1463,7 @@ extern SDL_DECLSPEC int SDLCALL SDL_GetAudioStreamData(SDL_AudioStream *stream, * * \threadsafety It is safe to call this function from any thread. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_GetAudioStreamData * \sa SDL_PutAudioStreamData @@ -1502,7 +1502,7 @@ extern SDL_DECLSPEC int SDLCALL SDL_GetAudioStreamAvailable(SDL_AudioStream *str * * \threadsafety It is safe to call this function from any thread. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_PutAudioStreamData * \sa SDL_ClearAudioStream @@ -1524,7 +1524,7 @@ extern SDL_DECLSPEC int SDLCALL SDL_GetAudioStreamQueued(SDL_AudioStream *stream * * \threadsafety It is safe to call this function from any thread. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_PutAudioStreamData */ @@ -1542,7 +1542,7 @@ extern SDL_DECLSPEC bool SDLCALL SDL_FlushAudioStream(SDL_AudioStream *stream); * * \threadsafety It is safe to call this function from any thread. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_GetAudioStreamAvailable * \sa SDL_GetAudioStreamData @@ -1569,7 +1569,7 @@ extern SDL_DECLSPEC bool SDLCALL SDL_ClearAudioStream(SDL_AudioStream *stream); * * \threadsafety It is safe to call this function from any thread. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_ResumeAudioStreamDevice */ @@ -1589,7 +1589,7 @@ extern SDL_DECLSPEC bool SDLCALL SDL_PauseAudioStreamDevice(SDL_AudioStream *str * * \threadsafety It is safe to call this function from any thread. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_PauseAudioStreamDevice */ @@ -1607,7 +1607,7 @@ extern SDL_DECLSPEC bool SDLCALL SDL_ResumeAudioStreamDevice(SDL_AudioStream *st * * \threadsafety It is safe to call this function from any thread. * - * \since This function is available since SDL 3.1.10. + * \since This function is available since SDL 3.2.0. * * \sa SDL_PauseAudioStreamDevice * \sa SDL_ResumeAudioStreamDevice @@ -1637,7 +1637,7 @@ extern SDL_DECLSPEC bool SDLCALL SDL_AudioStreamDevicePaused(SDL_AudioStream *st * * \threadsafety It is safe to call this function from any thread. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_UnlockAudioStream */ @@ -1656,7 +1656,7 @@ extern SDL_DECLSPEC bool SDLCALL SDL_LockAudioStream(SDL_AudioStream *stream); * \threadsafety You should only call this from the same thread that * previously called SDL_LockAudioStream. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_LockAudioStream */ @@ -1697,7 +1697,7 @@ extern SDL_DECLSPEC bool SDLCALL SDL_UnlockAudioStream(SDL_AudioStream *stream); * is called, so your callback does not need to manage the lock * explicitly. * - * \since This datatype is available since SDL 3.1.3. + * \since This datatype is available since SDL 3.2.0. * * \sa SDL_SetAudioStreamGetCallback * \sa SDL_SetAudioStreamPutCallback @@ -1744,7 +1744,7 @@ typedef void (SDLCALL *SDL_AudioStreamCallback)(void *userdata, SDL_AudioStream * * \threadsafety It is safe to call this function from any thread. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_SetAudioStreamPutCallback */ @@ -1793,7 +1793,7 @@ extern SDL_DECLSPEC bool SDLCALL SDL_SetAudioStreamGetCallback(SDL_AudioStream * * * \threadsafety It is safe to call this function from any thread. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_SetAudioStreamGetCallback */ @@ -1815,7 +1815,7 @@ extern SDL_DECLSPEC bool SDLCALL SDL_SetAudioStreamPutCallback(SDL_AudioStream * * * \threadsafety It is safe to call this function from any thread. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_CreateAudioStream */ @@ -1877,7 +1877,7 @@ extern SDL_DECLSPEC void SDLCALL SDL_DestroyAudioStream(SDL_AudioStream *stream) * * \threadsafety It is safe to call this function from any thread. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_GetAudioStreamDevice * \sa SDL_ResumeAudioStreamDevice @@ -1915,7 +1915,7 @@ extern SDL_DECLSPEC SDL_AudioStream * SDLCALL SDL_OpenAudioDeviceStream(SDL_Audi * application is responsible for locking resources the callback * touches that need to be protected. * - * \since This datatype is available since SDL 3.1.3. + * \since This datatype is available since SDL 3.2.0. * * \sa SDL_SetAudioPostmixCallback */ @@ -1971,7 +1971,7 @@ typedef void (SDLCALL *SDL_AudioPostmixCallback)(void *userdata, const SDL_Audio * * \threadsafety It is safe to call this function from any thread. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. */ extern SDL_DECLSPEC bool SDLCALL SDL_SetAudioPostmixCallback(SDL_AudioDeviceID devid, SDL_AudioPostmixCallback callback, void *userdata); @@ -2049,7 +2049,7 @@ extern SDL_DECLSPEC bool SDLCALL SDL_SetAudioPostmixCallback(SDL_AudioDeviceID d * * \threadsafety It is safe to call this function from any thread. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_free * \sa SDL_LoadWAV @@ -2085,7 +2085,7 @@ extern SDL_DECLSPEC bool SDLCALL SDL_LoadWAV_IO(SDL_IOStream *src, bool closeio, * * \threadsafety It is safe to call this function from any thread. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_free * \sa SDL_LoadWAV_IO @@ -2124,7 +2124,7 @@ extern SDL_DECLSPEC bool SDLCALL SDL_LoadWAV(const char *path, SDL_AudioSpec *sp * * \threadsafety It is safe to call this function from any thread. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. */ extern SDL_DECLSPEC bool SDLCALL SDL_MixAudio(Uint8 *dst, const Uint8 *src, SDL_AudioFormat format, Uint32 len, float volume); @@ -2154,7 +2154,7 @@ extern SDL_DECLSPEC bool SDLCALL SDL_MixAudio(Uint8 *dst, const Uint8 *src, SDL_ * * \threadsafety It is safe to call this function from any thread. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. */ extern SDL_DECLSPEC bool SDLCALL SDL_ConvertAudioSamples(const SDL_AudioSpec *src_spec, const Uint8 *src_data, int src_len, const SDL_AudioSpec *dst_spec, Uint8 **dst_data, int *dst_len); @@ -2167,7 +2167,7 @@ extern SDL_DECLSPEC bool SDLCALL SDL_ConvertAudioSamples(const SDL_AudioSpec *sr * * \threadsafety It is safe to call this function from any thread. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. */ extern SDL_DECLSPEC const char * SDLCALL SDL_GetAudioFormatName(SDL_AudioFormat format); @@ -2183,7 +2183,7 @@ extern SDL_DECLSPEC const char * SDLCALL SDL_GetAudioFormatName(SDL_AudioFormat * * \threadsafety It is safe to call this function from any thread. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. */ extern SDL_DECLSPEC int SDLCALL SDL_GetSilenceValueForFormat(SDL_AudioFormat format); diff --git a/include/SDL3/SDL_begin_code.h b/include/SDL3/SDL_begin_code.h index 2e848c71fd187..a6b47cf4b916d 100644 --- a/include/SDL3/SDL_begin_code.h +++ b/include/SDL3/SDL_begin_code.h @@ -62,7 +62,7 @@ * On compilers without a deprecation mechanism, this is defined to nothing, * and using a deprecated function will not generate a warning. * - * \since This macro is available since SDL 3.1.3. + * \since This macro is available since SDL 3.2.0. */ #define SDL_DEPRECATED __attribute__((deprecated)) @@ -76,7 +76,7 @@ * This symbol is used in SDL's headers, but apps and other libraries are * welcome to use it for their own interfaces as well. * - * \since This macro is available since SDL 3.1.3. + * \since This macro is available since SDL 3.2.0. */ #define SDL_DECLSPEC __attribute__ ((visibility("default"))) @@ -97,7 +97,7 @@ * This symbol is used in SDL's headers, but apps and other libraries are * welcome to use it for their own interfaces as well. * - * \since This macro is available since SDL 3.1.3. + * \since This macro is available since SDL 3.2.0. */ #define SDLCALL __cdecl @@ -108,7 +108,7 @@ * to ignore this request. On compilers without inline support, this is * defined to nothing. * - * \since This macro is available since SDL 3.1.3. + * \since This macro is available since SDL 3.2.0. */ #define SDL_INLINE __inline @@ -123,7 +123,7 @@ * This symbol is used in SDL's headers, but apps and other libraries are * welcome to use it for their own interfaces as well. * - * \since This macro is available since SDL 3.1.3. + * \since This macro is available since SDL 3.2.0. */ #define SDL_FORCE_INLINE __forceinline @@ -140,7 +140,7 @@ * This symbol is used in SDL's headers, but apps and other libraries are * welcome to use it for their own interfaces as well. * - * \since This macro is available since SDL 3.1.3. + * \since This macro is available since SDL 3.2.0. */ #define SDL_NORETURN __attribute__((noreturn)) @@ -160,7 +160,7 @@ * This symbol is used in SDL's headers, but apps and other libraries are * welcome to use it for their own interfaces as well. * - * \since This macro is available since SDL 3.1.3. + * \since This macro is available since SDL 3.2.0. */ #define SDL_ANALYZER_NORETURN __attribute__((analyzer_noreturn)) @@ -188,7 +188,7 @@ * } * ``` * - * \since This macro is available since SDL 3.1.3. + * \since This macro is available since SDL 3.2.0. */ #define SDL_FALLTHROUGH [[fallthrough]] @@ -215,7 +215,7 @@ * * On compilers without nodiscard support, this is defined to nothing. * - * \since This macro is available since SDL 3.1.3. + * \since This macro is available since SDL 3.2.0. */ #define SDL_NODISCARD [[nodiscard]] @@ -232,7 +232,7 @@ * * Most apps don't need to, and should not, use this directly. * - * \since This macro is available since SDL 3.1.3. + * \since This macro is available since SDL 3.2.0. */ #define SDL_MALLOC __declspec(allocator) __desclspec(restrict) @@ -248,7 +248,7 @@ * * Most apps don't need to, and should not, use this directly. * - * \since This macro is available since SDL 3.1.3. + * \since This macro is available since SDL 3.2.0. */ #define SDL_ALLOC_SIZE(p) __attribute__((alloc_size(p))) @@ -261,7 +261,7 @@ * * On compilers without restrict support, this is defined to nothing. * - * \since This macro is available since SDL 3.1.3. + * \since This macro is available since SDL 3.2.0. */ #define SDL_RESTRICT __restrict__ @@ -277,7 +277,7 @@ * On compilers without has_builtin support, this is defined to 0 (always * false). * - * \since This macro is available since SDL 3.1.3. + * \since This macro is available since SDL 3.2.0. */ #define SDL_HAS_BUILTIN(x) __has_builtin(x) diff --git a/include/SDL3/SDL_bits.h b/include/SDL3/SDL_bits.h index 6657e6b256a59..7435ce6d9399d 100644 --- a/include/SDL3/SDL_bits.h +++ b/include/SDL3/SDL_bits.h @@ -61,7 +61,7 @@ extern __inline int _SDL_bsr_watcom(Uint32); * * \threadsafety It is safe to call this function from any thread. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. */ SDL_FORCE_INLINE int SDL_MostSignificantBitIndex32(Uint32 x) { @@ -128,7 +128,7 @@ SDL_FORCE_INLINE int SDL_MostSignificantBitIndex32(Uint32 x) * * \threadsafety It is safe to call this function from any thread. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. */ SDL_FORCE_INLINE bool SDL_HasExactlyOneBitSet32(Uint32 x) { diff --git a/include/SDL3/SDL_blendmode.h b/include/SDL3/SDL_blendmode.h index f7ab590ebefaf..8f00cbcafb083 100644 --- a/include/SDL3/SDL_blendmode.h +++ b/include/SDL3/SDL_blendmode.h @@ -45,7 +45,7 @@ extern "C" { * * Additional values may be obtained from SDL_ComposeCustomBlendMode. * - * \since This datatype is available since SDL 3.1.3. + * \since This datatype is available since SDL 3.2.0. * * \sa SDL_ComposeCustomBlendMode */ @@ -64,7 +64,7 @@ typedef Uint32 SDL_BlendMode; * The blend operation used when combining source and destination pixel * components. * - * \since This enum is available since SDL 3.1.3. + * \since This enum is available since SDL 3.2.0. */ typedef enum SDL_BlendOperation { @@ -83,7 +83,7 @@ typedef enum SDL_BlendOperation * operation. The comma-separated factors listed above are always applied in * the component order red, green, blue, and alpha. * - * \since This enum is available since SDL 3.1.3. + * \since This enum is available since SDL 3.2.0. */ typedef enum SDL_BlendFactor { @@ -179,7 +179,7 @@ typedef enum SDL_BlendFactor * * \threadsafety It is safe to call this function from any thread. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_SetRenderDrawBlendMode * \sa SDL_GetRenderDrawBlendMode diff --git a/include/SDL3/SDL_camera.h b/include/SDL3/SDL_camera.h index ba02c20c2faaf..c4d05962b6387 100644 --- a/include/SDL3/SDL_camera.h +++ b/include/SDL3/SDL_camera.h @@ -88,7 +88,7 @@ extern "C" { * * The value 0 is an invalid ID. * - * \since This datatype is available since SDL 3.1.3. + * \since This datatype is available since SDL 3.2.0. * * \sa SDL_GetCameras */ @@ -97,7 +97,7 @@ typedef Uint32 SDL_CameraID; /** * The opaque structure used to identify an opened SDL camera. * - * \since This struct is available since SDL 3.1.3. + * \since This struct is available since SDL 3.2.0. */ typedef struct SDL_Camera SDL_Camera; @@ -107,7 +107,7 @@ typedef struct SDL_Camera SDL_Camera; * Cameras often support multiple formats; each one will be encapsulated in * this struct. * - * \since This struct is available since SDL 3.1.3. + * \since This struct is available since SDL 3.2.0. * * \sa SDL_GetCameraSupportedFormats * \sa SDL_GetCameraFormat @@ -125,7 +125,7 @@ typedef struct SDL_CameraSpec /** * The position of camera in relation to system device. * - * \since This enum is available since SDL 3.1.3. + * \since This enum is available since SDL 3.2.0. * * \sa SDL_GetCameraPosition */ @@ -154,7 +154,7 @@ typedef enum SDL_CameraPosition * * \threadsafety It is safe to call this function from any thread. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_GetCameraDriver */ @@ -178,7 +178,7 @@ extern SDL_DECLSPEC int SDLCALL SDL_GetNumCameraDrivers(void); * * \threadsafety It is safe to call this function from any thread. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_GetNumCameraDrivers */ @@ -196,7 +196,7 @@ extern SDL_DECLSPEC const char * SDLCALL SDL_GetCameraDriver(int index); * * \threadsafety It is safe to call this function from any thread. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. */ extern SDL_DECLSPEC const char * SDLCALL SDL_GetCurrentCameraDriver(void); @@ -211,7 +211,7 @@ extern SDL_DECLSPEC const char * SDLCALL SDL_GetCurrentCameraDriver(void); * * \threadsafety It is safe to call this function from any thread. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_OpenCamera */ @@ -249,7 +249,7 @@ extern SDL_DECLSPEC SDL_CameraID * SDLCALL SDL_GetCameras(int *count); * * \threadsafety It is safe to call this function from any thread. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_GetCameras * \sa SDL_OpenCamera @@ -265,7 +265,7 @@ extern SDL_DECLSPEC SDL_CameraSpec ** SDLCALL SDL_GetCameraSupportedFormats(SDL_ * * \threadsafety It is safe to call this function from any thread. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_GetCameras */ @@ -284,7 +284,7 @@ extern SDL_DECLSPEC const char * SDLCALL SDL_GetCameraName(SDL_CameraID instance * * \threadsafety It is safe to call this function from any thread. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_GetCameras */ @@ -330,7 +330,7 @@ extern SDL_DECLSPEC SDL_CameraPosition SDLCALL SDL_GetCameraPosition(SDL_CameraI * * \threadsafety It is safe to call this function from any thread. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_GetCameras * \sa SDL_GetCameraFormat @@ -363,7 +363,7 @@ extern SDL_DECLSPEC SDL_Camera * SDLCALL SDL_OpenCamera(SDL_CameraID instance_id * * \threadsafety It is safe to call this function from any thread. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_OpenCamera * \sa SDL_CloseCamera @@ -379,7 +379,7 @@ extern SDL_DECLSPEC int SDLCALL SDL_GetCameraPermissionState(SDL_Camera *camera) * * \threadsafety It is safe to call this function from any thread. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_OpenCamera */ @@ -394,7 +394,7 @@ extern SDL_DECLSPEC SDL_CameraID SDLCALL SDL_GetCameraID(SDL_Camera *camera); * * \threadsafety It is safe to call this function from any thread. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. */ extern SDL_DECLSPEC SDL_PropertiesID SDLCALL SDL_GetCameraProperties(SDL_Camera *camera); @@ -418,7 +418,7 @@ extern SDL_DECLSPEC SDL_PropertiesID SDLCALL SDL_GetCameraProperties(SDL_Camera * * \threadsafety It is safe to call this function from any thread. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_OpenCamera */ @@ -461,7 +461,7 @@ extern SDL_DECLSPEC bool SDLCALL SDL_GetCameraFormat(SDL_Camera *camera, SDL_Cam * * \threadsafety It is safe to call this function from any thread. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_ReleaseCameraFrame */ @@ -489,7 +489,7 @@ extern SDL_DECLSPEC SDL_Surface * SDLCALL SDL_AcquireCameraFrame(SDL_Camera *cam * * \threadsafety It is safe to call this function from any thread. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_AcquireCameraFrame */ @@ -504,7 +504,7 @@ extern SDL_DECLSPEC void SDLCALL SDL_ReleaseCameraFrame(SDL_Camera *camera, SDL_ * \threadsafety It is safe to call this function from any thread, but no * thread may reference `device` once this function is called. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_OpenCamera */ diff --git a/include/SDL3/SDL_clipboard.h b/include/SDL3/SDL_clipboard.h index 3c67d469dbb86..0d3cbb499b11b 100644 --- a/include/SDL3/SDL_clipboard.h +++ b/include/SDL3/SDL_clipboard.h @@ -96,7 +96,7 @@ extern "C" { * * \threadsafety This function should only be called on the main thread. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_GetClipboardText * \sa SDL_HasClipboardText @@ -115,7 +115,7 @@ extern SDL_DECLSPEC bool SDLCALL SDL_SetClipboardText(const char *text); * * \threadsafety This function should only be called on the main thread. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_HasClipboardText * \sa SDL_SetClipboardText @@ -129,7 +129,7 @@ extern SDL_DECLSPEC char * SDLCALL SDL_GetClipboardText(void); * * \threadsafety This function should only be called on the main thread. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_GetClipboardText * \sa SDL_SetClipboardText @@ -145,7 +145,7 @@ extern SDL_DECLSPEC bool SDLCALL SDL_HasClipboardText(void); * * \threadsafety This function should only be called on the main thread. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_GetPrimarySelectionText * \sa SDL_HasPrimarySelectionText @@ -164,7 +164,7 @@ extern SDL_DECLSPEC bool SDLCALL SDL_SetPrimarySelectionText(const char *text); * * \threadsafety This function should only be called on the main thread. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_HasPrimarySelectionText * \sa SDL_SetPrimarySelectionText @@ -179,7 +179,7 @@ extern SDL_DECLSPEC char * SDLCALL SDL_GetPrimarySelectionText(void); * * \threadsafety This function should only be called on the main thread. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_GetPrimarySelectionText * \sa SDL_SetPrimarySelectionText @@ -204,7 +204,7 @@ extern SDL_DECLSPEC bool SDLCALL SDL_HasPrimarySelectionText(void); * breakage in receiving applications. The returned data will not be * freed so it needs to be retained and dealt with internally. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_SetClipboardData */ @@ -216,7 +216,7 @@ typedef const void *(SDLCALL *SDL_ClipboardDataCallback)(void *userdata, const c * * \param userdata a pointer to provided user data. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_SetClipboardData */ @@ -246,7 +246,7 @@ typedef void (SDLCALL *SDL_ClipboardCleanupCallback)(void *userdata); * * \threadsafety This function should only be called on the main thread. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_ClearClipboardData * \sa SDL_GetClipboardData @@ -262,7 +262,7 @@ extern SDL_DECLSPEC bool SDLCALL SDL_SetClipboardData(SDL_ClipboardDataCallback * * \threadsafety This function should only be called on the main thread. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_SetClipboardData */ @@ -282,7 +282,7 @@ extern SDL_DECLSPEC bool SDLCALL SDL_ClearClipboardData(void); * * \threadsafety This function should only be called on the main thread. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_HasClipboardData * \sa SDL_SetClipboardData @@ -298,7 +298,7 @@ extern SDL_DECLSPEC void * SDLCALL SDL_GetClipboardData(const char *mime_type, s * * \threadsafety This function should only be called on the main thread. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_SetClipboardData * \sa SDL_GetClipboardData @@ -316,7 +316,7 @@ extern SDL_DECLSPEC bool SDLCALL SDL_HasClipboardData(const char *mime_type); * * \threadsafety This function should only be called on the main thread. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_SetClipboardData */ diff --git a/include/SDL3/SDL_cpuinfo.h b/include/SDL3/SDL_cpuinfo.h index 5ea38495425c7..1745bd9349015 100644 --- a/include/SDL3/SDL_cpuinfo.h +++ b/include/SDL3/SDL_cpuinfo.h @@ -55,7 +55,7 @@ extern "C" { * processors have a 128 byte cache line. We use the larger value to be * generally safe. * - * \since This macro is available since SDL 3.1.3. + * \since This macro is available since SDL 3.2.0. */ #define SDL_CACHELINE_SIZE 128 @@ -68,7 +68,7 @@ extern "C" { * * \threadsafety It is safe to call this function from any thread. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. */ extern SDL_DECLSPEC int SDLCALL SDL_GetNumLogicalCPUCores(void); @@ -82,7 +82,7 @@ extern SDL_DECLSPEC int SDLCALL SDL_GetNumLogicalCPUCores(void); * * \threadsafety It is safe to call this function from any thread. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. */ extern SDL_DECLSPEC int SDLCALL SDL_GetCPUCacheLineSize(void); @@ -96,7 +96,7 @@ extern SDL_DECLSPEC int SDLCALL SDL_GetCPUCacheLineSize(void); * * \threadsafety It is safe to call this function from any thread. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. */ extern SDL_DECLSPEC bool SDLCALL SDL_HasAltiVec(void); @@ -109,7 +109,7 @@ extern SDL_DECLSPEC bool SDLCALL SDL_HasAltiVec(void); * * \threadsafety It is safe to call this function from any thread. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. */ extern SDL_DECLSPEC bool SDLCALL SDL_HasMMX(void); @@ -122,7 +122,7 @@ extern SDL_DECLSPEC bool SDLCALL SDL_HasMMX(void); * * \threadsafety It is safe to call this function from any thread. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_HasSSE2 * \sa SDL_HasSSE3 @@ -140,7 +140,7 @@ extern SDL_DECLSPEC bool SDLCALL SDL_HasSSE(void); * * \threadsafety It is safe to call this function from any thread. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_HasSSE * \sa SDL_HasSSE3 @@ -158,7 +158,7 @@ extern SDL_DECLSPEC bool SDLCALL SDL_HasSSE2(void); * * \threadsafety It is safe to call this function from any thread. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_HasSSE * \sa SDL_HasSSE2 @@ -176,7 +176,7 @@ extern SDL_DECLSPEC bool SDLCALL SDL_HasSSE3(void); * * \threadsafety It is safe to call this function from any thread. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_HasSSE * \sa SDL_HasSSE2 @@ -194,7 +194,7 @@ extern SDL_DECLSPEC bool SDLCALL SDL_HasSSE41(void); * * \threadsafety It is safe to call this function from any thread. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_HasSSE * \sa SDL_HasSSE2 @@ -212,7 +212,7 @@ extern SDL_DECLSPEC bool SDLCALL SDL_HasSSE42(void); * * \threadsafety It is safe to call this function from any thread. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_HasAVX2 * \sa SDL_HasAVX512F @@ -228,7 +228,7 @@ extern SDL_DECLSPEC bool SDLCALL SDL_HasAVX(void); * * \threadsafety It is safe to call this function from any thread. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_HasAVX * \sa SDL_HasAVX512F @@ -244,7 +244,7 @@ extern SDL_DECLSPEC bool SDLCALL SDL_HasAVX2(void); * * \threadsafety It is safe to call this function from any thread. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_HasAVX * \sa SDL_HasAVX2 @@ -262,7 +262,7 @@ extern SDL_DECLSPEC bool SDLCALL SDL_HasAVX512F(void); * * \threadsafety It is safe to call this function from any thread. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_HasNEON */ @@ -277,7 +277,7 @@ extern SDL_DECLSPEC bool SDLCALL SDL_HasARMSIMD(void); * * \threadsafety It is safe to call this function from any thread. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. */ extern SDL_DECLSPEC bool SDLCALL SDL_HasNEON(void); @@ -291,7 +291,7 @@ extern SDL_DECLSPEC bool SDLCALL SDL_HasNEON(void); * * \threadsafety It is safe to call this function from any thread. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. */ extern SDL_DECLSPEC bool SDLCALL SDL_HasLSX(void); @@ -305,7 +305,7 @@ extern SDL_DECLSPEC bool SDLCALL SDL_HasLSX(void); * * \threadsafety It is safe to call this function from any thread. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. */ extern SDL_DECLSPEC bool SDLCALL SDL_HasLASX(void); @@ -316,7 +316,7 @@ extern SDL_DECLSPEC bool SDLCALL SDL_HasLASX(void); * * \threadsafety It is safe to call this function from any thread. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. */ extern SDL_DECLSPEC int SDLCALL SDL_GetSystemRAM(void); @@ -337,7 +337,7 @@ extern SDL_DECLSPEC int SDLCALL SDL_GetSystemRAM(void); * * \threadsafety It is safe to call this function from any thread. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_aligned_alloc * \sa SDL_aligned_free diff --git a/include/SDL3/SDL_dialog.h b/include/SDL3/SDL_dialog.h index 22cd8e376fcbb..460038ff2b513 100644 --- a/include/SDL3/SDL_dialog.h +++ b/include/SDL3/SDL_dialog.h @@ -59,7 +59,7 @@ extern "C" { * hyphens, underscores and periods. Alternatively, the whole string can be a * single asterisk ("*"), which serves as an "All files" filter. * - * \since This struct is available since SDL 3.1.3. + * \since This struct is available since SDL 3.2.0. * * \sa SDL_DialogFileCallback * \sa SDL_ShowOpenFileDialog @@ -102,7 +102,7 @@ typedef struct SDL_DialogFileFilter * \param filelist the file(s) chosen by the user. * \param filter index of the selected filter. * - * \since This datatype is available since SDL 3.1.3. + * \since This datatype is available since SDL 3.2.0. * * \sa SDL_DialogFileFilter * \sa SDL_ShowOpenFileDialog @@ -153,7 +153,7 @@ typedef void (SDLCALL *SDL_DialogFileCallback)(void *userdata, const char * cons * callback may be invoked from the same thread or from a * different one, depending on the OS's constraints. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_DialogFileCallback * \sa SDL_DialogFileFilter @@ -202,7 +202,7 @@ extern SDL_DECLSPEC void SDLCALL SDL_ShowOpenFileDialog(SDL_DialogFileCallback c * callback may be invoked from the same thread or from a * different one, depending on the OS's constraints. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_DialogFileCallback * \sa SDL_DialogFileFilter @@ -248,7 +248,7 @@ extern SDL_DECLSPEC void SDLCALL SDL_ShowSaveFileDialog(SDL_DialogFileCallback c * callback may be invoked from the same thread or from a * different one, depending on the OS's constraints. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_DialogFileCallback * \sa SDL_ShowOpenFileDialog @@ -263,7 +263,7 @@ extern SDL_DECLSPEC void SDLCALL SDL_ShowOpenFolderDialog(SDL_DialogFileCallback * This is used by SDL_ShowFileDialogWithProperties() to decide what kind of * dialog to present to the user. * - * \since This enum is available since SDL 3.1.3. + * \since This enum is available since SDL 3.2.0. * * \sa SDL_ShowFileDialogWithProperties */ @@ -312,7 +312,7 @@ typedef enum SDL_FileDialogType * callback may be invoked from the same thread or from a * different one, depending on the OS's constraints. * - * \since This function is available since SDL 3.1.8. + * \since This function is available since SDL 3.2.0. * * \sa SDL_FileDialogType * \sa SDL_DialogFileCallback diff --git a/include/SDL3/SDL_endian.h b/include/SDL3/SDL_endian.h index 94026960d97cd..a34e9d4b09c1f 100644 --- a/include/SDL3/SDL_endian.h +++ b/include/SDL3/SDL_endian.h @@ -78,7 +78,7 @@ _m_prefetch(void *__P) * #endif * ``` * - * \since This macro is available since SDL 3.1.3. + * \since This macro is available since SDL 3.2.0. * * \sa SDL_BYTEORDER * \sa SDL_BIG_ENDIAN @@ -97,7 +97,7 @@ _m_prefetch(void *__P) * #endif * ``` * - * \since This macro is available since SDL 3.1.3. + * \since This macro is available since SDL 3.2.0. * * \sa SDL_BYTEORDER * \sa SDL_LIL_ENDIAN @@ -122,7 +122,7 @@ _m_prefetch(void *__P) * #endif * ``` * - * \since This macro is available since SDL 3.1.3. + * \since This macro is available since SDL 3.2.0. * * \sa SDL_LIL_ENDIAN * \sa SDL_BIG_ENDIAN @@ -184,7 +184,7 @@ _m_prefetch(void *__P) * #endif * ``` * - * \since This macro is available since SDL 3.1.3. + * \since This macro is available since SDL 3.2.0. * * \sa SDL_LIL_ENDIAN * \sa SDL_BIG_ENDIAN @@ -403,7 +403,7 @@ SDL_FORCE_INLINE Uint64 SDL_Swap64(Uint64 x) * * \threadsafety It is safe to call this function from any thread. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. */ SDL_FORCE_INLINE float SDL_SwapFloat(float x) { @@ -442,7 +442,7 @@ SDL_FORCE_INLINE float SDL_SwapFloat(float x) * * \threadsafety It is safe to call this function from any thread. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. */ SDL_FORCE_INLINE Uint16 SDL_Swap16(Uint16 x) { return x_but_byteswapped; } @@ -463,7 +463,7 @@ SDL_FORCE_INLINE Uint16 SDL_Swap16(Uint16 x) { return x_but_byteswapped; } * * \threadsafety It is safe to call this function from any thread. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. */ SDL_FORCE_INLINE Uint32 SDL_Swap32(Uint32 x) { return x_but_byteswapped; } @@ -484,7 +484,7 @@ SDL_FORCE_INLINE Uint32 SDL_Swap32(Uint32 x) { return x_but_byteswapped; } * * \threadsafety It is safe to call this function from any thread. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. */ SDL_FORCE_INLINE Uint32 SDL_Swap64(Uint64 x) { return x_but_byteswapped; } @@ -500,7 +500,7 @@ SDL_FORCE_INLINE Uint32 SDL_Swap64(Uint64 x) { return x_but_byteswapped; } * * \threadsafety It is safe to call this macro from any thread. * - * \since This macro is available since SDL 3.1.3. + * \since This macro is available since SDL 3.2.0. */ #define SDL_Swap16LE(x) SwapOnlyIfNecessary(x) @@ -516,7 +516,7 @@ SDL_FORCE_INLINE Uint32 SDL_Swap64(Uint64 x) { return x_but_byteswapped; } * * \threadsafety It is safe to call this macro from any thread. * - * \since This macro is available since SDL 3.1.3. + * \since This macro is available since SDL 3.2.0. */ #define SDL_Swap32LE(x) SwapOnlyIfNecessary(x) @@ -532,7 +532,7 @@ SDL_FORCE_INLINE Uint32 SDL_Swap64(Uint64 x) { return x_but_byteswapped; } * * \threadsafety It is safe to call this macro from any thread. * - * \since This macro is available since SDL 3.1.3. + * \since This macro is available since SDL 3.2.0. */ #define SDL_Swap64LE(x) SwapOnlyIfNecessary(x) @@ -548,7 +548,7 @@ SDL_FORCE_INLINE Uint32 SDL_Swap64(Uint64 x) { return x_but_byteswapped; } * * \threadsafety It is safe to call this macro from any thread. * - * \since This macro is available since SDL 3.1.3. + * \since This macro is available since SDL 3.2.0. */ #define SDL_SwapFloatLE(x) SwapOnlyIfNecessary(x) @@ -564,7 +564,7 @@ SDL_FORCE_INLINE Uint32 SDL_Swap64(Uint64 x) { return x_but_byteswapped; } * * \threadsafety It is safe to call this macro from any thread. * - * \since This macro is available since SDL 3.1.3. + * \since This macro is available since SDL 3.2.0. */ #define SDL_Swap16BE(x) SwapOnlyIfNecessary(x) @@ -580,7 +580,7 @@ SDL_FORCE_INLINE Uint32 SDL_Swap64(Uint64 x) { return x_but_byteswapped; } * * \threadsafety It is safe to call this macro from any thread. * - * \since This macro is available since SDL 3.1.3. + * \since This macro is available since SDL 3.2.0. */ #define SDL_Swap32BE(x) SwapOnlyIfNecessary(x) @@ -596,7 +596,7 @@ SDL_FORCE_INLINE Uint32 SDL_Swap64(Uint64 x) { return x_but_byteswapped; } * * \threadsafety It is safe to call this macro from any thread. * - * \since This macro is available since SDL 3.1.3. + * \since This macro is available since SDL 3.2.0. */ #define SDL_Swap64BE(x) SwapOnlyIfNecessary(x) @@ -612,7 +612,7 @@ SDL_FORCE_INLINE Uint32 SDL_Swap64(Uint64 x) { return x_but_byteswapped; } * * \threadsafety It is safe to call this macro from any thread. * - * \since This macro is available since SDL 3.1.3. + * \since This macro is available since SDL 3.2.0. */ #define SDL_SwapFloatBE(x) SwapOnlyIfNecessary(x) diff --git a/include/SDL3/SDL_error.h b/include/SDL3/SDL_error.h index b15d1fd5548ee..934967c1cf0be 100644 --- a/include/SDL3/SDL_error.h +++ b/include/SDL3/SDL_error.h @@ -80,7 +80,7 @@ extern "C" { * * \threadsafety It is safe to call this function from any thread. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_ClearError * \sa SDL_GetError @@ -99,7 +99,7 @@ extern SDL_DECLSPEC bool SDLCALL SDL_SetError(SDL_PRINTF_FORMAT_STRING const cha * * \threadsafety It is safe to call this function from any thread. * - * \since This function is available since SDL 3.1.6. + * \since This function is available since SDL 3.2.0. * * \sa SDL_ClearError * \sa SDL_GetError @@ -116,7 +116,7 @@ extern SDL_DECLSPEC bool SDLCALL SDL_SetErrorV(SDL_PRINTF_FORMAT_STRING const ch * * \threadsafety It is safe to call this function from any thread. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. */ extern SDL_DECLSPEC bool SDLCALL SDL_OutOfMemory(void); @@ -150,7 +150,7 @@ extern SDL_DECLSPEC bool SDLCALL SDL_OutOfMemory(void); * * \threadsafety It is safe to call this function from any thread. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_ClearError * \sa SDL_SetError @@ -164,7 +164,7 @@ extern SDL_DECLSPEC const char * SDLCALL SDL_GetError(void); * * \threadsafety It is safe to call this function from any thread. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_GetError * \sa SDL_SetError @@ -187,7 +187,7 @@ extern SDL_DECLSPEC bool SDLCALL SDL_ClearError(void); * * \threadsafety It is safe to call this macro from any thread. * - * \since This macro is available since SDL 3.1.3. + * \since This macro is available since SDL 3.2.0. */ #define SDL_Unsupported() SDL_SetError("That operation is not supported") @@ -211,7 +211,7 @@ extern SDL_DECLSPEC bool SDLCALL SDL_ClearError(void); * * \threadsafety It is safe to call this macro from any thread. * - * \since This macro is available since SDL 3.1.3. + * \since This macro is available since SDL 3.2.0. */ #define SDL_InvalidParamError(param) SDL_SetError("Parameter '%s' is invalid", (param)) diff --git a/include/SDL3/SDL_events.h b/include/SDL3/SDL_events.h index df62ca62ffa1c..1323e9f0b6445 100644 --- a/include/SDL3/SDL_events.h +++ b/include/SDL3/SDL_events.h @@ -79,7 +79,7 @@ extern "C" { /** * The types of events that can be delivered. * - * \since This enum is available since SDL 3.1.3. + * \since This enum is available since SDL 3.2.0. */ typedef enum SDL_EventType { @@ -282,7 +282,7 @@ typedef enum SDL_EventType /** * Fields shared by every event * - * \since This struct is available since SDL 3.1.3. + * \since This struct is available since SDL 3.2.0. */ typedef struct SDL_CommonEvent { @@ -294,7 +294,7 @@ typedef struct SDL_CommonEvent /** * Display state change event data (event.display.*) * - * \since This struct is available since SDL 3.1.3. + * \since This struct is available since SDL 3.2.0. */ typedef struct SDL_DisplayEvent { @@ -309,7 +309,7 @@ typedef struct SDL_DisplayEvent /** * Window state change event data (event.window.*) * - * \since This struct is available since SDL 3.1.3. + * \since This struct is available since SDL 3.2.0. */ typedef struct SDL_WindowEvent { @@ -324,7 +324,7 @@ typedef struct SDL_WindowEvent /** * Keyboard device event structure (event.kdevice.*) * - * \since This struct is available since SDL 3.1.3. + * \since This struct is available since SDL 3.2.0. */ typedef struct SDL_KeyboardDeviceEvent { @@ -343,7 +343,7 @@ typedef struct SDL_KeyboardDeviceEvent * event scancode and modifiers directly from the keyboard layout, bypassing * SDL_HINT_KEYCODE_OPTIONS, by calling SDL_GetKeyFromScancode(). * - * \since This struct is available since SDL 3.1.3. + * \since This struct is available since SDL 3.2.0. * * \sa SDL_GetKeyFromScancode * \sa SDL_HINT_KEYCODE_OPTIONS @@ -370,7 +370,7 @@ typedef struct SDL_KeyboardEvent * will be inserted into the editing text. The length is the number of UTF-8 * characters that will be replaced by new typing. * - * \since This struct is available since SDL 3.1.3. + * \since This struct is available since SDL 3.2.0. */ typedef struct SDL_TextEditingEvent { @@ -386,7 +386,7 @@ typedef struct SDL_TextEditingEvent /** * Keyboard IME candidates event structure (event.edit_candidates.*) * - * \since This struct is available since SDL 3.1.3. + * \since This struct is available since SDL 3.2.0. */ typedef struct SDL_TextEditingCandidatesEvent { @@ -409,7 +409,7 @@ typedef struct SDL_TextEditingCandidatesEvent * This event will never be delivered unless text input is enabled by calling * SDL_StartTextInput(). Text input is disabled by default! * - * \since This struct is available since SDL 3.1.3. + * \since This struct is available since SDL 3.2.0. * * \sa SDL_StartTextInput * \sa SDL_StopTextInput @@ -426,7 +426,7 @@ typedef struct SDL_TextInputEvent /** * Mouse device event structure (event.mdevice.*) * - * \since This struct is available since SDL 3.1.3. + * \since This struct is available since SDL 3.2.0. */ typedef struct SDL_MouseDeviceEvent { @@ -439,7 +439,7 @@ typedef struct SDL_MouseDeviceEvent /** * Mouse motion event structure (event.motion.*) * - * \since This struct is available since SDL 3.1.3. + * \since This struct is available since SDL 3.2.0. */ typedef struct SDL_MouseMotionEvent { @@ -458,7 +458,7 @@ typedef struct SDL_MouseMotionEvent /** * Mouse button event structure (event.button.*) * - * \since This struct is available since SDL 3.1.3. + * \since This struct is available since SDL 3.2.0. */ typedef struct SDL_MouseButtonEvent { @@ -478,7 +478,7 @@ typedef struct SDL_MouseButtonEvent /** * Mouse wheel event structure (event.wheel.*) * - * \since This struct is available since SDL 3.1.3. + * \since This struct is available since SDL 3.2.0. */ typedef struct SDL_MouseWheelEvent { @@ -497,7 +497,7 @@ typedef struct SDL_MouseWheelEvent /** * Joystick axis motion event structure (event.jaxis.*) * - * \since This struct is available since SDL 3.1.3. + * \since This struct is available since SDL 3.2.0. */ typedef struct SDL_JoyAxisEvent { @@ -516,7 +516,7 @@ typedef struct SDL_JoyAxisEvent /** * Joystick trackball motion event structure (event.jball.*) * - * \since This struct is available since SDL 3.1.3. + * \since This struct is available since SDL 3.2.0. */ typedef struct SDL_JoyBallEvent { @@ -535,7 +535,7 @@ typedef struct SDL_JoyBallEvent /** * Joystick hat position change event structure (event.jhat.*) * - * \since This struct is available since SDL 3.1.3. + * \since This struct is available since SDL 3.2.0. */ typedef struct SDL_JoyHatEvent { @@ -558,7 +558,7 @@ typedef struct SDL_JoyHatEvent /** * Joystick button event structure (event.jbutton.*) * - * \since This struct is available since SDL 3.1.3. + * \since This struct is available since SDL 3.2.0. */ typedef struct SDL_JoyButtonEvent { @@ -578,7 +578,7 @@ typedef struct SDL_JoyButtonEvent * SDL will send JOYSTICK_ADDED events for devices that are already plugged in * during SDL_Init. * - * \since This struct is available since SDL 3.1.3. + * \since This struct is available since SDL 3.2.0. * * \sa SDL_GamepadDeviceEvent */ @@ -593,7 +593,7 @@ typedef struct SDL_JoyDeviceEvent /** * Joystick battery level change event structure (event.jbattery.*) * - * \since This struct is available since SDL 3.1.3. + * \since This struct is available since SDL 3.2.0. */ typedef struct SDL_JoyBatteryEvent { @@ -608,7 +608,7 @@ typedef struct SDL_JoyBatteryEvent /** * Gamepad axis motion event structure (event.gaxis.*) * - * \since This struct is available since SDL 3.1.3. + * \since This struct is available since SDL 3.2.0. */ typedef struct SDL_GamepadAxisEvent { @@ -628,7 +628,7 @@ typedef struct SDL_GamepadAxisEvent /** * Gamepad button event structure (event.gbutton.*) * - * \since This struct is available since SDL 3.1.3. + * \since This struct is available since SDL 3.2.0. */ typedef struct SDL_GamepadButtonEvent { @@ -653,7 +653,7 @@ typedef struct SDL_GamepadButtonEvent * in during SDL_Init() and are recognized as gamepads. It will also send * events for joysticks that get gamepad mappings at runtime. * - * \since This struct is available since SDL 3.1.3. + * \since This struct is available since SDL 3.2.0. * * \sa SDL_JoyDeviceEvent */ @@ -668,7 +668,7 @@ typedef struct SDL_GamepadDeviceEvent /** * Gamepad touchpad event structure (event.gtouchpad.*) * - * \since This struct is available since SDL 3.1.3. + * \since This struct is available since SDL 3.2.0. */ typedef struct SDL_GamepadTouchpadEvent { @@ -686,7 +686,7 @@ typedef struct SDL_GamepadTouchpadEvent /** * Gamepad sensor event structure (event.gsensor.*) * - * \since This struct is available since SDL 3.1.3. + * \since This struct is available since SDL 3.2.0. */ typedef struct SDL_GamepadSensorEvent { @@ -702,7 +702,7 @@ typedef struct SDL_GamepadSensorEvent /** * Audio device event structure (event.adevice.*) * - * \since This struct is available since SDL 3.1.3. + * \since This struct is available since SDL 3.2.0. */ typedef struct SDL_AudioDeviceEvent { @@ -719,7 +719,7 @@ typedef struct SDL_AudioDeviceEvent /** * Camera device event structure (event.cdevice.*) * - * \since This struct is available since SDL 3.1.3. + * \since This struct is available since SDL 3.2.0. */ typedef struct SDL_CameraDeviceEvent { @@ -733,7 +733,7 @@ typedef struct SDL_CameraDeviceEvent /** * Renderer event structure (event.render.*) * - * \since This struct is available since SDL 3.1.7. + * \since This struct is available since SDL 3.2.0. */ typedef struct SDL_RenderEvent { @@ -761,7 +761,7 @@ typedef struct SDL_RenderEvent * report a touch outside of the window, which will also be outside of the * range. * - * \since This struct is available since SDL 3.1.3. + * \since This struct is available since SDL 3.2.0. */ typedef struct SDL_TouchFingerEvent { @@ -791,7 +791,7 @@ typedef struct SDL_TouchFingerEvent * is there." The pen touching and lifting off from the tablet while not * leaving the area are handled by SDL_EVENT_PEN_DOWN and SDL_EVENT_PEN_UP. * - * \since This struct is available since SDL 3.1.3. + * \since This struct is available since SDL 3.2.0. */ typedef struct SDL_PenProximityEvent { @@ -811,7 +811,7 @@ typedef struct SDL_PenProximityEvent * `pen_state & SDL_PEN_INPUT_DOWN` to decide if a pen is "drawing" when * dealing with pen motion. * - * \since This struct is available since SDL 3.1.3. + * \since This struct is available since SDL 3.2.0. */ typedef struct SDL_PenMotionEvent { @@ -831,7 +831,7 @@ typedef struct SDL_PenMotionEvent * These events come when a pen touches a surface (a tablet, etc), or lifts * off from one. * - * \since This struct is available since SDL 3.1.3. + * \since This struct is available since SDL 3.2.0. */ typedef struct SDL_PenTouchEvent { @@ -853,7 +853,7 @@ typedef struct SDL_PenTouchEvent * This is for buttons on the pen itself that the user might click. The pen * itself pressing down to draw triggers a SDL_EVENT_PEN_DOWN event instead. * - * \since This struct is available since SDL 3.1.3. + * \since This struct is available since SDL 3.2.0. */ typedef struct SDL_PenButtonEvent { @@ -875,7 +875,7 @@ typedef struct SDL_PenButtonEvent * You might get some of these events even if the pen isn't touching the * tablet. * - * \since This struct is available since SDL 3.1.3. + * \since This struct is available since SDL 3.2.0. */ typedef struct SDL_PenAxisEvent { @@ -895,7 +895,7 @@ typedef struct SDL_PenAxisEvent * An event used to drop text or request a file open by the system * (event.drop.*) * - * \since This struct is available since SDL 3.1.3. + * \since This struct is available since SDL 3.2.0. */ typedef struct SDL_DropEvent { @@ -913,7 +913,7 @@ typedef struct SDL_DropEvent * An event triggered when the clipboard contents have changed * (event.clipboard.*) * - * \since This struct is available since SDL 3.1.3. + * \since This struct is available since SDL 3.2.0. */ typedef struct SDL_ClipboardEvent { @@ -928,7 +928,7 @@ typedef struct SDL_ClipboardEvent /** * Sensor event structure (event.sensor.*) * - * \since This struct is available since SDL 3.1.3. + * \since This struct is available since SDL 3.2.0. */ typedef struct SDL_SensorEvent { @@ -943,7 +943,7 @@ typedef struct SDL_SensorEvent /** * The "quit requested" event * - * \since This struct is available since SDL 3.1.3. + * \since This struct is available since SDL 3.2.0. */ typedef struct SDL_QuitEvent { @@ -961,7 +961,7 @@ typedef struct SDL_QuitEvent * the programmer; the only requirement is that '''type''' is a value obtained * from SDL_RegisterEvents(). * - * \since This struct is available since SDL 3.1.3. + * \since This struct is available since SDL 3.2.0. */ typedef struct SDL_UserEvent { @@ -981,7 +981,7 @@ typedef struct SDL_UserEvent * The SDL_Event structure is the core of all event handling in SDL. SDL_Event * is a union of all event structures used in SDL. * - * \since This struct is available since SDL 3.1.3. + * \since This struct is available since SDL 3.2.0. */ typedef union SDL_Event { @@ -1061,7 +1061,7 @@ SDL_COMPILE_TIME_ASSERT(SDL_Event, sizeof(SDL_Event) == sizeof(((SDL_Event *)NUL * * \threadsafety This function should only be called on the main thread. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_PollEvent * \sa SDL_WaitEvent @@ -1073,7 +1073,7 @@ extern SDL_DECLSPEC void SDLCALL SDL_PumpEvents(void); /** * The type of action to request from SDL_PeepEvents(). * - * \since This enum is available since SDL 3.1.3. + * \since This enum is available since SDL 3.2.0. */ typedef enum SDL_EventAction { @@ -1118,7 +1118,7 @@ typedef enum SDL_EventAction * * \threadsafety It is safe to call this function from any thread. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_PollEvent * \sa SDL_PumpEvents @@ -1139,7 +1139,7 @@ extern SDL_DECLSPEC int SDLCALL SDL_PeepEvents(SDL_Event *events, int numevents, * * \threadsafety It is safe to call this function from any thread. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_HasEvents */ @@ -1160,7 +1160,7 @@ extern SDL_DECLSPEC bool SDLCALL SDL_HasEvent(Uint32 type); * * \threadsafety It is safe to call this function from any thread. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_HasEvents */ @@ -1188,7 +1188,7 @@ extern SDL_DECLSPEC bool SDLCALL SDL_HasEvents(Uint32 minType, Uint32 maxType); * * \threadsafety It is safe to call this function from any thread. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_FlushEvents */ @@ -1215,7 +1215,7 @@ extern SDL_DECLSPEC void SDLCALL SDL_FlushEvent(Uint32 type); * * \threadsafety It is safe to call this function from any thread. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_FlushEvent */ @@ -1259,7 +1259,7 @@ extern SDL_DECLSPEC void SDLCALL SDL_FlushEvents(Uint32 minType, Uint32 maxType) * * \threadsafety This function should only be called on the main thread. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_PushEvent * \sa SDL_WaitEvent @@ -1283,7 +1283,7 @@ extern SDL_DECLSPEC bool SDLCALL SDL_PollEvent(SDL_Event *event); * * \threadsafety This function should only be called on the main thread. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_PollEvent * \sa SDL_PushEvent @@ -1313,7 +1313,7 @@ extern SDL_DECLSPEC bool SDLCALL SDL_WaitEvent(SDL_Event *event); * * \threadsafety This function should only be called on the main thread. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_PollEvent * \sa SDL_PushEvent @@ -1347,7 +1347,7 @@ extern SDL_DECLSPEC bool SDLCALL SDL_WaitEventTimeout(SDL_Event *event, Sint32 t * * \threadsafety It is safe to call this function from any thread. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_PeepEvents * \sa SDL_PollEvent @@ -1369,7 +1369,7 @@ extern SDL_DECLSPEC bool SDLCALL SDL_PushEvent(SDL_Event *event); * application is responsible for locking resources the callback * touches that need to be protected. * - * \since This datatype is available since SDL 3.1.3. + * \since This datatype is available since SDL 3.2.0. * * \sa SDL_SetEventFilter * \sa SDL_AddEventWatch @@ -1407,7 +1407,7 @@ typedef bool (SDLCALL *SDL_EventFilter)(void *userdata, SDL_Event *event); * * \threadsafety It is safe to call this function from any thread. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_AddEventWatch * \sa SDL_SetEventEnabled @@ -1430,7 +1430,7 @@ extern SDL_DECLSPEC void SDLCALL SDL_SetEventFilter(SDL_EventFilter filter, void * * \threadsafety It is safe to call this function from any thread. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_SetEventFilter */ @@ -1461,7 +1461,7 @@ extern SDL_DECLSPEC bool SDLCALL SDL_GetEventFilter(SDL_EventFilter *filter, voi * * \threadsafety It is safe to call this function from any thread. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_RemoveEventWatch * \sa SDL_SetEventFilter @@ -1479,7 +1479,7 @@ extern SDL_DECLSPEC bool SDLCALL SDL_AddEventWatch(SDL_EventFilter filter, void * * \threadsafety It is safe to call this function from any thread. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_AddEventWatch */ @@ -1498,7 +1498,7 @@ extern SDL_DECLSPEC void SDLCALL SDL_RemoveEventWatch(SDL_EventFilter filter, vo * * \threadsafety It is safe to call this function from any thread. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_GetEventFilter * \sa SDL_SetEventFilter @@ -1513,7 +1513,7 @@ extern SDL_DECLSPEC void SDLCALL SDL_FilterEvents(SDL_EventFilter filter, void * * * \threadsafety It is safe to call this function from any thread. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_EventEnabled */ @@ -1527,7 +1527,7 @@ extern SDL_DECLSPEC void SDLCALL SDL_SetEventEnabled(Uint32 type, bool enabled); * * \threadsafety It is safe to call this function from any thread. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_SetEventEnabled */ @@ -1543,7 +1543,7 @@ extern SDL_DECLSPEC bool SDLCALL SDL_EventEnabled(Uint32 type); * * \threadsafety It is safe to call this function from any thread. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_PushEvent */ @@ -1557,7 +1557,7 @@ extern SDL_DECLSPEC Uint32 SDLCALL SDL_RegisterEvents(int numevents); * * \threadsafety It is safe to call this function from any thread. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_PollEvent * \sa SDL_WaitEvent diff --git a/include/SDL3/SDL_filesystem.h b/include/SDL3/SDL_filesystem.h index 81366842617ca..af3ca27e02199 100644 --- a/include/SDL3/SDL_filesystem.h +++ b/include/SDL3/SDL_filesystem.h @@ -89,7 +89,7 @@ extern "C" { * doesn't implement this functionality, call SDL_GetError() for more * information. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_GetPrefPath */ @@ -144,7 +144,7 @@ extern SDL_DECLSPEC const char * SDLCALL SDL_GetBasePath(void); * etc.). This should be freed with SDL_free() when it is no longer * needed. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_GetBasePath */ @@ -175,7 +175,7 @@ extern SDL_DECLSPEC char * SDLCALL SDL_GetPrefPath(const char *org, const char * * * Note that on macOS/iOS, the Videos folder is called "Movies". * - * \since This enum is available since SDL 3.1.3. + * \since This enum is available since SDL 3.2.0. * * \sa SDL_GetUserFolder */ @@ -216,7 +216,7 @@ typedef enum SDL_Folder * \returns either a null-terminated C string containing the full path to the * folder, or NULL if an error happened. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. */ extern SDL_DECLSPEC const char * SDLCALL SDL_GetUserFolder(SDL_Folder folder); @@ -230,7 +230,7 @@ extern SDL_DECLSPEC const char * SDLCALL SDL_GetUserFolder(SDL_Folder folder); * symlinks, named pipes, etc. They are currently reported as * SDL_PATHTYPE_OTHER. * - * \since This enum is available since SDL 3.1.3. + * \since This enum is available since SDL 3.2.0. * * \sa SDL_PathInfo */ @@ -245,7 +245,7 @@ typedef enum SDL_PathType /** * Information about a path on the filesystem. * - * \since This datatype is available since SDL 3.1.3. + * \since This datatype is available since SDL 3.2.0. * * \sa SDL_GetPathInfo * \sa SDL_GetStoragePathInfo @@ -262,7 +262,7 @@ typedef struct SDL_PathInfo /** * Flags for path matching. * - * \since This datatype is available since SDL 3.1.3. + * \since This datatype is available since SDL 3.2.0. * * \sa SDL_GlobDirectory * \sa SDL_GlobStorageDirectory @@ -283,14 +283,14 @@ typedef Uint32 SDL_GlobFlags; * \returns true on success or false on failure; call SDL_GetError() for more * information. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. */ extern SDL_DECLSPEC bool SDLCALL SDL_CreateDirectory(const char *path); /** * Possible results from an enumeration callback. * - * \since This enum is available since SDL 3.1.3. + * \since This enum is available since SDL 3.2.0. * * \sa SDL_EnumerateDirectoryCallback */ @@ -321,7 +321,7 @@ typedef enum SDL_EnumerationResult * \param fname the next entry in the enumeration. * \returns how the enumeration should proceed. * - * \since This datatype is available since SDL 3.1.3. + * \since This datatype is available since SDL 3.2.0. * * \sa SDL_EnumerateDirectory */ @@ -346,7 +346,7 @@ typedef SDL_EnumerationResult (SDLCALL *SDL_EnumerateDirectoryCallback)(void *us * \returns true on success or false on failure; call SDL_GetError() for more * information. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. */ extern SDL_DECLSPEC bool SDLCALL SDL_EnumerateDirectory(const char *path, SDL_EnumerateDirectoryCallback callback, void *userdata); @@ -360,7 +360,7 @@ extern SDL_DECLSPEC bool SDLCALL SDL_EnumerateDirectory(const char *path, SDL_En * \returns true on success or false on failure; call SDL_GetError() for more * information. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. */ extern SDL_DECLSPEC bool SDLCALL SDL_RemovePath(const char *path); @@ -383,7 +383,7 @@ extern SDL_DECLSPEC bool SDLCALL SDL_RemovePath(const char *path); * \returns true on success or false on failure; call SDL_GetError() for more * information. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. */ extern SDL_DECLSPEC bool SDLCALL SDL_RenamePath(const char *oldpath, const char *newpath); @@ -423,7 +423,7 @@ extern SDL_DECLSPEC bool SDLCALL SDL_RenamePath(const char *oldpath, const char * \returns true on success or false on failure; call SDL_GetError() for more * information. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. */ extern SDL_DECLSPEC bool SDLCALL SDL_CopyFile(const char *oldpath, const char *newpath); @@ -436,7 +436,7 @@ extern SDL_DECLSPEC bool SDLCALL SDL_CopyFile(const char *oldpath, const char *n * \returns true on success or false if the file doesn't exist, or another * failure; call SDL_GetError() for more information. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. */ extern SDL_DECLSPEC bool SDLCALL SDL_GetPathInfo(const char *path, SDL_PathInfo *info); @@ -469,7 +469,7 @@ extern SDL_DECLSPEC bool SDLCALL SDL_GetPathInfo(const char *path, SDL_PathInfo * * \threadsafety It is safe to call this function from any thread. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. */ extern SDL_DECLSPEC char ** SDLCALL SDL_GlobDirectory(const char *path, const char *pattern, SDL_GlobFlags flags, int *count); @@ -490,7 +490,7 @@ extern SDL_DECLSPEC char ** SDLCALL SDL_GlobDirectory(const char *path, const ch * platform-dependent notation. NULL if there's a problem. This * should be freed with SDL_free() when it is no longer needed. * - * \since This function is available since SDL 3.1.8. + * \since This function is available since SDL 3.2.0. */ extern SDL_DECLSPEC char * SDLCALL SDL_GetCurrentDirectory(void); diff --git a/include/SDL3/SDL_gamepad.h b/include/SDL3/SDL_gamepad.h index 60f98e25199d9..264f763b28e9d 100644 --- a/include/SDL3/SDL_gamepad.h +++ b/include/SDL3/SDL_gamepad.h @@ -92,7 +92,7 @@ extern "C" { /** * The structure used to identify an SDL gamepad * - * \since This struct is available since SDL 3.1.3. + * \since This struct is available since SDL 3.2.0. */ typedef struct SDL_Gamepad SDL_Gamepad; @@ -142,7 +142,7 @@ typedef enum SDL_GamepadType * You can query the labels for the face buttons using * SDL_GetGamepadButtonLabel() * - * \since This enum is available since SDL 3.1.3. + * \since This enum is available since SDL 3.2.0. */ typedef enum SDL_GamepadButton { @@ -185,7 +185,7 @@ typedef enum SDL_GamepadButton * For a complete set, you should look at the button and gamepad type and have * a set of symbols that work well with your art style. * - * \since This enum is available since SDL 3.1.3. + * \since This enum is available since SDL 3.2.0. */ typedef enum SDL_GamepadButtonLabel { @@ -212,7 +212,7 @@ typedef enum SDL_GamepadButtonLabel * pressed) when reported by SDL_GetGamepadAxis(). Note that this is not the * same range that will be reported by the lower-level SDL_GetJoystickAxis(). * - * \since This enum is available since SDL 3.1.3. + * \since This enum is available since SDL 3.2.0. */ typedef enum SDL_GamepadAxis { @@ -234,7 +234,7 @@ typedef enum SDL_GamepadAxis * gamepad. This enum is used as part of SDL_GamepadBinding to specify those * mappings. * - * \since This enum is available since SDL 3.1.3. + * \since This enum is available since SDL 3.2.0. */ typedef enum SDL_GamepadBindingType { @@ -255,7 +255,7 @@ typedef enum SDL_GamepadBindingType * more with a simple text string. Those strings are parsed into a collection * of these structs to make it easier to operate on the data. * - * \since This struct is available since SDL 3.1.3. + * \since This struct is available since SDL 3.2.0. * * \sa SDL_GetGamepadBindings */ @@ -328,7 +328,7 @@ typedef struct SDL_GamepadBinding * * \threadsafety It is safe to call this function from any thread. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_AddGamepadMappingsFromFile * \sa SDL_AddGamepadMappingsFromIO @@ -368,7 +368,7 @@ extern SDL_DECLSPEC int SDLCALL SDL_AddGamepadMapping(const char *mapping); * * \threadsafety It is safe to call this function from any thread. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_AddGamepadMapping * \sa SDL_AddGamepadMappingsFromFile @@ -402,7 +402,7 @@ extern SDL_DECLSPEC int SDLCALL SDL_AddGamepadMappingsFromIO(SDL_IOStream *src, * * \threadsafety It is safe to call this function from any thread. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_AddGamepadMapping * \sa SDL_AddGamepadMappingsFromIO @@ -422,7 +422,7 @@ extern SDL_DECLSPEC int SDLCALL SDL_AddGamepadMappingsFromFile(const char *file) * \returns true on success or false on failure; call SDL_GetError() for more * information. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. */ extern SDL_DECLSPEC bool SDLCALL SDL_ReloadGamepadMappings(void); @@ -436,7 +436,7 @@ extern SDL_DECLSPEC bool SDLCALL SDL_ReloadGamepadMappings(void); * single allocation that should be freed with SDL_free() when it is * no longer needed. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. */ extern SDL_DECLSPEC char ** SDLCALL SDL_GetGamepadMappings(int *count); @@ -448,7 +448,7 @@ extern SDL_DECLSPEC char ** SDLCALL SDL_GetGamepadMappings(int *count); * information. This should be freed with SDL_free() when it is no * longer needed. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_GetJoystickGUIDForID * \sa SDL_GetJoystickGUID @@ -465,7 +465,7 @@ extern SDL_DECLSPEC char * SDLCALL SDL_GetGamepadMappingForGUID(SDL_GUID guid); * available; call SDL_GetError() for more information. This should * be freed with SDL_free() when it is no longer needed. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_AddGamepadMapping * \sa SDL_GetGamepadMappingForID @@ -485,7 +485,7 @@ extern SDL_DECLSPEC char * SDLCALL SDL_GetGamepadMapping(SDL_Gamepad *gamepad); * \returns true on success or false on failure; call SDL_GetError() for more * information. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_AddGamepadMapping * \sa SDL_GetGamepadMapping @@ -497,7 +497,7 @@ extern SDL_DECLSPEC bool SDLCALL SDL_SetGamepadMapping(SDL_JoystickID instance_i * * \returns true if a gamepad is connected, false otherwise. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_GetGamepads */ @@ -512,7 +512,7 @@ extern SDL_DECLSPEC bool SDLCALL SDL_HasGamepad(void); * call SDL_GetError() for more information. This should be freed * with SDL_free() when it is no longer needed. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_HasGamepad * \sa SDL_OpenGamepad @@ -526,7 +526,7 @@ extern SDL_DECLSPEC SDL_JoystickID * SDLCALL SDL_GetGamepads(int *count); * \returns true if the given joystick is supported by the gamepad interface, * false if it isn't or it's an invalid index. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_GetJoysticks * \sa SDL_OpenGamepad @@ -542,7 +542,7 @@ extern SDL_DECLSPEC bool SDLCALL SDL_IsGamepad(SDL_JoystickID instance_id); * \returns the name of the selected gamepad. If no name can be found, this * function returns NULL; call SDL_GetError() for more information. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_GetGamepadName * \sa SDL_GetGamepads @@ -558,7 +558,7 @@ extern SDL_DECLSPEC const char * SDLCALL SDL_GetGamepadNameForID(SDL_JoystickID * \returns the path of the selected gamepad. If no path can be found, this * function returns NULL; call SDL_GetError() for more information. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_GetGamepadPath * \sa SDL_GetGamepads @@ -573,7 +573,7 @@ extern SDL_DECLSPEC const char * SDLCALL SDL_GetGamepadPathForID(SDL_JoystickID * \param instance_id the joystick instance ID. * \returns the player index of a gamepad, or -1 if it's not available. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_GetGamepadPlayerIndex * \sa SDL_GetGamepads @@ -589,7 +589,7 @@ extern SDL_DECLSPEC int SDLCALL SDL_GetGamepadPlayerIndexForID(SDL_JoystickID in * \returns the GUID of the selected gamepad. If called on an invalid index, * this function returns a zero GUID. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_GUIDToString * \sa SDL_GetGamepads @@ -606,7 +606,7 @@ extern SDL_DECLSPEC SDL_GUID SDLCALL SDL_GetGamepadGUIDForID(SDL_JoystickID inst * \returns the USB vendor ID of the selected gamepad. If called on an invalid * index, this function returns zero. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_GetGamepadVendor * \sa SDL_GetGamepads @@ -623,7 +623,7 @@ extern SDL_DECLSPEC Uint16 SDLCALL SDL_GetGamepadVendorForID(SDL_JoystickID inst * \returns the USB product ID of the selected gamepad. If called on an * invalid index, this function returns zero. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_GetGamepadProduct * \sa SDL_GetGamepads @@ -640,7 +640,7 @@ extern SDL_DECLSPEC Uint16 SDLCALL SDL_GetGamepadProductForID(SDL_JoystickID ins * \returns the product version of the selected gamepad. If called on an * invalid index, this function returns zero. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_GetGamepadProductVersion * \sa SDL_GetGamepads @@ -655,7 +655,7 @@ extern SDL_DECLSPEC Uint16 SDLCALL SDL_GetGamepadProductVersionForID(SDL_Joystic * \param instance_id the joystick instance ID. * \returns the gamepad type. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_GetGamepadType * \sa SDL_GetGamepads @@ -671,7 +671,7 @@ extern SDL_DECLSPEC SDL_GamepadType SDLCALL SDL_GetGamepadTypeForID(SDL_Joystick * \param instance_id the joystick instance ID. * \returns the gamepad type. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_GetGamepadTypeForID * \sa SDL_GetGamepads @@ -688,7 +688,7 @@ extern SDL_DECLSPEC SDL_GamepadType SDLCALL SDL_GetRealGamepadTypeForID(SDL_Joys * \returns the mapping string. Returns NULL if no mapping is available. This * should be freed with SDL_free() when it is no longer needed. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_GetGamepads * \sa SDL_GetGamepadMapping @@ -702,7 +702,7 @@ extern SDL_DECLSPEC char * SDLCALL SDL_GetGamepadMappingForID(SDL_JoystickID ins * \returns a gamepad identifier or NULL if an error occurred; call * SDL_GetError() for more information. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_CloseGamepad * \sa SDL_IsGamepad @@ -717,7 +717,7 @@ extern SDL_DECLSPEC SDL_Gamepad * SDLCALL SDL_OpenGamepad(SDL_JoystickID instanc * \returns an SDL_Gamepad on success or NULL on failure or if it hasn't been * opened yet; call SDL_GetError() for more information. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. */ extern SDL_DECLSPEC SDL_Gamepad * SDLCALL SDL_GetGamepadFromID(SDL_JoystickID instance_id); @@ -727,7 +727,7 @@ extern SDL_DECLSPEC SDL_Gamepad * SDLCALL SDL_GetGamepadFromID(SDL_JoystickID in * \param player_index the player index, which different from the instance ID. * \returns the SDL_Gamepad associated with a player index. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_GetGamepadPlayerIndex * \sa SDL_SetGamepadPlayerIndex @@ -757,7 +757,7 @@ extern SDL_DECLSPEC SDL_Gamepad * SDLCALL SDL_GetGamepadFromPlayerIndex(int play * \returns a valid property ID on success or 0 on failure; call * SDL_GetError() for more information. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. */ extern SDL_DECLSPEC SDL_PropertiesID SDLCALL SDL_GetGamepadProperties(SDL_Gamepad *gamepad); @@ -775,7 +775,7 @@ extern SDL_DECLSPEC SDL_PropertiesID SDLCALL SDL_GetGamepadProperties(SDL_Gamepa * \returns the instance ID of the specified gamepad on success or 0 on * failure; call SDL_GetError() for more information. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. */ extern SDL_DECLSPEC SDL_JoystickID SDLCALL SDL_GetGamepadID(SDL_Gamepad *gamepad); @@ -787,7 +787,7 @@ extern SDL_DECLSPEC SDL_JoystickID SDLCALL SDL_GetGamepadID(SDL_Gamepad *gamepad * \returns the implementation dependent name for the gamepad, or NULL if * there is no name or the identifier passed is invalid. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_GetGamepadNameForID */ @@ -801,7 +801,7 @@ extern SDL_DECLSPEC const char * SDLCALL SDL_GetGamepadName(SDL_Gamepad *gamepad * \returns the implementation dependent path for the gamepad, or NULL if * there is no path or the identifier passed is invalid. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_GetGamepadPathForID */ @@ -814,7 +814,7 @@ extern SDL_DECLSPEC const char * SDLCALL SDL_GetGamepadPath(SDL_Gamepad *gamepad * \returns the gamepad type, or SDL_GAMEPAD_TYPE_UNKNOWN if it's not * available. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_GetGamepadTypeForID */ @@ -827,7 +827,7 @@ extern SDL_DECLSPEC SDL_GamepadType SDLCALL SDL_GetGamepadType(SDL_Gamepad *game * \returns the gamepad type, or SDL_GAMEPAD_TYPE_UNKNOWN if it's not * available. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_GetRealGamepadTypeForID */ @@ -841,7 +841,7 @@ extern SDL_DECLSPEC SDL_GamepadType SDLCALL SDL_GetRealGamepadType(SDL_Gamepad * * \param gamepad the gamepad object to query. * \returns the player index for gamepad, or -1 if it's not available. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_SetGamepadPlayerIndex */ @@ -856,7 +856,7 @@ extern SDL_DECLSPEC int SDLCALL SDL_GetGamepadPlayerIndex(SDL_Gamepad *gamepad); * \returns true on success or false on failure; call SDL_GetError() for more * information. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_GetGamepadPlayerIndex */ @@ -870,7 +870,7 @@ extern SDL_DECLSPEC bool SDLCALL SDL_SetGamepadPlayerIndex(SDL_Gamepad *gamepad, * \param gamepad the gamepad object to query. * \returns the USB vendor ID, or zero if unavailable. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_GetGamepadVendorForID */ @@ -884,7 +884,7 @@ extern SDL_DECLSPEC Uint16 SDLCALL SDL_GetGamepadVendor(SDL_Gamepad *gamepad); * \param gamepad the gamepad object to query. * \returns the USB product ID, or zero if unavailable. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_GetGamepadProductForID */ @@ -898,7 +898,7 @@ extern SDL_DECLSPEC Uint16 SDLCALL SDL_GetGamepadProduct(SDL_Gamepad *gamepad); * \param gamepad the gamepad object to query. * \returns the USB product version, or zero if unavailable. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_GetGamepadProductVersionForID */ @@ -912,7 +912,7 @@ extern SDL_DECLSPEC Uint16 SDLCALL SDL_GetGamepadProductVersion(SDL_Gamepad *gam * \param gamepad the gamepad object to query. * \returns the gamepad firmware version, or zero if unavailable. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. */ extern SDL_DECLSPEC Uint16 SDLCALL SDL_GetGamepadFirmwareVersion(SDL_Gamepad *gamepad); @@ -924,7 +924,7 @@ extern SDL_DECLSPEC Uint16 SDLCALL SDL_GetGamepadFirmwareVersion(SDL_Gamepad *ga * \param gamepad the gamepad object to query. * \returns the serial number, or NULL if unavailable. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. */ extern SDL_DECLSPEC const char * SDLCALL SDL_GetGamepadSerial(SDL_Gamepad *gamepad); @@ -937,7 +937,7 @@ extern SDL_DECLSPEC const char * SDLCALL SDL_GetGamepadSerial(SDL_Gamepad *gamep * \param gamepad the gamepad object to query. * \returns the gamepad handle, or 0 if unavailable. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. */ extern SDL_DECLSPEC Uint64 SDLCALL SDL_GetGamepadSteamHandle(SDL_Gamepad *gamepad); @@ -949,7 +949,7 @@ extern SDL_DECLSPEC Uint64 SDLCALL SDL_GetGamepadSteamHandle(SDL_Gamepad *gamepa * `SDL_JOYSTICK_CONNECTION_INVALID` on failure; call SDL_GetError() * for more information. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. */ extern SDL_DECLSPEC SDL_JoystickConnectionState SDLCALL SDL_GetGamepadConnectionState(SDL_Gamepad *gamepad); @@ -969,7 +969,7 @@ extern SDL_DECLSPEC SDL_JoystickConnectionState SDLCALL SDL_GetGamepadConnection * battery. * \returns the current battery state. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. */ extern SDL_DECLSPEC SDL_PowerState SDLCALL SDL_GetGamepadPowerInfo(SDL_Gamepad *gamepad, int *percent); @@ -981,7 +981,7 @@ extern SDL_DECLSPEC SDL_PowerState SDLCALL SDL_GetGamepadPowerInfo(SDL_Gamepad * * \returns true if the gamepad has been opened and is currently connected, or * false if not. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. */ extern SDL_DECLSPEC bool SDLCALL SDL_GamepadConnected(SDL_Gamepad *gamepad); @@ -1001,7 +1001,7 @@ extern SDL_DECLSPEC bool SDLCALL SDL_GamepadConnected(SDL_Gamepad *gamepad); * \returns an SDL_Joystick object, or NULL on failure; call SDL_GetError() * for more information. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. */ extern SDL_DECLSPEC SDL_Joystick * SDLCALL SDL_GetGamepadJoystick(SDL_Gamepad *gamepad); @@ -1013,7 +1013,7 @@ extern SDL_DECLSPEC SDL_Joystick * SDLCALL SDL_GetGamepadJoystick(SDL_Gamepad *g * * \param enabled whether to process gamepad events or not. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_GamepadEventsEnabled * \sa SDL_UpdateGamepads @@ -1028,7 +1028,7 @@ extern SDL_DECLSPEC void SDLCALL SDL_SetGamepadEventsEnabled(bool enabled); * * \returns true if gamepad events are being processed, false otherwise. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_SetGamepadEventsEnabled */ @@ -1044,7 +1044,7 @@ extern SDL_DECLSPEC bool SDLCALL SDL_GamepadEventsEnabled(void); * single allocation that should be freed with SDL_free() when it is * no longer needed. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. */ extern SDL_DECLSPEC SDL_GamepadBinding ** SDLCALL SDL_GetGamepadBindings(SDL_Gamepad *gamepad, int *count); @@ -1055,7 +1055,7 @@ extern SDL_DECLSPEC SDL_GamepadBinding ** SDLCALL SDL_GetGamepadBindings(SDL_Gam * enabled. Under such circumstances, it will not be necessary to call this * function. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. */ extern SDL_DECLSPEC void SDLCALL SDL_UpdateGamepads(void); @@ -1071,7 +1071,7 @@ extern SDL_DECLSPEC void SDLCALL SDL_UpdateGamepads(void); * \returns the SDL_GamepadType enum corresponding to the input string, or * `SDL_GAMEPAD_TYPE_UNKNOWN` if no match was found. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_GetGamepadStringForType */ @@ -1085,7 +1085,7 @@ extern SDL_DECLSPEC SDL_GamepadType SDLCALL SDL_GetGamepadTypeFromString(const c * specified. The string returned is of the format used by * SDL_Gamepad mapping strings. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_GetGamepadTypeFromString */ @@ -1107,7 +1107,7 @@ extern SDL_DECLSPEC const char * SDLCALL SDL_GetGamepadStringForType(SDL_Gamepad * \returns the SDL_GamepadAxis enum corresponding to the input string, or * `SDL_GAMEPAD_AXIS_INVALID` if no match was found. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_GetGamepadStringForAxis */ @@ -1121,7 +1121,7 @@ extern SDL_DECLSPEC SDL_GamepadAxis SDLCALL SDL_GetGamepadAxisFromString(const c * specified. The string returned is of the format used by * SDL_Gamepad mapping strings. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_GetGamepadAxisFromString */ @@ -1137,7 +1137,7 @@ extern SDL_DECLSPEC const char * SDLCALL SDL_GetGamepadStringForAxis(SDL_Gamepad * \param axis an axis enum value (an SDL_GamepadAxis value). * \returns true if the gamepad has this axis, false otherwise. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_GamepadHasButton * \sa SDL_GetGamepadAxis @@ -1161,7 +1161,7 @@ extern SDL_DECLSPEC bool SDLCALL SDL_GamepadHasAxis(SDL_Gamepad *gamepad, SDL_Ga * \returns axis state (including 0) on success or 0 (also) on failure; call * SDL_GetError() for more information. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_GamepadHasAxis * \sa SDL_GetGamepadButton @@ -1180,7 +1180,7 @@ extern SDL_DECLSPEC Sint16 SDLCALL SDL_GetGamepadAxis(SDL_Gamepad *gamepad, SDL_ * \returns the SDL_GamepadButton enum corresponding to the input string, or * `SDL_GAMEPAD_BUTTON_INVALID` if no match was found. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_GetGamepadStringForButton */ @@ -1194,7 +1194,7 @@ extern SDL_DECLSPEC SDL_GamepadButton SDLCALL SDL_GetGamepadButtonFromString(con * specified. The string returned is of the format used by * SDL_Gamepad mapping strings. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_GetGamepadButtonFromString */ @@ -1210,7 +1210,7 @@ extern SDL_DECLSPEC const char * SDLCALL SDL_GetGamepadStringForButton(SDL_Gamep * \param button a button enum value (an SDL_GamepadButton value). * \returns true if the gamepad has this button, false otherwise. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_GamepadHasAxis */ @@ -1223,7 +1223,7 @@ extern SDL_DECLSPEC bool SDLCALL SDL_GamepadHasButton(SDL_Gamepad *gamepad, SDL_ * \param button a button index (one of the SDL_GamepadButton values). * \returns true if the button is pressed, false otherwise. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_GamepadHasButton * \sa SDL_GetGamepadAxis @@ -1237,7 +1237,7 @@ extern SDL_DECLSPEC bool SDLCALL SDL_GetGamepadButton(SDL_Gamepad *gamepad, SDL_ * \param button a button index (one of the SDL_GamepadButton values). * \returns the SDL_GamepadButtonLabel enum corresponding to the button label. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_GetGamepadButtonLabel */ @@ -1250,7 +1250,7 @@ extern SDL_DECLSPEC SDL_GamepadButtonLabel SDLCALL SDL_GetGamepadButtonLabelForT * \param button a button index (one of the SDL_GamepadButton values). * \returns the SDL_GamepadButtonLabel enum corresponding to the button label. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_GetGamepadButtonLabelForType */ @@ -1262,7 +1262,7 @@ extern SDL_DECLSPEC SDL_GamepadButtonLabel SDLCALL SDL_GetGamepadButtonLabel(SDL * \param gamepad a gamepad. * \returns number of touchpads. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_GetNumGamepadTouchpadFingers */ @@ -1276,7 +1276,7 @@ extern SDL_DECLSPEC int SDLCALL SDL_GetNumGamepadTouchpads(SDL_Gamepad *gamepad) * \param touchpad a touchpad. * \returns number of supported simultaneous fingers. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_GetGamepadTouchpadFinger * \sa SDL_GetNumGamepadTouchpads @@ -1299,7 +1299,7 @@ extern SDL_DECLSPEC int SDLCALL SDL_GetNumGamepadTouchpadFingers(SDL_Gamepad *ga * \returns true on success or false on failure; call SDL_GetError() for more * information. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_GetNumGamepadTouchpadFingers */ @@ -1312,7 +1312,7 @@ extern SDL_DECLSPEC bool SDLCALL SDL_GetGamepadTouchpadFinger(SDL_Gamepad *gamep * \param type the type of sensor to query. * \returns true if the sensor exists, false otherwise. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_GetGamepadSensorData * \sa SDL_GetGamepadSensorDataRate @@ -1329,7 +1329,7 @@ extern SDL_DECLSPEC bool SDLCALL SDL_GamepadHasSensor(SDL_Gamepad *gamepad, SDL_ * \returns true on success or false on failure; call SDL_GetError() for more * information. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_GamepadHasSensor * \sa SDL_GamepadSensorEnabled @@ -1343,7 +1343,7 @@ extern SDL_DECLSPEC bool SDLCALL SDL_SetGamepadSensorEnabled(SDL_Gamepad *gamepa * \param type the type of sensor to query. * \returns true if the sensor is enabled, false otherwise. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_SetGamepadSensorEnabled */ @@ -1356,7 +1356,7 @@ extern SDL_DECLSPEC bool SDLCALL SDL_GamepadSensorEnabled(SDL_Gamepad *gamepad, * \param type the type of sensor to query. * \returns the data rate, or 0.0f if the data rate is not available. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. */ extern SDL_DECLSPEC float SDLCALL SDL_GetGamepadSensorDataRate(SDL_Gamepad *gamepad, SDL_SensorType type); @@ -1373,7 +1373,7 @@ extern SDL_DECLSPEC float SDLCALL SDL_GetGamepadSensorDataRate(SDL_Gamepad *game * \returns true on success or false on failure; call SDL_GetError() for more * information. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. */ extern SDL_DECLSPEC bool SDLCALL SDL_GetGamepadSensorData(SDL_Gamepad *gamepad, SDL_SensorType type, float *data, int num_values); @@ -1395,7 +1395,7 @@ extern SDL_DECLSPEC bool SDLCALL SDL_GetGamepadSensorData(SDL_Gamepad *gamepad, * \returns true on success or false on failure; call SDL_GetError() for more * information. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. */ extern SDL_DECLSPEC bool SDLCALL SDL_RumbleGamepad(SDL_Gamepad *gamepad, Uint16 low_frequency_rumble, Uint16 high_frequency_rumble, Uint32 duration_ms); @@ -1421,7 +1421,7 @@ extern SDL_DECLSPEC bool SDLCALL SDL_RumbleGamepad(SDL_Gamepad *gamepad, Uint16 * \returns true on success or false on failure; call SDL_GetError() for more * information. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_RumbleGamepad */ @@ -1443,7 +1443,7 @@ extern SDL_DECLSPEC bool SDLCALL SDL_RumbleGamepadTriggers(SDL_Gamepad *gamepad, * \returns true on success or false on failure; call SDL_GetError() for more * information. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. */ extern SDL_DECLSPEC bool SDLCALL SDL_SetGamepadLED(SDL_Gamepad *gamepad, Uint8 red, Uint8 green, Uint8 blue); @@ -1456,7 +1456,7 @@ extern SDL_DECLSPEC bool SDLCALL SDL_SetGamepadLED(SDL_Gamepad *gamepad, Uint8 r * \returns true on success or false on failure; call SDL_GetError() for more * information. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. */ extern SDL_DECLSPEC bool SDLCALL SDL_SendGamepadEffect(SDL_Gamepad *gamepad, const void *data, int size); @@ -1466,7 +1466,7 @@ extern SDL_DECLSPEC bool SDLCALL SDL_SendGamepadEffect(SDL_Gamepad *gamepad, con * \param gamepad a gamepad identifier previously returned by * SDL_OpenGamepad(). * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_OpenGamepad */ @@ -1480,7 +1480,7 @@ extern SDL_DECLSPEC void SDLCALL SDL_CloseGamepad(SDL_Gamepad *gamepad); * \param button a button on the gamepad. * \returns the sfSymbolsName or NULL if the name can't be found. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_GetGamepadAppleSFSymbolsNameForAxis */ @@ -1493,7 +1493,7 @@ extern SDL_DECLSPEC const char * SDLCALL SDL_GetGamepadAppleSFSymbolsNameForButt * \param axis an axis on the gamepad. * \returns the sfSymbolsName or NULL if the name can't be found. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_GetGamepadAppleSFSymbolsNameForButton */ diff --git a/include/SDL3/SDL_gpu.h b/include/SDL3/SDL_gpu.h index 00e7b9ad8bb5e..1de755b85ee86 100644 --- a/include/SDL3/SDL_gpu.h +++ b/include/SDL3/SDL_gpu.h @@ -321,7 +321,7 @@ extern "C" { /** * An opaque handle representing the SDL_GPU context. * - * \since This struct is available since SDL 3.1.3 + * \since This struct is available since SDL 3.2.0 */ typedef struct SDL_GPUDevice SDL_GPUDevice; @@ -331,7 +331,7 @@ typedef struct SDL_GPUDevice SDL_GPUDevice; * Used for vertices, indices, indirect draw commands, and general compute * data. * - * \since This struct is available since SDL 3.1.3 + * \since This struct is available since SDL 3.2.0 * * \sa SDL_CreateGPUBuffer * \sa SDL_UploadToGPUBuffer @@ -354,7 +354,7 @@ typedef struct SDL_GPUBuffer SDL_GPUBuffer; * * Used for transferring data to and from the device. * - * \since This struct is available since SDL 3.1.3 + * \since This struct is available since SDL 3.2.0 * * \sa SDL_CreateGPUTransferBuffer * \sa SDL_MapGPUTransferBuffer @@ -370,7 +370,7 @@ typedef struct SDL_GPUTransferBuffer SDL_GPUTransferBuffer; /** * An opaque handle representing a texture. * - * \since This struct is available since SDL 3.1.3 + * \since This struct is available since SDL 3.2.0 * * \sa SDL_CreateGPUTexture * \sa SDL_UploadToGPUTexture @@ -390,7 +390,7 @@ typedef struct SDL_GPUTexture SDL_GPUTexture; /** * An opaque handle representing a sampler. * - * \since This struct is available since SDL 3.1.3 + * \since This struct is available since SDL 3.2.0 * * \sa SDL_CreateGPUSampler * \sa SDL_BindGPUVertexSamplers @@ -402,7 +402,7 @@ typedef struct SDL_GPUSampler SDL_GPUSampler; /** * An opaque handle representing a compiled shader object. * - * \since This struct is available since SDL 3.1.3 + * \since This struct is available since SDL 3.2.0 * * \sa SDL_CreateGPUShader * \sa SDL_CreateGPUGraphicsPipeline @@ -415,7 +415,7 @@ typedef struct SDL_GPUShader SDL_GPUShader; * * Used during compute passes. * - * \since This struct is available since SDL 3.1.3 + * \since This struct is available since SDL 3.2.0 * * \sa SDL_CreateGPUComputePipeline * \sa SDL_BindGPUComputePipeline @@ -428,7 +428,7 @@ typedef struct SDL_GPUComputePipeline SDL_GPUComputePipeline; * * Used during render passes. * - * \since This struct is available since SDL 3.1.3 + * \since This struct is available since SDL 3.2.0 * * \sa SDL_CreateGPUGraphicsPipeline * \sa SDL_BindGPUGraphicsPipeline @@ -453,7 +453,7 @@ typedef struct SDL_GPUGraphicsPipeline SDL_GPUGraphicsPipeline; * In multi-threading scenarios, you should only access a command buffer on * the thread you acquired it from. * - * \since This struct is available since SDL 3.1.3 + * \since This struct is available since SDL 3.2.0 * * \sa SDL_AcquireGPUCommandBuffer * \sa SDL_SubmitGPUCommandBuffer @@ -467,7 +467,7 @@ typedef struct SDL_GPUCommandBuffer SDL_GPUCommandBuffer; * This handle is transient and should not be held or referenced after * SDL_EndGPURenderPass is called. * - * \since This struct is available since SDL 3.1.3 + * \since This struct is available since SDL 3.2.0 * * \sa SDL_BeginGPURenderPass * \sa SDL_EndGPURenderPass @@ -480,7 +480,7 @@ typedef struct SDL_GPURenderPass SDL_GPURenderPass; * This handle is transient and should not be held or referenced after * SDL_EndGPUComputePass is called. * - * \since This struct is available since SDL 3.1.3 + * \since This struct is available since SDL 3.2.0 * * \sa SDL_BeginGPUComputePass * \sa SDL_EndGPUComputePass @@ -493,7 +493,7 @@ typedef struct SDL_GPUComputePass SDL_GPUComputePass; * This handle is transient and should not be held or referenced after * SDL_EndGPUCopyPass is called. * - * \since This struct is available since SDL 3.1.3 + * \since This struct is available since SDL 3.2.0 * * \sa SDL_BeginGPUCopyPass * \sa SDL_EndGPUCopyPass @@ -503,7 +503,7 @@ typedef struct SDL_GPUCopyPass SDL_GPUCopyPass; /** * An opaque handle representing a fence. * - * \since This struct is available since SDL 3.1.3 + * \since This struct is available since SDL 3.2.0 * * \sa SDL_SubmitGPUCommandBufferAndAcquireFence * \sa SDL_QueryGPUFence @@ -529,7 +529,7 @@ typedef struct SDL_GPUFence SDL_GPUFence; * topology for both compatibility and performance reasons. You WILL regret * using it. * - * \since This enum is available since SDL 3.1.3 + * \since This enum is available since SDL 3.2.0 * * \sa SDL_CreateGPUGraphicsPipeline */ @@ -546,7 +546,7 @@ typedef enum SDL_GPUPrimitiveType * Specifies how the contents of a texture attached to a render pass are * treated at the beginning of the render pass. * - * \since This enum is available since SDL 3.1.3 + * \since This enum is available since SDL 3.2.0 * * \sa SDL_BeginGPURenderPass */ @@ -561,7 +561,7 @@ typedef enum SDL_GPULoadOp * Specifies how the contents of a texture attached to a render pass are * treated at the end of the render pass. * - * \since This enum is available since SDL 3.1.3 + * \since This enum is available since SDL 3.2.0 * * \sa SDL_BeginGPURenderPass */ @@ -576,7 +576,7 @@ typedef enum SDL_GPUStoreOp /** * Specifies the size of elements in an index buffer. * - * \since This enum is available since SDL 3.1.3 + * \since This enum is available since SDL 3.2.0 * * \sa SDL_CreateGPUGraphicsPipeline */ @@ -666,7 +666,7 @@ typedef enum SDL_GPUIndexElementSize * Unless D16_UNORM is sufficient for your purposes, always check which of * D24/D32 is supported before creating a depth-stencil texture! * - * \since This enum is available since SDL 3.1.3 + * \since This enum is available since SDL 3.2.0 * * \sa SDL_CreateGPUTexture * \sa SDL_GPUTextureSupportsFormat @@ -812,7 +812,7 @@ typedef enum SDL_GPUTextureFormat * within a compute pass. Note that SIMULTANEOUS usage is only supported by a * limited number of texture formats. * - * \since This datatype is available since SDL 3.1.3 + * \since This datatype is available since SDL 3.2.0 * * \sa SDL_CreateGPUTexture */ @@ -829,7 +829,7 @@ typedef Uint32 SDL_GPUTextureUsageFlags; /** * Specifies the type of a texture. * - * \since This enum is available since SDL 3.1.3 + * \since This enum is available since SDL 3.2.0 * * \sa SDL_CreateGPUTexture */ @@ -848,7 +848,7 @@ typedef enum SDL_GPUTextureType * Used in multisampling. Note that this value only applies when the texture * is used as a render target. * - * \since This enum is available since SDL 3.1.3 + * \since This enum is available since SDL 3.2.0 * * \sa SDL_CreateGPUTexture * \sa SDL_GPUTextureSupportsSampleCount @@ -867,7 +867,7 @@ typedef enum SDL_GPUSampleCount * * Can be passed in as the layer field in texture-related structs. * - * \since This enum is available since SDL 3.1.3 + * \since This enum is available since SDL 3.2.0 */ typedef enum SDL_GPUCubeMapFace { @@ -888,7 +888,7 @@ typedef enum SDL_GPUCubeMapFace * Unlike textures, READ | WRITE can be used for simultaneous read-write * usage. The same data synchronization concerns as textures apply. * - * \since This datatype is available since SDL 3.1.3 + * \since This datatype is available since SDL 3.2.0 * * \sa SDL_CreateGPUBuffer */ @@ -907,7 +907,7 @@ typedef Uint32 SDL_GPUBufferUsageFlags; * Note that mapping and copying FROM an upload transfer buffer or TO a * download transfer buffer is undefined behavior. * - * \since This enum is available since SDL 3.1.3 + * \since This enum is available since SDL 3.2.0 * * \sa SDL_CreateGPUTransferBuffer */ @@ -920,7 +920,7 @@ typedef enum SDL_GPUTransferBufferUsage /** * Specifies which stage a shader program corresponds to. * - * \since This enum is available since SDL 3.1.3 + * \since This enum is available since SDL 3.2.0 * * \sa SDL_CreateGPUShader */ @@ -935,7 +935,7 @@ typedef enum SDL_GPUShaderStage * * Each format corresponds to a specific backend that accepts it. * - * \since This datatype is available since SDL 3.1.3 + * \since This datatype is available since SDL 3.2.0 * * \sa SDL_CreateGPUShader */ @@ -952,7 +952,7 @@ typedef Uint32 SDL_GPUShaderFormat; /** * Specifies the format of a vertex attribute. * - * \since This enum is available since SDL 3.1.3 + * \since This enum is available since SDL 3.2.0 * * \sa SDL_CreateGPUGraphicsPipeline */ @@ -1018,7 +1018,7 @@ typedef enum SDL_GPUVertexElementFormat /** * Specifies the rate at which vertex attributes are pulled from buffers. * - * \since This enum is available since SDL 3.1.3 + * \since This enum is available since SDL 3.2.0 * * \sa SDL_CreateGPUGraphicsPipeline */ @@ -1031,7 +1031,7 @@ typedef enum SDL_GPUVertexInputRate /** * Specifies the fill mode of the graphics pipeline. * - * \since This enum is available since SDL 3.1.3 + * \since This enum is available since SDL 3.2.0 * * \sa SDL_CreateGPUGraphicsPipeline */ @@ -1044,7 +1044,7 @@ typedef enum SDL_GPUFillMode /** * Specifies the facing direction in which triangle faces will be culled. * - * \since This enum is available since SDL 3.1.3 + * \since This enum is available since SDL 3.2.0 * * \sa SDL_CreateGPUGraphicsPipeline */ @@ -1059,7 +1059,7 @@ typedef enum SDL_GPUCullMode * Specifies the vertex winding that will cause a triangle to be determined to * be front-facing. * - * \since This enum is available since SDL 3.1.3 + * \since This enum is available since SDL 3.2.0 * * \sa SDL_CreateGPUGraphicsPipeline */ @@ -1072,7 +1072,7 @@ typedef enum SDL_GPUFrontFace /** * Specifies a comparison operator for depth, stencil and sampler operations. * - * \since This enum is available since SDL 3.1.3 + * \since This enum is available since SDL 3.2.0 * * \sa SDL_CreateGPUGraphicsPipeline */ @@ -1093,7 +1093,7 @@ typedef enum SDL_GPUCompareOp * Specifies what happens to a stored stencil value if stencil tests fail or * pass. * - * \since This enum is available since SDL 3.1.3 + * \since This enum is available since SDL 3.2.0 * * \sa SDL_CreateGPUGraphicsPipeline */ @@ -1117,7 +1117,7 @@ typedef enum SDL_GPUStencilOp * The source color is the value written by the fragment shader. The * destination color is the value currently existing in the texture. * - * \since This enum is available since SDL 3.1.3 + * \since This enum is available since SDL 3.2.0 * * \sa SDL_CreateGPUGraphicsPipeline */ @@ -1138,7 +1138,7 @@ typedef enum SDL_GPUBlendOp * The source color is the value written by the fragment shader. The * destination color is the value currently existing in the texture. * - * \since This enum is available since SDL 3.1.3 + * \since This enum is available since SDL 3.2.0 * * \sa SDL_CreateGPUGraphicsPipeline */ @@ -1163,7 +1163,7 @@ typedef enum SDL_GPUBlendFactor /** * Specifies which color components are written in a graphics pipeline. * - * \since This datatype is available since SDL 3.1.3 + * \since This datatype is available since SDL 3.2.0 * * \sa SDL_CreateGPUGraphicsPipeline */ @@ -1177,7 +1177,7 @@ typedef Uint8 SDL_GPUColorComponentFlags; /** * Specifies a filter operation used by a sampler. * - * \since This enum is available since SDL 3.1.3 + * \since This enum is available since SDL 3.2.0 * * \sa SDL_CreateGPUSampler */ @@ -1190,7 +1190,7 @@ typedef enum SDL_GPUFilter /** * Specifies a mipmap mode used by a sampler. * - * \since This enum is available since SDL 3.1.3 + * \since This enum is available since SDL 3.2.0 * * \sa SDL_CreateGPUSampler */ @@ -1204,7 +1204,7 @@ typedef enum SDL_GPUSamplerMipmapMode * Specifies behavior of texture sampling when the coordinates exceed the 0-1 * range. * - * \since This enum is available since SDL 3.1.3 + * \since This enum is available since SDL 3.2.0 * * \sa SDL_CreateGPUSampler */ @@ -1234,7 +1234,7 @@ typedef enum SDL_GPUSamplerAddressMode * there is a pending image to present, the pending image is replaced by the * new image. Similar to VSYNC, but with reduced visual latency. * - * \since This enum is available since SDL 3.1.3 + * \since This enum is available since SDL 3.2.0 * * \sa SDL_SetGPUSwapchainParameters * \sa SDL_WindowSupportsGPUPresentMode @@ -1267,7 +1267,7 @@ typedef enum SDL_GPUPresentMode * - HDR10_ST2084: A2R10G10B10 or A2B10G10R10 swapchain. Pixel values are in * BT.2020 ST2084 (PQ) encoding. * - * \since This enum is available since SDL 3.1.3 + * \since This enum is available since SDL 3.2.0 * * \sa SDL_SetGPUSwapchainParameters * \sa SDL_WindowSupportsGPUSwapchainComposition @@ -1286,7 +1286,7 @@ typedef enum SDL_GPUSwapchainComposition /** * A structure specifying a viewport. * - * \since This struct is available since SDL 3.1.3 + * \since This struct is available since SDL 3.2.0 * * \sa SDL_SetGPUViewport */ @@ -1304,7 +1304,7 @@ typedef struct SDL_GPUViewport * A structure specifying parameters related to transferring data to or from a * texture. * - * \since This struct is available since SDL 3.1.3 + * \since This struct is available since SDL 3.2.0 * * \sa SDL_UploadToGPUTexture * \sa SDL_DownloadFromGPUTexture @@ -1322,7 +1322,7 @@ typedef struct SDL_GPUTextureTransferInfo * * Used when transferring buffer data to or from a transfer buffer. * - * \since This struct is available since SDL 3.1.3 + * \since This struct is available since SDL 3.2.0 * * \sa SDL_UploadToGPUBuffer * \sa SDL_DownloadFromGPUBuffer @@ -1338,7 +1338,7 @@ typedef struct SDL_GPUTransferBufferLocation * * Used when copying data from one texture to another. * - * \since This struct is available since SDL 3.1.3 + * \since This struct is available since SDL 3.2.0 * * \sa SDL_CopyGPUTextureToTexture */ @@ -1357,7 +1357,7 @@ typedef struct SDL_GPUTextureLocation * * Used when transferring data to or from a texture. * - * \since This struct is available since SDL 3.1.3 + * \since This struct is available since SDL 3.2.0 * * \sa SDL_UploadToGPUTexture * \sa SDL_DownloadFromGPUTexture @@ -1378,7 +1378,7 @@ typedef struct SDL_GPUTextureRegion /** * A structure specifying a region of a texture used in the blit operation. * - * \since This struct is available since SDL 3.1.3 + * \since This struct is available since SDL 3.2.0 * * \sa SDL_BlitGPUTexture */ @@ -1398,7 +1398,7 @@ typedef struct SDL_GPUBlitRegion * * Used when copying data between buffers. * - * \since This struct is available since SDL 3.1.3 + * \since This struct is available since SDL 3.2.0 * * \sa SDL_CopyGPUBufferToBuffer */ @@ -1413,7 +1413,7 @@ typedef struct SDL_GPUBufferLocation * * Used when transferring data to or from buffers. * - * \since This struct is available since SDL 3.1.3 + * \since This struct is available since SDL 3.2.0 * * \sa SDL_UploadToGPUBuffer * \sa SDL_DownloadFromGPUBuffer @@ -1435,7 +1435,7 @@ typedef struct SDL_GPUBufferRegion * only way to keep behavior consistent and portable is to always pass 0 for * the correlating parameter in the draw calls. * - * \since This struct is available since SDL 3.1.3 + * \since This struct is available since SDL 3.2.0 * * \sa SDL_DrawGPUPrimitivesIndirect */ @@ -1457,7 +1457,7 @@ typedef struct SDL_GPUIndirectDrawCommand * only way to keep behavior consistent and portable is to always pass 0 for * the correlating parameter in the draw calls. * - * \since This struct is available since SDL 3.1.3 + * \since This struct is available since SDL 3.2.0 * * \sa SDL_DrawGPUIndexedPrimitivesIndirect */ @@ -1473,7 +1473,7 @@ typedef struct SDL_GPUIndexedIndirectDrawCommand /** * A structure specifying the parameters of an indexed dispatch command. * - * \since This struct is available since SDL 3.1.3 + * \since This struct is available since SDL 3.2.0 * * \sa SDL_DispatchGPUComputeIndirect */ @@ -1489,7 +1489,7 @@ typedef struct SDL_GPUIndirectDispatchCommand /** * A structure specifying the parameters of a sampler. * - * \since This function is available since SDL 3.1.3 + * \since This function is available since SDL 3.2.0 * * \sa SDL_CreateGPUSampler */ @@ -1527,7 +1527,7 @@ typedef struct SDL_GPUSamplerCreateInfo * SDL_GPUVertexAttribute. For example, if an attribute has a buffer_slot of * 0, then that attribute belongs to the vertex buffer bound at slot 0. * - * \since This struct is available since SDL 3.1.3 + * \since This struct is available since SDL 3.2.0 * * \sa SDL_GPUVertexAttribute * \sa SDL_GPUVertexInputState @@ -1546,7 +1546,7 @@ typedef struct SDL_GPUVertexBufferDescription * All vertex attribute locations provided to an SDL_GPUVertexInputState must * be unique. * - * \since This struct is available since SDL 3.1.3 + * \since This struct is available since SDL 3.2.0 * * \sa SDL_GPUVertexBufferDescription * \sa SDL_GPUVertexInputState @@ -1563,7 +1563,7 @@ typedef struct SDL_GPUVertexAttribute * A structure specifying the parameters of a graphics pipeline vertex input * state. * - * \since This struct is available since SDL 3.1.3 + * \since This struct is available since SDL 3.2.0 * * \sa SDL_GPUGraphicsPipelineCreateInfo * \sa SDL_GPUVertexBufferDescription @@ -1580,7 +1580,7 @@ typedef struct SDL_GPUVertexInputState /** * A structure specifying the stencil operation state of a graphics pipeline. * - * \since This struct is available since SDL 3.1.3 + * \since This struct is available since SDL 3.2.0 * * \sa SDL_GPUDepthStencilState */ @@ -1595,7 +1595,7 @@ typedef struct SDL_GPUStencilOpState /** * A structure specifying the blend state of a color target. * - * \since This struct is available since SDL 3.1.3 + * \since This struct is available since SDL 3.2.0 * * \sa SDL_GPUColorTargetDescription */ @@ -1618,7 +1618,7 @@ typedef struct SDL_GPUColorTargetBlendState /** * A structure specifying code and metadata for creating a shader object. * - * \since This struct is available since SDL 3.1.3 + * \since This struct is available since SDL 3.2.0 * * \sa SDL_CreateGPUShader */ @@ -1644,7 +1644,7 @@ typedef struct SDL_GPUShaderCreateInfo * that certain usage combinations are invalid, for example SAMPLER and * GRAPHICS_STORAGE. * - * \since This struct is available since SDL 3.1.3 + * \since This struct is available since SDL 3.2.0 * * \sa SDL_CreateGPUTexture * \sa SDL_GPUTextureType @@ -1672,7 +1672,7 @@ typedef struct SDL_GPUTextureCreateInfo * Usage flags can be bitwise OR'd together for combinations of usages. Note * that certain combinations are invalid, for example VERTEX and INDEX. * - * \since This struct is available since SDL 3.1.3 + * \since This struct is available since SDL 3.2.0 * * \sa SDL_CreateGPUBuffer * \sa SDL_GPUBufferUsageFlags @@ -1688,7 +1688,7 @@ typedef struct SDL_GPUBufferCreateInfo /** * A structure specifying the parameters of a transfer buffer. * - * \since This struct is available since SDL 3.1.3 + * \since This struct is available since SDL 3.2.0 * * \sa SDL_CreateGPUTransferBuffer */ @@ -1711,7 +1711,7 @@ typedef struct SDL_GPUTransferBufferCreateInfo * consider enabling depth clip and then manually clamping depth in your * fragment shaders on Metal and Vulkan. * - * \since This struct is available since SDL 3.1.3 + * \since This struct is available since SDL 3.2.0 * * \sa SDL_GPUGraphicsPipelineCreateInfo */ @@ -1733,7 +1733,7 @@ typedef struct SDL_GPURasterizerState * A structure specifying the parameters of the graphics pipeline multisample * state. * - * \since This struct is available since SDL 3.1.3 + * \since This struct is available since SDL 3.2.0 * * \sa SDL_GPUGraphicsPipelineCreateInfo */ @@ -1751,7 +1751,7 @@ typedef struct SDL_GPUMultisampleState * A structure specifying the parameters of the graphics pipeline depth * stencil state. * - * \since This struct is available since SDL 3.1.3 + * \since This struct is available since SDL 3.2.0 * * \sa SDL_GPUGraphicsPipelineCreateInfo */ @@ -1774,7 +1774,7 @@ typedef struct SDL_GPUDepthStencilState * A structure specifying the parameters of color targets used in a graphics * pipeline. * - * \since This struct is available since SDL 3.1.3 + * \since This struct is available since SDL 3.2.0 * * \sa SDL_GPUGraphicsPipelineTargetInfo */ @@ -1788,7 +1788,7 @@ typedef struct SDL_GPUColorTargetDescription * A structure specifying the descriptions of render targets used in a * graphics pipeline. * - * \since This struct is available since SDL 3.1.3 + * \since This struct is available since SDL 3.2.0 * * \sa SDL_GPUGraphicsPipelineCreateInfo */ @@ -1806,7 +1806,7 @@ typedef struct SDL_GPUGraphicsPipelineTargetInfo /** * A structure specifying the parameters of a graphics pipeline state. * - * \since This struct is available since SDL 3.1.3 + * \since This struct is available since SDL 3.2.0 * * \sa SDL_CreateGPUGraphicsPipeline * \sa SDL_GPUVertexInputState @@ -1833,7 +1833,7 @@ typedef struct SDL_GPUGraphicsPipelineCreateInfo /** * A structure specifying the parameters of a compute pipeline state. * - * \since This struct is available since SDL 3.1.3 + * \since This struct is available since SDL 3.2.0 * * \sa SDL_CreateGPUComputePipeline */ @@ -1887,7 +1887,7 @@ typedef struct SDL_GPUComputePipelineCreateInfo * stores the multisample texture's contents. Not recommended as it requires * significant memory bandwidth. * - * \since This struct is available since SDL 3.1.3 + * \since This struct is available since SDL 3.2.0 * * \sa SDL_BeginGPURenderPass */ @@ -1948,7 +1948,7 @@ typedef struct SDL_GPUColorTargetInfo * * Note that depth/stencil targets do not support multisample resolves. * - * \since This struct is available since SDL 3.1.3 + * \since This struct is available since SDL 3.2.0 * * \sa SDL_BeginGPURenderPass */ @@ -1969,7 +1969,7 @@ typedef struct SDL_GPUDepthStencilTargetInfo /** * A structure containing parameters for a blit command. * - * \since This struct is available since SDL 3.1.3 + * \since This struct is available since SDL 3.2.0 * * \sa SDL_BlitGPUTexture */ @@ -1991,7 +1991,7 @@ typedef struct SDL_GPUBlitInfo { /** * A structure specifying parameters in a buffer binding call. * - * \since This struct is available since SDL 3.1.3 + * \since This struct is available since SDL 3.2.0 * * \sa SDL_BindGPUVertexBuffers * \sa SDL_BindGPUIndexBuffer @@ -2005,7 +2005,7 @@ typedef struct SDL_GPUBufferBinding /** * A structure specifying parameters in a sampler binding call. * - * \since This struct is available since SDL 3.1.3 + * \since This struct is available since SDL 3.2.0 * * \sa SDL_BindGPUVertexSamplers * \sa SDL_BindGPUFragmentSamplers @@ -2020,7 +2020,7 @@ typedef struct SDL_GPUTextureSamplerBinding * A structure specifying parameters related to binding buffers in a compute * pass. * - * \since This struct is available since SDL 3.1.3 + * \since This struct is available since SDL 3.2.0 * * \sa SDL_BeginGPUComputePass */ @@ -2037,7 +2037,7 @@ typedef struct SDL_GPUStorageBufferReadWriteBinding * A structure specifying parameters related to binding textures in a compute * pass. * - * \since This struct is available since SDL 3.1.3 + * \since This struct is available since SDL 3.2.0 * * \sa SDL_BeginGPUComputePass */ @@ -2065,7 +2065,7 @@ typedef struct SDL_GPUStorageTextureReadWriteBinding * driver. * \returns true if supported, false otherwise. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_CreateGPUDevice */ @@ -2079,7 +2079,7 @@ extern SDL_DECLSPEC bool SDLCALL SDL_GPUSupportsShaderFormats( * \param props the properties to use. * \returns true if supported, false otherwise. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_CreateGPUDeviceWithProperties */ @@ -2097,7 +2097,7 @@ extern SDL_DECLSPEC bool SDLCALL SDL_GPUSupportsProperties( * \returns a GPU context on success or NULL on failure; call SDL_GetError() * for more information. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_GetGPUShaderFormats * \sa SDL_GetGPUDeviceDriver @@ -2145,7 +2145,7 @@ extern SDL_DECLSPEC SDL_GPUDevice *SDLCALL SDL_CreateGPUDevice( * \returns a GPU context on success or NULL on failure; call SDL_GetError() * for more information. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_GetGPUShaderFormats * \sa SDL_GetGPUDeviceDriver @@ -2171,7 +2171,7 @@ extern SDL_DECLSPEC SDL_GPUDevice *SDLCALL SDL_CreateGPUDeviceWithProperties( * * \param device a GPU Context to destroy. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_CreateGPUDevice */ @@ -2182,7 +2182,7 @@ extern SDL_DECLSPEC void SDLCALL SDL_DestroyGPUDevice(SDL_GPUDevice *device); * * \returns the number of built in GPU drivers. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_GetGPUDriver */ @@ -2201,7 +2201,7 @@ extern SDL_DECLSPEC int SDLCALL SDL_GetNumGPUDrivers(void); * \param index the index of a GPU driver. * \returns the name of the GPU driver with the given **index**. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_GetNumGPUDrivers */ @@ -2213,7 +2213,7 @@ extern SDL_DECLSPEC const char * SDLCALL SDL_GetGPUDriver(int index); * \param device a GPU context to query. * \returns the name of the device's driver, or NULL on error. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. */ extern SDL_DECLSPEC const char * SDLCALL SDL_GetGPUDeviceDriver(SDL_GPUDevice *device); @@ -2224,7 +2224,7 @@ extern SDL_DECLSPEC const char * SDLCALL SDL_GetGPUDeviceDriver(SDL_GPUDevice *d * \returns a bitflag indicating which shader formats the driver is able to * consume. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. */ extern SDL_DECLSPEC SDL_GPUShaderFormat SDLCALL SDL_GetGPUShaderFormats(SDL_GPUDevice *device); @@ -2270,7 +2270,7 @@ extern SDL_DECLSPEC SDL_GPUShaderFormat SDLCALL SDL_GetGPUShaderFormats(SDL_GPUD * \returns a compute pipeline object on success, or NULL on failure; call * SDL_GetError() for more information. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_BindGPUComputePipeline * \sa SDL_ReleaseGPUComputePipeline @@ -2296,7 +2296,7 @@ extern SDL_DECLSPEC SDL_GPUComputePipeline *SDLCALL SDL_CreateGPUComputePipeline * \returns a graphics pipeline object on success, or NULL on failure; call * SDL_GetError() for more information. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_CreateGPUShader * \sa SDL_BindGPUGraphicsPipeline @@ -2323,7 +2323,7 @@ extern SDL_DECLSPEC SDL_GPUGraphicsPipeline *SDLCALL SDL_CreateGPUGraphicsPipeli * \returns a sampler object on success, or NULL on failure; call * SDL_GetError() for more information. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_BindGPUVertexSamplers * \sa SDL_BindGPUFragmentSamplers @@ -2403,7 +2403,7 @@ extern SDL_DECLSPEC SDL_GPUSampler *SDLCALL SDL_CreateGPUSampler( * \returns a shader object on success, or NULL on failure; call * SDL_GetError() for more information. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_CreateGPUGraphicsPipeline * \sa SDL_ReleaseGPUShader @@ -2456,7 +2456,7 @@ extern SDL_DECLSPEC SDL_GPUShader *SDLCALL SDL_CreateGPUShader( * \returns a texture object on success, or NULL on failure; call * SDL_GetError() for more information. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_UploadToGPUTexture * \sa SDL_DownloadFromGPUTexture @@ -2506,7 +2506,7 @@ extern SDL_DECLSPEC SDL_GPUTexture *SDLCALL SDL_CreateGPUTexture( * \returns a buffer object on success, or NULL on failure; call * SDL_GetError() for more information. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_UploadToGPUBuffer * \sa SDL_DownloadFromGPUBuffer @@ -2546,7 +2546,7 @@ extern SDL_DECLSPEC SDL_GPUBuffer *SDLCALL SDL_CreateGPUBuffer( * \returns a transfer buffer on success, or NULL on failure; call * SDL_GetError() for more information. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_UploadToGPUBuffer * \sa SDL_DownloadFromGPUBuffer @@ -2575,7 +2575,7 @@ extern SDL_DECLSPEC SDL_GPUTransferBuffer *SDLCALL SDL_CreateGPUTransferBuffer( * \threadsafety This function is not thread safe, you must make sure the * buffer is not simultaneously used by any other thread. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_CreateGPUBuffer */ @@ -2598,7 +2598,7 @@ extern SDL_DECLSPEC void SDLCALL SDL_SetGPUBufferName( * \threadsafety This function is not thread safe, you must make sure the * texture is not simultaneously used by any other thread. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_CreateGPUTexture */ @@ -2615,7 +2615,7 @@ extern SDL_DECLSPEC void SDLCALL SDL_SetGPUTextureName( * \param command_buffer a command buffer. * \param text a UTF-8 string constant to insert as the label. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. */ extern SDL_DECLSPEC void SDLCALL SDL_InsertGPUDebugLabel( SDL_GPUCommandBuffer *command_buffer, @@ -2638,7 +2638,7 @@ extern SDL_DECLSPEC void SDLCALL SDL_InsertGPUDebugLabel( * \param command_buffer a command buffer. * \param name a UTF-8 string constant that names the group. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_PopGPUDebugGroup */ @@ -2651,7 +2651,7 @@ extern SDL_DECLSPEC void SDLCALL SDL_PushGPUDebugGroup( * * \param command_buffer a command buffer. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_PushGPUDebugGroup */ @@ -2668,7 +2668,7 @@ extern SDL_DECLSPEC void SDLCALL SDL_PopGPUDebugGroup( * \param device a GPU context. * \param texture a texture to be destroyed. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. */ extern SDL_DECLSPEC void SDLCALL SDL_ReleaseGPUTexture( SDL_GPUDevice *device, @@ -2682,7 +2682,7 @@ extern SDL_DECLSPEC void SDLCALL SDL_ReleaseGPUTexture( * \param device a GPU context. * \param sampler a sampler to be destroyed. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. */ extern SDL_DECLSPEC void SDLCALL SDL_ReleaseGPUSampler( SDL_GPUDevice *device, @@ -2696,7 +2696,7 @@ extern SDL_DECLSPEC void SDLCALL SDL_ReleaseGPUSampler( * \param device a GPU context. * \param buffer a buffer to be destroyed. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. */ extern SDL_DECLSPEC void SDLCALL SDL_ReleaseGPUBuffer( SDL_GPUDevice *device, @@ -2710,7 +2710,7 @@ extern SDL_DECLSPEC void SDLCALL SDL_ReleaseGPUBuffer( * \param device a GPU context. * \param transfer_buffer a transfer buffer to be destroyed. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. */ extern SDL_DECLSPEC void SDLCALL SDL_ReleaseGPUTransferBuffer( SDL_GPUDevice *device, @@ -2724,7 +2724,7 @@ extern SDL_DECLSPEC void SDLCALL SDL_ReleaseGPUTransferBuffer( * \param device a GPU context. * \param compute_pipeline a compute pipeline to be destroyed. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. */ extern SDL_DECLSPEC void SDLCALL SDL_ReleaseGPUComputePipeline( SDL_GPUDevice *device, @@ -2738,7 +2738,7 @@ extern SDL_DECLSPEC void SDLCALL SDL_ReleaseGPUComputePipeline( * \param device a GPU context. * \param shader a shader to be destroyed. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. */ extern SDL_DECLSPEC void SDLCALL SDL_ReleaseGPUShader( SDL_GPUDevice *device, @@ -2752,7 +2752,7 @@ extern SDL_DECLSPEC void SDLCALL SDL_ReleaseGPUShader( * \param device a GPU context. * \param graphics_pipeline a graphics pipeline to be destroyed. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. */ extern SDL_DECLSPEC void SDLCALL SDL_ReleaseGPUGraphicsPipeline( SDL_GPUDevice *device, @@ -2777,7 +2777,7 @@ extern SDL_DECLSPEC void SDLCALL SDL_ReleaseGPUGraphicsPipeline( * \returns a command buffer, or NULL on failure; call SDL_GetError() for more * information. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_SubmitGPUCommandBuffer * \sa SDL_SubmitGPUCommandBufferAndAcquireFence @@ -2797,7 +2797,7 @@ extern SDL_DECLSPEC SDL_GPUCommandBuffer *SDLCALL SDL_AcquireGPUCommandBuffer( * \param data client data to write. * \param length the length of the data to write. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. */ extern SDL_DECLSPEC void SDLCALL SDL_PushGPUVertexUniformData( SDL_GPUCommandBuffer *command_buffer, @@ -2815,7 +2815,7 @@ extern SDL_DECLSPEC void SDLCALL SDL_PushGPUVertexUniformData( * \param data client data to write. * \param length the length of the data to write. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. */ extern SDL_DECLSPEC void SDLCALL SDL_PushGPUFragmentUniformData( SDL_GPUCommandBuffer *command_buffer, @@ -2833,7 +2833,7 @@ extern SDL_DECLSPEC void SDLCALL SDL_PushGPUFragmentUniformData( * \param data client data to write. * \param length the length of the data to write. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. */ extern SDL_DECLSPEC void SDLCALL SDL_PushGPUComputeUniformData( SDL_GPUCommandBuffer *command_buffer, @@ -2864,7 +2864,7 @@ extern SDL_DECLSPEC void SDLCALL SDL_PushGPUComputeUniformData( * NULL. * \returns a render pass handle. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_EndGPURenderPass */ @@ -2882,7 +2882,7 @@ extern SDL_DECLSPEC SDL_GPURenderPass *SDLCALL SDL_BeginGPURenderPass( * \param render_pass a render pass handle. * \param graphics_pipeline the graphics pipeline to bind. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. */ extern SDL_DECLSPEC void SDLCALL SDL_BindGPUGraphicsPipeline( SDL_GPURenderPass *render_pass, @@ -2894,7 +2894,7 @@ extern SDL_DECLSPEC void SDLCALL SDL_BindGPUGraphicsPipeline( * \param render_pass a render pass handle. * \param viewport the viewport to set. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. */ extern SDL_DECLSPEC void SDLCALL SDL_SetGPUViewport( SDL_GPURenderPass *render_pass, @@ -2906,7 +2906,7 @@ extern SDL_DECLSPEC void SDLCALL SDL_SetGPUViewport( * \param render_pass a render pass handle. * \param scissor the scissor area to set. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. */ extern SDL_DECLSPEC void SDLCALL SDL_SetGPUScissor( SDL_GPURenderPass *render_pass, @@ -2918,7 +2918,7 @@ extern SDL_DECLSPEC void SDLCALL SDL_SetGPUScissor( * \param render_pass a render pass handle. * \param blend_constants the blend constant color. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_GPU_BLENDFACTOR_CONSTANT_COLOR * \sa SDL_GPU_BLENDFACTOR_ONE_MINUS_CONSTANT_COLOR @@ -2933,7 +2933,7 @@ extern SDL_DECLSPEC void SDLCALL SDL_SetGPUBlendConstants( * \param render_pass a render pass handle. * \param reference the stencil reference value to set. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. */ extern SDL_DECLSPEC void SDLCALL SDL_SetGPUStencilReference( SDL_GPURenderPass *render_pass, @@ -2949,7 +2949,7 @@ extern SDL_DECLSPEC void SDLCALL SDL_SetGPUStencilReference( * buffers and offset values. * \param num_bindings the number of bindings in the bindings array. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. */ extern SDL_DECLSPEC void SDLCALL SDL_BindGPUVertexBuffers( SDL_GPURenderPass *render_pass, @@ -2966,7 +2966,7 @@ extern SDL_DECLSPEC void SDLCALL SDL_BindGPUVertexBuffers( * \param index_element_size whether the index values in the buffer are 16- or * 32-bit. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. */ extern SDL_DECLSPEC void SDLCALL SDL_BindGPUIndexBuffer( SDL_GPURenderPass *render_pass, @@ -2985,7 +2985,7 @@ extern SDL_DECLSPEC void SDLCALL SDL_BindGPUIndexBuffer( * \param num_bindings the number of texture-sampler pairs to bind from the * array. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. */ extern SDL_DECLSPEC void SDLCALL SDL_BindGPUVertexSamplers( SDL_GPURenderPass *render_pass, @@ -3004,7 +3004,7 @@ extern SDL_DECLSPEC void SDLCALL SDL_BindGPUVertexSamplers( * \param storage_textures an array of storage textures. * \param num_bindings the number of storage texture to bind from the array. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. */ extern SDL_DECLSPEC void SDLCALL SDL_BindGPUVertexStorageTextures( SDL_GPURenderPass *render_pass, @@ -3023,7 +3023,7 @@ extern SDL_DECLSPEC void SDLCALL SDL_BindGPUVertexStorageTextures( * \param storage_buffers an array of buffers. * \param num_bindings the number of buffers to bind from the array. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. */ extern SDL_DECLSPEC void SDLCALL SDL_BindGPUVertexStorageBuffers( SDL_GPURenderPass *render_pass, @@ -3043,7 +3043,7 @@ extern SDL_DECLSPEC void SDLCALL SDL_BindGPUVertexStorageBuffers( * \param num_bindings the number of texture-sampler pairs to bind from the * array. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. */ extern SDL_DECLSPEC void SDLCALL SDL_BindGPUFragmentSamplers( SDL_GPURenderPass *render_pass, @@ -3062,7 +3062,7 @@ extern SDL_DECLSPEC void SDLCALL SDL_BindGPUFragmentSamplers( * \param storage_textures an array of storage textures. * \param num_bindings the number of storage textures to bind from the array. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. */ extern SDL_DECLSPEC void SDLCALL SDL_BindGPUFragmentStorageTextures( SDL_GPURenderPass *render_pass, @@ -3081,7 +3081,7 @@ extern SDL_DECLSPEC void SDLCALL SDL_BindGPUFragmentStorageTextures( * \param storage_buffers an array of storage buffers. * \param num_bindings the number of storage buffers to bind from the array. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. */ extern SDL_DECLSPEC void SDLCALL SDL_BindGPUFragmentStorageBuffers( SDL_GPURenderPass *render_pass, @@ -3112,7 +3112,7 @@ extern SDL_DECLSPEC void SDLCALL SDL_BindGPUFragmentStorageBuffers( * vertex buffer. * \param first_instance the ID of the first instance to draw. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. */ extern SDL_DECLSPEC void SDLCALL SDL_DrawGPUIndexedPrimitives( SDL_GPURenderPass *render_pass, @@ -3140,7 +3140,7 @@ extern SDL_DECLSPEC void SDLCALL SDL_DrawGPUIndexedPrimitives( * \param first_vertex the index of the first vertex to draw. * \param first_instance the ID of the first instance to draw. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. */ extern SDL_DECLSPEC void SDLCALL SDL_DrawGPUPrimitives( SDL_GPURenderPass *render_pass, @@ -3163,7 +3163,7 @@ extern SDL_DECLSPEC void SDLCALL SDL_DrawGPUPrimitives( * \param draw_count the number of draw parameter sets that should be read * from the draw buffer. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. */ extern SDL_DECLSPEC void SDLCALL SDL_DrawGPUPrimitivesIndirect( SDL_GPURenderPass *render_pass, @@ -3185,7 +3185,7 @@ extern SDL_DECLSPEC void SDLCALL SDL_DrawGPUPrimitivesIndirect( * \param draw_count the number of draw parameter sets that should be read * from the draw buffer. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. */ extern SDL_DECLSPEC void SDLCALL SDL_DrawGPUIndexedPrimitivesIndirect( SDL_GPURenderPass *render_pass, @@ -3201,7 +3201,7 @@ extern SDL_DECLSPEC void SDLCALL SDL_DrawGPUIndexedPrimitivesIndirect( * * \param render_pass a render pass handle. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. */ extern SDL_DECLSPEC void SDLCALL SDL_EndGPURenderPass( SDL_GPURenderPass *render_pass); @@ -3241,7 +3241,7 @@ extern SDL_DECLSPEC void SDLCALL SDL_EndGPURenderPass( * from the array. * \returns a compute pass handle. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_EndGPUComputePass */ @@ -3258,7 +3258,7 @@ extern SDL_DECLSPEC SDL_GPUComputePass *SDLCALL SDL_BeginGPUComputePass( * \param compute_pass a compute pass handle. * \param compute_pipeline a compute pipeline to bind. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. */ extern SDL_DECLSPEC void SDLCALL SDL_BindGPUComputePipeline( SDL_GPUComputePass *compute_pass, @@ -3276,7 +3276,7 @@ extern SDL_DECLSPEC void SDLCALL SDL_BindGPUComputePipeline( * \param num_bindings the number of texture-sampler bindings to bind from the * array. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. */ extern SDL_DECLSPEC void SDLCALL SDL_BindGPUComputeSamplers( SDL_GPUComputePass *compute_pass, @@ -3295,7 +3295,7 @@ extern SDL_DECLSPEC void SDLCALL SDL_BindGPUComputeSamplers( * \param storage_textures an array of storage textures. * \param num_bindings the number of storage textures to bind from the array. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. */ extern SDL_DECLSPEC void SDLCALL SDL_BindGPUComputeStorageTextures( SDL_GPUComputePass *compute_pass, @@ -3314,7 +3314,7 @@ extern SDL_DECLSPEC void SDLCALL SDL_BindGPUComputeStorageTextures( * \param storage_buffers an array of storage buffer binding structs. * \param num_bindings the number of storage buffers to bind from the array. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. */ extern SDL_DECLSPEC void SDLCALL SDL_BindGPUComputeStorageBuffers( SDL_GPUComputePass *compute_pass, @@ -3340,7 +3340,7 @@ extern SDL_DECLSPEC void SDLCALL SDL_BindGPUComputeStorageBuffers( * \param groupcount_z number of local workgroups to dispatch in the Z * dimension. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. */ extern SDL_DECLSPEC void SDLCALL SDL_DispatchGPUCompute( SDL_GPUComputePass *compute_pass, @@ -3364,7 +3364,7 @@ extern SDL_DECLSPEC void SDLCALL SDL_DispatchGPUCompute( * \param buffer a buffer containing dispatch parameters. * \param offset the offset to start reading from the dispatch buffer. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. */ extern SDL_DECLSPEC void SDLCALL SDL_DispatchGPUComputeIndirect( SDL_GPUComputePass *compute_pass, @@ -3379,7 +3379,7 @@ extern SDL_DECLSPEC void SDLCALL SDL_DispatchGPUComputeIndirect( * * \param compute_pass a compute pass handle. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. */ extern SDL_DECLSPEC void SDLCALL SDL_EndGPUComputePass( SDL_GPUComputePass *compute_pass); @@ -3397,7 +3397,7 @@ extern SDL_DECLSPEC void SDLCALL SDL_EndGPUComputePass( * \returns the address of the mapped transfer buffer memory, or NULL on * failure; call SDL_GetError() for more information. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. */ extern SDL_DECLSPEC void *SDLCALL SDL_MapGPUTransferBuffer( SDL_GPUDevice *device, @@ -3410,7 +3410,7 @@ extern SDL_DECLSPEC void *SDLCALL SDL_MapGPUTransferBuffer( * \param device a GPU context. * \param transfer_buffer a previously mapped transfer buffer. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. */ extern SDL_DECLSPEC void SDLCALL SDL_UnmapGPUTransferBuffer( SDL_GPUDevice *device, @@ -3428,7 +3428,7 @@ extern SDL_DECLSPEC void SDLCALL SDL_UnmapGPUTransferBuffer( * \param command_buffer a command buffer. * \returns a copy pass handle. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. */ extern SDL_DECLSPEC SDL_GPUCopyPass *SDLCALL SDL_BeginGPUCopyPass( SDL_GPUCommandBuffer *command_buffer); @@ -3448,7 +3448,7 @@ extern SDL_DECLSPEC SDL_GPUCopyPass *SDLCALL SDL_BeginGPUCopyPass( * \param cycle if true, cycles the texture if the texture is bound, otherwise * overwrites the data. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. */ extern SDL_DECLSPEC void SDLCALL SDL_UploadToGPUTexture( SDL_GPUCopyPass *copy_pass, @@ -3468,7 +3468,7 @@ extern SDL_DECLSPEC void SDLCALL SDL_UploadToGPUTexture( * \param cycle if true, cycles the buffer if it is already bound, otherwise * overwrites the data. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. */ extern SDL_DECLSPEC void SDLCALL SDL_UploadToGPUBuffer( SDL_GPUCopyPass *copy_pass, @@ -3491,7 +3491,7 @@ extern SDL_DECLSPEC void SDLCALL SDL_UploadToGPUBuffer( * \param cycle if true, cycles the destination texture if the destination * texture is bound, otherwise overwrites the data. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. */ extern SDL_DECLSPEC void SDLCALL SDL_CopyGPUTextureToTexture( SDL_GPUCopyPass *copy_pass, @@ -3515,7 +3515,7 @@ extern SDL_DECLSPEC void SDLCALL SDL_CopyGPUTextureToTexture( * \param cycle if true, cycles the destination buffer if it is already bound, * otherwise overwrites the data. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. */ extern SDL_DECLSPEC void SDLCALL SDL_CopyGPUBufferToBuffer( SDL_GPUCopyPass *copy_pass, @@ -3535,7 +3535,7 @@ extern SDL_DECLSPEC void SDLCALL SDL_CopyGPUBufferToBuffer( * \param destination the destination transfer buffer with image layout * information. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. */ extern SDL_DECLSPEC void SDLCALL SDL_DownloadFromGPUTexture( SDL_GPUCopyPass *copy_pass, @@ -3552,7 +3552,7 @@ extern SDL_DECLSPEC void SDLCALL SDL_DownloadFromGPUTexture( * \param source the source buffer with offset and size. * \param destination the destination transfer buffer with offset. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. */ extern SDL_DECLSPEC void SDLCALL SDL_DownloadFromGPUBuffer( SDL_GPUCopyPass *copy_pass, @@ -3564,7 +3564,7 @@ extern SDL_DECLSPEC void SDLCALL SDL_DownloadFromGPUBuffer( * * \param copy_pass a copy pass handle. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. */ extern SDL_DECLSPEC void SDLCALL SDL_EndGPUCopyPass( SDL_GPUCopyPass *copy_pass); @@ -3577,7 +3577,7 @@ extern SDL_DECLSPEC void SDLCALL SDL_EndGPUCopyPass( * \param command_buffer a command_buffer. * \param texture a texture with more than 1 mip level. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. */ extern SDL_DECLSPEC void SDLCALL SDL_GenerateMipmapsForGPUTexture( SDL_GPUCommandBuffer *command_buffer, @@ -3591,7 +3591,7 @@ extern SDL_DECLSPEC void SDLCALL SDL_GenerateMipmapsForGPUTexture( * \param command_buffer a command buffer. * \param info the blit info struct containing the blit parameters. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. */ extern SDL_DECLSPEC void SDLCALL SDL_BlitGPUTexture( SDL_GPUCommandBuffer *command_buffer, @@ -3609,7 +3609,7 @@ extern SDL_DECLSPEC void SDLCALL SDL_BlitGPUTexture( * \param swapchain_composition the swapchain composition to check. * \returns true if supported, false if unsupported. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_ClaimWindowForGPUDevice */ @@ -3628,7 +3628,7 @@ extern SDL_DECLSPEC bool SDLCALL SDL_WindowSupportsGPUSwapchainComposition( * \param present_mode the presentation mode to check. * \returns true if supported, false if unsupported. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_ClaimWindowForGPUDevice */ @@ -3657,7 +3657,7 @@ extern SDL_DECLSPEC bool SDLCALL SDL_WindowSupportsGPUPresentMode( * \threadsafety This function should only be called from the thread that * created the window. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_WaitAndAcquireGPUSwapchainTexture * \sa SDL_ReleaseWindowFromGPUDevice @@ -3674,7 +3674,7 @@ extern SDL_DECLSPEC bool SDLCALL SDL_ClaimWindowForGPUDevice( * \param device a GPU context. * \param window an SDL_Window that has been claimed. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_ClaimWindowForGPUDevice */ @@ -3700,7 +3700,7 @@ extern SDL_DECLSPEC void SDLCALL SDL_ReleaseWindowFromGPUDevice( * \returns true if successful, false on error; call SDL_GetError() for more * information. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_WindowSupportsGPUPresentMode * \sa SDL_WindowSupportsGPUSwapchainComposition @@ -3734,7 +3734,7 @@ extern SDL_DECLSPEC bool SDLCALL SDL_SetGPUSwapchainParameters( * \returns true if successful, false on error; call SDL_GetError() for more * information. * - * \since This function is available since SDL 3.1.8. + * \since This function is available since SDL 3.2.0. */ extern SDL_DECLSPEC bool SDLCALL SDL_SetGPUAllowedFramesInFlight( SDL_GPUDevice *device, @@ -3749,7 +3749,7 @@ extern SDL_DECLSPEC bool SDLCALL SDL_SetGPUAllowedFramesInFlight( * \param window an SDL_Window that has been claimed. * \returns the texture format of the swapchain. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. */ extern SDL_DECLSPEC SDL_GPUTextureFormat SDLCALL SDL_GetGPUSwapchainTextureFormat( SDL_GPUDevice *device, @@ -3790,7 +3790,7 @@ extern SDL_DECLSPEC SDL_GPUTextureFormat SDLCALL SDL_GetGPUSwapchainTextureForma * \threadsafety This function should only be called from the thread that * created the window. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_ClaimWindowForGPUDevice * \sa SDL_SubmitGPUCommandBuffer @@ -3819,7 +3819,7 @@ extern SDL_DECLSPEC bool SDLCALL SDL_AcquireGPUSwapchainTexture( * \threadsafety This function should only be called from the thread that * created the window. * - * \since This function is available since SDL 3.1.8. + * \since This function is available since SDL 3.2.0. * * \sa SDL_AcquireGPUSwapchainTexture * \sa SDL_WaitAndAcquireGPUSwapchainTexture @@ -3862,7 +3862,7 @@ extern SDL_DECLSPEC bool SDLCALL SDL_WaitForGPUSwapchain( * \threadsafety This function should only be called from the thread that * created the window. * - * \since This function is available since SDL 3.1.8. + * \since This function is available since SDL 3.2.0. * * \sa SDL_SubmitGPUCommandBuffer * \sa SDL_SubmitGPUCommandBufferAndAcquireFence @@ -3888,7 +3888,7 @@ extern SDL_DECLSPEC bool SDLCALL SDL_WaitAndAcquireGPUSwapchainTexture( * \returns true on success, false on failure; call SDL_GetError() for more * information. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_AcquireGPUCommandBuffer * \sa SDL_WaitAndAcquireGPUSwapchainTexture @@ -3914,7 +3914,7 @@ extern SDL_DECLSPEC bool SDLCALL SDL_SubmitGPUCommandBuffer( * \returns a fence associated with the command buffer, or NULL on failure; * call SDL_GetError() for more information. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_AcquireGPUCommandBuffer * \sa SDL_WaitAndAcquireGPUSwapchainTexture @@ -3941,7 +3941,7 @@ extern SDL_DECLSPEC SDL_GPUFence *SDLCALL SDL_SubmitGPUCommandBufferAndAcquireFe * \returns true on success, false on error; call SDL_GetError() for more * information. * - * \since This function is available since SDL 3.1.6. + * \since This function is available since SDL 3.2.0. * * \sa SDL_WaitAndAcquireGPUSwapchainTexture * \sa SDL_AcquireGPUCommandBuffer @@ -3957,7 +3957,7 @@ extern SDL_DECLSPEC bool SDLCALL SDL_CancelGPUCommandBuffer( * \returns true on success, false on failure; call SDL_GetError() for more * information. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_WaitForGPUFences */ @@ -3975,7 +3975,7 @@ extern SDL_DECLSPEC bool SDLCALL SDL_WaitForGPUIdle( * \returns true on success, false on failure; call SDL_GetError() for more * information. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_SubmitGPUCommandBufferAndAcquireFence * \sa SDL_WaitForGPUIdle @@ -3993,7 +3993,7 @@ extern SDL_DECLSPEC bool SDLCALL SDL_WaitForGPUFences( * \param fence a fence. * \returns true if the fence is signaled, false if it is not. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_SubmitGPUCommandBufferAndAcquireFence */ @@ -4007,7 +4007,7 @@ extern SDL_DECLSPEC bool SDLCALL SDL_QueryGPUFence( * \param device a GPU context. * \param fence a fence. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_SubmitGPUCommandBufferAndAcquireFence */ @@ -4023,7 +4023,7 @@ extern SDL_DECLSPEC void SDLCALL SDL_ReleaseGPUFence( * \param format the texture format you want to know the texel size of. * \returns the texel block size of the texture format. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_UploadToGPUTexture */ @@ -4040,7 +4040,7 @@ extern SDL_DECLSPEC Uint32 SDLCALL SDL_GPUTextureFormatTexelBlockSize( * \param usage a bitmask of all usage scenarios to check. * \returns whether the texture format is supported for this type and usage. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. */ extern SDL_DECLSPEC bool SDLCALL SDL_GPUTextureSupportsFormat( SDL_GPUDevice *device, @@ -4056,7 +4056,7 @@ extern SDL_DECLSPEC bool SDLCALL SDL_GPUTextureSupportsFormat( * \param sample_count the sample count to check. * \returns a hardware-specific version of min(preferred, possible). * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. */ extern SDL_DECLSPEC bool SDLCALL SDL_GPUTextureSupportsSampleCount( SDL_GPUDevice *device, @@ -4072,7 +4072,7 @@ extern SDL_DECLSPEC bool SDLCALL SDL_GPUTextureSupportsSampleCount( * \param depth_or_layer_count depth for 3D textures or layer count otherwise. * \returns the size of a texture with this format and dimensions. * - * \since This function is available since SDL 3.1.6. + * \since This function is available since SDL 3.2.0. */ extern SDL_DECLSPEC Uint32 SDLCALL SDL_CalculateGPUTextureFormatSize( SDL_GPUTextureFormat format, @@ -4091,7 +4091,7 @@ extern SDL_DECLSPEC Uint32 SDLCALL SDL_CalculateGPUTextureFormatSize( * * \param device a GPU context. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_AddEventWatch */ @@ -4106,7 +4106,7 @@ extern SDL_DECLSPEC void SDLCALL SDL_GDKSuspendGPU(SDL_GPUDevice *device); * * \param device a GPU context. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_AddEventWatch */ diff --git a/include/SDL3/SDL_guid.h b/include/SDL3/SDL_guid.h index c1bf8d2d85166..e2f32ffc9b337 100644 --- a/include/SDL3/SDL_guid.h +++ b/include/SDL3/SDL_guid.h @@ -56,7 +56,7 @@ extern "C" { * GUIDs may be platform-dependent (i.e., the same device may report different * GUIDs on different operating systems). * - * \since This struct is available since SDL 3.1.3. + * \since This struct is available since SDL 3.2.0. */ typedef struct SDL_GUID { Uint8 data[16]; @@ -71,7 +71,7 @@ typedef struct SDL_GUID { * \param pszGUID buffer in which to write the ASCII string. * \param cbGUID the size of pszGUID, should be at least 33 bytes. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_StringToGUID */ @@ -87,7 +87,7 @@ extern SDL_DECLSPEC void SDLCALL SDL_GUIDToString(SDL_GUID guid, char *pszGUID, * \param pchGUID string containing an ASCII representation of a GUID. * \returns a SDL_GUID structure. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_GUIDToString */ diff --git a/include/SDL3/SDL_haptic.h b/include/SDL3/SDL_haptic.h index 84f8c0c4f7695..a45335b2858a1 100644 --- a/include/SDL3/SDL_haptic.h +++ b/include/SDL3/SDL_haptic.h @@ -141,7 +141,7 @@ extern "C" { /** * The haptic structure used to identify an SDL haptic. * - * \since This struct is available since SDL 3.1.3. + * \since This struct is available since SDL 3.2.0. * * \sa SDL_OpenHaptic * \sa SDL_OpenHapticFromJoystick @@ -167,7 +167,7 @@ typedef struct SDL_Haptic SDL_Haptic; * * Constant haptic effect. * - * \since This macro is available since SDL 3.1.3. + * \since This macro is available since SDL 3.2.0. * * \sa SDL_HapticCondition */ @@ -178,7 +178,7 @@ typedef struct SDL_Haptic SDL_Haptic; * * Periodic haptic effect that simulates sine waves. * - * \since This macro is available since SDL 3.1.3. + * \since This macro is available since SDL 3.2.0. * * \sa SDL_HapticPeriodic */ @@ -189,7 +189,7 @@ typedef struct SDL_Haptic SDL_Haptic; * * Periodic haptic effect that simulates square waves. * - * \since This macro is available since SDL 3.1.3. + * \since This macro is available since SDL 3.2.0. * * \sa SDL_HapticPeriodic */ @@ -200,7 +200,7 @@ typedef struct SDL_Haptic SDL_Haptic; * * Periodic haptic effect that simulates triangular waves. * - * \since This macro is available since SDL 3.1.3. + * \since This macro is available since SDL 3.2.0. * * \sa SDL_HapticPeriodic */ @@ -211,7 +211,7 @@ typedef struct SDL_Haptic SDL_Haptic; * * Periodic haptic effect that simulates saw tooth up waves. * - * \since This macro is available since SDL 3.1.3. + * \since This macro is available since SDL 3.2.0. * * \sa SDL_HapticPeriodic */ @@ -222,7 +222,7 @@ typedef struct SDL_Haptic SDL_Haptic; * * Periodic haptic effect that simulates saw tooth down waves. * - * \since This macro is available since SDL 3.1.3. + * \since This macro is available since SDL 3.2.0. * * \sa SDL_HapticPeriodic */ @@ -233,7 +233,7 @@ typedef struct SDL_Haptic SDL_Haptic; * * Ramp haptic effect. * - * \since This macro is available since SDL 3.1.3. + * \since This macro is available since SDL 3.2.0. * * \sa SDL_HapticRamp */ @@ -245,7 +245,7 @@ typedef struct SDL_Haptic SDL_Haptic; * Condition haptic effect that simulates a spring. Effect is based on the * axes position. * - * \since This macro is available since SDL 3.1.3. + * \since This macro is available since SDL 3.2.0. * * \sa SDL_HapticCondition */ @@ -257,7 +257,7 @@ typedef struct SDL_Haptic SDL_Haptic; * Condition haptic effect that simulates dampening. Effect is based on the * axes velocity. * - * \since This macro is available since SDL 3.1.3. + * \since This macro is available since SDL 3.2.0. * * \sa SDL_HapticCondition */ @@ -269,7 +269,7 @@ typedef struct SDL_Haptic SDL_Haptic; * Condition haptic effect that simulates inertia. Effect is based on the axes * acceleration. * - * \since This macro is available since SDL 3.1.3. + * \since This macro is available since SDL 3.2.0. * * \sa SDL_HapticCondition */ @@ -281,7 +281,7 @@ typedef struct SDL_Haptic SDL_Haptic; * Condition haptic effect that simulates friction. Effect is based on the * axes movement. * - * \since This macro is available since SDL 3.1.3. + * \since This macro is available since SDL 3.2.0. * * \sa SDL_HapticCondition */ @@ -292,7 +292,7 @@ typedef struct SDL_Haptic SDL_Haptic; * * Haptic effect for direct control over high/low frequency motors. * - * \since This macro is available since SDL 3.1.3. + * \since This macro is available since SDL 3.2.0. * * \sa SDL_HapticLeftRight */ @@ -301,21 +301,21 @@ typedef struct SDL_Haptic SDL_Haptic; /** * Reserved for future use. * - * \since This macro is available since SDL 3.1.3. + * \since This macro is available since SDL 3.2.0. */ #define SDL_HAPTIC_RESERVED1 (1u<<12) /** * Reserved for future use. * - * \since This macro is available since SDL 3.1.3. + * \since This macro is available since SDL 3.2.0. */ #define SDL_HAPTIC_RESERVED2 (1u<<13) /** * Reserved for future use. * - * \since This macro is available since SDL 3.1.3. + * \since This macro is available since SDL 3.2.0. */ #define SDL_HAPTIC_RESERVED3 (1u<<14) @@ -324,7 +324,7 @@ typedef struct SDL_Haptic SDL_Haptic; * * User defined custom haptic effect. * - * \since This macro is available since SDL 3.1.3. + * \since This macro is available since SDL 3.2.0. */ #define SDL_HAPTIC_CUSTOM (1u<<15) @@ -337,7 +337,7 @@ typedef struct SDL_Haptic SDL_Haptic; * * Device supports setting the global gain. * - * \since This macro is available since SDL 3.1.3. + * \since This macro is available since SDL 3.2.0. * * \sa SDL_SetHapticGain */ @@ -348,7 +348,7 @@ typedef struct SDL_Haptic SDL_Haptic; * * Device supports setting autocenter. * - * \since This macro is available since SDL 3.1.3. + * \since This macro is available since SDL 3.2.0. * * \sa SDL_SetHapticAutocenter */ @@ -359,7 +359,7 @@ typedef struct SDL_Haptic SDL_Haptic; * * Device supports querying effect status. * - * \since This macro is available since SDL 3.1.3. + * \since This macro is available since SDL 3.2.0. * * \sa SDL_GetHapticEffectStatus */ @@ -370,7 +370,7 @@ typedef struct SDL_Haptic SDL_Haptic; * * Devices supports being paused. * - * \since This macro is available since SDL 3.1.3. + * \since This macro is available since SDL 3.2.0. * * \sa SDL_PauseHaptic * \sa SDL_ResumeHaptic @@ -386,7 +386,7 @@ typedef struct SDL_Haptic SDL_Haptic; /** * Uses polar coordinates for the direction. * - * \since This macro is available since SDL 3.1.3. + * \since This macro is available since SDL 3.2.0. * * \sa SDL_HapticDirection */ @@ -395,7 +395,7 @@ typedef struct SDL_Haptic SDL_Haptic; /** * Uses cartesian coordinates for the direction. * - * \since This macro is available since SDL 3.1.3. + * \since This macro is available since SDL 3.2.0. * * \sa SDL_HapticDirection */ @@ -404,7 +404,7 @@ typedef struct SDL_Haptic SDL_Haptic; /** * Uses spherical coordinates for the direction. * - * \since This macro is available since SDL 3.1.3. + * \since This macro is available since SDL 3.2.0. * * \sa SDL_HapticDirection */ @@ -416,7 +416,7 @@ typedef struct SDL_Haptic SDL_Haptic; * This provides better compatibility across platforms and devices as SDL will * guess the correct axis. * - * \since This macro is available since SDL 3.1.3. + * \since This macro is available since SDL 3.2.0. * * \sa SDL_HapticDirection */ @@ -433,7 +433,7 @@ typedef struct SDL_Haptic SDL_Haptic; /** * Used to play a device an infinite number of times. * - * \since This macro is available since SDL 3.1.3. + * \since This macro is available since SDL 3.2.0. * * \sa SDL_RunHapticEffect */ @@ -534,7 +534,7 @@ typedef struct SDL_Haptic SDL_Haptic; * direction.dir[0] = 9000; // Since we only have two axes we don't need more parameters. * ``` * - * \since This struct is available since SDL 3.1.3. + * \since This struct is available since SDL 3.2.0. * * \sa SDL_HAPTIC_POLAR * \sa SDL_HAPTIC_CARTESIAN @@ -558,7 +558,7 @@ typedef struct SDL_HapticDirection * A constant effect applies a constant force in the specified direction to * the joystick. * - * \since This struct is available since SDL 3.1.3. + * \since This struct is available since SDL 3.2.0. * * \sa SDL_HAPTIC_CONSTANT * \sa SDL_HapticEffect @@ -640,7 +640,7 @@ typedef struct SDL_HapticConstant * \| \| \| \| \| \| \| * ``` * - * \since This struct is available since SDL 3.1.3. + * \since This struct is available since SDL 3.2.0. * * \sa SDL_HAPTIC_SINE * \sa SDL_HAPTIC_SQUARE @@ -696,7 +696,7 @@ typedef struct SDL_HapticPeriodic * SDL_HapticDirection diagram for which side is positive and which is * negative. * - * \since This struct is available since SDL 3.1.3. + * \since This struct is available since SDL 3.2.0. * * \sa SDL_HapticDirection * \sa SDL_HAPTIC_SPRING @@ -739,7 +739,7 @@ typedef struct SDL_HapticCondition * effects get added to the ramp effect making the effect become quadratic * instead of linear. * - * \since This struct is available since SDL 3.1.3. + * \since This struct is available since SDL 3.2.0. * * \sa SDL_HAPTIC_RAMP * \sa SDL_HapticEffect @@ -778,7 +778,7 @@ typedef struct SDL_HapticRamp * motors, commonly found in modern game controllers. The small (right) motor * is high frequency, and the large (left) motor is low frequency. * - * \since This struct is available since SDL 3.1.3. + * \since This struct is available since SDL 3.2.0. * * \sa SDL_HAPTIC_LEFTRIGHT * \sa SDL_HapticEffect @@ -808,7 +808,7 @@ typedef struct SDL_HapticLeftRight * If channels is one, the effect is rotated using the defined direction. * Otherwise it uses the samples in data for the different axes. * - * \since This struct is available since SDL 3.1.3. + * \since This struct is available since SDL 3.2.0. * * \sa SDL_HAPTIC_CUSTOM * \sa SDL_HapticEffect @@ -903,7 +903,7 @@ typedef struct SDL_HapticCustom * Note either the attack_level or the fade_level may be above the actual * effect level. * - * \since This struct is available since SDL 3.1.3. + * \since This struct is available since SDL 3.2.0. * * \sa SDL_HapticConstant * \sa SDL_HapticPeriodic @@ -932,7 +932,7 @@ typedef union SDL_HapticEffect * * The value 0 is an invalid ID. * - * \since This datatype is available since SDL 3.1.3. + * \since This datatype is available since SDL 3.2.0. */ typedef Uint32 SDL_HapticID; @@ -948,7 +948,7 @@ typedef Uint32 SDL_HapticID; * failure; call SDL_GetError() for more information. This should be * freed with SDL_free() when it is no longer needed. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_OpenHaptic */ @@ -964,7 +964,7 @@ extern SDL_DECLSPEC SDL_HapticID * SDLCALL SDL_GetHaptics(int *count); * this function returns NULL; call SDL_GetError() for more * information. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_GetHapticName * \sa SDL_OpenHaptic @@ -985,7 +985,7 @@ extern SDL_DECLSPEC const char * SDLCALL SDL_GetHapticNameForID(SDL_HapticID ins * \returns the device identifier or NULL on failure; call SDL_GetError() for * more information. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_CloseHaptic * \sa SDL_GetHaptics @@ -1004,7 +1004,7 @@ extern SDL_DECLSPEC SDL_Haptic * SDLCALL SDL_OpenHaptic(SDL_HapticID instance_id * \returns an SDL_Haptic on success or NULL on failure or if it hasn't been * opened yet; call SDL_GetError() for more information. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. */ extern SDL_DECLSPEC SDL_Haptic * SDLCALL SDL_GetHapticFromID(SDL_HapticID instance_id); @@ -1015,7 +1015,7 @@ extern SDL_DECLSPEC SDL_Haptic * SDLCALL SDL_GetHapticFromID(SDL_HapticID instan * \returns the instance ID of the specified haptic device on success or 0 on * failure; call SDL_GetError() for more information. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. */ extern SDL_DECLSPEC SDL_HapticID SDLCALL SDL_GetHapticID(SDL_Haptic *haptic); @@ -1027,7 +1027,7 @@ extern SDL_DECLSPEC SDL_HapticID SDLCALL SDL_GetHapticID(SDL_Haptic *haptic); * this function returns NULL; call SDL_GetError() for more * information. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_GetHapticNameForID */ @@ -1038,7 +1038,7 @@ extern SDL_DECLSPEC const char * SDLCALL SDL_GetHapticName(SDL_Haptic *haptic); * * \returns true if the mouse is haptic or false if it isn't. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_OpenHapticFromMouse */ @@ -1050,7 +1050,7 @@ extern SDL_DECLSPEC bool SDLCALL SDL_IsMouseHaptic(void); * \returns the haptic device identifier or NULL on failure; call * SDL_GetError() for more information. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_CloseHaptic * \sa SDL_IsMouseHaptic @@ -1063,7 +1063,7 @@ extern SDL_DECLSPEC SDL_Haptic * SDLCALL SDL_OpenHapticFromMouse(void); * \param joystick the SDL_Joystick to test for haptic capabilities. * \returns true if the joystick is haptic or false if it isn't. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_OpenHapticFromJoystick */ @@ -1084,7 +1084,7 @@ extern SDL_DECLSPEC bool SDLCALL SDL_IsJoystickHaptic(SDL_Joystick *joystick); * \returns a valid haptic device identifier on success or NULL on failure; * call SDL_GetError() for more information. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_CloseHaptic * \sa SDL_IsJoystickHaptic @@ -1096,7 +1096,7 @@ extern SDL_DECLSPEC SDL_Haptic * SDLCALL SDL_OpenHapticFromJoystick(SDL_Joystick * * \param haptic the SDL_Haptic device to close. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_OpenHaptic */ @@ -1113,7 +1113,7 @@ extern SDL_DECLSPEC void SDLCALL SDL_CloseHaptic(SDL_Haptic *haptic); * \returns the number of effects the haptic device can store or a negative * error code on failure; call SDL_GetError() for more information. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_GetMaxHapticEffectsPlaying * \sa SDL_GetHapticFeatures @@ -1129,7 +1129,7 @@ extern SDL_DECLSPEC int SDLCALL SDL_GetMaxHapticEffects(SDL_Haptic *haptic); * \returns the number of effects the haptic device can play at the same time * or -1 on failure; call SDL_GetError() for more information. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_GetMaxHapticEffects * \sa SDL_GetHapticFeatures @@ -1143,7 +1143,7 @@ extern SDL_DECLSPEC int SDLCALL SDL_GetMaxHapticEffectsPlaying(SDL_Haptic *hapti * \returns a list of supported haptic features in bitwise manner (OR'd), or 0 * on failure; call SDL_GetError() for more information. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_HapticEffectSupported * \sa SDL_GetMaxHapticEffects @@ -1160,7 +1160,7 @@ extern SDL_DECLSPEC Uint32 SDLCALL SDL_GetHapticFeatures(SDL_Haptic *haptic); * \returns the number of axes on success or -1 on failure; call * SDL_GetError() for more information. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. */ extern SDL_DECLSPEC int SDLCALL SDL_GetNumHapticAxes(SDL_Haptic *haptic); @@ -1171,7 +1171,7 @@ extern SDL_DECLSPEC int SDLCALL SDL_GetNumHapticAxes(SDL_Haptic *haptic); * \param effect the desired effect to query. * \returns true if the effect is supported or false if it isn't. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_CreateHapticEffect * \sa SDL_GetHapticFeatures @@ -1187,7 +1187,7 @@ extern SDL_DECLSPEC bool SDLCALL SDL_HapticEffectSupported(SDL_Haptic *haptic, c * \returns the ID of the effect on success or -1 on failure; call * SDL_GetError() for more information. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_DestroyHapticEffect * \sa SDL_RunHapticEffect @@ -1210,7 +1210,7 @@ extern SDL_DECLSPEC int SDLCALL SDL_CreateHapticEffect(SDL_Haptic *haptic, const * \returns true on success or false on failure; call SDL_GetError() for more * information. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_CreateHapticEffect * \sa SDL_RunHapticEffect @@ -1233,7 +1233,7 @@ extern SDL_DECLSPEC bool SDLCALL SDL_UpdateHapticEffect(SDL_Haptic *haptic, int * \returns true on success or false on failure; call SDL_GetError() for more * information. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_GetHapticEffectStatus * \sa SDL_StopHapticEffect @@ -1249,7 +1249,7 @@ extern SDL_DECLSPEC bool SDLCALL SDL_RunHapticEffect(SDL_Haptic *haptic, int eff * \returns true on success or false on failure; call SDL_GetError() for more * information. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_RunHapticEffect * \sa SDL_StopHapticEffects @@ -1265,7 +1265,7 @@ extern SDL_DECLSPEC bool SDLCALL SDL_StopHapticEffect(SDL_Haptic *haptic, int ef * \param haptic the SDL_Haptic device to destroy the effect on. * \param effect the ID of the haptic effect to destroy. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_CreateHapticEffect */ @@ -1281,7 +1281,7 @@ extern SDL_DECLSPEC void SDLCALL SDL_DestroyHapticEffect(SDL_Haptic *haptic, int * \returns true if it is playing, false if it isn't playing or haptic status * isn't supported. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_GetHapticFeatures */ @@ -1303,7 +1303,7 @@ extern SDL_DECLSPEC bool SDLCALL SDL_GetHapticEffectStatus(SDL_Haptic *haptic, i * \returns true on success or false on failure; call SDL_GetError() for more * information. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_GetHapticFeatures */ @@ -1322,7 +1322,7 @@ extern SDL_DECLSPEC bool SDLCALL SDL_SetHapticGain(SDL_Haptic *haptic, int gain) * \returns true on success or false on failure; call SDL_GetError() for more * information. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_GetHapticFeatures */ @@ -1341,7 +1341,7 @@ extern SDL_DECLSPEC bool SDLCALL SDL_SetHapticAutocenter(SDL_Haptic *haptic, int * \returns true on success or false on failure; call SDL_GetError() for more * information. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_ResumeHaptic */ @@ -1356,7 +1356,7 @@ extern SDL_DECLSPEC bool SDLCALL SDL_PauseHaptic(SDL_Haptic *haptic); * \returns true on success or false on failure; call SDL_GetError() for more * information. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_PauseHaptic */ @@ -1369,7 +1369,7 @@ extern SDL_DECLSPEC bool SDLCALL SDL_ResumeHaptic(SDL_Haptic *haptic); * \returns true on success or false on failure; call SDL_GetError() for more * information. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_RunHapticEffect * \sa SDL_StopHapticEffects @@ -1382,7 +1382,7 @@ extern SDL_DECLSPEC bool SDLCALL SDL_StopHapticEffects(SDL_Haptic *haptic); * \param haptic haptic device to check for rumble support. * \returns true if the effect is supported or false if it isn't. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_InitHapticRumble */ @@ -1395,7 +1395,7 @@ extern SDL_DECLSPEC bool SDLCALL SDL_HapticRumbleSupported(SDL_Haptic *haptic); * \returns true on success or false on failure; call SDL_GetError() for more * information. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_PlayHapticRumble * \sa SDL_StopHapticRumble @@ -1412,7 +1412,7 @@ extern SDL_DECLSPEC bool SDLCALL SDL_InitHapticRumble(SDL_Haptic *haptic); * \returns true on success or false on failure; call SDL_GetError() for more * information. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_InitHapticRumble * \sa SDL_StopHapticRumble @@ -1426,7 +1426,7 @@ extern SDL_DECLSPEC bool SDLCALL SDL_PlayHapticRumble(SDL_Haptic *haptic, float * \returns true on success or false on failure; call SDL_GetError() for more * information. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_PlayHapticRumble */ diff --git a/include/SDL3/SDL_hidapi.h b/include/SDL3/SDL_hidapi.h index 9e28506189acb..131b03723a5fa 100644 --- a/include/SDL3/SDL_hidapi.h +++ b/include/SDL3/SDL_hidapi.h @@ -65,14 +65,14 @@ extern "C" { /** * An opaque handle representing an open HID device. * - * \since This struct is available since SDL 3.1.3. + * \since This struct is available since SDL 3.2.0. */ typedef struct SDL_hid_device SDL_hid_device; /** * HID underlying bus types. * - * \since This enum is available since SDL 3.1.3. + * \since This enum is available since SDL 3.2.0. */ typedef enum SDL_hid_bus_type { /** Unknown bus type */ @@ -107,7 +107,7 @@ typedef enum SDL_hid_bus_type { /** * Information about a connected HID device * - * \since This struct is available since SDL 3.1.3. + * \since This struct is available since SDL 3.2.0. */ typedef struct SDL_hid_device_info { @@ -169,7 +169,7 @@ typedef struct SDL_hid_device_info * \returns 0 on success or a negative error code on failure; call * SDL_GetError() for more information. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_hid_exit */ @@ -184,7 +184,7 @@ extern SDL_DECLSPEC int SDLCALL SDL_hid_init(void); * \returns 0 on success or a negative error code on failure; call * SDL_GetError() for more information. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_hid_init */ @@ -205,7 +205,7 @@ extern SDL_DECLSPEC int SDLCALL SDL_hid_exit(void); * \returns a change counter that is incremented with each potential device * change, or 0 if device change detection isn't available. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_hid_enumerate */ @@ -233,7 +233,7 @@ extern SDL_DECLSPEC Uint32 SDLCALL SDL_hid_device_change_count(void); * in the case of failure. Free this linked list by calling * SDL_hid_free_enumeration(). * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_hid_device_change_count */ @@ -247,7 +247,7 @@ extern SDL_DECLSPEC SDL_hid_device_info * SDLCALL SDL_hid_enumerate(unsigned sho * \param devs pointer to a list of struct_device returned from * SDL_hid_enumerate(). * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. */ extern SDL_DECLSPEC void SDLCALL SDL_hid_free_enumeration(SDL_hid_device_info *devs); @@ -265,7 +265,7 @@ extern SDL_DECLSPEC void SDLCALL SDL_hid_free_enumeration(SDL_hid_device_info *d * \returns a pointer to a SDL_hid_device object on success or NULL on * failure; call SDL_GetError() for more information. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. */ extern SDL_DECLSPEC SDL_hid_device * SDLCALL SDL_hid_open(unsigned short vendor_id, unsigned short product_id, const wchar_t *serial_number); @@ -279,7 +279,7 @@ extern SDL_DECLSPEC SDL_hid_device * SDLCALL SDL_hid_open(unsigned short vendor_ * \returns a pointer to a SDL_hid_device object on success or NULL on * failure; call SDL_GetError() for more information. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. */ extern SDL_DECLSPEC SDL_hid_device * SDLCALL SDL_hid_open_path(const char *path); @@ -306,7 +306,7 @@ extern SDL_DECLSPEC SDL_hid_device * SDLCALL SDL_hid_open_path(const char *path) * \returns the actual number of bytes written and -1 on on failure; call * SDL_GetError() for more information. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. */ extern SDL_DECLSPEC int SDLCALL SDL_hid_write(SDL_hid_device *dev, const unsigned char *data, size_t length); @@ -327,7 +327,7 @@ extern SDL_DECLSPEC int SDLCALL SDL_hid_write(SDL_hid_device *dev, const unsigne * SDL_GetError() for more information. If no packet was available to * be read within the timeout period, this function returns 0. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. */ extern SDL_DECLSPEC int SDLCALL SDL_hid_read_timeout(SDL_hid_device *dev, unsigned char *data, size_t length, int milliseconds); @@ -348,7 +348,7 @@ extern SDL_DECLSPEC int SDLCALL SDL_hid_read_timeout(SDL_hid_device *dev, unsign * be read and the handle is in non-blocking mode, this function * returns 0. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. */ extern SDL_DECLSPEC int SDLCALL SDL_hid_read(SDL_hid_device *dev, unsigned char *data, size_t length); @@ -367,7 +367,7 @@ extern SDL_DECLSPEC int SDLCALL SDL_hid_read(SDL_hid_device *dev, unsigned char * \returns 0 on success or a negative error code on failure; call * SDL_GetError() for more information. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. */ extern SDL_DECLSPEC int SDLCALL SDL_hid_set_nonblocking(SDL_hid_device *dev, int nonblock); @@ -392,7 +392,7 @@ extern SDL_DECLSPEC int SDLCALL SDL_hid_set_nonblocking(SDL_hid_device *dev, int * \returns the actual number of bytes written and -1 on failure; call * SDL_GetError() for more information. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. */ extern SDL_DECLSPEC int SDLCALL SDL_hid_send_feature_report(SDL_hid_device *dev, const unsigned char *data, size_t length); @@ -415,7 +415,7 @@ extern SDL_DECLSPEC int SDLCALL SDL_hid_send_feature_report(SDL_hid_device *dev, * still in the first byte), or -1 on on failure; call SDL_GetError() * for more information. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. */ extern SDL_DECLSPEC int SDLCALL SDL_hid_get_feature_report(SDL_hid_device *dev, unsigned char *data, size_t length); @@ -438,7 +438,7 @@ extern SDL_DECLSPEC int SDLCALL SDL_hid_get_feature_report(SDL_hid_device *dev, * still in the first byte), or -1 on on failure; call SDL_GetError() * for more information. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. */ extern SDL_DECLSPEC int SDLCALL SDL_hid_get_input_report(SDL_hid_device *dev, unsigned char *data, size_t length); @@ -449,7 +449,7 @@ extern SDL_DECLSPEC int SDLCALL SDL_hid_get_input_report(SDL_hid_device *dev, un * \returns 0 on success or a negative error code on failure; call * SDL_GetError() for more information. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. */ extern SDL_DECLSPEC int SDLCALL SDL_hid_close(SDL_hid_device *dev); @@ -462,7 +462,7 @@ extern SDL_DECLSPEC int SDLCALL SDL_hid_close(SDL_hid_device *dev); * \returns 0 on success or a negative error code on failure; call * SDL_GetError() for more information. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. */ extern SDL_DECLSPEC int SDLCALL SDL_hid_get_manufacturer_string(SDL_hid_device *dev, wchar_t *string, size_t maxlen); @@ -475,7 +475,7 @@ extern SDL_DECLSPEC int SDLCALL SDL_hid_get_manufacturer_string(SDL_hid_device * * \returns 0 on success or a negative error code on failure; call * SDL_GetError() for more information. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. */ extern SDL_DECLSPEC int SDLCALL SDL_hid_get_product_string(SDL_hid_device *dev, wchar_t *string, size_t maxlen); @@ -488,7 +488,7 @@ extern SDL_DECLSPEC int SDLCALL SDL_hid_get_product_string(SDL_hid_device *dev, * \returns 0 on success or a negative error code on failure; call * SDL_GetError() for more information. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. */ extern SDL_DECLSPEC int SDLCALL SDL_hid_get_serial_number_string(SDL_hid_device *dev, wchar_t *string, size_t maxlen); @@ -502,7 +502,7 @@ extern SDL_DECLSPEC int SDLCALL SDL_hid_get_serial_number_string(SDL_hid_device * \returns 0 on success or a negative error code on failure; call * SDL_GetError() for more information. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. */ extern SDL_DECLSPEC int SDLCALL SDL_hid_get_indexed_string(SDL_hid_device *dev, int string_index, wchar_t *string, size_t maxlen); @@ -514,7 +514,7 @@ extern SDL_DECLSPEC int SDLCALL SDL_hid_get_indexed_string(SDL_hid_device *dev, * on failure; call SDL_GetError() for more information. This struct * is valid until the device is closed with SDL_hid_close(). * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. */ extern SDL_DECLSPEC SDL_hid_device_info * SDLCALL SDL_hid_get_device_info(SDL_hid_device *dev); @@ -530,7 +530,7 @@ extern SDL_DECLSPEC SDL_hid_device_info * SDLCALL SDL_hid_get_device_info(SDL_hi * \returns the number of bytes actually copied or -1 on failure; call * SDL_GetError() for more information. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. */ extern SDL_DECLSPEC int SDLCALL SDL_hid_get_report_descriptor(SDL_hid_device *dev, unsigned char *buf, size_t buf_size); @@ -539,7 +539,7 @@ extern SDL_DECLSPEC int SDLCALL SDL_hid_get_report_descriptor(SDL_hid_device *de * * \param active true to start the scan, false to stop the scan. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. */ extern SDL_DECLSPEC void SDLCALL SDL_hid_ble_scan(bool active); diff --git a/include/SDL3/SDL_hints.h b/include/SDL3/SDL_hints.h index dd25fb9c19839..115499855fc61 100644 --- a/include/SDL3/SDL_hints.h +++ b/include/SDL3/SDL_hints.h @@ -61,7 +61,7 @@ extern "C" { * * This hint can be set anytime. * - * \since This hint is available since SDL 3.1.3. + * \since This hint is available since SDL 3.2.0. */ #define SDL_HINT_ALLOW_ALT_TAB_WHILE_GRABBED "SDL_ALLOW_ALT_TAB_WHILE_GRABBED" @@ -81,7 +81,7 @@ extern "C" { * * This hint can be set anytime. * - * \since This hint is available since SDL 3.1.3. + * \since This hint is available since SDL 3.2.0. */ #define SDL_HINT_ANDROID_ALLOW_RECREATE_ACTIVITY "SDL_ANDROID_ALLOW_RECREATE_ACTIVITY" @@ -96,7 +96,7 @@ extern "C" { * * This hint should be set before SDL is initialized. * - * \since This hint is available since SDL 3.1.3. + * \since This hint is available since SDL 3.2.0. */ #define SDL_HINT_ANDROID_BLOCK_ON_PAUSE "SDL_ANDROID_BLOCK_ON_PAUSE" @@ -113,7 +113,7 @@ extern "C" { * * This hint should be set before SDL audio is initialized. * - * \since This hint is available since SDL 3.1.8. + * \since This hint is available since SDL 3.2.0. */ #define SDL_HINT_ANDROID_LOW_LATENCY_AUDIO "SDL_ANDROID_LOW_LATENCY_AUDIO" @@ -136,7 +136,7 @@ extern "C" { * * This hint can be set anytime. * - * \since This hint is available since SDL 3.1.3. + * \since This hint is available since SDL 3.2.0. */ #define SDL_HINT_ANDROID_TRAP_BACK_BUTTON "SDL_ANDROID_TRAP_BACK_BUTTON" @@ -152,7 +152,7 @@ extern "C" { * * This hint should be set before SDL is initialized. * - * \since This hint is available since SDL 3.1.3. + * \since This hint is available since SDL 3.2.0. */ #define SDL_HINT_APP_ID "SDL_APP_ID" @@ -170,7 +170,7 @@ extern "C" { * * This hint should be set before SDL is initialized. * - * \since This hint is available since SDL 3.1.3. + * \since This hint is available since SDL 3.2.0. */ #define SDL_HINT_APP_NAME "SDL_APP_NAME" @@ -193,7 +193,7 @@ extern "C" { * * This hint can be set anytime. * - * \since This hint is available since SDL 3.1.3. + * \since This hint is available since SDL 3.2.0. */ #define SDL_HINT_APPLE_TV_CONTROLLER_UI_EVENTS "SDL_APPLE_TV_CONTROLLER_UI_EVENTS" @@ -208,7 +208,7 @@ extern "C" { * * This hint can be set anytime. * - * \since This hint is available since SDL 3.1.3. + * \since This hint is available since SDL 3.2.0. */ #define SDL_HINT_APPLE_TV_REMOTE_ALLOW_ROTATION "SDL_APPLE_TV_REMOTE_ALLOW_ROTATION" @@ -225,7 +225,7 @@ extern "C" { * * This hint should be set before an audio device is opened. * - * \since This hint is available since SDL 3.1.3. + * \since This hint is available since SDL 3.2.0. * * \sa SDL_HINT_AUDIO_ALSA_DEFAULT_PLAYBACK_DEVICE * \sa SDL_HINT_AUDIO_ALSA_DEFAULT_RECORDING_DEVICE @@ -243,7 +243,7 @@ extern "C" { * * This hint should be set before an audio device is opened. * - * \since This hint is available since SDL 3.1.7. + * \since This hint is available since SDL 3.2.0. * * \sa SDL_HINT_AUDIO_ALSA_DEFAULT_RECORDING_DEVICE * \sa SDL_HINT_AUDIO_ALSA_DEFAULT_DEVICE @@ -261,7 +261,7 @@ extern "C" { * * This hint should be set before an audio device is opened. * - * \since This hint is available since SDL 3.1.7. + * \since This hint is available since SDL 3.2.0. * * \sa SDL_HINT_AUDIO_ALSA_DEFAULT_PLAYBACK_DEVICE * \sa SDL_HINT_AUDIO_ALSA_DEFAULT_DEVICE @@ -282,7 +282,7 @@ extern "C" { * * This hint should be set before an audio device is opened. * - * \since This hint is available since SDL 3.1.3. + * \since This hint is available since SDL 3.2.0. */ #define SDL_HINT_AUDIO_CATEGORY "SDL_AUDIO_CATEGORY" @@ -295,7 +295,7 @@ extern "C" { * * This hint should be set before an audio device is opened. * - * \since This hint is available since SDL 3.1.3. + * \since This hint is available since SDL 3.2.0. */ #define SDL_HINT_AUDIO_CHANNELS "SDL_AUDIO_CHANNELS" @@ -318,7 +318,7 @@ extern "C" { * * This hint should be set before an audio device is opened. * - * \since This hint is available since SDL 3.1.3. + * \since This hint is available since SDL 3.2.0. */ #define SDL_HINT_AUDIO_DEVICE_APP_ICON_NAME "SDL_AUDIO_DEVICE_APP_ICON_NAME" @@ -340,7 +340,7 @@ extern "C" { * * This hint should be set before an audio device is opened. * - * \since This hint is available since SDL 3.1.3. + * \since This hint is available since SDL 3.2.0. */ #define SDL_HINT_AUDIO_DEVICE_SAMPLE_FRAMES "SDL_AUDIO_DEVICE_SAMPLE_FRAMES" @@ -367,7 +367,7 @@ extern "C" { * * This hint should be set before an audio device is opened. * - * \since This hint is available since SDL 3.1.3. + * \since This hint is available since SDL 3.2.0. */ #define SDL_HINT_AUDIO_DEVICE_STREAM_NAME "SDL_AUDIO_DEVICE_STREAM_NAME" @@ -393,7 +393,7 @@ extern "C" { * * This hint should be set before an audio device is opened. * - * \since This hint is available since SDL 3.1.3. + * \since This hint is available since SDL 3.2.0. */ #define SDL_HINT_AUDIO_DEVICE_STREAM_ROLE "SDL_AUDIO_DEVICE_STREAM_ROLE" @@ -404,7 +404,7 @@ extern "C" { * * This hint should be set before an audio device is opened. * - * \since This hint is available since SDL 3.1.3. + * \since This hint is available since SDL 3.2.0. */ #define SDL_HINT_AUDIO_DISK_INPUT_FILE "SDL_AUDIO_DISK_INPUT_FILE" @@ -415,7 +415,7 @@ extern "C" { * * This hint should be set before an audio device is opened. * - * \since This hint is available since SDL 3.1.3. + * \since This hint is available since SDL 3.2.0. */ #define SDL_HINT_AUDIO_DISK_OUTPUT_FILE "SDL_AUDIO_DISK_OUTPUT_FILE" @@ -428,7 +428,7 @@ extern "C" { * * This hint should be set before an audio device is opened. * - * \since This hint is available since SDL 3.1.3. + * \since This hint is available since SDL 3.2.0. */ #define SDL_HINT_AUDIO_DISK_TIMESCALE "SDL_AUDIO_DISK_TIMESCALE" @@ -442,7 +442,7 @@ extern "C" { * * This hint should be set before SDL is initialized. * - * \since This hint is available since SDL 3.1.3. + * \since This hint is available since SDL 3.2.0. */ #define SDL_HINT_AUDIO_DRIVER "SDL_AUDIO_DRIVER" @@ -455,7 +455,7 @@ extern "C" { * * This hint should be set before an audio device is opened. * - * \since This hint is available since SDL 3.1.3. + * \since This hint is available since SDL 3.2.0. */ #define SDL_HINT_AUDIO_DUMMY_TIMESCALE "SDL_AUDIO_DUMMY_TIMESCALE" @@ -482,7 +482,7 @@ extern "C" { * * This hint should be set before an audio device is opened. * - * \since This hint is available since SDL 3.1.3. + * \since This hint is available since SDL 3.2.0. */ #define SDL_HINT_AUDIO_FORMAT "SDL_AUDIO_FORMAT" @@ -495,7 +495,7 @@ extern "C" { * * This hint should be set before an audio device is opened. * - * \since This hint is available since SDL 3.1.3. + * \since This hint is available since SDL 3.2.0. */ #define SDL_HINT_AUDIO_FREQUENCY "SDL_AUDIO_FREQUENCY" @@ -518,7 +518,7 @@ extern "C" { * * This hint should be set before SDL is initialized. * - * \since This hint is available since SDL 3.1.3. + * \since This hint is available since SDL 3.2.0. */ #define SDL_HINT_AUDIO_INCLUDE_MONITORS "SDL_AUDIO_INCLUDE_MONITORS" @@ -533,7 +533,7 @@ extern "C" { * * This hint can be set anytime. * - * \since This hint is available since SDL 3.1.3. + * \since This hint is available since SDL 3.2.0. */ #define SDL_HINT_AUTO_UPDATE_JOYSTICKS "SDL_AUTO_UPDATE_JOYSTICKS" @@ -548,7 +548,7 @@ extern "C" { * * This hint can be set anytime. * - * \since This hint is available since SDL 3.1.3. + * \since This hint is available since SDL 3.2.0. */ #define SDL_HINT_AUTO_UPDATE_SENSORS "SDL_AUTO_UPDATE_SENSORS" @@ -571,7 +571,7 @@ extern "C" { * * This hint can be set anytime. * - * \since This hint is available since SDL 3.1.3. + * \since This hint is available since SDL 3.2.0. */ #define SDL_HINT_BMP_SAVE_LEGACY_FORMAT "SDL_BMP_SAVE_LEGACY_FORMAT" @@ -587,7 +587,7 @@ extern "C" { * best camera backend on your behalf. This hint needs to be set before * SDL_Init() is called to be useful. * - * \since This hint is available since SDL 3.1.3. + * \since This hint is available since SDL 3.2.0. */ #define SDL_HINT_CAMERA_DRIVER "SDL_CAMERA_DRIVER" @@ -620,7 +620,7 @@ extern "C" { * * The items can be prefixed by '+'/'-' to add/remove features. * - * \since This hint is available since SDL 3.1.3. + * \since This hint is available since SDL 3.2.0. */ #define SDL_HINT_CPU_FEATURE_MASK "SDL_CPU_FEATURE_MASK" @@ -634,7 +634,7 @@ extern "C" { * * This hint should be set before SDL is initialized. * - * \since This hint is available since SDL 3.1.3. + * \since This hint is available since SDL 3.2.0. */ #define SDL_HINT_JOYSTICK_DIRECTINPUT "SDL_JOYSTICK_DIRECTINPUT" @@ -663,7 +663,7 @@ extern "C" { * * This hint can be set anytime. * - * \since This hint is available since SDL 3.1.3. + * \since This hint is available since SDL 3.2.0. */ #define SDL_HINT_FILE_DIALOG_DRIVER "SDL_FILE_DIALOG_DRIVER" @@ -681,7 +681,7 @@ extern "C" { * * This hint can be set anytime. * - * \since This hint is available since SDL 3.1.3. + * \since This hint is available since SDL 3.2.0. */ #define SDL_HINT_DISPLAY_USABLE_BOUNDS "SDL_DISPLAY_USABLE_BOUNDS" @@ -702,7 +702,7 @@ extern "C" { * * This hint can be set anytime. * - * \since This hint is available since SDL 3.1.3. + * \since This hint is available since SDL 3.2.0. */ #define SDL_HINT_EMSCRIPTEN_ASYNCIFY "SDL_EMSCRIPTEN_ASYNCIFY" @@ -715,7 +715,7 @@ extern "C" { * * This hint should be set before creating a window. * - * \since This hint is available since SDL 3.1.3. + * \since This hint is available since SDL 3.2.0. */ #define SDL_HINT_EMSCRIPTEN_CANVAS_SELECTOR "SDL_EMSCRIPTEN_CANVAS_SELECTOR" @@ -736,7 +736,7 @@ extern "C" { * * This hint should be set before creating a window. * - * \since This hint is available since SDL 3.1.3. + * \since This hint is available since SDL 3.2.0. */ #define SDL_HINT_EMSCRIPTEN_KEYBOARD_ELEMENT "SDL_EMSCRIPTEN_KEYBOARD_ELEMENT" @@ -753,7 +753,7 @@ extern "C" { * * This hint must be set before SDL_StartTextInput() is called * - * \since This hint is available since SDL 3.1.3. + * \since This hint is available since SDL 3.2.0. */ #define SDL_HINT_ENABLE_SCREEN_KEYBOARD "SDL_ENABLE_SCREEN_KEYBOARD" @@ -770,7 +770,7 @@ extern "C" { * * This hint should be set before SDL is initialized. * - * \since This hint is available since SDL 3.1.3. + * \since This hint is available since SDL 3.2.0. */ #define SDL_HINT_EVDEV_DEVICES "SDL_EVDEV_DEVICES" @@ -794,7 +794,7 @@ extern "C" { * * This hint can be set anytime. * - * \since This hint is available since SDL 3.1.3. + * \since This hint is available since SDL 3.2.0. */ #define SDL_HINT_EVENT_LOGGING "SDL_EVENT_LOGGING" @@ -814,7 +814,7 @@ extern "C" { * * This hint can be set anytime. * - * \since This hint is available since SDL 3.1.3. + * \since This hint is available since SDL 3.2.0. */ #define SDL_HINT_FORCE_RAISEWINDOW "SDL_FORCE_RAISEWINDOW" @@ -835,7 +835,7 @@ extern "C" { * * This hint should be set before calling SDL_GetWindowSurface() * - * \since This hint is available since SDL 3.1.3. + * \since This hint is available since SDL 3.2.0. */ #define SDL_HINT_FRAMEBUFFER_ACCELERATION "SDL_FRAMEBUFFER_ACCELERATION" @@ -850,7 +850,7 @@ extern "C" { * * This hint should be set before SDL is initialized. * - * \since This hint is available since SDL 3.1.3. + * \since This hint is available since SDL 3.2.0. */ #define SDL_HINT_GAMECONTROLLERCONFIG "SDL_GAMECONTROLLERCONFIG" @@ -866,7 +866,7 @@ extern "C" { * * This hint should be set before SDL is initialized. * - * \since This hint is available since SDL 3.1.3. + * \since This hint is available since SDL 3.2.0. */ #define SDL_HINT_GAMECONTROLLERCONFIG_FILE "SDL_GAMECONTROLLERCONFIG_FILE" @@ -890,7 +890,7 @@ extern "C" { * * This hint should be set before SDL is initialized. * - * \since This hint is available since SDL 3.1.3. + * \since This hint is available since SDL 3.2.0. */ #define SDL_HINT_GAMECONTROLLERTYPE "SDL_GAMECONTROLLERTYPE" @@ -908,7 +908,7 @@ extern "C" { * * This hint can be set anytime. * - * \since This hint is available since SDL 3.1.3. + * \since This hint is available since SDL 3.2.0. */ #define SDL_HINT_GAMECONTROLLER_IGNORE_DEVICES "SDL_GAMECONTROLLER_IGNORE_DEVICES" @@ -926,7 +926,7 @@ extern "C" { * * This hint can be set anytime. * - * \since This hint is available since SDL 3.1.3. + * \since This hint is available since SDL 3.2.0. */ #define SDL_HINT_GAMECONTROLLER_IGNORE_DEVICES_EXCEPT "SDL_GAMECONTROLLER_IGNORE_DEVICES_EXCEPT" @@ -949,7 +949,7 @@ extern "C" { * * This hint should be set before a gamepad is opened. * - * \since This hint is available since SDL 3.1.3. + * \since This hint is available since SDL 3.2.0. */ #define SDL_HINT_GAMECONTROLLER_SENSOR_FUSION "SDL_GAMECONTROLLER_SENSOR_FUSION" @@ -961,7 +961,7 @@ extern "C" { * * This hint should be set before calling SDL_StartTextInput() * - * \since This hint is available since SDL 3.1.3. + * \since This hint is available since SDL 3.2.0. */ #define SDL_HINT_GDK_TEXTINPUT_DEFAULT_TEXT "SDL_GDK_TEXTINPUT_DEFAULT_TEXT" @@ -973,7 +973,7 @@ extern "C" { * * This hint should be set before calling SDL_StartTextInput() * - * \since This hint is available since SDL 3.1.3. + * \since This hint is available since SDL 3.2.0. */ #define SDL_HINT_GDK_TEXTINPUT_DESCRIPTION "SDL_GDK_TEXTINPUT_DESCRIPTION" @@ -988,7 +988,7 @@ extern "C" { * * This hint should be set before calling SDL_StartTextInput() * - * \since This hint is available since SDL 3.1.3. + * \since This hint is available since SDL 3.2.0. */ #define SDL_HINT_GDK_TEXTINPUT_MAX_LENGTH "SDL_GDK_TEXTINPUT_MAX_LENGTH" @@ -1004,7 +1004,7 @@ extern "C" { * * This hint should be set before calling SDL_StartTextInput() * - * \since This hint is available since SDL 3.1.3. + * \since This hint is available since SDL 3.2.0. */ #define SDL_HINT_GDK_TEXTINPUT_SCOPE "SDL_GDK_TEXTINPUT_SCOPE" @@ -1015,7 +1015,7 @@ extern "C" { * * This hint should be set before calling SDL_StartTextInput() * - * \since This hint is available since SDL 3.1.3. + * \since This hint is available since SDL 3.2.0. */ #define SDL_HINT_GDK_TEXTINPUT_TITLE "SDL_GDK_TEXTINPUT_TITLE" @@ -1033,7 +1033,7 @@ extern "C" { * * This hint should be set before SDL is initialized. * - * \since This hint is available since SDL 3.1.3. + * \since This hint is available since SDL 3.2.0. */ #define SDL_HINT_HIDAPI_LIBUSB "SDL_HIDAPI_LIBUSB" @@ -1051,7 +1051,7 @@ extern "C" { * * This hint should be set before SDL is initialized. * - * \since This hint is available since SDL 3.1.3. + * \since This hint is available since SDL 3.2.0. */ #define SDL_HINT_HIDAPI_LIBUSB_WHITELIST "SDL_HIDAPI_LIBUSB_WHITELIST" @@ -1065,7 +1065,7 @@ extern "C" { * * This hint should be set before SDL is initialized. * - * \since This hint is available since SDL 3.1.3. + * \since This hint is available since SDL 3.2.0. */ #define SDL_HINT_HIDAPI_UDEV "SDL_HIDAPI_UDEV" @@ -1079,7 +1079,7 @@ extern "C" { * * This hint should be set before any GPU functions are called. * - * \since This hint is available since SDL 3.1.3. + * \since This hint is available since SDL 3.2.0. */ #define SDL_HINT_GPU_DRIVER "SDL_GPU_DRIVER" @@ -1098,7 +1098,7 @@ extern "C" { * * This hint can be set anytime. * - * \since This hint is available since SDL 3.1.3. + * \since This hint is available since SDL 3.2.0. */ #define SDL_HINT_HIDAPI_ENUMERATE_ONLY_CONTROLLERS "SDL_HIDAPI_ENUMERATE_ONLY_CONTROLLERS" @@ -1115,7 +1115,7 @@ extern "C" { * * This hint can be set anytime. * - * \since This hint is available since SDL 3.1.3. + * \since This hint is available since SDL 3.2.0. */ #define SDL_HINT_HIDAPI_IGNORE_DEVICES "SDL_HIDAPI_IGNORE_DEVICES" @@ -1138,7 +1138,7 @@ extern "C" { * * This hint should be set before SDL is initialized. * - * \since This hint is available since SDL 3.1.3. + * \since This hint is available since SDL 3.2.0. */ #define SDL_HINT_IME_IMPLEMENTED_UI "SDL_IME_IMPLEMENTED_UI" @@ -1157,7 +1157,7 @@ extern "C" { * * This hint can be set anytime. * - * \since This hint is available since SDL 3.1.3. + * \since This hint is available since SDL 3.2.0. */ #define SDL_HINT_IOS_HIDE_HOME_INDICATOR "SDL_IOS_HIDE_HOME_INDICATOR" @@ -1174,7 +1174,7 @@ extern "C" { * * This hint can be set anytime. * - * \since This hint is available since SDL 3.1.3. + * \since This hint is available since SDL 3.2.0. */ #define SDL_HINT_JOYSTICK_ALLOW_BACKGROUND_EVENTS "SDL_JOYSTICK_ALLOW_BACKGROUND_EVENTS" @@ -1191,7 +1191,7 @@ extern "C" { * * This hint can be set anytime. * - * \since This hint is available since SDL 3.1.3. + * \since This hint is available since SDL 3.2.0. */ #define SDL_HINT_JOYSTICK_ARCADESTICK_DEVICES "SDL_JOYSTICK_ARCADESTICK_DEVICES" @@ -1212,7 +1212,7 @@ extern "C" { * * This hint can be set anytime. * - * \since This hint is available since SDL 3.1.3. + * \since This hint is available since SDL 3.2.0. */ #define SDL_HINT_JOYSTICK_ARCADESTICK_DEVICES_EXCLUDED "SDL_JOYSTICK_ARCADESTICK_DEVICES_EXCLUDED" @@ -1230,7 +1230,7 @@ extern "C" { * * This hint can be set anytime. * - * \since This hint is available since SDL 3.1.3. + * \since This hint is available since SDL 3.2.0. */ #define SDL_HINT_JOYSTICK_BLACKLIST_DEVICES "SDL_JOYSTICK_BLACKLIST_DEVICES" @@ -1251,7 +1251,7 @@ extern "C" { * * This hint can be set anytime. * - * \since This hint is available since SDL 3.1.3. + * \since This hint is available since SDL 3.2.0. */ #define SDL_HINT_JOYSTICK_BLACKLIST_DEVICES_EXCLUDED "SDL_JOYSTICK_BLACKLIST_DEVICES_EXCLUDED" @@ -1261,7 +1261,7 @@ extern "C" { * * This variable is currently only used by the Linux joystick driver. * - * \since This hint is available since SDL 3.1.3. + * \since This hint is available since SDL 3.2.0. */ #define SDL_HINT_JOYSTICK_DEVICE "SDL_JOYSTICK_DEVICE" @@ -1286,7 +1286,7 @@ extern "C" { * * This hint can be enabled anytime. * - * \since This hint is available since SDL 3.1.8. + * \since This hint is available since SDL 3.2.0. */ #define SDL_HINT_JOYSTICK_ENHANCED_REPORTS "SDL_JOYSTICK_ENHANCED_REPORTS" @@ -1303,7 +1303,7 @@ extern "C" { * * This hint can be set anytime. * - * \since This hint is available since SDL 3.1.3. + * \since This hint is available since SDL 3.2.0. */ #define SDL_HINT_JOYSTICK_FLIGHTSTICK_DEVICES "SDL_JOYSTICK_FLIGHTSTICK_DEVICES" @@ -1324,7 +1324,7 @@ extern "C" { * * This hint can be set anytime. * - * \since This hint is available since SDL 3.1.3. + * \since This hint is available since SDL 3.2.0. */ #define SDL_HINT_JOYSTICK_FLIGHTSTICK_DEVICES_EXCLUDED "SDL_JOYSTICK_FLIGHTSTICK_DEVICES_EXCLUDED" @@ -1341,7 +1341,7 @@ extern "C" { * * This hint should be set before SDL is initialized. * - * \since This hint is available since SDL 3.1.3. + * \since This hint is available since SDL 3.2.0. */ #define SDL_HINT_JOYSTICK_GAMEINPUT "SDL_JOYSTICK_GAMEINPUT" @@ -1359,7 +1359,7 @@ extern "C" { * * This hint can be set anytime. * - * \since This hint is available since SDL 3.1.3. + * \since This hint is available since SDL 3.2.0. */ #define SDL_HINT_JOYSTICK_GAMECUBE_DEVICES "SDL_JOYSTICK_GAMECUBE_DEVICES" @@ -1380,7 +1380,7 @@ extern "C" { * * This hint can be set anytime. * - * \since This hint is available since SDL 3.1.3. + * \since This hint is available since SDL 3.2.0. */ #define SDL_HINT_JOYSTICK_GAMECUBE_DEVICES_EXCLUDED "SDL_JOYSTICK_GAMECUBE_DEVICES_EXCLUDED" @@ -1397,7 +1397,7 @@ extern "C" { * * This hint should be set before initializing joysticks and gamepads. * - * \since This hint is available since SDL 3.1.3. + * \since This hint is available since SDL 3.2.0. */ #define SDL_HINT_JOYSTICK_HIDAPI "SDL_JOYSTICK_HIDAPI" @@ -1414,7 +1414,7 @@ extern "C" { * * This hint should be set before initializing joysticks and gamepads. * - * \since This hint is available since SDL 3.1.3. + * \since This hint is available since SDL 3.2.0. */ #define SDL_HINT_JOYSTICK_HIDAPI_COMBINE_JOY_CONS "SDL_JOYSTICK_HIDAPI_COMBINE_JOY_CONS" @@ -1431,7 +1431,7 @@ extern "C" { * * This hint should be set before initializing joysticks and gamepads. * - * \since This hint is available since SDL 3.1.3. + * \since This hint is available since SDL 3.2.0. */ #define SDL_HINT_JOYSTICK_HIDAPI_GAMECUBE "SDL_JOYSTICK_HIDAPI_GAMECUBE" @@ -1452,7 +1452,7 @@ extern "C" { * * This hint can be set anytime. * - * \since This hint is available since SDL 3.1.3. + * \since This hint is available since SDL 3.2.0. */ #define SDL_HINT_JOYSTICK_HIDAPI_GAMECUBE_RUMBLE_BRAKE "SDL_JOYSTICK_HIDAPI_GAMECUBE_RUMBLE_BRAKE" @@ -1469,7 +1469,7 @@ extern "C" { * * This hint should be set before initializing joysticks and gamepads. * - * \since This hint is available since SDL 3.1.3. + * \since This hint is available since SDL 3.2.0. */ #define SDL_HINT_JOYSTICK_HIDAPI_JOY_CONS "SDL_JOYSTICK_HIDAPI_JOY_CONS" @@ -1488,7 +1488,7 @@ extern "C" { * * This hint can be set anytime. * - * \since This hint is available since SDL 3.1.3. + * \since This hint is available since SDL 3.2.0. */ #define SDL_HINT_JOYSTICK_HIDAPI_JOYCON_HOME_LED "SDL_JOYSTICK_HIDAPI_JOYCON_HOME_LED" @@ -1505,7 +1505,7 @@ extern "C" { * * This hint should be set before initializing joysticks and gamepads. * - * \since This hint is available since SDL 3.1.3. + * \since This hint is available since SDL 3.2.0. */ #define SDL_HINT_JOYSTICK_HIDAPI_LUNA "SDL_JOYSTICK_HIDAPI_LUNA" @@ -1522,7 +1522,7 @@ extern "C" { * * This hint should be set before initializing joysticks and gamepads. * - * \since This hint is available since SDL 3.1.3. + * \since This hint is available since SDL 3.2.0. */ #define SDL_HINT_JOYSTICK_HIDAPI_NINTENDO_CLASSIC "SDL_JOYSTICK_HIDAPI_NINTENDO_CLASSIC" @@ -1544,7 +1544,7 @@ extern "C" { * * This hint should be set before initializing joysticks and gamepads. * - * \since This hint is available since SDL 3.1.3. + * \since This hint is available since SDL 3.2.0. */ #define SDL_HINT_JOYSTICK_HIDAPI_PS3 "SDL_JOYSTICK_HIDAPI_PS3" @@ -1561,7 +1561,7 @@ extern "C" { * * This hint should be set before initializing joysticks and gamepads. * - * \since This hint is available since SDL 3.1.3. + * \since This hint is available since SDL 3.2.0. */ #define SDL_HINT_JOYSTICK_HIDAPI_PS3_SIXAXIS_DRIVER "SDL_JOYSTICK_HIDAPI_PS3_SIXAXIS_DRIVER" @@ -1578,7 +1578,7 @@ extern "C" { * * This hint should be set before initializing joysticks and gamepads. * - * \since This hint is available since SDL 3.1.3. + * \since This hint is available since SDL 3.2.0. */ #define SDL_HINT_JOYSTICK_HIDAPI_PS4 "SDL_JOYSTICK_HIDAPI_PS4" @@ -1593,7 +1593,7 @@ extern "C" { * This hint can be set anytime, but only takes effect when extended input * reports are enabled. * - * \since This hint is available since SDL 3.1.3. + * \since This hint is available since SDL 3.2.0. */ #define SDL_HINT_JOYSTICK_HIDAPI_PS4_REPORT_INTERVAL "SDL_JOYSTICK_HIDAPI_PS4_REPORT_INTERVAL" @@ -1610,7 +1610,7 @@ extern "C" { * * This hint should be set before initializing joysticks and gamepads. * - * \since This hint is available since SDL 3.1.3. + * \since This hint is available since SDL 3.2.0. */ #define SDL_HINT_JOYSTICK_HIDAPI_PS5 "SDL_JOYSTICK_HIDAPI_PS5" @@ -1623,7 +1623,7 @@ extern "C" { * - "0": player LEDs are not enabled. * - "1": player LEDs are enabled. (default) * - * \since This hint is available since SDL 3.1.3. + * \since This hint is available since SDL 3.2.0. */ #define SDL_HINT_JOYSTICK_HIDAPI_PS5_PLAYER_LED "SDL_JOYSTICK_HIDAPI_PS5_PLAYER_LED" @@ -1640,7 +1640,7 @@ extern "C" { * * This hint should be set before initializing joysticks and gamepads. * - * \since This hint is available since SDL 3.1.3. + * \since This hint is available since SDL 3.2.0. */ #define SDL_HINT_JOYSTICK_HIDAPI_SHIELD "SDL_JOYSTICK_HIDAPI_SHIELD" @@ -1655,7 +1655,7 @@ extern "C" { * * The default is the value of SDL_HINT_JOYSTICK_HIDAPI. * - * \since This hint is available since SDL 3.1.3. + * \since This hint is available since SDL 3.2.0. */ #define SDL_HINT_JOYSTICK_HIDAPI_STADIA "SDL_JOYSTICK_HIDAPI_STADIA" @@ -1672,7 +1672,7 @@ extern "C" { * * This hint should be set before initializing joysticks and gamepads. * - * \since This hint is available since SDL 3.1.3. + * \since This hint is available since SDL 3.2.0. */ #define SDL_HINT_JOYSTICK_HIDAPI_STEAM "SDL_JOYSTICK_HIDAPI_STEAM" @@ -1691,7 +1691,7 @@ extern "C" { * * This hint can be set anytime. * - * \since This hint is available since SDL 3.1.8. + * \since This hint is available since SDL 3.2.0. */ #define SDL_HINT_JOYSTICK_HIDAPI_STEAM_HOME_LED "SDL_JOYSTICK_HIDAPI_STEAM_HOME_LED" @@ -1708,7 +1708,7 @@ extern "C" { * * This hint should be set before initializing joysticks and gamepads. * - * \since This hint is available since SDL 3.1.3. + * \since This hint is available since SDL 3.2.0. */ #define SDL_HINT_JOYSTICK_HIDAPI_STEAMDECK "SDL_JOYSTICK_HIDAPI_STEAMDECK" @@ -1736,7 +1736,7 @@ extern "C" { * * This hint should be set before initializing joysticks and gamepads. * - * \since This hint is available since SDL 3.1.3. + * \since This hint is available since SDL 3.2.0. */ #define SDL_HINT_JOYSTICK_HIDAPI_SWITCH "SDL_JOYSTICK_HIDAPI_SWITCH" @@ -1755,7 +1755,7 @@ extern "C" { * * This hint can be set anytime. * - * \since This hint is available since SDL 3.1.3. + * \since This hint is available since SDL 3.2.0. */ #define SDL_HINT_JOYSTICK_HIDAPI_SWITCH_HOME_LED "SDL_JOYSTICK_HIDAPI_SWITCH_HOME_LED" @@ -1770,7 +1770,7 @@ extern "C" { * * This hint can be set anytime. * - * \since This hint is available since SDL 3.1.3. + * \since This hint is available since SDL 3.2.0. */ #define SDL_HINT_JOYSTICK_HIDAPI_SWITCH_PLAYER_LED "SDL_JOYSTICK_HIDAPI_SWITCH_PLAYER_LED" @@ -1786,7 +1786,7 @@ extern "C" { * * This hint should be set before opening a Joy-Con controller. * - * \since This hint is available since SDL 3.1.3. + * \since This hint is available since SDL 3.2.0. */ #define SDL_HINT_JOYSTICK_HIDAPI_VERTICAL_JOY_CONS "SDL_JOYSTICK_HIDAPI_VERTICAL_JOY_CONS" @@ -1804,7 +1804,7 @@ extern "C" { * * This hint should be set before initializing joysticks and gamepads. * - * \since This hint is available since SDL 3.1.3. + * \since This hint is available since SDL 3.2.0. */ #define SDL_HINT_JOYSTICK_HIDAPI_WII "SDL_JOYSTICK_HIDAPI_WII" @@ -1819,7 +1819,7 @@ extern "C" { * * This hint can be set anytime. * - * \since This hint is available since SDL 3.1.3. + * \since This hint is available since SDL 3.2.0. */ #define SDL_HINT_JOYSTICK_HIDAPI_WII_PLAYER_LED "SDL_JOYSTICK_HIDAPI_WII_PLAYER_LED" @@ -1837,7 +1837,7 @@ extern "C" { * * This hint should be set before initializing joysticks and gamepads. * - * \since This hint is available since SDL 3.1.3. + * \since This hint is available since SDL 3.2.0. */ #define SDL_HINT_JOYSTICK_HIDAPI_XBOX "SDL_JOYSTICK_HIDAPI_XBOX" @@ -1854,7 +1854,7 @@ extern "C" { * * This hint should be set before initializing joysticks and gamepads. * - * \since This hint is available since SDL 3.1.3. + * \since This hint is available since SDL 3.2.0. */ #define SDL_HINT_JOYSTICK_HIDAPI_XBOX_360 "SDL_JOYSTICK_HIDAPI_XBOX_360" @@ -1869,7 +1869,7 @@ extern "C" { * * This hint can be set anytime. * - * \since This hint is available since SDL 3.1.3. + * \since This hint is available since SDL 3.2.0. */ #define SDL_HINT_JOYSTICK_HIDAPI_XBOX_360_PLAYER_LED "SDL_JOYSTICK_HIDAPI_XBOX_360_PLAYER_LED" @@ -1886,7 +1886,7 @@ extern "C" { * * This hint should be set before initializing joysticks and gamepads. * - * \since This hint is available since SDL 3.1.3. + * \since This hint is available since SDL 3.2.0. */ #define SDL_HINT_JOYSTICK_HIDAPI_XBOX_360_WIRELESS "SDL_JOYSTICK_HIDAPI_XBOX_360_WIRELESS" @@ -1903,7 +1903,7 @@ extern "C" { * * This hint should be set before initializing joysticks and gamepads. * - * \since This hint is available since SDL 3.1.3. + * \since This hint is available since SDL 3.2.0. */ #define SDL_HINT_JOYSTICK_HIDAPI_XBOX_ONE "SDL_JOYSTICK_HIDAPI_XBOX_ONE" @@ -1922,7 +1922,7 @@ extern "C" { * * This hint can be set anytime. * - * \since This hint is available since SDL 3.1.3. + * \since This hint is available since SDL 3.2.0. */ #define SDL_HINT_JOYSTICK_HIDAPI_XBOX_ONE_HOME_LED "SDL_JOYSTICK_HIDAPI_XBOX_ONE_HOME_LED" @@ -1937,7 +1937,7 @@ extern "C" { * * This hint should be set before SDL is initialized. * - * \since This hint is available since SDL 3.1.3. + * \since This hint is available since SDL 3.2.0. */ #define SDL_HINT_JOYSTICK_IOKIT "SDL_JOYSTICK_IOKIT" @@ -1952,7 +1952,7 @@ extern "C" { * * This hint should be set before SDL is initialized. * - * \since This hint is available since SDL 3.1.3. + * \since This hint is available since SDL 3.2.0. */ #define SDL_HINT_JOYSTICK_LINUX_CLASSIC "SDL_JOYSTICK_LINUX_CLASSIC" @@ -1967,7 +1967,7 @@ extern "C" { * * This hint should be set before a controller is opened. * - * \since This hint is available since SDL 3.1.3. + * \since This hint is available since SDL 3.2.0. */ #define SDL_HINT_JOYSTICK_LINUX_DEADZONES "SDL_JOYSTICK_LINUX_DEADZONES" @@ -1985,7 +1985,7 @@ extern "C" { * * This hint should be set before a controller is opened. * - * \since This hint is available since SDL 3.1.3. + * \since This hint is available since SDL 3.2.0. */ #define SDL_HINT_JOYSTICK_LINUX_DIGITAL_HATS "SDL_JOYSTICK_LINUX_DIGITAL_HATS" @@ -2001,7 +2001,7 @@ extern "C" { * * This hint should be set before a controller is opened. * - * \since This hint is available since SDL 3.1.3. + * \since This hint is available since SDL 3.2.0. */ #define SDL_HINT_JOYSTICK_LINUX_HAT_DEADZONES "SDL_JOYSTICK_LINUX_HAT_DEADZONES" @@ -2016,7 +2016,7 @@ extern "C" { * * This hint should be set before SDL is initialized. * - * \since This hint is available since SDL 3.1.3. + * \since This hint is available since SDL 3.2.0. */ #define SDL_HINT_JOYSTICK_MFI "SDL_JOYSTICK_MFI" @@ -2031,7 +2031,7 @@ extern "C" { * * This hint should be set before SDL is initialized. * - * \since This hint is available since SDL 3.1.3. + * \since This hint is available since SDL 3.2.0. */ #define SDL_HINT_JOYSTICK_RAWINPUT "SDL_JOYSTICK_RAWINPUT" @@ -2048,7 +2048,7 @@ extern "C" { * * This hint should be set before a gamepad is opened. * - * \since This hint is available since SDL 3.1.3. + * \since This hint is available since SDL 3.2.0. */ #define SDL_HINT_JOYSTICK_RAWINPUT_CORRELATE_XINPUT "SDL_JOYSTICK_RAWINPUT_CORRELATE_XINPUT" @@ -2063,7 +2063,7 @@ extern "C" { * * This hint should be set before SDL is initialized. * - * \since This hint is available since SDL 3.1.3. + * \since This hint is available since SDL 3.2.0. */ #define SDL_HINT_JOYSTICK_ROG_CHAKRAM "SDL_JOYSTICK_ROG_CHAKRAM" @@ -2078,7 +2078,7 @@ extern "C" { * * This hint should be set before SDL is initialized. * - * \since This hint is available since SDL 3.1.3. + * \since This hint is available since SDL 3.2.0. */ #define SDL_HINT_JOYSTICK_THREAD "SDL_JOYSTICK_THREAD" @@ -2095,7 +2095,7 @@ extern "C" { * * This hint can be set anytime. * - * \since This hint is available since SDL 3.1.3. + * \since This hint is available since SDL 3.2.0. */ #define SDL_HINT_JOYSTICK_THROTTLE_DEVICES "SDL_JOYSTICK_THROTTLE_DEVICES" @@ -2116,7 +2116,7 @@ extern "C" { * * This hint can be set anytime. * - * \since This hint is available since SDL 3.1.3. + * \since This hint is available since SDL 3.2.0. */ #define SDL_HINT_JOYSTICK_THROTTLE_DEVICES_EXCLUDED "SDL_JOYSTICK_THROTTLE_DEVICES_EXCLUDED" @@ -2131,7 +2131,7 @@ extern "C" { * * This hint should be set before SDL is initialized. * - * \since This hint is available since SDL 3.1.3. + * \since This hint is available since SDL 3.2.0. */ #define SDL_HINT_JOYSTICK_WGI "SDL_JOYSTICK_WGI" @@ -2148,7 +2148,7 @@ extern "C" { * * This hint can be set anytime. * - * \since This hint is available since SDL 3.1.3. + * \since This hint is available since SDL 3.2.0. */ #define SDL_HINT_JOYSTICK_WHEEL_DEVICES "SDL_JOYSTICK_WHEEL_DEVICES" @@ -2169,7 +2169,7 @@ extern "C" { * * This hint can be set anytime. * - * \since This hint is available since SDL 3.1.3. + * \since This hint is available since SDL 3.2.0. */ #define SDL_HINT_JOYSTICK_WHEEL_DEVICES_EXCLUDED "SDL_JOYSTICK_WHEEL_DEVICES_EXCLUDED" @@ -2187,7 +2187,7 @@ extern "C" { * * This hint should be set before a controller is opened. * - * \since This hint is available since SDL 3.1.3. + * \since This hint is available since SDL 3.2.0. */ #define SDL_HINT_JOYSTICK_ZERO_CENTERED_DEVICES "SDL_JOYSTICK_ZERO_CENTERED_DEVICES" @@ -2221,7 +2221,7 @@ extern "C" { * * This hint can be set anytime. * - * \since This hint is available since SDL 3.1.3. + * \since This hint is available since SDL 3.2.0. */ #define SDL_HINT_KEYCODE_OPTIONS "SDL_KEYCODE_OPTIONS" @@ -2235,7 +2235,7 @@ extern "C" { * * This hint should be set before SDL is initialized. * - * \since This hint is available since SDL 3.1.3. + * \since This hint is available since SDL 3.2.0. */ #define SDL_HINT_KMSDRM_DEVICE_INDEX "SDL_KMSDRM_DEVICE_INDEX" @@ -2263,7 +2263,7 @@ extern "C" { * * This hint should be set before SDL is initialized. * - * \since This hint is available since SDL 3.1.3. + * \since This hint is available since SDL 3.2.0. */ #define SDL_HINT_KMSDRM_REQUIRE_DRM_MASTER "SDL_KMSDRM_REQUIRE_DRM_MASTER" @@ -2289,7 +2289,7 @@ extern "C" { * * This hint can be set anytime. * - * \since This hint is available since SDL 3.1.3. + * \since This hint is available since SDL 3.2.0. */ #define SDL_HINT_LOGGING "SDL_LOGGING" @@ -2305,7 +2305,7 @@ extern "C" { * * This hint needs to be set before SDL_Init(). * - * \since This hint is available since SDL 3.1.3. + * \since This hint is available since SDL 3.2.0. */ #define SDL_HINT_MAC_BACKGROUND_APP "SDL_MAC_BACKGROUND_APP" @@ -2321,7 +2321,7 @@ extern "C" { * * This hint can be set anytime. * - * \since This hint is available since SDL 3.1.3. + * \since This hint is available since SDL 3.2.0. */ #define SDL_HINT_MAC_CTRL_CLICK_EMULATE_RIGHT_CLICK "SDL_MAC_CTRL_CLICK_EMULATE_RIGHT_CLICK" @@ -2344,7 +2344,7 @@ extern "C" { * * This hint can be set anytime. * - * \since This hint is available since SDL 3.1.3. + * \since This hint is available since SDL 3.2.0. */ #define SDL_HINT_MAC_OPENGL_ASYNC_DISPATCH "SDL_MAC_OPENGL_ASYNC_DISPATCH" @@ -2410,7 +2410,7 @@ extern "C" { * * This hint can be set anytime. * - * \since This hint is available since SDL 3.1.3. + * \since This hint is available since SDL 3.2.0. */ #define SDL_HINT_MAIN_CALLBACK_RATE "SDL_MAIN_CALLBACK_RATE" @@ -2429,7 +2429,7 @@ extern "C" { * * This hint can be set anytime. * - * \since This hint is available since SDL 3.1.3. + * \since This hint is available since SDL 3.2.0. */ #define SDL_HINT_MOUSE_AUTO_CAPTURE "SDL_MOUSE_AUTO_CAPTURE" @@ -2438,7 +2438,7 @@ extern "C" { * * This hint can be set anytime. * - * \since This hint is available since SDL 3.1.3. + * \since This hint is available since SDL 3.2.0. */ #define SDL_HINT_MOUSE_DOUBLE_CLICK_RADIUS "SDL_MOUSE_DOUBLE_CLICK_RADIUS" @@ -2447,7 +2447,7 @@ extern "C" { * * This hint can be set anytime. * - * \since This hint is available since SDL 3.1.3. + * \since This hint is available since SDL 3.2.0. */ #define SDL_HINT_MOUSE_DOUBLE_CLICK_TIME "SDL_MOUSE_DOUBLE_CLICK_TIME" @@ -2459,7 +2459,7 @@ extern "C" { * * This hint needs to be set before SDL_Init(). * - * \since This hint is available since SDL 3.1.3. + * \since This hint is available since SDL 3.2.0. */ #define SDL_HINT_MOUSE_DEFAULT_SYSTEM_CURSOR "SDL_MOUSE_DEFAULT_SYSTEM_CURSOR" @@ -2491,7 +2491,7 @@ extern "C" { * * This hint can be set anytime. * - * \since This hint is available since SDL 3.1.3. + * \since This hint is available since SDL 3.2.0. */ #define SDL_HINT_MOUSE_EMULATE_WARP_WITH_RELATIVE "SDL_MOUSE_EMULATE_WARP_WITH_RELATIVE" @@ -2505,7 +2505,7 @@ extern "C" { * * This hint can be set anytime. * - * \since This hint is available since SDL 3.1.3. + * \since This hint is available since SDL 3.2.0. */ #define SDL_HINT_MOUSE_FOCUS_CLICKTHROUGH "SDL_MOUSE_FOCUS_CLICKTHROUGH" @@ -2515,7 +2515,7 @@ extern "C" { * * This hint can be set anytime. * - * \since This hint is available since SDL 3.1.3. + * \since This hint is available since SDL 3.2.0. */ #define SDL_HINT_MOUSE_NORMAL_SPEED_SCALE "SDL_MOUSE_NORMAL_SPEED_SCALE" @@ -2536,7 +2536,7 @@ extern "C" { * * This hint can be set anytime. * - * \since This hint is available since SDL 3.1.3. + * \since This hint is available since SDL 3.2.0. */ #define SDL_HINT_MOUSE_RELATIVE_MODE_CENTER "SDL_MOUSE_RELATIVE_MODE_CENTER" @@ -2546,7 +2546,7 @@ extern "C" { * * This hint can be set anytime. * - * \since This hint is available since SDL 3.1.3. + * \since This hint is available since SDL 3.2.0. */ #define SDL_HINT_MOUSE_RELATIVE_SPEED_SCALE "SDL_MOUSE_RELATIVE_SPEED_SCALE" @@ -2565,7 +2565,7 @@ extern "C" { * * This hint can be set anytime. * - * \since This hint is available since SDL 3.1.3. + * \since This hint is available since SDL 3.2.0. */ #define SDL_HINT_MOUSE_RELATIVE_SYSTEM_SCALE "SDL_MOUSE_RELATIVE_SYSTEM_SCALE" @@ -2584,7 +2584,7 @@ extern "C" { * * This hint can be set anytime. * - * \since This hint is available since SDL 3.1.3. + * \since This hint is available since SDL 3.2.0. */ #define SDL_HINT_MOUSE_RELATIVE_WARP_MOTION "SDL_MOUSE_RELATIVE_WARP_MOTION" @@ -2603,7 +2603,7 @@ extern "C" { * * This hint can be set anytime. * - * \since This hint is available since SDL 3.1.3. + * \since This hint is available since SDL 3.2.0. */ #define SDL_HINT_MOUSE_RELATIVE_CURSOR_VISIBLE "SDL_MOUSE_RELATIVE_CURSOR_VISIBLE" @@ -2620,7 +2620,7 @@ extern "C" { * * This hint can be set anytime. * - * \since This hint is available since SDL 3.1.3. + * \since This hint is available since SDL 3.2.0. */ #define SDL_HINT_MOUSE_TOUCH_EVENTS "SDL_MOUSE_TOUCH_EVENTS" @@ -2638,7 +2638,7 @@ extern "C" { * * This hint should be set before SDL is initialized. * - * \since This hint is available since SDL 3.1.3. + * \since This hint is available since SDL 3.2.0. */ #define SDL_HINT_MUTE_CONSOLE_KEYBOARD "SDL_MUTE_CONSOLE_KEYBOARD" @@ -2653,7 +2653,7 @@ extern "C" { * * This hint should be set before SDL is initialized. * - * \since This hint is available since SDL 3.1.3. + * \since This hint is available since SDL 3.2.0. */ #define SDL_HINT_NO_SIGNAL_HANDLERS "SDL_NO_SIGNAL_HANDLERS" @@ -2664,7 +2664,7 @@ extern "C" { * OpenGL context. If this hint isn't set, SDL will choose a reasonable * default. * - * \since This hint is available since SDL 3.1.3. + * \since This hint is available since SDL 3.2.0. */ #define SDL_HINT_OPENGL_LIBRARY "SDL_OPENGL_LIBRARY" @@ -2710,7 +2710,7 @@ extern "C" { * * This hint should be set before SDL is initialized. * - * \since This hint is available since SDL 3.1.3. + * \since This hint is available since SDL 3.2.0. */ #define SDL_HINT_OPENGL_ES_DRIVER "SDL_OPENGL_ES_DRIVER" @@ -2741,7 +2741,7 @@ extern "C" { * * This hint should be set before SDL is initialized. * - * \since This hint is available since SDL 3.1.3. + * \since This hint is available since SDL 3.2.0. */ #define SDL_HINT_ORIENTATIONS "SDL_ORIENTATIONS" @@ -2761,7 +2761,7 @@ extern "C" { * * This hint can be set anytime. * - * \since This hint is available since SDL 3.1.3. + * \since This hint is available since SDL 3.2.0. */ #define SDL_HINT_POLL_SENTINEL "SDL_POLL_SENTINEL" @@ -2779,7 +2779,7 @@ extern "C" { * * This hint can be set anytime. * - * \since This hint is available since SDL 3.1.3. + * \since This hint is available since SDL 3.2.0. */ #define SDL_HINT_PREFERRED_LOCALES "SDL_PREFERRED_LOCALES" @@ -2802,7 +2802,7 @@ extern "C" { * * This hint can be set anytime. * - * \since This hint is available since SDL 3.1.3. + * \since This hint is available since SDL 3.2.0. */ #define SDL_HINT_QUIT_ON_LAST_WINDOW_CLOSE "SDL_QUIT_ON_LAST_WINDOW_CLOSE" @@ -2817,7 +2817,7 @@ extern "C" { * * This hint should be set before creating a renderer. * - * \since This hint is available since SDL 3.1.3. + * \since This hint is available since SDL 3.2.0. */ #define SDL_HINT_RENDER_DIRECT3D_THREADSAFE "SDL_RENDER_DIRECT3D_THREADSAFE" @@ -2833,7 +2833,7 @@ extern "C" { * * This hint should be set before creating a renderer. * - * \since This hint is available since SDL 3.1.3. + * \since This hint is available since SDL 3.2.0. */ #define SDL_HINT_RENDER_DIRECT3D11_DEBUG "SDL_RENDER_DIRECT3D11_DEBUG" @@ -2847,7 +2847,7 @@ extern "C" { * * By default, SDL does not use Vulkan Validation Layers. * - * \since This hint is available since SDL 3.1.3. + * \since This hint is available since SDL 3.2.0. */ #define SDL_HINT_RENDER_VULKAN_DEBUG "SDL_RENDER_VULKAN_DEBUG" @@ -2861,7 +2861,7 @@ extern "C" { * * This hint should be set before creating a renderer. * - * \since This hint is available since SDL 3.1.3. + * \since This hint is available since SDL 3.2.0. */ #define SDL_HINT_RENDER_GPU_DEBUG "SDL_RENDER_GPU_DEBUG" @@ -2876,7 +2876,7 @@ extern "C" { * * This hint should be set before creating a renderer. * - * \since This hint is available since SDL 3.1.3. + * \since This hint is available since SDL 3.2.0. */ #define SDL_HINT_RENDER_GPU_LOW_POWER "SDL_RENDER_GPU_LOW_POWER" @@ -2909,7 +2909,7 @@ extern "C" { * * This hint should be set before creating a renderer. * - * \since This hint is available since SDL 3.1.3. + * \since This hint is available since SDL 3.2.0. */ #define SDL_HINT_RENDER_DRIVER "SDL_RENDER_DRIVER" @@ -2927,7 +2927,7 @@ extern "C" { * * This hint should be set before creating a renderer. * - * \since This hint is available since SDL 3.1.3. + * \since This hint is available since SDL 3.2.0. */ #define SDL_HINT_RENDER_LINE_METHOD "SDL_RENDER_LINE_METHOD" @@ -2942,7 +2942,7 @@ extern "C" { * * This hint should be set before creating a renderer. * - * \since This hint is available since SDL 3.1.3. + * \since This hint is available since SDL 3.2.0. */ #define SDL_HINT_RENDER_METAL_PREFER_LOW_POWER_DEVICE "SDL_RENDER_METAL_PREFER_LOW_POWER_DEVICE" @@ -2959,7 +2959,7 @@ extern "C" { * * This hint should be set before creating a renderer. * - * \since This hint is available since SDL 3.1.3. + * \since This hint is available since SDL 3.2.0. */ #define SDL_HINT_RENDER_VSYNC "SDL_RENDER_VSYNC" @@ -2976,7 +2976,7 @@ extern "C" { * * This hint can be set anytime. * - * \since This hint is available since SDL 3.1.3. + * \since This hint is available since SDL 3.2.0. */ #define SDL_HINT_RETURN_KEY_HIDES_IME "SDL_RETURN_KEY_HIDES_IME" @@ -2993,7 +2993,7 @@ extern "C" { * * This hint should be set before SDL is initialized. * - * \since This hint is available since SDL 3.1.3. + * \since This hint is available since SDL 3.2.0. * * \sa SDL_HINT_ROG_GAMEPAD_MICE_EXCLUDED */ @@ -3015,7 +3015,7 @@ extern "C" { * * This hint should be set before SDL is initialized. * - * \since This hint is available since SDL 3.1.3. + * \since This hint is available since SDL 3.2.0. */ #define SDL_HINT_ROG_GAMEPAD_MICE_EXCLUDED "SDL_ROG_GAMEPAD_MICE_EXCLUDED" @@ -3027,7 +3027,7 @@ extern "C" { * * This hint should be set before SDL is initialized. * - * \since This hint is available since SDL 3.1.3. + * \since This hint is available since SDL 3.2.0. */ #define SDL_HINT_RPI_VIDEO_LAYER "SDL_RPI_VIDEO_LAYER" @@ -3049,7 +3049,7 @@ extern "C" { * * This hint should be set before calling SDL_DisableScreenSaver() * - * \since This hint is available since SDL 3.1.3. + * \since This hint is available since SDL 3.2.0. */ #define SDL_HINT_SCREENSAVER_INHIBIT_ACTIVITY_NAME "SDL_SCREENSAVER_INHIBIT_ACTIVITY_NAME" @@ -3068,7 +3068,7 @@ extern "C" { * * This hint can be set anytime. * - * \since This hint is available since SDL 3.1.3. + * \since This hint is available since SDL 3.2.0. */ #define SDL_HINT_SHUTDOWN_DBUS_ON_QUIT "SDL_SHUTDOWN_DBUS_ON_QUIT" @@ -3082,7 +3082,7 @@ extern "C" { * * This hint should be set before SDL is initialized. * - * \since This hint is available since SDL 3.1.3. + * \since This hint is available since SDL 3.2.0. */ #define SDL_HINT_STORAGE_TITLE_DRIVER "SDL_STORAGE_TITLE_DRIVER" @@ -3096,7 +3096,7 @@ extern "C" { * * This hint should be set before SDL is initialized. * - * \since This hint is available since SDL 3.1.3. + * \since This hint is available since SDL 3.2.0. */ #define SDL_HINT_STORAGE_USER_DRIVER "SDL_STORAGE_USER_DRIVER" @@ -3125,7 +3125,7 @@ extern "C" { * * This hint should be set before calling SDL_SetCurrentThreadPriority() * - * \since This hint is available since SDL 3.1.3. + * \since This hint is available since SDL 3.2.0. */ #define SDL_HINT_THREAD_FORCE_REALTIME_TIME_CRITICAL "SDL_THREAD_FORCE_REALTIME_TIME_CRITICAL" @@ -3148,7 +3148,7 @@ extern "C" { * * This hint should be set before calling SDL_SetCurrentThreadPriority() * - * \since This hint is available since SDL 3.1.3. + * \since This hint is available since SDL 3.2.0. */ #define SDL_HINT_THREAD_PRIORITY_POLICY "SDL_THREAD_PRIORITY_POLICY" @@ -3168,7 +3168,7 @@ extern "C" { * * This hint can be set anytime. * - * \since This hint is available since SDL 3.1.3. + * \since This hint is available since SDL 3.2.0. */ #define SDL_HINT_TIMER_RESOLUTION "SDL_TIMER_RESOLUTION" @@ -3183,7 +3183,7 @@ extern "C" { * * This hint can be set anytime. * - * \since This hint is available since SDL 3.1.3. + * \since This hint is available since SDL 3.2.0. */ #define SDL_HINT_TOUCH_MOUSE_EVENTS "SDL_TOUCH_MOUSE_EVENTS" @@ -3204,7 +3204,7 @@ extern "C" { * * This hint should be set before SDL is initialized. * - * \since This hint is available since SDL 3.1.3. + * \since This hint is available since SDL 3.2.0. */ #define SDL_HINT_TRACKPAD_IS_TOUCH_ONLY "SDL_TRACKPAD_IS_TOUCH_ONLY" @@ -3219,7 +3219,7 @@ extern "C" { * * This hint should be set before SDL is initialized. * - * \since This hint is available since SDL 3.1.3. + * \since This hint is available since SDL 3.2.0. */ #define SDL_HINT_TV_REMOTE_AS_JOYSTICK "SDL_TV_REMOTE_AS_JOYSTICK" @@ -3233,7 +3233,7 @@ extern "C" { * * This hint should be set before SDL is initialized. * - * \since This hint is available since SDL 3.1.3. + * \since This hint is available since SDL 3.2.0. */ #define SDL_HINT_VIDEO_ALLOW_SCREENSAVER "SDL_VIDEO_ALLOW_SCREENSAVER" @@ -3281,7 +3281,7 @@ extern "C" { * * This hint should be set before SDL is initialized. * - * \since This hint is available since SDL 3.1.3. + * \since This hint is available since SDL 3.2.0. */ #define SDL_HINT_VIDEO_DOUBLE_BUFFER "SDL_VIDEO_DOUBLE_BUFFER" @@ -3299,7 +3299,7 @@ extern "C" { * * This hint should be set before SDL is initialized. * - * \since This hint is available since SDL 3.1.3. + * \since This hint is available since SDL 3.2.0. */ #define SDL_HINT_VIDEO_DRIVER "SDL_VIDEO_DRIVER" @@ -3312,7 +3312,7 @@ extern "C" { * * This hint can be set anytime. * - * \since This hint is available since SDL 3.1.3. + * \since This hint is available since SDL 3.2.0. */ #define SDL_HINT_VIDEO_DUMMY_SAVE_FRAMES "SDL_VIDEO_DUMMY_SAVE_FRAMES" @@ -3326,7 +3326,7 @@ extern "C" { * * This hint should be set before SDL is initialized. * - * \since This hint is available since SDL 3.1.3. + * \since This hint is available since SDL 3.2.0. */ #define SDL_HINT_VIDEO_EGL_ALLOW_GETDISPLAY_FALLBACK "SDL_VIDEO_EGL_ALLOW_GETDISPLAY_FALLBACK" @@ -3342,7 +3342,7 @@ extern "C" { * * This hint should be set before SDL is initialized. * - * \since This hint is available since SDL 3.1.3. + * \since This hint is available since SDL 3.2.0. */ #define SDL_HINT_VIDEO_FORCE_EGL "SDL_VIDEO_FORCE_EGL" @@ -3360,7 +3360,7 @@ extern "C" { * * This hint should be set before creating a window. * - * \since This hint is available since SDL 3.1.3. + * \since This hint is available since SDL 3.2.0. */ #define SDL_HINT_VIDEO_MAC_FULLSCREEN_SPACES "SDL_VIDEO_MAC_FULLSCREEN_SPACES" @@ -3381,7 +3381,7 @@ extern "C" { * * This hint can be set anytime. * - * \since This hint is available since SDL 3.1.9. + * \since This hint is available since SDL 3.2.0. */ #define SDL_HINT_VIDEO_MAC_FULLSCREEN_MENU_VISIBILITY "SDL_VIDEO_MAC_FULLSCREEN_MENU_VISIBILITY" @@ -3397,7 +3397,7 @@ extern "C" { * * This hint can be set anytime. * - * \since This hint is available since SDL 3.1.3. + * \since This hint is available since SDL 3.2.0. */ #define SDL_HINT_VIDEO_MINIMIZE_ON_FOCUS_LOSS "SDL_VIDEO_MINIMIZE_ON_FOCUS_LOSS" @@ -3414,7 +3414,7 @@ extern "C" { * * This hint can be set anytime. * - * \since This hint is available since SDL 3.1.3. + * \since This hint is available since SDL 3.2.0. */ #define SDL_HINT_VIDEO_OFFSCREEN_SAVE_FRAMES "SDL_VIDEO_OFFSCREEN_SAVE_FRAMES" @@ -3440,7 +3440,7 @@ extern "C" { * * This hint can be set anytime. * - * \since This hint is available since SDL 3.1.3. + * \since This hint is available since SDL 3.2.0. */ #define SDL_HINT_VIDEO_SYNC_WINDOW_OPERATIONS "SDL_VIDEO_SYNC_WINDOW_OPERATIONS" @@ -3458,7 +3458,7 @@ extern "C" { * * This hint should be set before SDL is initialized. * - * \since This hint is available since SDL 3.1.3. + * \since This hint is available since SDL 3.2.0. */ #define SDL_HINT_VIDEO_WAYLAND_ALLOW_LIBDECOR "SDL_VIDEO_WAYLAND_ALLOW_LIBDECOR" @@ -3478,7 +3478,7 @@ extern "C" { * * This hint should be set before SDL is initialized. * - * \since This hint is available since SDL 3.1.3. + * \since This hint is available since SDL 3.2.0. */ #define SDL_HINT_VIDEO_WAYLAND_MODE_EMULATION "SDL_VIDEO_WAYLAND_MODE_EMULATION" @@ -3500,7 +3500,7 @@ extern "C" { * * This hint should be set before creating a window. * - * \since This hint is available since SDL 3.1.3. + * \since This hint is available since SDL 3.2.0. */ #define SDL_HINT_VIDEO_WAYLAND_MODE_SCALING "SDL_VIDEO_WAYLAND_MODE_SCALING" @@ -3520,7 +3520,7 @@ extern "C" { * * This hint should be set before SDL is initialized. * - * \since This hint is available since SDL 3.1.3. + * \since This hint is available since SDL 3.2.0. */ #define SDL_HINT_VIDEO_WAYLAND_PREFER_LIBDECOR "SDL_VIDEO_WAYLAND_PREFER_LIBDECOR" @@ -3559,7 +3559,7 @@ extern "C" { * * This hint should be set before creating a window. * - * \since This hint is available since SDL 3.1.3. + * \since This hint is available since SDL 3.2.0. */ #define SDL_HINT_VIDEO_WAYLAND_SCALE_TO_DISPLAY "SDL_VIDEO_WAYLAND_SCALE_TO_DISPLAY" @@ -3581,7 +3581,7 @@ extern "C" { * * This hint should be set before SDL is initialized. * - * \since This hint is available since SDL 3.1.3. + * \since This hint is available since SDL 3.2.0. */ #define SDL_HINT_VIDEO_WIN_D3DCOMPILER "SDL_VIDEO_WIN_D3DCOMPILER" @@ -3596,7 +3596,7 @@ extern "C" { * * This hint should be set before creating a window. * - * \since This hint is available since SDL 3.1.3. + * \since This hint is available since SDL 3.2.0. */ #define SDL_HINT_VIDEO_X11_NET_WM_BYPASS_COMPOSITOR "SDL_VIDEO_X11_NET_WM_BYPASS_COMPOSITOR" @@ -3615,7 +3615,7 @@ extern "C" { * * This hint should be set before creating a window. * - * \since This hint is available since SDL 3.1.3. + * \since This hint is available since SDL 3.2.0. */ #define SDL_HINT_VIDEO_X11_NET_WM_PING "SDL_VIDEO_X11_NET_WM_PING" @@ -3629,7 +3629,7 @@ extern "C" { * * This hint should be set before initializing the video subsystem. * - * \since This hint is available since SDL 3.1.3. + * \since This hint is available since SDL 3.2.0. */ #define SDL_HINT_VIDEO_X11_NODIRECTCOLOR "SDL_VIDEO_X11_NODIRECTCOLOR" @@ -3640,7 +3640,7 @@ extern "C" { * * This hint should be set before SDL is initialized. * - * \since This hint is available since SDL 3.1.3. + * \since This hint is available since SDL 3.2.0. */ #define SDL_HINT_VIDEO_X11_SCALING_FACTOR "SDL_VIDEO_X11_SCALING_FACTOR" @@ -3649,7 +3649,7 @@ extern "C" { * * This hint should be set before initializing the video subsystem. * - * \since This hint is available since SDL 3.1.3. + * \since This hint is available since SDL 3.2.0. */ #define SDL_HINT_VIDEO_X11_VISUALID "SDL_VIDEO_X11_VISUALID" @@ -3658,7 +3658,7 @@ extern "C" { * * This hint should be set before creating a window. * - * \since This hint is available since SDL 3.1.3. + * \since This hint is available since SDL 3.2.0. */ #define SDL_HINT_VIDEO_X11_WINDOW_VISUALID "SDL_VIDEO_X11_WINDOW_VISUALID" @@ -3672,7 +3672,7 @@ extern "C" { * * This hint should be set before SDL is initialized. * - * \since This hint is available since SDL 3.1.3. + * \since This hint is available since SDL 3.2.0. */ #define SDL_HINT_VIDEO_X11_XRANDR "SDL_VIDEO_X11_XRANDR" @@ -3687,7 +3687,7 @@ extern "C" { * * This hint should be set before SDL is initialized. * - * \since This hint is available since SDL 3.1.3. + * \since This hint is available since SDL 3.2.0. */ #define SDL_HINT_VITA_ENABLE_BACK_TOUCH "SDL_VITA_ENABLE_BACK_TOUCH" @@ -3702,7 +3702,7 @@ extern "C" { * * This hint should be set before SDL is initialized. * - * \since This hint is available since SDL 3.1.3. + * \since This hint is available since SDL 3.2.0. */ #define SDL_HINT_VITA_ENABLE_FRONT_TOUCH "SDL_VITA_ENABLE_FRONT_TOUCH" @@ -3713,7 +3713,7 @@ extern "C" { * * This hint should be set before SDL is initialized. * - * \since This hint is available since SDL 3.1.3. + * \since This hint is available since SDL 3.2.0. */ #define SDL_HINT_VITA_MODULE_PATH "SDL_VITA_MODULE_PATH" @@ -3726,7 +3726,7 @@ extern "C" { * * This hint should be set before SDL is initialized. * - * \since This hint is available since SDL 3.1.3. + * \since This hint is available since SDL 3.2.0. */ #define SDL_HINT_VITA_PVR_INIT "SDL_VITA_PVR_INIT" @@ -3741,7 +3741,7 @@ extern "C" { * * This hint should be set before SDL is initialized. * - * \since This hint is available since SDL 3.1.3. + * \since This hint is available since SDL 3.2.0. */ #define SDL_HINT_VITA_RESOLUTION "SDL_VITA_RESOLUTION" @@ -3756,7 +3756,7 @@ extern "C" { * * This hint should be set before SDL is initialized. * - * \since This hint is available since SDL 3.1.3. + * \since This hint is available since SDL 3.2.0. */ #define SDL_HINT_VITA_PVR_OPENGL "SDL_VITA_PVR_OPENGL" @@ -3772,7 +3772,7 @@ extern "C" { * * This hint can be set anytime. * - * \since This hint is available since SDL 3.1.3. + * \since This hint is available since SDL 3.2.0. */ #define SDL_HINT_VITA_TOUCH_MOUSE_DEVICE "SDL_VITA_TOUCH_MOUSE_DEVICE" @@ -3783,7 +3783,7 @@ extern "C" { * * This hint should be set before calling SDL_Vulkan_CreateSurface() * - * \since This hint is available since SDL 3.1.3. + * \since This hint is available since SDL 3.2.0. */ #define SDL_HINT_VULKAN_DISPLAY "SDL_VULKAN_DISPLAY" @@ -3793,7 +3793,7 @@ extern "C" { * This hint should be set before creating a Vulkan window or calling * SDL_Vulkan_LoadLibrary(). * - * \since This hint is available since SDL 3.1.3. + * \since This hint is available since SDL 3.2.0. */ #define SDL_HINT_VULKAN_LIBRARY "SDL_VULKAN_LIBRARY" @@ -3825,7 +3825,7 @@ extern "C" { * * This hint should be set before calling SDL_LoadWAV() or SDL_LoadWAV_IO() * - * \since This hint is available since SDL 3.1.3. + * \since This hint is available since SDL 3.2.0. */ #define SDL_HINT_WAVE_FACT_CHUNK "SDL_WAVE_FACT_CHUNK" @@ -3837,7 +3837,7 @@ extern "C" { * * This hint should be set before calling SDL_LoadWAV() or SDL_LoadWAV_IO() * - * \since This hint is available since SDL 3.1.3. + * \since This hint is available since SDL 3.2.0. */ #define SDL_HINT_WAVE_CHUNK_LIMIT "SDL_WAVE_CHUNK_LIMIT" @@ -3865,7 +3865,7 @@ extern "C" { * * This hint should be set before calling SDL_LoadWAV() or SDL_LoadWAV_IO() * - * \since This hint is available since SDL 3.1.3. + * \since This hint is available since SDL 3.2.0. */ #define SDL_HINT_WAVE_RIFF_CHUNK_SIZE "SDL_WAVE_RIFF_CHUNK_SIZE" @@ -3885,7 +3885,7 @@ extern "C" { * * This hint should be set before calling SDL_LoadWAV() or SDL_LoadWAV_IO() * - * \since This hint is available since SDL 3.1.3. + * \since This hint is available since SDL 3.2.0. */ #define SDL_HINT_WAVE_TRUNCATION "SDL_WAVE_TRUNCATION" @@ -3902,7 +3902,7 @@ extern "C" { * * This hint can be set anytime. * - * \since This hint is available since SDL 3.1.3. + * \since This hint is available since SDL 3.2.0. */ #define SDL_HINT_WINDOW_ACTIVATE_WHEN_RAISED "SDL_WINDOW_ACTIVATE_WHEN_RAISED" @@ -3919,7 +3919,7 @@ extern "C" { * * This hint can be set anytime. * - * \since This hint is available since SDL 3.1.3. + * \since This hint is available since SDL 3.2.0. */ #define SDL_HINT_WINDOW_ACTIVATE_WHEN_SHOWN "SDL_WINDOW_ACTIVATE_WHEN_SHOWN" @@ -3937,7 +3937,7 @@ extern "C" { * * This hint can be set anytime. * - * \since This hint is available since SDL 3.1.3. + * \since This hint is available since SDL 3.2.0. */ #define SDL_HINT_WINDOW_ALLOW_TOPMOST "SDL_WINDOW_ALLOW_TOPMOST" @@ -3953,7 +3953,7 @@ extern "C" { * * This hint can be set anytime. * - * \since This hint is available since SDL 3.1.3. + * \since This hint is available since SDL 3.2.0. */ #define SDL_HINT_WINDOW_FRAME_USABLE_WHILE_CURSOR_HIDDEN "SDL_WINDOW_FRAME_USABLE_WHILE_CURSOR_HIDDEN" @@ -3969,7 +3969,7 @@ extern "C" { * * This hint can be set anytime. * - * \since This hint is available since SDL 3.1.3. + * \since This hint is available since SDL 3.2.0. */ #define SDL_HINT_WINDOWS_CLOSE_ON_ALT_F4 "SDL_WINDOWS_CLOSE_ON_ALT_F4" @@ -3998,7 +3998,7 @@ extern "C" { * * This hint can be set anytime. * - * \since This hint is available since SDL 3.1.3. + * \since This hint is available since SDL 3.2.0. */ #define SDL_HINT_WINDOWS_ENABLE_MENU_MNEMONICS "SDL_WINDOWS_ENABLE_MENU_MNEMONICS" @@ -4013,7 +4013,7 @@ extern "C" { * * This hint can be set anytime. * - * \since This hint is available since SDL 3.1.3. + * \since This hint is available since SDL 3.2.0. */ #define SDL_HINT_WINDOWS_ENABLE_MESSAGELOOP "SDL_WINDOWS_ENABLE_MESSAGELOOP" @@ -4029,7 +4029,7 @@ extern "C" { * * This hint should be set before SDL is initialized. * - * \since This hint is available since SDL 3.1.3. + * \since This hint is available since SDL 3.2.0. */ #define SDL_HINT_WINDOWS_GAMEINPUT "SDL_WINDOWS_GAMEINPUT" @@ -4043,7 +4043,7 @@ extern "C" { * * This hint can be set anytime. * - * \since This hint is available since SDL 3.1.3. + * \since This hint is available since SDL 3.2.0. */ #define SDL_HINT_WINDOWS_RAW_KEYBOARD "SDL_WINDOWS_RAW_KEYBOARD" @@ -4064,7 +4064,7 @@ extern "C" { * * This hint should be set before SDL is initialized. * - * \since This hint is available since SDL 3.1.3. + * \since This hint is available since SDL 3.2.0. */ #define SDL_HINT_WINDOWS_FORCE_SEMAPHORE_KERNEL "SDL_WINDOWS_FORCE_SEMAPHORE_KERNEL" @@ -4074,7 +4074,7 @@ extern "C" { * * This hint should be set before SDL is initialized. * - * \since This hint is available since SDL 3.1.3. + * \since This hint is available since SDL 3.2.0. */ #define SDL_HINT_WINDOWS_INTRESOURCE_ICON "SDL_WINDOWS_INTRESOURCE_ICON" @@ -4084,7 +4084,7 @@ extern "C" { * * This hint should be set before SDL is initialized. * - * \since This hint is available since SDL 3.1.3. + * \since This hint is available since SDL 3.2.0. */ #define SDL_HINT_WINDOWS_INTRESOURCE_ICON_SMALL "SDL_WINDOWS_INTRESOURCE_ICON_SMALL" @@ -4110,7 +4110,7 @@ extern "C" { * * This hint should be set before SDL is initialized. * - * \since This hint is available since SDL 3.1.3. + * \since This hint is available since SDL 3.2.0. */ #define SDL_HINT_WINDOWS_USE_D3D9EX "SDL_WINDOWS_USE_D3D9EX" @@ -4127,7 +4127,7 @@ extern "C" { * * This hint should be set before creating a window. * - * \since This hint is available since SDL 3.1.3. + * \since This hint is available since SDL 3.2.0. */ #define SDL_HINT_WINDOWS_ERASE_BACKGROUND_MODE "SDL_WINDOWS_ERASE_BACKGROUND_MODE" @@ -4148,7 +4148,7 @@ extern "C" { * * This hint should be set before creating a window. * - * \since This hint is available since SDL 3.1.3. + * \since This hint is available since SDL 3.2.0. */ #define SDL_HINT_X11_FORCE_OVERRIDE_REDIRECT "SDL_X11_FORCE_OVERRIDE_REDIRECT" @@ -4165,7 +4165,7 @@ extern "C" { * * This hint should be set before creating a window. * - * \since This hint is available since SDL 3.1.3. + * \since This hint is available since SDL 3.2.0. */ #define SDL_HINT_X11_WINDOW_TYPE "SDL_X11_WINDOW_TYPE" @@ -4176,7 +4176,7 @@ extern "C" { * * This hint should be set before initializing the video subsystem. * - * \since This hint is available since SDL 3.1.3. + * \since This hint is available since SDL 3.2.0. */ #define SDL_HINT_X11_XCB_LIBRARY "SDL_X11_XCB_LIBRARY" @@ -4191,7 +4191,7 @@ extern "C" { * * This hint should be set before SDL is initialized. * - * \since This hint is available since SDL 3.1.3. + * \since This hint is available since SDL 3.2.0. */ #define SDL_HINT_XINPUT_ENABLED "SDL_XINPUT_ENABLED" @@ -4215,7 +4215,7 @@ extern "C" { * This hint should be set before an assertion failure is triggered and can be * changed at any time. * - * \since This hint is available since SDL 3.1.3. + * \since This hint is available since SDL 3.2.0. */ #define SDL_HINT_ASSERT "SDL_ASSERT" @@ -4253,7 +4253,7 @@ extern "C" { /** * An enumeration of hint priorities. * - * \since This enum is available since SDL 3.1.3. + * \since This enum is available since SDL 3.2.0. */ typedef enum SDL_HintPriority { @@ -4277,7 +4277,7 @@ typedef enum SDL_HintPriority * * \threadsafety It is safe to call this function from any thread. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_GetHint * \sa SDL_ResetHint @@ -4299,7 +4299,7 @@ extern SDL_DECLSPEC bool SDLCALL SDL_SetHintWithPriority(const char *name, const * * \threadsafety It is safe to call this function from any thread. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_GetHint * \sa SDL_ResetHint @@ -4320,7 +4320,7 @@ extern SDL_DECLSPEC bool SDLCALL SDL_SetHint(const char *name, const char *value * * \threadsafety It is safe to call this function from any thread. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_SetHint * \sa SDL_ResetHints @@ -4336,7 +4336,7 @@ extern SDL_DECLSPEC bool SDLCALL SDL_ResetHint(const char *name); * * \threadsafety It is safe to call this function from any thread. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_ResetHint */ @@ -4355,7 +4355,7 @@ extern SDL_DECLSPEC void SDLCALL SDL_ResetHints(void); * callback instead is always thread-safe, as SDL holds a lock * on the thread subsystem during the callback. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_SetHint * \sa SDL_SetHintWithPriority @@ -4372,7 +4372,7 @@ extern SDL_DECLSPEC const char *SDLCALL SDL_GetHint(const char *name); * * \threadsafety It is safe to call this function from any thread. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_GetHint * \sa SDL_SetHint @@ -4394,7 +4394,7 @@ extern SDL_DECLSPEC bool SDLCALL SDL_GetHintBoolean(const char *name, bool defau * hint value. SDL holds a lock on the hint subsystem when * calling this callback. * - * \since This datatype is available since SDL 3.1.3. + * \since This datatype is available since SDL 3.2.0. * * \sa SDL_AddHintCallback */ @@ -4415,7 +4415,7 @@ typedef void(SDLCALL *SDL_HintCallback)(void *userdata, const char *name, const * * \threadsafety It is safe to call this function from any thread. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_RemoveHintCallback */ @@ -4431,7 +4431,7 @@ extern SDL_DECLSPEC bool SDLCALL SDL_AddHintCallback(const char *name, SDL_HintC * * \threadsafety It is safe to call this function from any thread. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_AddHintCallback */ diff --git a/include/SDL3/SDL_init.h b/include/SDL3/SDL_init.h index 6eb21f841c32d..adf0de8a21e21 100644 --- a/include/SDL3/SDL_init.h +++ b/include/SDL3/SDL_init.h @@ -67,7 +67,7 @@ extern "C" { * These are the flags which may be passed to SDL_Init(). You should specify * the subsystems which you will be using in your application. * - * \since This datatype is available since SDL 3.1.3. + * \since This datatype is available since SDL 3.2.0. * * \sa SDL_Init * \sa SDL_Quit @@ -104,7 +104,7 @@ typedef Uint32 SDL_InitFlags; * [Main callbacks in SDL3](https://wiki.libsdl.org/SDL3/README/main-functions#main-callbacks-in-sdl3) * for complete details. * - * \since This enum is available since SDL 3.1.3. + * \since This enum is available since SDL 3.2.0. */ typedef enum SDL_AppResult { @@ -128,7 +128,7 @@ typedef enum SDL_AppResult * \returns SDL_APP_FAILURE to terminate with an error, SDL_APP_SUCCESS to * terminate with success, SDL_APP_CONTINUE to continue. * - * \since This datatype is available since SDL 3.1.3. + * \since This datatype is available since SDL 3.2.0. */ typedef SDL_AppResult (SDLCALL *SDL_AppInit_func)(void **appstate, int argc, char *argv[]); @@ -143,7 +143,7 @@ typedef SDL_AppResult (SDLCALL *SDL_AppInit_func)(void **appstate, int argc, cha * \returns SDL_APP_FAILURE to terminate with an error, SDL_APP_SUCCESS to * terminate with success, SDL_APP_CONTINUE to continue. * - * \since This datatype is available since SDL 3.1.3. + * \since This datatype is available since SDL 3.2.0. */ typedef SDL_AppResult (SDLCALL *SDL_AppIterate_func)(void *appstate); @@ -159,7 +159,7 @@ typedef SDL_AppResult (SDLCALL *SDL_AppIterate_func)(void *appstate); * \returns SDL_APP_FAILURE to terminate with an error, SDL_APP_SUCCESS to * terminate with success, SDL_APP_CONTINUE to continue. * - * \since This datatype is available since SDL 3.1.3. + * \since This datatype is available since SDL 3.2.0. */ typedef SDL_AppResult (SDLCALL *SDL_AppEvent_func)(void *appstate, SDL_Event *event); @@ -173,7 +173,7 @@ typedef SDL_AppResult (SDLCALL *SDL_AppEvent_func)(void *appstate, SDL_Event *ev * \param appstate an optional pointer, provided by the app in SDL_AppInit. * \param result the result code that terminated the app (success or failure). * - * \since This datatype is available since SDL 3.1.3. + * \since This datatype is available since SDL 3.2.0. */ typedef void (SDLCALL *SDL_AppQuit_func)(void *appstate, SDL_AppResult result); @@ -224,7 +224,7 @@ typedef void (SDLCALL *SDL_AppQuit_func)(void *appstate, SDL_AppResult result); * \returns true on success or false on failure; call SDL_GetError() for more * information. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_SetAppMetadata * \sa SDL_SetAppMetadataProperty @@ -244,7 +244,7 @@ extern SDL_DECLSPEC bool SDLCALL SDL_Init(SDL_InitFlags flags); * \returns true on success or false on failure; call SDL_GetError() for more * information. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_Init * \sa SDL_Quit @@ -260,7 +260,7 @@ extern SDL_DECLSPEC bool SDLCALL SDL_InitSubSystem(SDL_InitFlags flags); * * \param flags any of the flags used by SDL_Init(); see SDL_Init for details. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_InitSubSystem * \sa SDL_Quit @@ -274,7 +274,7 @@ extern SDL_DECLSPEC void SDLCALL SDL_QuitSubSystem(SDL_InitFlags flags); * \returns a mask of all initialized subsystems if `flags` is 0, otherwise it * returns the initialization status of the specified subsystems. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_Init * \sa SDL_InitSubSystem @@ -292,7 +292,7 @@ extern SDL_DECLSPEC SDL_InitFlags SDLCALL SDL_WasInit(SDL_InitFlags flags); * application is shutdown, but it is not wise to do this from a library or * other dynamically loaded code. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_Init * \sa SDL_QuitSubSystem @@ -313,7 +313,7 @@ extern SDL_DECLSPEC void SDLCALL SDL_Quit(void); * * \threadsafety It is safe to call this function from any thread. * - * \since This function is available since SDL 3.1.8. + * \since This function is available since SDL 3.2.0. * * \sa SDL_RunOnMainThread */ @@ -324,7 +324,7 @@ extern SDL_DECLSPEC bool SDLCALL SDL_IsMainThread(void); * * \param userdata an app-controlled pointer that is passed to the callback. * - * \since This datatype is available since SDL 3.1.8. + * \since This datatype is available since SDL 3.2.0. * * \sa SDL_RunOnMainThread */ @@ -350,7 +350,7 @@ typedef void (SDLCALL *SDL_MainThreadCallback)(void *userdata); * * \threadsafety It is safe to call this function from any thread. * - * \since This function is available since SDL 3.1.8. + * \since This function is available since SDL 3.2.0. * * \sa SDL_IsMainThread */ @@ -388,7 +388,7 @@ extern SDL_DECLSPEC bool SDLCALL SDL_RunOnMainThread(SDL_MainThreadCallback call * * \threadsafety It is safe to call this function from any thread. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_SetAppMetadataProperty */ @@ -450,7 +450,7 @@ extern SDL_DECLSPEC bool SDLCALL SDL_SetAppMetadata(const char *appname, const c * * \threadsafety It is safe to call this function from any thread. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_GetAppMetadataProperty * \sa SDL_SetAppMetadata @@ -481,7 +481,7 @@ extern SDL_DECLSPEC bool SDLCALL SDL_SetAppMetadataProperty(const char *name, co * freed if you call SDL_SetAppMetadataProperty() to set that * property from another thread. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_SetAppMetadata * \sa SDL_SetAppMetadataProperty diff --git a/include/SDL3/SDL_intrin.h b/include/SDL3/SDL_intrin.h index 079c6f904b161..f10fe5807f74d 100644 --- a/include/SDL3/SDL_intrin.h +++ b/include/SDL3/SDL_intrin.h @@ -335,7 +335,7 @@ _m_prefetch(void *__P) * This symbol is used by SDL internally, but apps and other libraries are * welcome to use it for their own interfaces as well. * - * \since This macro is available since SDL 3.1.3. + * \since This macro is available since SDL 3.2.0. */ #define SDL_TARGETING(x) __attribute__((target(x))) diff --git a/include/SDL3/SDL_iostream.h b/include/SDL3/SDL_iostream.h index a45a12d01ccb9..4ca16093e52c1 100644 --- a/include/SDL3/SDL_iostream.h +++ b/include/SDL3/SDL_iostream.h @@ -48,7 +48,7 @@ extern "C" { /** * SDL_IOStream status, set by a read or write operation. * - * \since This enum is available since SDL 3.1.3. + * \since This enum is available since SDL 3.2.0. */ typedef enum SDL_IOStatus { @@ -66,7 +66,7 @@ typedef enum SDL_IOStatus * These map to the same "whence" concept that `fseek` or `lseek` use in the * standard C runtime. * - * \since This enum is available since SDL 3.1.3. + * \since This enum is available since SDL 3.2.0. */ typedef enum SDL_IOWhence { @@ -85,7 +85,7 @@ typedef enum SDL_IOWhence * * This structure should be initialized using SDL_INIT_INTERFACE() * - * \since This struct is available since SDL 3.1.3. + * \since This struct is available since SDL 3.2.0. * * \sa SDL_INIT_INTERFACE */ @@ -177,7 +177,7 @@ SDL_COMPILE_TIME_ASSERT(SDL_IOStreamInterface_SIZE, * SDL_OpenIO() to provide their own stream implementation behind this * struct's abstract interface. * - * \since This struct is available since SDL 3.1.3. + * \since This struct is available since SDL 3.2.0. */ typedef struct SDL_IOStream SDL_IOStream; @@ -262,7 +262,7 @@ typedef struct SDL_IOStream SDL_IOStream; * * \threadsafety This function is not thread safe. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_CloseIO * \sa SDL_FlushIO @@ -307,7 +307,7 @@ extern SDL_DECLSPEC SDL_IOStream * SDLCALL SDL_IOFromFile(const char *file, cons * * \threadsafety It is safe to call this function from any thread. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_IOFromConstMem * \sa SDL_CloseIO @@ -353,7 +353,7 @@ extern SDL_DECLSPEC SDL_IOStream * SDLCALL SDL_IOFromMem(void *mem, size_t size) * * \threadsafety It is safe to call this function from any thread. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_IOFromMem * \sa SDL_CloseIO @@ -383,7 +383,7 @@ extern SDL_DECLSPEC SDL_IOStream * SDLCALL SDL_IOFromConstMem(const void *mem, s * * \threadsafety It is safe to call this function from any thread. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_CloseIO * \sa SDL_ReadIO @@ -418,7 +418,7 @@ extern SDL_DECLSPEC SDL_IOStream * SDLCALL SDL_IOFromDynamicMem(void); * * \threadsafety It is safe to call this function from any thread. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_CloseIO * \sa SDL_INIT_INTERFACE @@ -454,7 +454,7 @@ extern SDL_DECLSPEC SDL_IOStream * SDLCALL SDL_OpenIO(const SDL_IOStreamInterfac * * \threadsafety This function is not thread safe. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_OpenIO */ @@ -469,7 +469,7 @@ extern SDL_DECLSPEC bool SDLCALL SDL_CloseIO(SDL_IOStream *context); * * \threadsafety This function is not thread safe. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. */ extern SDL_DECLSPEC SDL_PropertiesID SDLCALL SDL_GetIOProperties(SDL_IOStream *context); @@ -489,7 +489,7 @@ extern SDL_DECLSPEC SDL_PropertiesID SDLCALL SDL_GetIOProperties(SDL_IOStream *c * * \threadsafety This function is not thread safe. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. */ extern SDL_DECLSPEC SDL_IOStatus SDLCALL SDL_GetIOStatus(SDL_IOStream *context); @@ -503,7 +503,7 @@ extern SDL_DECLSPEC SDL_IOStatus SDLCALL SDL_GetIOStatus(SDL_IOStream *context); * * \threadsafety This function is not thread safe. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. */ extern SDL_DECLSPEC Sint64 SDLCALL SDL_GetIOSize(SDL_IOStream *context); @@ -530,7 +530,7 @@ extern SDL_DECLSPEC Sint64 SDLCALL SDL_GetIOSize(SDL_IOStream *context); * * \threadsafety This function is not thread safe. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_TellIO */ @@ -550,7 +550,7 @@ extern SDL_DECLSPEC Sint64 SDLCALL SDL_SeekIO(SDL_IOStream *context, Sint64 offs * * \threadsafety This function is not thread safe. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_SeekIO */ @@ -575,7 +575,7 @@ extern SDL_DECLSPEC Sint64 SDLCALL SDL_TellIO(SDL_IOStream *context); * * \threadsafety This function is not thread safe. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_WriteIO * \sa SDL_GetIOStatus @@ -604,7 +604,7 @@ extern SDL_DECLSPEC size_t SDLCALL SDL_ReadIO(SDL_IOStream *context, void *ptr, * * \threadsafety This function is not thread safe. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_IOprintf * \sa SDL_ReadIO @@ -628,7 +628,7 @@ extern SDL_DECLSPEC size_t SDLCALL SDL_WriteIO(SDL_IOStream *context, const void * * \threadsafety This function is not thread safe. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_IOvprintf * \sa SDL_WriteIO @@ -648,7 +648,7 @@ extern SDL_DECLSPEC size_t SDLCALL SDL_IOprintf(SDL_IOStream *context, SDL_PRINT * * \threadsafety This function is not thread safe. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_IOprintf * \sa SDL_WriteIO @@ -668,7 +668,7 @@ extern SDL_DECLSPEC size_t SDLCALL SDL_IOvprintf(SDL_IOStream *context, SDL_PRIN * * \threadsafety This function is not thread safe. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_OpenIO * \sa SDL_WriteIO @@ -694,7 +694,7 @@ extern SDL_DECLSPEC bool SDLCALL SDL_FlushIO(SDL_IOStream *context); * * \threadsafety This function is not thread safe. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_LoadFile * \sa SDL_SaveFile_IO @@ -717,7 +717,7 @@ extern SDL_DECLSPEC void * SDLCALL SDL_LoadFile_IO(SDL_IOStream *src, size_t *da * * \threadsafety This function is not thread safe. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_LoadFile_IO * \sa SDL_SaveFile @@ -738,7 +738,7 @@ extern SDL_DECLSPEC void * SDLCALL SDL_LoadFile(const char *file, size_t *datasi * * \threadsafety This function is not thread safe. * - * \since This function is available since SDL 3.1.8. + * \since This function is available since SDL 3.2.0. * * \sa SDL_SaveFile * \sa SDL_LoadFile_IO @@ -757,7 +757,7 @@ extern SDL_DECLSPEC bool SDLCALL SDL_SaveFile_IO(SDL_IOStream *src, const void * * * \threadsafety This function is not thread safe. * - * \since This function is available since SDL 3.1.8. + * \since This function is available since SDL 3.2.0. * * \sa SDL_SaveFile_IO * \sa SDL_LoadFile @@ -786,7 +786,7 @@ extern SDL_DECLSPEC bool SDLCALL SDL_SaveFile(const char *file, const void *data * * \threadsafety This function is not thread safe. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. */ extern SDL_DECLSPEC bool SDLCALL SDL_ReadU8(SDL_IOStream *src, Uint8 *value); @@ -805,7 +805,7 @@ extern SDL_DECLSPEC bool SDLCALL SDL_ReadU8(SDL_IOStream *src, Uint8 *value); * * \threadsafety This function is not thread safe. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. */ extern SDL_DECLSPEC bool SDLCALL SDL_ReadS8(SDL_IOStream *src, Sint8 *value); @@ -828,7 +828,7 @@ extern SDL_DECLSPEC bool SDLCALL SDL_ReadS8(SDL_IOStream *src, Sint8 *value); * * \threadsafety This function is not thread safe. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. */ extern SDL_DECLSPEC bool SDLCALL SDL_ReadU16LE(SDL_IOStream *src, Uint16 *value); @@ -851,7 +851,7 @@ extern SDL_DECLSPEC bool SDLCALL SDL_ReadU16LE(SDL_IOStream *src, Uint16 *value) * * \threadsafety This function is not thread safe. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. */ extern SDL_DECLSPEC bool SDLCALL SDL_ReadS16LE(SDL_IOStream *src, Sint16 *value); @@ -874,7 +874,7 @@ extern SDL_DECLSPEC bool SDLCALL SDL_ReadS16LE(SDL_IOStream *src, Sint16 *value) * * \threadsafety This function is not thread safe. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. */ extern SDL_DECLSPEC bool SDLCALL SDL_ReadU16BE(SDL_IOStream *src, Uint16 *value); @@ -897,7 +897,7 @@ extern SDL_DECLSPEC bool SDLCALL SDL_ReadU16BE(SDL_IOStream *src, Uint16 *value) * * \threadsafety This function is not thread safe. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. */ extern SDL_DECLSPEC bool SDLCALL SDL_ReadS16BE(SDL_IOStream *src, Sint16 *value); @@ -920,7 +920,7 @@ extern SDL_DECLSPEC bool SDLCALL SDL_ReadS16BE(SDL_IOStream *src, Sint16 *value) * * \threadsafety This function is not thread safe. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. */ extern SDL_DECLSPEC bool SDLCALL SDL_ReadU32LE(SDL_IOStream *src, Uint32 *value); @@ -943,7 +943,7 @@ extern SDL_DECLSPEC bool SDLCALL SDL_ReadU32LE(SDL_IOStream *src, Uint32 *value) * * \threadsafety This function is not thread safe. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. */ extern SDL_DECLSPEC bool SDLCALL SDL_ReadS32LE(SDL_IOStream *src, Sint32 *value); @@ -966,7 +966,7 @@ extern SDL_DECLSPEC bool SDLCALL SDL_ReadS32LE(SDL_IOStream *src, Sint32 *value) * * \threadsafety This function is not thread safe. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. */ extern SDL_DECLSPEC bool SDLCALL SDL_ReadU32BE(SDL_IOStream *src, Uint32 *value); @@ -989,7 +989,7 @@ extern SDL_DECLSPEC bool SDLCALL SDL_ReadU32BE(SDL_IOStream *src, Uint32 *value) * * \threadsafety This function is not thread safe. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. */ extern SDL_DECLSPEC bool SDLCALL SDL_ReadS32BE(SDL_IOStream *src, Sint32 *value); @@ -1012,7 +1012,7 @@ extern SDL_DECLSPEC bool SDLCALL SDL_ReadS32BE(SDL_IOStream *src, Sint32 *value) * * \threadsafety This function is not thread safe. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. */ extern SDL_DECLSPEC bool SDLCALL SDL_ReadU64LE(SDL_IOStream *src, Uint64 *value); @@ -1035,7 +1035,7 @@ extern SDL_DECLSPEC bool SDLCALL SDL_ReadU64LE(SDL_IOStream *src, Uint64 *value) * * \threadsafety This function is not thread safe. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. */ extern SDL_DECLSPEC bool SDLCALL SDL_ReadS64LE(SDL_IOStream *src, Sint64 *value); @@ -1058,7 +1058,7 @@ extern SDL_DECLSPEC bool SDLCALL SDL_ReadS64LE(SDL_IOStream *src, Sint64 *value) * * \threadsafety This function is not thread safe. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. */ extern SDL_DECLSPEC bool SDLCALL SDL_ReadU64BE(SDL_IOStream *src, Uint64 *value); @@ -1081,7 +1081,7 @@ extern SDL_DECLSPEC bool SDLCALL SDL_ReadU64BE(SDL_IOStream *src, Uint64 *value) * * \threadsafety This function is not thread safe. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. */ extern SDL_DECLSPEC bool SDLCALL SDL_ReadS64BE(SDL_IOStream *src, Sint64 *value); /* @} *//* Read endian functions */ @@ -1103,7 +1103,7 @@ extern SDL_DECLSPEC bool SDLCALL SDL_ReadS64BE(SDL_IOStream *src, Sint64 *value) * * \threadsafety This function is not thread safe. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. */ extern SDL_DECLSPEC bool SDLCALL SDL_WriteU8(SDL_IOStream *dst, Uint8 value); @@ -1117,7 +1117,7 @@ extern SDL_DECLSPEC bool SDLCALL SDL_WriteU8(SDL_IOStream *dst, Uint8 value); * * \threadsafety This function is not thread safe. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. */ extern SDL_DECLSPEC bool SDLCALL SDL_WriteS8(SDL_IOStream *dst, Sint8 value); @@ -1136,7 +1136,7 @@ extern SDL_DECLSPEC bool SDLCALL SDL_WriteS8(SDL_IOStream *dst, Sint8 value); * * \threadsafety This function is not thread safe. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. */ extern SDL_DECLSPEC bool SDLCALL SDL_WriteU16LE(SDL_IOStream *dst, Uint16 value); @@ -1155,7 +1155,7 @@ extern SDL_DECLSPEC bool SDLCALL SDL_WriteU16LE(SDL_IOStream *dst, Uint16 value) * * \threadsafety This function is not thread safe. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. */ extern SDL_DECLSPEC bool SDLCALL SDL_WriteS16LE(SDL_IOStream *dst, Sint16 value); @@ -1173,7 +1173,7 @@ extern SDL_DECLSPEC bool SDLCALL SDL_WriteS16LE(SDL_IOStream *dst, Sint16 value) * * \threadsafety This function is not thread safe. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. */ extern SDL_DECLSPEC bool SDLCALL SDL_WriteU16BE(SDL_IOStream *dst, Uint16 value); @@ -1191,7 +1191,7 @@ extern SDL_DECLSPEC bool SDLCALL SDL_WriteU16BE(SDL_IOStream *dst, Uint16 value) * * \threadsafety This function is not thread safe. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. */ extern SDL_DECLSPEC bool SDLCALL SDL_WriteS16BE(SDL_IOStream *dst, Sint16 value); @@ -1210,7 +1210,7 @@ extern SDL_DECLSPEC bool SDLCALL SDL_WriteS16BE(SDL_IOStream *dst, Sint16 value) * * \threadsafety This function is not thread safe. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. */ extern SDL_DECLSPEC bool SDLCALL SDL_WriteU32LE(SDL_IOStream *dst, Uint32 value); @@ -1229,7 +1229,7 @@ extern SDL_DECLSPEC bool SDLCALL SDL_WriteU32LE(SDL_IOStream *dst, Uint32 value) * * \threadsafety This function is not thread safe. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. */ extern SDL_DECLSPEC bool SDLCALL SDL_WriteS32LE(SDL_IOStream *dst, Sint32 value); @@ -1247,7 +1247,7 @@ extern SDL_DECLSPEC bool SDLCALL SDL_WriteS32LE(SDL_IOStream *dst, Sint32 value) * * \threadsafety This function is not thread safe. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. */ extern SDL_DECLSPEC bool SDLCALL SDL_WriteU32BE(SDL_IOStream *dst, Uint32 value); @@ -1265,7 +1265,7 @@ extern SDL_DECLSPEC bool SDLCALL SDL_WriteU32BE(SDL_IOStream *dst, Uint32 value) * * \threadsafety This function is not thread safe. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. */ extern SDL_DECLSPEC bool SDLCALL SDL_WriteS32BE(SDL_IOStream *dst, Sint32 value); @@ -1284,7 +1284,7 @@ extern SDL_DECLSPEC bool SDLCALL SDL_WriteS32BE(SDL_IOStream *dst, Sint32 value) * * \threadsafety This function is not thread safe. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. */ extern SDL_DECLSPEC bool SDLCALL SDL_WriteU64LE(SDL_IOStream *dst, Uint64 value); @@ -1303,7 +1303,7 @@ extern SDL_DECLSPEC bool SDLCALL SDL_WriteU64LE(SDL_IOStream *dst, Uint64 value) * * \threadsafety This function is not thread safe. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. */ extern SDL_DECLSPEC bool SDLCALL SDL_WriteS64LE(SDL_IOStream *dst, Sint64 value); @@ -1321,7 +1321,7 @@ extern SDL_DECLSPEC bool SDLCALL SDL_WriteS64LE(SDL_IOStream *dst, Sint64 value) * * \threadsafety This function is not thread safe. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. */ extern SDL_DECLSPEC bool SDLCALL SDL_WriteU64BE(SDL_IOStream *dst, Uint64 value); @@ -1339,7 +1339,7 @@ extern SDL_DECLSPEC bool SDLCALL SDL_WriteU64BE(SDL_IOStream *dst, Uint64 value) * * \threadsafety This function is not thread safe. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. */ extern SDL_DECLSPEC bool SDLCALL SDL_WriteS64BE(SDL_IOStream *dst, Sint64 value); diff --git a/include/SDL3/SDL_joystick.h b/include/SDL3/SDL_joystick.h index 23c891fd11a15..d15668b66ac9a 100644 --- a/include/SDL3/SDL_joystick.h +++ b/include/SDL3/SDL_joystick.h @@ -81,7 +81,7 @@ extern SDL_Mutex *SDL_joystick_lock; * * This is opaque data. * - * \since This struct is available since SDL 3.1.3. + * \since This struct is available since SDL 3.2.0. */ typedef struct SDL_Joystick SDL_Joystick; @@ -93,7 +93,7 @@ typedef struct SDL_Joystick SDL_Joystick; * * The value 0 is an invalid ID. * - * \since This datatype is available since SDL 3.1.3. + * \since This datatype is available since SDL 3.2.0. */ typedef Uint32 SDL_JoystickID; @@ -107,7 +107,7 @@ typedef Uint32 SDL_JoystickID; * This is by no means a complete list of everything that can be plugged into * a computer. * - * \since This enum is available since SDL 3.1.3. + * \since This enum is available since SDL 3.2.0. */ typedef enum SDL_JoystickType { @@ -130,7 +130,7 @@ typedef enum SDL_JoystickType * This is used by SDL_GetJoystickConnectionState to report how a device is * connected to the system. * - * \since This enum is available since SDL 3.1.3. + * \since This enum is available since SDL 3.2.0. */ typedef enum SDL_JoystickConnectionState { @@ -143,7 +143,7 @@ typedef enum SDL_JoystickConnectionState /** * The largest value an SDL_Joystick's axis can report. * - * \since This macro is available since SDL 3.1.3. + * \since This macro is available since SDL 3.2.0. * * \sa SDL_JOYSTICK_AXIS_MIN */ @@ -154,7 +154,7 @@ typedef enum SDL_JoystickConnectionState * * This is a negative number! * - * \since This macro is available since SDL 3.1.3. + * \since This macro is available since SDL 3.2.0. * * \sa SDL_JOYSTICK_AXIS_MAX */ @@ -170,14 +170,14 @@ typedef enum SDL_JoystickConnectionState * joysticks while processing to guarantee that the joystick list won't change * and joystick and gamepad events will not be delivered. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. */ extern SDL_DECLSPEC void SDLCALL SDL_LockJoysticks(void) SDL_ACQUIRE(SDL_joystick_lock); /** * Unlocking for atomic access to the joystick API. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. */ extern SDL_DECLSPEC void SDLCALL SDL_UnlockJoysticks(void) SDL_RELEASE(SDL_joystick_lock); @@ -186,7 +186,7 @@ extern SDL_DECLSPEC void SDLCALL SDL_UnlockJoysticks(void) SDL_RELEASE(SDL_joyst * * \returns true if a joystick is connected, false otherwise. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_GetJoysticks */ @@ -201,7 +201,7 @@ extern SDL_DECLSPEC bool SDLCALL SDL_HasJoystick(void); * call SDL_GetError() for more information. This should be freed * with SDL_free() when it is no longer needed. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_HasJoystick * \sa SDL_OpenJoystick @@ -217,7 +217,7 @@ extern SDL_DECLSPEC SDL_JoystickID * SDLCALL SDL_GetJoysticks(int *count); * \returns the name of the selected joystick. If no name can be found, this * function returns NULL; call SDL_GetError() for more information. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_GetJoystickName * \sa SDL_GetJoysticks @@ -233,7 +233,7 @@ extern SDL_DECLSPEC const char * SDLCALL SDL_GetJoystickNameForID(SDL_JoystickID * \returns the path of the selected joystick. If no path can be found, this * function returns NULL; call SDL_GetError() for more information. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_GetJoystickPath * \sa SDL_GetJoysticks @@ -248,7 +248,7 @@ extern SDL_DECLSPEC const char * SDLCALL SDL_GetJoystickPathForID(SDL_JoystickID * \param instance_id the joystick instance ID. * \returns the player index of a joystick, or -1 if it's not available. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_GetJoystickPlayerIndex * \sa SDL_GetJoysticks @@ -264,7 +264,7 @@ extern SDL_DECLSPEC int SDLCALL SDL_GetJoystickPlayerIndexForID(SDL_JoystickID i * \returns the GUID of the selected joystick. If called with an invalid * instance_id, this function returns a zero GUID. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_GetJoystickGUID * \sa SDL_GUIDToString @@ -281,7 +281,7 @@ extern SDL_DECLSPEC SDL_GUID SDLCALL SDL_GetJoystickGUIDForID(SDL_JoystickID ins * \returns the USB vendor ID of the selected joystick. If called with an * invalid instance_id, this function returns 0. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_GetJoystickVendor * \sa SDL_GetJoysticks @@ -298,7 +298,7 @@ extern SDL_DECLSPEC Uint16 SDLCALL SDL_GetJoystickVendorForID(SDL_JoystickID ins * \returns the USB product ID of the selected joystick. If called with an * invalid instance_id, this function returns 0. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_GetJoystickProduct * \sa SDL_GetJoysticks @@ -315,7 +315,7 @@ extern SDL_DECLSPEC Uint16 SDLCALL SDL_GetJoystickProductForID(SDL_JoystickID in * \returns the product version of the selected joystick. If called with an * invalid instance_id, this function returns 0. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_GetJoystickProductVersion * \sa SDL_GetJoysticks @@ -332,7 +332,7 @@ extern SDL_DECLSPEC Uint16 SDLCALL SDL_GetJoystickProductVersionForID(SDL_Joysti * invalid instance_id, this function returns * `SDL_JOYSTICK_TYPE_UNKNOWN`. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_GetJoystickType * \sa SDL_GetJoysticks @@ -349,7 +349,7 @@ extern SDL_DECLSPEC SDL_JoystickType SDLCALL SDL_GetJoystickTypeForID(SDL_Joysti * \returns a joystick identifier or NULL on failure; call SDL_GetError() for * more information. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_CloseJoystick */ @@ -362,7 +362,7 @@ extern SDL_DECLSPEC SDL_Joystick * SDLCALL SDL_OpenJoystick(SDL_JoystickID insta * \returns an SDL_Joystick on success or NULL on failure or if it hasn't been * opened yet; call SDL_GetError() for more information. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. */ extern SDL_DECLSPEC SDL_Joystick * SDLCALL SDL_GetJoystickFromID(SDL_JoystickID instance_id); @@ -373,7 +373,7 @@ extern SDL_DECLSPEC SDL_Joystick * SDLCALL SDL_GetJoystickFromID(SDL_JoystickID * \returns an SDL_Joystick on success or NULL on failure; call SDL_GetError() * for more information. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_GetJoystickPlayerIndex * \sa SDL_SetJoystickPlayerIndex @@ -383,7 +383,7 @@ extern SDL_DECLSPEC SDL_Joystick * SDLCALL SDL_GetJoystickFromPlayerIndex(int pl /** * The structure that describes a virtual joystick touchpad. * - * \since This struct is available since SDL 3.1.3. + * \since This struct is available since SDL 3.2.0. * * \sa SDL_VirtualJoystickDesc */ @@ -396,7 +396,7 @@ typedef struct SDL_VirtualJoystickTouchpadDesc /** * The structure that describes a virtual joystick sensor. * - * \since This struct is available since SDL 3.1.3. + * \since This struct is available since SDL 3.2.0. * * \sa SDL_VirtualJoystickDesc */ @@ -412,7 +412,7 @@ typedef struct SDL_VirtualJoystickSensorDesc * This structure should be initialized using SDL_INIT_INTERFACE(). All * elements of this structure are optional. * - * \since This struct is available since SDL 3.1.3. + * \since This struct is available since SDL 3.2.0. * * \sa SDL_AttachVirtualJoystick * \sa SDL_INIT_INTERFACE @@ -469,7 +469,7 @@ SDL_COMPILE_TIME_ASSERT(SDL_VirtualJoystickDesc_SIZE, * \returns the joystick instance ID, or 0 on failure; call SDL_GetError() for * more information. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_DetachVirtualJoystick */ @@ -483,7 +483,7 @@ extern SDL_DECLSPEC SDL_JoystickID SDLCALL SDL_AttachVirtualJoystick(const SDL_V * \returns true on success or false on failure; call SDL_GetError() for more * information. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_AttachVirtualJoystick */ @@ -495,7 +495,7 @@ extern SDL_DECLSPEC bool SDLCALL SDL_DetachVirtualJoystick(SDL_JoystickID instan * \param instance_id the joystick instance ID. * \returns true if the joystick is virtual, false otherwise. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. */ extern SDL_DECLSPEC bool SDLCALL SDL_IsJoystickVirtual(SDL_JoystickID instance_id); @@ -518,7 +518,7 @@ extern SDL_DECLSPEC bool SDLCALL SDL_IsJoystickVirtual(SDL_JoystickID instance_i * \returns true on success or false on failure; call SDL_GetError() for more * information. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. */ extern SDL_DECLSPEC bool SDLCALL SDL_SetJoystickVirtualAxis(SDL_Joystick *joystick, int axis, Sint16 value); @@ -538,7 +538,7 @@ extern SDL_DECLSPEC bool SDLCALL SDL_SetJoystickVirtualAxis(SDL_Joystick *joysti * \returns true on success or false on failure; call SDL_GetError() for more * information. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. */ extern SDL_DECLSPEC bool SDLCALL SDL_SetJoystickVirtualBall(SDL_Joystick *joystick, int ball, Sint16 xrel, Sint16 yrel); @@ -557,7 +557,7 @@ extern SDL_DECLSPEC bool SDLCALL SDL_SetJoystickVirtualBall(SDL_Joystick *joysti * \returns true on success or false on failure; call SDL_GetError() for more * information. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. */ extern SDL_DECLSPEC bool SDLCALL SDL_SetJoystickVirtualButton(SDL_Joystick *joystick, int button, bool down); @@ -576,7 +576,7 @@ extern SDL_DECLSPEC bool SDLCALL SDL_SetJoystickVirtualButton(SDL_Joystick *joys * \returns true on success or false on failure; call SDL_GetError() for more * information. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. */ extern SDL_DECLSPEC bool SDLCALL SDL_SetJoystickVirtualHat(SDL_Joystick *joystick, int hat, Uint8 value); @@ -602,7 +602,7 @@ extern SDL_DECLSPEC bool SDLCALL SDL_SetJoystickVirtualHat(SDL_Joystick *joystic * \returns true on success or false on failure; call SDL_GetError() for more * information. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. */ extern SDL_DECLSPEC bool SDLCALL SDL_SetJoystickVirtualTouchpad(SDL_Joystick *joystick, int touchpad, int finger, bool down, float x, float y, float pressure); @@ -624,7 +624,7 @@ extern SDL_DECLSPEC bool SDLCALL SDL_SetJoystickVirtualTouchpad(SDL_Joystick *jo * \returns true on success or false on failure; call SDL_GetError() for more * information. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. */ extern SDL_DECLSPEC bool SDLCALL SDL_SendJoystickVirtualSensorData(SDL_Joystick *joystick, SDL_SensorType type, Uint64 sensor_timestamp, const float *data, int num_values); @@ -648,7 +648,7 @@ extern SDL_DECLSPEC bool SDLCALL SDL_SendJoystickVirtualSensorData(SDL_Joystick * \returns a valid property ID on success or 0 on failure; call * SDL_GetError() for more information. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. */ extern SDL_DECLSPEC SDL_PropertiesID SDLCALL SDL_GetJoystickProperties(SDL_Joystick *joystick); @@ -665,7 +665,7 @@ extern SDL_DECLSPEC SDL_PropertiesID SDLCALL SDL_GetJoystickProperties(SDL_Joyst * \returns the name of the selected joystick. If no name can be found, this * function returns NULL; call SDL_GetError() for more information. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_GetJoystickNameForID */ @@ -678,7 +678,7 @@ extern SDL_DECLSPEC const char * SDLCALL SDL_GetJoystickName(SDL_Joystick *joyst * \returns the path of the selected joystick. If no path can be found, this * function returns NULL; call SDL_GetError() for more information. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_GetJoystickPathForID */ @@ -693,7 +693,7 @@ extern SDL_DECLSPEC const char * SDLCALL SDL_GetJoystickPath(SDL_Joystick *joyst * \param joystick the SDL_Joystick obtained from SDL_OpenJoystick(). * \returns the player index, or -1 if it's not available. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_SetJoystickPlayerIndex */ @@ -708,7 +708,7 @@ extern SDL_DECLSPEC int SDLCALL SDL_GetJoystickPlayerIndex(SDL_Joystick *joystic * \returns true on success or false on failure; call SDL_GetError() for more * information. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_GetJoystickPlayerIndex */ @@ -724,7 +724,7 @@ extern SDL_DECLSPEC bool SDLCALL SDL_SetJoystickPlayerIndex(SDL_Joystick *joysti * this function returns a zero GUID; call SDL_GetError() for more * information. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_GetJoystickGUIDForID * \sa SDL_GUIDToString @@ -739,7 +739,7 @@ extern SDL_DECLSPEC SDL_GUID SDLCALL SDL_GetJoystickGUID(SDL_Joystick *joystick) * \param joystick the SDL_Joystick obtained from SDL_OpenJoystick(). * \returns the USB vendor ID of the selected joystick, or 0 if unavailable. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_GetJoystickVendorForID */ @@ -753,7 +753,7 @@ extern SDL_DECLSPEC Uint16 SDLCALL SDL_GetJoystickVendor(SDL_Joystick *joystick) * \param joystick the SDL_Joystick obtained from SDL_OpenJoystick(). * \returns the USB product ID of the selected joystick, or 0 if unavailable. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_GetJoystickProductForID */ @@ -767,7 +767,7 @@ extern SDL_DECLSPEC Uint16 SDLCALL SDL_GetJoystickProduct(SDL_Joystick *joystick * \param joystick the SDL_Joystick obtained from SDL_OpenJoystick(). * \returns the product version of the selected joystick, or 0 if unavailable. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_GetJoystickProductVersionForID */ @@ -782,7 +782,7 @@ extern SDL_DECLSPEC Uint16 SDLCALL SDL_GetJoystickProductVersion(SDL_Joystick *j * \returns the firmware version of the selected joystick, or 0 if * unavailable. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. */ extern SDL_DECLSPEC Uint16 SDLCALL SDL_GetJoystickFirmwareVersion(SDL_Joystick *joystick); @@ -795,7 +795,7 @@ extern SDL_DECLSPEC Uint16 SDLCALL SDL_GetJoystickFirmwareVersion(SDL_Joystick * * \returns the serial number of the selected joystick, or NULL if * unavailable. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. */ extern SDL_DECLSPEC const char * SDLCALL SDL_GetJoystickSerial(SDL_Joystick *joystick); @@ -805,7 +805,7 @@ extern SDL_DECLSPEC const char * SDLCALL SDL_GetJoystickSerial(SDL_Joystick *joy * \param joystick the SDL_Joystick obtained from SDL_OpenJoystick(). * \returns the SDL_JoystickType of the selected joystick. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_GetJoystickTypeForID */ @@ -824,7 +824,7 @@ extern SDL_DECLSPEC SDL_JoystickType SDLCALL SDL_GetJoystickType(SDL_Joystick *j * \param crc16 a pointer filled in with a CRC used to distinguish different * products with the same VID/PID, or 0 if not available. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_GetJoystickGUIDForID */ @@ -837,7 +837,7 @@ extern SDL_DECLSPEC void SDLCALL SDL_GetJoystickGUIDInfo(SDL_GUID guid, Uint16 * * \returns true if the joystick has been opened, false if it has not; call * SDL_GetError() for more information. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. */ extern SDL_DECLSPEC bool SDLCALL SDL_JoystickConnected(SDL_Joystick *joystick); @@ -848,7 +848,7 @@ extern SDL_DECLSPEC bool SDLCALL SDL_JoystickConnected(SDL_Joystick *joystick); * \returns the instance ID of the specified joystick on success or 0 on * failure; call SDL_GetError() for more information. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. */ extern SDL_DECLSPEC SDL_JoystickID SDLCALL SDL_GetJoystickID(SDL_Joystick *joystick); @@ -863,7 +863,7 @@ extern SDL_DECLSPEC SDL_JoystickID SDLCALL SDL_GetJoystickID(SDL_Joystick *joyst * \returns the number of axis controls/number of axes on success or -1 on * failure; call SDL_GetError() for more information. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_GetJoystickAxis * \sa SDL_GetNumJoystickBalls @@ -884,7 +884,7 @@ extern SDL_DECLSPEC int SDLCALL SDL_GetNumJoystickAxes(SDL_Joystick *joystick); * \returns the number of trackballs on success or -1 on failure; call * SDL_GetError() for more information. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_GetJoystickBall * \sa SDL_GetNumJoystickAxes @@ -900,7 +900,7 @@ extern SDL_DECLSPEC int SDLCALL SDL_GetNumJoystickBalls(SDL_Joystick *joystick); * \returns the number of POV hats on success or -1 on failure; call * SDL_GetError() for more information. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_GetJoystickHat * \sa SDL_GetNumJoystickAxes @@ -916,7 +916,7 @@ extern SDL_DECLSPEC int SDLCALL SDL_GetNumJoystickHats(SDL_Joystick *joystick); * \returns the number of buttons on success or -1 on failure; call * SDL_GetError() for more information. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_GetJoystickButton * \sa SDL_GetNumJoystickAxes @@ -934,7 +934,7 @@ extern SDL_DECLSPEC int SDLCALL SDL_GetNumJoystickButtons(SDL_Joystick *joystick * * \param enabled whether to process joystick events or not. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_JoystickEventsEnabled * \sa SDL_UpdateJoysticks @@ -950,7 +950,7 @@ extern SDL_DECLSPEC void SDLCALL SDL_SetJoystickEventsEnabled(bool enabled); * * \returns true if joystick events are being processed, false otherwise. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_SetJoystickEventsEnabled */ @@ -962,7 +962,7 @@ extern SDL_DECLSPEC bool SDLCALL SDL_JoystickEventsEnabled(void); * This is called automatically by the event loop if any joystick events are * enabled. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. */ extern SDL_DECLSPEC void SDLCALL SDL_UpdateJoysticks(void); @@ -984,7 +984,7 @@ extern SDL_DECLSPEC void SDLCALL SDL_UpdateJoysticks(void); * \returns a 16-bit signed integer representing the current position of the * axis or 0 on failure; call SDL_GetError() for more information. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_GetNumJoystickAxes */ @@ -1002,7 +1002,7 @@ extern SDL_DECLSPEC Sint16 SDLCALL SDL_GetJoystickAxis(SDL_Joystick *joystick, i * \param state upon return, the initial value is supplied here. * \returns true if this axis has any initial value, or false if not. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. */ extern SDL_DECLSPEC bool SDLCALL SDL_GetJoystickAxisInitialState(SDL_Joystick *joystick, int axis, Sint16 *state); @@ -1021,7 +1021,7 @@ extern SDL_DECLSPEC bool SDLCALL SDL_GetJoystickAxisInitialState(SDL_Joystick *j * \returns true on success or false on failure; call SDL_GetError() for more * information. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_GetNumJoystickBalls */ @@ -1036,7 +1036,7 @@ extern SDL_DECLSPEC bool SDLCALL SDL_GetJoystickBall(SDL_Joystick *joystick, int * \param hat the hat index to get the state from; indices start at index 0. * \returns the current hat position. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_GetNumJoystickHats */ @@ -1060,7 +1060,7 @@ extern SDL_DECLSPEC Uint8 SDLCALL SDL_GetJoystickHat(SDL_Joystick *joystick, int * index 0. * \returns true if the button is pressed, false otherwise. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_GetNumJoystickButtons */ @@ -1083,7 +1083,7 @@ extern SDL_DECLSPEC bool SDLCALL SDL_GetJoystickButton(SDL_Joystick *joystick, i * \param duration_ms the duration of the rumble effect, in milliseconds. * \returns true, or false if rumble isn't supported on this joystick. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. */ extern SDL_DECLSPEC bool SDLCALL SDL_RumbleJoystick(SDL_Joystick *joystick, Uint16 low_frequency_rumble, Uint16 high_frequency_rumble, Uint32 duration_ms); @@ -1110,7 +1110,7 @@ extern SDL_DECLSPEC bool SDLCALL SDL_RumbleJoystick(SDL_Joystick *joystick, Uint * \returns true on success or false on failure; call SDL_GetError() for more * information. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_RumbleJoystick */ @@ -1132,7 +1132,7 @@ extern SDL_DECLSPEC bool SDLCALL SDL_RumbleJoystickTriggers(SDL_Joystick *joysti * \returns true on success or false on failure; call SDL_GetError() for more * information. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. */ extern SDL_DECLSPEC bool SDLCALL SDL_SetJoystickLED(SDL_Joystick *joystick, Uint8 red, Uint8 green, Uint8 blue); @@ -1145,7 +1145,7 @@ extern SDL_DECLSPEC bool SDLCALL SDL_SetJoystickLED(SDL_Joystick *joystick, Uint * \returns true on success or false on failure; call SDL_GetError() for more * information. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. */ extern SDL_DECLSPEC bool SDLCALL SDL_SendJoystickEffect(SDL_Joystick *joystick, const void *data, int size); @@ -1154,7 +1154,7 @@ extern SDL_DECLSPEC bool SDLCALL SDL_SendJoystickEffect(SDL_Joystick *joystick, * * \param joystick the joystick device to close. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_OpenJoystick */ @@ -1168,7 +1168,7 @@ extern SDL_DECLSPEC void SDLCALL SDL_CloseJoystick(SDL_Joystick *joystick); * `SDL_JOYSTICK_CONNECTION_INVALID` on failure; call SDL_GetError() * for more information. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. */ extern SDL_DECLSPEC SDL_JoystickConnectionState SDLCALL SDL_GetJoystickConnectionState(SDL_Joystick *joystick); @@ -1189,7 +1189,7 @@ extern SDL_DECLSPEC SDL_JoystickConnectionState SDLCALL SDL_GetJoystickConnectio * \returns the current battery state or `SDL_POWERSTATE_ERROR` on failure; * call SDL_GetError() for more information. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. */ extern SDL_DECLSPEC SDL_PowerState SDLCALL SDL_GetJoystickPowerInfo(SDL_Joystick *joystick, int *percent); diff --git a/include/SDL3/SDL_keyboard.h b/include/SDL3/SDL_keyboard.h index 6d3db29d34868..afa77b6c2c3ad 100644 --- a/include/SDL3/SDL_keyboard.h +++ b/include/SDL3/SDL_keyboard.h @@ -55,7 +55,7 @@ extern "C" { * * The value 0 is an invalid ID. * - * \since This datatype is available since SDL 3.1.3. + * \since This datatype is available since SDL 3.2.0. */ typedef Uint32 SDL_KeyboardID; @@ -68,7 +68,7 @@ typedef Uint32 SDL_KeyboardID; * * \threadsafety This function should only be called on the main thread. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_GetKeyboards */ @@ -90,7 +90,7 @@ extern SDL_DECLSPEC bool SDLCALL SDL_HasKeyboard(void); * * \threadsafety This function should only be called on the main thread. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_GetKeyboardNameForID * \sa SDL_HasKeyboard @@ -108,7 +108,7 @@ extern SDL_DECLSPEC SDL_KeyboardID * SDLCALL SDL_GetKeyboards(int *count); * * \threadsafety This function should only be called on the main thread. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_GetKeyboards */ @@ -121,7 +121,7 @@ extern SDL_DECLSPEC const char * SDLCALL SDL_GetKeyboardNameForID(SDL_KeyboardID * * \threadsafety This function should only be called on the main thread. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. */ extern SDL_DECLSPEC SDL_Window * SDLCALL SDL_GetKeyboardFocus(void); @@ -151,7 +151,7 @@ extern SDL_DECLSPEC SDL_Window * SDLCALL SDL_GetKeyboardFocus(void); * * \threadsafety It is safe to call this function from any thread. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_PumpEvents * \sa SDL_ResetKeyboard @@ -165,7 +165,7 @@ extern SDL_DECLSPEC const bool * SDLCALL SDL_GetKeyboardState(int *numkeys); * * \threadsafety This function should only be called on the main thread. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_GetKeyboardState */ @@ -179,7 +179,7 @@ extern SDL_DECLSPEC void SDLCALL SDL_ResetKeyboard(void); * * \threadsafety It is safe to call this function from any thread. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_GetKeyboardState * \sa SDL_SetModState @@ -201,7 +201,7 @@ extern SDL_DECLSPEC SDL_Keymod SDLCALL SDL_GetModState(void); * * \threadsafety It is safe to call this function from any thread. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_GetModState */ @@ -224,7 +224,7 @@ extern SDL_DECLSPEC void SDLCALL SDL_SetModState(SDL_Keymod modstate); * * \threadsafety This function is not thread safe. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_GetKeyName * \sa SDL_GetScancodeFromKey @@ -245,7 +245,7 @@ extern SDL_DECLSPEC SDL_Keycode SDLCALL SDL_GetKeyFromScancode(SDL_Scancode scan * * \threadsafety This function is not thread safe. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_GetKeyFromScancode * \sa SDL_GetScancodeName @@ -264,7 +264,7 @@ extern SDL_DECLSPEC SDL_Scancode SDLCALL SDL_GetScancodeFromKey(SDL_Keycode key, * * \threadsafety This function is not thread safe. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_GetScancodeName */ @@ -288,7 +288,7 @@ extern SDL_DECLSPEC bool SDLCALL SDL_SetScancodeName(SDL_Scancode scancode, cons * * \threadsafety This function is not thread safe. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_GetScancodeFromKey * \sa SDL_GetScancodeFromName @@ -305,7 +305,7 @@ extern SDL_DECLSPEC const char * SDLCALL SDL_GetScancodeName(SDL_Scancode scanco * * \threadsafety This function is not thread safe. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_GetKeyFromName * \sa SDL_GetScancodeFromKey @@ -325,7 +325,7 @@ extern SDL_DECLSPEC SDL_Scancode SDLCALL SDL_GetScancodeFromName(const char *nam * * \threadsafety This function is not thread safe. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_GetKeyFromName * \sa SDL_GetKeyFromScancode @@ -342,7 +342,7 @@ extern SDL_DECLSPEC const char * SDLCALL SDL_GetKeyName(SDL_Keycode key); * * \threadsafety This function is not thread safe. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_GetKeyFromScancode * \sa SDL_GetKeyName @@ -369,7 +369,7 @@ extern SDL_DECLSPEC SDL_Keycode SDLCALL SDL_GetKeyFromName(const char *name); * * \threadsafety This function should only be called on the main thread. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_SetTextInputArea * \sa SDL_StartTextInputWithProperties @@ -385,7 +385,7 @@ extern SDL_DECLSPEC bool SDLCALL SDL_StartTextInput(SDL_Window *window); * value is valid on every platform, but where a value isn't supported, a * reasonable fallback will be used. * - * \since This enum is available since SDL 3.1.3. + * \since This enum is available since SDL 3.2.0. * * \sa SDL_StartTextInputWithProperties */ @@ -409,7 +409,7 @@ typedef enum SDL_TextInputType * Not every value is valid on every platform, but where a value isn't * supported, a reasonable fallback will be used. * - * \since This enum is available since SDL 3.1.3. + * \since This enum is available since SDL 3.2.0. * * \sa SDL_StartTextInputWithProperties */ @@ -464,7 +464,7 @@ typedef enum SDL_Capitalization * * \threadsafety This function should only be called on the main thread. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_SetTextInputArea * \sa SDL_StartTextInput @@ -487,7 +487,7 @@ extern SDL_DECLSPEC bool SDLCALL SDL_StartTextInputWithProperties(SDL_Window *wi * * \threadsafety This function should only be called on the main thread. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_StartTextInput */ @@ -505,7 +505,7 @@ extern SDL_DECLSPEC bool SDLCALL SDL_TextInputActive(SDL_Window *window); * * \threadsafety This function should only be called on the main thread. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_StartTextInput */ @@ -520,7 +520,7 @@ extern SDL_DECLSPEC bool SDLCALL SDL_StopTextInput(SDL_Window *window); * * \threadsafety This function should only be called on the main thread. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_StartTextInput * \sa SDL_StopTextInput @@ -543,7 +543,7 @@ extern SDL_DECLSPEC bool SDLCALL SDL_ClearComposition(SDL_Window *window); * * \threadsafety This function should only be called on the main thread. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_GetTextInputArea * \sa SDL_StartTextInput @@ -565,7 +565,7 @@ extern SDL_DECLSPEC bool SDLCALL SDL_SetTextInputArea(SDL_Window *window, const * * \threadsafety This function should only be called on the main thread. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_SetTextInputArea */ @@ -579,7 +579,7 @@ extern SDL_DECLSPEC bool SDLCALL SDL_GetTextInputArea(SDL_Window *window, SDL_Re * * \threadsafety This function should only be called on the main thread. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_StartTextInput * \sa SDL_ScreenKeyboardShown @@ -594,7 +594,7 @@ extern SDL_DECLSPEC bool SDLCALL SDL_HasScreenKeyboardSupport(void); * * \threadsafety This function should only be called on the main thread. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_HasScreenKeyboardSupport */ diff --git a/include/SDL3/SDL_keycode.h b/include/SDL3/SDL_keycode.h index 3c40e962598ec..61b68e794f8e0 100644 --- a/include/SDL3/SDL_keycode.h +++ b/include/SDL3/SDL_keycode.h @@ -50,7 +50,7 @@ * Keys with the `SDLK_EXTENDED_MASK` bit set do not map to a scancode or * unicode code point. * - * \since This datatype is available since SDL 3.1.3. + * \since This datatype is available since SDL 3.2.0. */ typedef Uint32 SDL_Keycode; @@ -317,7 +317,7 @@ typedef Uint32 SDL_Keycode; /** * Valid key modifiers (possibly OR'd together). * - * \since This datatype is available since SDL 3.1.3. + * \since This datatype is available since SDL 3.2.0. */ typedef Uint16 SDL_Keymod; diff --git a/include/SDL3/SDL_loadso.h b/include/SDL3/SDL_loadso.h index 6a32aa4f857e6..f8649d7580159 100644 --- a/include/SDL3/SDL_loadso.h +++ b/include/SDL3/SDL_loadso.h @@ -68,7 +68,7 @@ extern "C" { /** * An opaque datatype that represents a loaded shared object. * - * \since This datatype is available since SDL 3.1.3. + * \since This datatype is available since SDL 3.2.0. * * \sa SDL_LoadObject * \sa SDL_LoadFunction @@ -85,7 +85,7 @@ typedef struct SDL_SharedObject SDL_SharedObject; * * \threadsafety It is safe to call this function from any thread. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_LoadFunction * \sa SDL_UnloadObject @@ -114,7 +114,7 @@ extern SDL_DECLSPEC SDL_SharedObject * SDLCALL SDL_LoadObject(const char *sofile * * \threadsafety It is safe to call this function from any thread. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_LoadObject */ @@ -130,7 +130,7 @@ extern SDL_DECLSPEC SDL_FunctionPointer SDLCALL SDL_LoadFunction(SDL_SharedObjec * * \threadsafety It is safe to call this function from any thread. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_LoadObject */ diff --git a/include/SDL3/SDL_locale.h b/include/SDL3/SDL_locale.h index 233f8a19e274e..902843e81f3af 100644 --- a/include/SDL3/SDL_locale.h +++ b/include/SDL3/SDL_locale.h @@ -53,7 +53,7 @@ extern "C" { * would be "en"), and the country, if not NULL, will be an ISO-3166 country * code (so Canada would be "CA"). * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_GetPreferredLocales */ @@ -102,7 +102,7 @@ typedef struct SDL_Locale * allocation that should be freed with SDL_free() when it is no * longer needed. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. */ extern SDL_DECLSPEC SDL_Locale ** SDLCALL SDL_GetPreferredLocales(int *count); diff --git a/include/SDL3/SDL_log.h b/include/SDL3/SDL_log.h index 891fff1505f89..a56476c6d2a4e 100644 --- a/include/SDL3/SDL_log.h +++ b/include/SDL3/SDL_log.h @@ -76,7 +76,7 @@ extern "C" { * level, the assert category is enabled at the WARN level, test is enabled at * the VERBOSE level and all other categories are enabled at the ERROR level. * - * \since This enum is available since SDL 3.1.3. + * \since This enum is available since SDL 3.2.0. */ typedef enum SDL_LogCategory { @@ -116,7 +116,7 @@ typedef enum SDL_LogCategory /** * The predefined log priorities * - * \since This enum is available since SDL 3.1.3. + * \since This enum is available since SDL 3.2.0. */ typedef enum SDL_LogPriority { @@ -139,7 +139,7 @@ typedef enum SDL_LogPriority * * \threadsafety It is safe to call this function from any thread. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_ResetLogPriorities * \sa SDL_SetLogPriority @@ -154,7 +154,7 @@ extern SDL_DECLSPEC void SDLCALL SDL_SetLogPriorities(SDL_LogPriority priority); * * \threadsafety It is safe to call this function from any thread. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_GetLogPriority * \sa SDL_ResetLogPriorities @@ -170,7 +170,7 @@ extern SDL_DECLSPEC void SDLCALL SDL_SetLogPriority(int category, SDL_LogPriorit * * \threadsafety It is safe to call this function from any thread. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_SetLogPriority */ @@ -183,7 +183,7 @@ extern SDL_DECLSPEC SDL_LogPriority SDLCALL SDL_GetLogPriority(int category); * * \threadsafety It is safe to call this function from any thread. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_SetLogPriorities * \sa SDL_SetLogPriority @@ -205,7 +205,7 @@ extern SDL_DECLSPEC void SDLCALL SDL_ResetLogPriorities(void); * * \threadsafety It is safe to call this function from any thread. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_SetLogPriorities * \sa SDL_SetLogPriority @@ -221,7 +221,7 @@ extern SDL_DECLSPEC bool SDLCALL SDL_SetLogPriorityPrefix(SDL_LogPriority priori * * \threadsafety It is safe to call this function from any thread. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_LogCritical * \sa SDL_LogDebug @@ -245,7 +245,7 @@ extern SDL_DECLSPEC void SDLCALL SDL_Log(SDL_PRINTF_FORMAT_STRING const char *fm * * \threadsafety It is safe to call this function from any thread. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_Log * \sa SDL_LogCritical @@ -270,7 +270,7 @@ extern SDL_DECLSPEC void SDLCALL SDL_LogTrace(int category, SDL_PRINTF_FORMAT_ST * * \threadsafety It is safe to call this function from any thread. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_Log * \sa SDL_LogCritical @@ -293,7 +293,7 @@ extern SDL_DECLSPEC void SDLCALL SDL_LogVerbose(int category, SDL_PRINTF_FORMAT_ * * \threadsafety It is safe to call this function from any thread. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_Log * \sa SDL_LogCritical @@ -317,7 +317,7 @@ extern SDL_DECLSPEC void SDLCALL SDL_LogDebug(int category, SDL_PRINTF_FORMAT_ST * * \threadsafety It is safe to call this function from any thread. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_Log * \sa SDL_LogCritical @@ -341,7 +341,7 @@ extern SDL_DECLSPEC void SDLCALL SDL_LogInfo(int category, SDL_PRINTF_FORMAT_STR * * \threadsafety It is safe to call this function from any thread. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_Log * \sa SDL_LogCritical @@ -365,7 +365,7 @@ extern SDL_DECLSPEC void SDLCALL SDL_LogWarn(int category, SDL_PRINTF_FORMAT_STR * * \threadsafety It is safe to call this function from any thread. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_Log * \sa SDL_LogCritical @@ -389,7 +389,7 @@ extern SDL_DECLSPEC void SDLCALL SDL_LogError(int category, SDL_PRINTF_FORMAT_ST * * \threadsafety It is safe to call this function from any thread. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_Log * \sa SDL_LogDebug @@ -414,7 +414,7 @@ extern SDL_DECLSPEC void SDLCALL SDL_LogCritical(int category, SDL_PRINTF_FORMAT * * \threadsafety It is safe to call this function from any thread. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_Log * \sa SDL_LogCritical @@ -440,7 +440,7 @@ extern SDL_DECLSPEC void SDLCALL SDL_LogMessage(int category, * * \threadsafety It is safe to call this function from any thread. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_Log * \sa SDL_LogCritical @@ -469,7 +469,7 @@ extern SDL_DECLSPEC void SDLCALL SDL_LogMessageV(int category, * \param priority the priority of the message. * \param message the message being output. * - * \since This datatype is available since SDL 3.1.3. + * \since This datatype is available since SDL 3.2.0. */ typedef void (SDLCALL *SDL_LogOutputFunction)(void *userdata, int category, SDL_LogPriority priority, const char *message); @@ -480,7 +480,7 @@ typedef void (SDLCALL *SDL_LogOutputFunction)(void *userdata, int category, SDL_ * * \threadsafety It is safe to call this function from any thread. * - * \since This function is available since SDL 3.1.6. + * \since This function is available since SDL 3.2.0. * * \sa SDL_SetLogOutputFunction * \sa SDL_GetLogOutputFunction @@ -497,7 +497,7 @@ extern SDL_DECLSPEC SDL_LogOutputFunction SDLCALL SDL_GetDefaultLogOutputFunctio * * \threadsafety It is safe to call this function from any thread. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_GetDefaultLogOutputFunction * \sa SDL_SetLogOutputFunction @@ -512,7 +512,7 @@ extern SDL_DECLSPEC void SDLCALL SDL_GetLogOutputFunction(SDL_LogOutputFunction * * \threadsafety It is safe to call this function from any thread. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_GetDefaultLogOutputFunction * \sa SDL_GetLogOutputFunction diff --git a/include/SDL3/SDL_main.h b/include/SDL3/SDL_main.h index 66ed481e8c9b1..38f598a4c47c0 100644 --- a/include/SDL3/SDL_main.h +++ b/include/SDL3/SDL_main.h @@ -330,7 +330,7 @@ extern "C" { * \returns SDL_APP_FAILURE to terminate with an error, SDL_APP_SUCCESS to * terminate with success, SDL_APP_CONTINUE to continue. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_AppIterate * \sa SDL_AppEvent @@ -382,7 +382,7 @@ extern SDLMAIN_DECLSPEC SDL_AppResult SDLCALL SDL_AppInit(void **appstate, int a * \threadsafety This function may get called concurrently with SDL_AppEvent() * for events not pushed on the main thread. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_AppInit * \sa SDL_AppEvent @@ -431,7 +431,7 @@ extern SDLMAIN_DECLSPEC SDL_AppResult SDLCALL SDL_AppIterate(void *appstate); * SDL_AppIterate() or SDL_AppQuit() for events not pushed from * the main thread. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_AppInit * \sa SDL_AppIterate @@ -470,7 +470,7 @@ extern SDLMAIN_DECLSPEC SDL_AppResult SDLCALL SDL_AppEvent(void *appstate, SDL_E * \threadsafety SDL_AppEvent() may get called concurrently with this function * if other threads that push events are still active. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_AppInit */ @@ -488,7 +488,7 @@ extern SDLMAIN_DECLSPEC void SDLCALL SDL_AppQuit(void *appstate, SDL_AppResult r * program completion, and small non-zero values are considered * errors. * - * \since This datatype is available since SDL 3.1.3. + * \since This datatype is available since SDL 3.2.0. */ typedef int (SDLCALL *SDL_main_func)(int argc, char *argv[]); @@ -521,7 +521,7 @@ typedef int (SDLCALL *SDL_main_func)(int argc, char *argv[]); * * \threadsafety This is the program entry point. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. */ extern SDLMAIN_DECLSPEC int SDLCALL SDL_main(int argc, char *argv[]); @@ -534,7 +534,7 @@ extern SDLMAIN_DECLSPEC int SDLCALL SDL_main(int argc, char *argv[]); * will not be changed it is necessary to define SDL_MAIN_HANDLED before * including SDL.h. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_Init */ @@ -566,7 +566,7 @@ extern SDL_DECLSPEC void SDLCALL SDL_SetMainReady(void); * \threadsafety Generally this is called once, near startup, from the * process's initial thread. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. */ extern SDL_DECLSPEC int SDLCALL SDL_RunApp(int argc, char *argv[], SDL_main_func mainFunction, void *reserved); @@ -593,7 +593,7 @@ extern SDL_DECLSPEC int SDLCALL SDL_RunApp(int argc, char *argv[], SDL_main_func * \threadsafety It is not safe to call this anywhere except as the only * function call in SDL_main. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. */ extern SDL_DECLSPEC int SDLCALL SDL_EnterAppMainCallbacks(int argc, char *argv[], SDL_AppInit_func appinit, SDL_AppIterate_func appiter, SDL_AppEvent_func appevent, SDL_AppQuit_func appquit); @@ -622,7 +622,7 @@ extern SDL_DECLSPEC int SDLCALL SDL_EnterAppMainCallbacks(int argc, char *argv[] * \returns true on success or false on failure; call SDL_GetError() for more * information. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. */ extern SDL_DECLSPEC bool SDLCALL SDL_RegisterApp(const char *name, Uint32 style, void *hInst); @@ -639,7 +639,7 @@ extern SDL_DECLSPEC bool SDLCALL SDL_RegisterApp(const char *name, Uint32 style, * deregistered when the registration counter in SDL_RegisterApp decrements to * zero through calls to this function. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. */ extern SDL_DECLSPEC void SDLCALL SDL_UnregisterApp(void); @@ -651,7 +651,7 @@ extern SDL_DECLSPEC void SDLCALL SDL_UnregisterApp(void); * This function is only needed for Xbox GDK support; all other platforms will * do nothing and set an "unsupported" error message. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. */ extern SDL_DECLSPEC void SDLCALL SDL_GDKSuspendComplete(void); diff --git a/include/SDL3/SDL_messagebox.h b/include/SDL3/SDL_messagebox.h index 862205ccc615b..365ae36a5a69c 100644 --- a/include/SDL3/SDL_messagebox.h +++ b/include/SDL3/SDL_messagebox.h @@ -54,7 +54,7 @@ extern "C" { * * If supported will display warning icon, etc. * - * \since This datatype is available since SDL 3.1.3. + * \since This datatype is available since SDL 3.2.0. */ typedef Uint32 SDL_MessageBoxFlags; @@ -67,7 +67,7 @@ typedef Uint32 SDL_MessageBoxFlags; /** * SDL_MessageBoxButtonData flags. * - * \since This datatype is available since SDL 3.1.3. + * \since This datatype is available since SDL 3.2.0. */ typedef Uint32 SDL_MessageBoxButtonFlags; @@ -77,7 +77,7 @@ typedef Uint32 SDL_MessageBoxButtonFlags; /** * Individual button data. * - * \since This struct is available since SDL 3.1.3. + * \since This struct is available since SDL 3.2.0. */ typedef struct SDL_MessageBoxButtonData { @@ -89,7 +89,7 @@ typedef struct SDL_MessageBoxButtonData /** * RGB value used in a message box color scheme * - * \since This struct is available since SDL 3.1.3. + * \since This struct is available since SDL 3.2.0. */ typedef struct SDL_MessageBoxColor { @@ -113,7 +113,7 @@ typedef enum SDL_MessageBoxColorType /** * A set of colors to use for message box dialogs * - * \since This struct is available since SDL 3.1.3. + * \since This struct is available since SDL 3.2.0. */ typedef struct SDL_MessageBoxColorScheme { @@ -123,7 +123,7 @@ typedef struct SDL_MessageBoxColorScheme /** * MessageBox structure containing title, text, window, etc. * - * \since This struct is available since SDL 3.1.3. + * \since This struct is available since SDL 3.2.0. */ typedef struct SDL_MessageBoxData { @@ -168,7 +168,7 @@ typedef struct SDL_MessageBoxData * \returns true on success or false on failure; call SDL_GetError() for more * information. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_ShowSimpleMessageBox */ @@ -210,7 +210,7 @@ extern SDL_DECLSPEC bool SDLCALL SDL_ShowMessageBox(const SDL_MessageBoxData *me * \returns true on success or false on failure; call SDL_GetError() for more * information. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_ShowMessageBox */ diff --git a/include/SDL3/SDL_metal.h b/include/SDL3/SDL_metal.h index 87d18dbfdc082..14b1bc87a2f9b 100644 --- a/include/SDL3/SDL_metal.h +++ b/include/SDL3/SDL_metal.h @@ -43,7 +43,7 @@ extern "C" { /** * A handle to a CAMetalLayer-backed NSView (macOS) or UIView (iOS/tvOS). * - * \since This datatype is available since SDL 3.1.3. + * \since This datatype is available since SDL 3.2.0. */ typedef void *SDL_MetalView; @@ -65,7 +65,7 @@ typedef void *SDL_MetalView; * \param window the window. * \returns handle NSView or UIView. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_Metal_DestroyView * \sa SDL_Metal_GetLayer @@ -80,7 +80,7 @@ extern SDL_DECLSPEC SDL_MetalView SDLCALL SDL_Metal_CreateView(SDL_Window *windo * * \param view the SDL_MetalView object. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_Metal_CreateView */ @@ -92,7 +92,7 @@ extern SDL_DECLSPEC void SDLCALL SDL_Metal_DestroyView(SDL_MetalView view); * \param view the SDL_MetalView object. * \returns a pointer. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. */ extern SDL_DECLSPEC void * SDLCALL SDL_Metal_GetLayer(SDL_MetalView view); diff --git a/include/SDL3/SDL_misc.h b/include/SDL3/SDL_misc.h index f6e694a5a088d..3dd6fcddd60f2 100644 --- a/include/SDL3/SDL_misc.h +++ b/include/SDL3/SDL_misc.h @@ -65,7 +65,7 @@ extern "C" { * \returns true on success or false on failure; call SDL_GetError() for more * information. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. */ extern SDL_DECLSPEC bool SDLCALL SDL_OpenURL(const char *url); diff --git a/include/SDL3/SDL_mouse.h b/include/SDL3/SDL_mouse.h index d0ec3e6ccd634..18856e20e97ac 100644 --- a/include/SDL3/SDL_mouse.h +++ b/include/SDL3/SDL_mouse.h @@ -76,7 +76,7 @@ extern "C" { * * The value 0 is an invalid ID. * - * \since This datatype is available since SDL 3.1.3. + * \since This datatype is available since SDL 3.2.0. */ typedef Uint32 SDL_MouseID; @@ -85,14 +85,14 @@ typedef Uint32 SDL_MouseID; * * This is opaque data. * - * \since This struct is available since SDL 3.1.3. + * \since This struct is available since SDL 3.2.0. */ typedef struct SDL_Cursor SDL_Cursor; /** * Cursor types for SDL_CreateSystemCursor(). * - * \since This enum is available since SDL 3.1.3. + * \since This enum is available since SDL 3.2.0. */ typedef enum SDL_SystemCursor { @@ -122,7 +122,7 @@ typedef enum SDL_SystemCursor /** * Scroll direction types for the Scroll event * - * \since This enum is available since SDL 3.1.3. + * \since This enum is available since SDL 3.2.0. */ typedef enum SDL_MouseWheelDirection { @@ -139,7 +139,7 @@ typedef enum SDL_MouseWheelDirection * - Button 4: Side mouse button 1 * - Button 5: Side mouse button 2 * - * \since This datatype is available since SDL 3.1.3. + * \since This datatype is available since SDL 3.2.0. * * \sa SDL_GetMouseState * \sa SDL_GetGlobalMouseState @@ -170,7 +170,7 @@ typedef Uint32 SDL_MouseButtonFlags; * * \threadsafety This function should only be called on the main thread. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_GetMice */ @@ -192,7 +192,7 @@ extern SDL_DECLSPEC bool SDLCALL SDL_HasMouse(void); * * \threadsafety This function should only be called on the main thread. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_GetMouseNameForID * \sa SDL_HasMouse @@ -210,7 +210,7 @@ extern SDL_DECLSPEC SDL_MouseID * SDLCALL SDL_GetMice(int *count); * * \threadsafety This function should only be called on the main thread. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_GetMice */ @@ -223,7 +223,7 @@ extern SDL_DECLSPEC const char * SDLCALL SDL_GetMouseNameForID(SDL_MouseID insta * * \threadsafety This function should only be called on the main thread. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. */ extern SDL_DECLSPEC SDL_Window * SDLCALL SDL_GetMouseFocus(void); @@ -253,7 +253,7 @@ extern SDL_DECLSPEC SDL_Window * SDLCALL SDL_GetMouseFocus(void); * * \threadsafety This function should only be called on the main thread. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_GetGlobalMouseState * \sa SDL_GetRelativeMouseState @@ -289,7 +289,7 @@ extern SDL_DECLSPEC SDL_MouseButtonFlags SDLCALL SDL_GetMouseState(float *x, flo * * \threadsafety This function should only be called on the main thread. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_CaptureMouse * \sa SDL_GetMouseState @@ -325,7 +325,7 @@ extern SDL_DECLSPEC SDL_MouseButtonFlags SDLCALL SDL_GetGlobalMouseState(float * * * \threadsafety This function should only be called on the main thread. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_GetMouseState * \sa SDL_GetGlobalMouseState @@ -349,7 +349,7 @@ extern SDL_DECLSPEC SDL_MouseButtonFlags SDLCALL SDL_GetRelativeMouseState(float * * \threadsafety This function should only be called on the main thread. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_WarpMouseGlobal */ @@ -374,7 +374,7 @@ extern SDL_DECLSPEC void SDLCALL SDL_WarpMouseInWindow(SDL_Window * window, * * \threadsafety This function should only be called on the main thread. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_WarpMouseInWindow */ @@ -402,7 +402,7 @@ extern SDL_DECLSPEC bool SDLCALL SDL_WarpMouseGlobal(float x, float y); * * \threadsafety This function should only be called on the main thread. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_GetWindowRelativeMouseMode */ @@ -416,7 +416,7 @@ extern SDL_DECLSPEC bool SDLCALL SDL_SetWindowRelativeMouseMode(SDL_Window *wind * * \threadsafety This function should only be called on the main thread. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_SetWindowRelativeMouseMode */ @@ -464,7 +464,7 @@ extern SDL_DECLSPEC bool SDLCALL SDL_GetWindowRelativeMouseMode(SDL_Window *wind * * \threadsafety This function should only be called on the main thread. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_GetGlobalMouseState */ @@ -507,7 +507,7 @@ extern SDL_DECLSPEC bool SDLCALL SDL_CaptureMouse(bool enabled); * * \threadsafety This function should only be called on the main thread. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_CreateColorCursor * \sa SDL_CreateSystemCursor @@ -540,7 +540,7 @@ extern SDL_DECLSPEC SDL_Cursor * SDLCALL SDL_CreateCursor(const Uint8 * data, * * \threadsafety This function should only be called on the main thread. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_CreateCursor * \sa SDL_CreateSystemCursor @@ -560,7 +560,7 @@ extern SDL_DECLSPEC SDL_Cursor * SDLCALL SDL_CreateColorCursor(SDL_Surface *surf * * \threadsafety This function should only be called on the main thread. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_DestroyCursor */ @@ -580,7 +580,7 @@ extern SDL_DECLSPEC SDL_Cursor * SDLCALL SDL_CreateSystemCursor(SDL_SystemCursor * * \threadsafety This function should only be called on the main thread. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_GetCursor */ @@ -596,7 +596,7 @@ extern SDL_DECLSPEC bool SDLCALL SDL_SetCursor(SDL_Cursor *cursor); * * \threadsafety This function should only be called on the main thread. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_SetCursor */ @@ -613,7 +613,7 @@ extern SDL_DECLSPEC SDL_Cursor * SDLCALL SDL_GetCursor(void); * * \threadsafety This function should only be called on the main thread. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. */ extern SDL_DECLSPEC SDL_Cursor * SDLCALL SDL_GetDefaultCursor(void); @@ -627,7 +627,7 @@ extern SDL_DECLSPEC SDL_Cursor * SDLCALL SDL_GetDefaultCursor(void); * * \threadsafety This function should only be called on the main thread. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_CreateColorCursor * \sa SDL_CreateCursor @@ -643,7 +643,7 @@ extern SDL_DECLSPEC void SDLCALL SDL_DestroyCursor(SDL_Cursor *cursor); * * \threadsafety This function should only be called on the main thread. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_CursorVisible * \sa SDL_HideCursor @@ -658,7 +658,7 @@ extern SDL_DECLSPEC bool SDLCALL SDL_ShowCursor(void); * * \threadsafety This function should only be called on the main thread. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_CursorVisible * \sa SDL_ShowCursor @@ -673,7 +673,7 @@ extern SDL_DECLSPEC bool SDLCALL SDL_HideCursor(void); * * \threadsafety This function should only be called on the main thread. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_HideCursor * \sa SDL_ShowCursor diff --git a/include/SDL3/SDL_mutex.h b/include/SDL3/SDL_mutex.h index b60d8421a7eea..c88ec153153a9 100644 --- a/include/SDL3/SDL_mutex.h +++ b/include/SDL3/SDL_mutex.h @@ -72,7 +72,7 @@ * * Please see https://clang.llvm.org/docs/ThreadSafetyAnalysis.html#mutex-h * - * \since This macro is available since SDL 3.1.3. + * \since This macro is available since SDL 3.2.0. */ #define SDL_CAPABILITY(x) \ SDL_THREAD_ANNOTATION_ATTRIBUTE__(capability(x)) @@ -82,7 +82,7 @@ * * Please see https://clang.llvm.org/docs/ThreadSafetyAnalysis.html#mutex-h * - * \since This macro is available since SDL 3.1.3. + * \since This macro is available since SDL 3.2.0. */ #define SDL_SCOPED_CAPABILITY \ SDL_THREAD_ANNOTATION_ATTRIBUTE__(scoped_lockable) @@ -92,7 +92,7 @@ * * Please see https://clang.llvm.org/docs/ThreadSafetyAnalysis.html#mutex-h * - * \since This macro is available since SDL 3.1.3. + * \since This macro is available since SDL 3.2.0. */ #define SDL_GUARDED_BY(x) \ SDL_THREAD_ANNOTATION_ATTRIBUTE__(guarded_by(x)) @@ -102,7 +102,7 @@ * * Please see https://clang.llvm.org/docs/ThreadSafetyAnalysis.html#mutex-h * - * \since This macro is available since SDL 3.1.3. + * \since This macro is available since SDL 3.2.0. */ #define SDL_PT_GUARDED_BY(x) \ SDL_THREAD_ANNOTATION_ATTRIBUTE__(pt_guarded_by(x)) @@ -112,7 +112,7 @@ * * Please see https://clang.llvm.org/docs/ThreadSafetyAnalysis.html#mutex-h * - * \since This macro is available since SDL 3.1.3. + * \since This macro is available since SDL 3.2.0. */ #define SDL_ACQUIRED_BEFORE(x) \ SDL_THREAD_ANNOTATION_ATTRIBUTE__(acquired_before(x)) @@ -122,7 +122,7 @@ * * Please see https://clang.llvm.org/docs/ThreadSafetyAnalysis.html#mutex-h * - * \since This macro is available since SDL 3.1.3. + * \since This macro is available since SDL 3.2.0. */ #define SDL_ACQUIRED_AFTER(x) \ SDL_THREAD_ANNOTATION_ATTRIBUTE__(acquired_after(x)) @@ -132,7 +132,7 @@ * * Please see https://clang.llvm.org/docs/ThreadSafetyAnalysis.html#mutex-h * - * \since This macro is available since SDL 3.1.3. + * \since This macro is available since SDL 3.2.0. */ #define SDL_REQUIRES(x) \ SDL_THREAD_ANNOTATION_ATTRIBUTE__(requires_capability(x)) @@ -142,7 +142,7 @@ * * Please see https://clang.llvm.org/docs/ThreadSafetyAnalysis.html#mutex-h * - * \since This macro is available since SDL 3.1.3. + * \since This macro is available since SDL 3.2.0. */ #define SDL_REQUIRES_SHARED(x) \ SDL_THREAD_ANNOTATION_ATTRIBUTE__(requires_shared_capability(x)) @@ -152,7 +152,7 @@ * * Please see https://clang.llvm.org/docs/ThreadSafetyAnalysis.html#mutex-h * - * \since This macro is available since SDL 3.1.3. + * \since This macro is available since SDL 3.2.0. */ #define SDL_ACQUIRE(x) \ SDL_THREAD_ANNOTATION_ATTRIBUTE__(acquire_capability(x)) @@ -162,7 +162,7 @@ * * Please see https://clang.llvm.org/docs/ThreadSafetyAnalysis.html#mutex-h * - * \since This macro is available since SDL 3.1.3. + * \since This macro is available since SDL 3.2.0. */ #define SDL_ACQUIRE_SHARED(x) \ SDL_THREAD_ANNOTATION_ATTRIBUTE__(acquire_shared_capability(x)) @@ -172,7 +172,7 @@ * * Please see https://clang.llvm.org/docs/ThreadSafetyAnalysis.html#mutex-h * - * \since This macro is available since SDL 3.1.3. + * \since This macro is available since SDL 3.2.0. */ #define SDL_RELEASE(x) \ SDL_THREAD_ANNOTATION_ATTRIBUTE__(release_capability(x)) @@ -182,7 +182,7 @@ * * Please see https://clang.llvm.org/docs/ThreadSafetyAnalysis.html#mutex-h * - * \since This macro is available since SDL 3.1.3. + * \since This macro is available since SDL 3.2.0. */ #define SDL_RELEASE_SHARED(x) \ SDL_THREAD_ANNOTATION_ATTRIBUTE__(release_shared_capability(x)) @@ -192,7 +192,7 @@ * * Please see https://clang.llvm.org/docs/ThreadSafetyAnalysis.html#mutex-h * - * \since This macro is available since SDL 3.1.3. + * \since This macro is available since SDL 3.2.0. */ #define SDL_RELEASE_GENERIC(x) \ SDL_THREAD_ANNOTATION_ATTRIBUTE__(release_generic_capability(x)) @@ -202,7 +202,7 @@ * * Please see https://clang.llvm.org/docs/ThreadSafetyAnalysis.html#mutex-h * - * \since This macro is available since SDL 3.1.3. + * \since This macro is available since SDL 3.2.0. */ #define SDL_TRY_ACQUIRE(x, y) \ SDL_THREAD_ANNOTATION_ATTRIBUTE__(try_acquire_capability(x, y)) @@ -212,7 +212,7 @@ * * Please see https://clang.llvm.org/docs/ThreadSafetyAnalysis.html#mutex-h * - * \since This macro is available since SDL 3.1.3. + * \since This macro is available since SDL 3.2.0. */ #define SDL_TRY_ACQUIRE_SHARED(x, y) \ SDL_THREAD_ANNOTATION_ATTRIBUTE__(try_acquire_shared_capability(x, y)) @@ -222,7 +222,7 @@ * * Please see https://clang.llvm.org/docs/ThreadSafetyAnalysis.html#mutex-h * - * \since This macro is available since SDL 3.1.3. + * \since This macro is available since SDL 3.2.0. */ #define SDL_EXCLUDES(x) \ SDL_THREAD_ANNOTATION_ATTRIBUTE__(locks_excluded(x)) @@ -232,7 +232,7 @@ * * Please see https://clang.llvm.org/docs/ThreadSafetyAnalysis.html#mutex-h * - * \since This macro is available since SDL 3.1.3. + * \since This macro is available since SDL 3.2.0. */ #define SDL_ASSERT_CAPABILITY(x) \ SDL_THREAD_ANNOTATION_ATTRIBUTE__(assert_capability(x)) @@ -242,7 +242,7 @@ * * Please see https://clang.llvm.org/docs/ThreadSafetyAnalysis.html#mutex-h * - * \since This macro is available since SDL 3.1.3. + * \since This macro is available since SDL 3.2.0. */ #define SDL_ASSERT_SHARED_CAPABILITY(x) \ SDL_THREAD_ANNOTATION_ATTRIBUTE__(assert_shared_capability(x)) @@ -252,7 +252,7 @@ * * Please see https://clang.llvm.org/docs/ThreadSafetyAnalysis.html#mutex-h * - * \since This macro is available since SDL 3.1.3. + * \since This macro is available since SDL 3.2.0. */ #define SDL_RETURN_CAPABILITY(x) \ SDL_THREAD_ANNOTATION_ATTRIBUTE__(lock_returned(x)) @@ -262,7 +262,7 @@ * * Please see https://clang.llvm.org/docs/ThreadSafetyAnalysis.html#mutex-h * - * \since This macro is available since SDL 3.1.3. + * \since This macro is available since SDL 3.2.0. */ #define SDL_NO_THREAD_SAFETY_ANALYSIS \ SDL_THREAD_ANNOTATION_ATTRIBUTE__(no_thread_safety_analysis) @@ -291,7 +291,7 @@ extern "C" { * * https://en.wikipedia.org/wiki/Mutex * - * \since This struct is available since SDL 3.1.3. + * \since This struct is available since SDL 3.2.0. */ typedef struct SDL_Mutex SDL_Mutex; @@ -308,7 +308,7 @@ typedef struct SDL_Mutex SDL_Mutex; * \returns the initialized and unlocked mutex or NULL on failure; call * SDL_GetError() for more information. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_DestroyMutex * \sa SDL_LockMutex @@ -334,7 +334,7 @@ extern SDL_DECLSPEC SDL_Mutex * SDLCALL SDL_CreateMutex(void); * * \param mutex the mutex to lock. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_TryLockMutex * \sa SDL_UnlockMutex @@ -355,7 +355,7 @@ extern SDL_DECLSPEC void SDLCALL SDL_LockMutex(SDL_Mutex *mutex) SDL_ACQUIRE(mut * \param mutex the mutex to try to lock. * \returns true on success, false if the mutex would block. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_LockMutex * \sa SDL_UnlockMutex @@ -374,7 +374,7 @@ extern SDL_DECLSPEC bool SDLCALL SDL_TryLockMutex(SDL_Mutex *mutex) SDL_TRY_ACQU * * \param mutex the mutex to unlock. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_LockMutex * \sa SDL_TryLockMutex @@ -392,7 +392,7 @@ extern SDL_DECLSPEC void SDLCALL SDL_UnlockMutex(SDL_Mutex *mutex) SDL_RELEASE(m * * \param mutex the mutex to destroy. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_CreateMutex */ @@ -422,7 +422,7 @@ extern SDL_DECLSPEC void SDLCALL SDL_DestroyMutex(SDL_Mutex *mutex); * about how threads are scheduled and when they can be recursively locked. * These are documented in the other rwlock functions. * - * \since This struct is available since SDL 3.1.3. + * \since This struct is available since SDL 3.2.0. */ typedef struct SDL_RWLock SDL_RWLock; @@ -457,7 +457,7 @@ typedef struct SDL_RWLock SDL_RWLock; * \returns the initialized and unlocked read/write lock or NULL on failure; * call SDL_GetError() for more information. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_DestroyRWLock * \sa SDL_LockRWLockForReading @@ -497,7 +497,7 @@ extern SDL_DECLSPEC SDL_RWLock * SDLCALL SDL_CreateRWLock(void); * * \param rwlock the read/write lock to lock. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_LockRWLockForWriting * \sa SDL_TryLockRWLockForReading @@ -528,7 +528,7 @@ extern SDL_DECLSPEC void SDLCALL SDL_LockRWLockForReading(SDL_RWLock *rwlock) SD * * \param rwlock the read/write lock to lock. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_LockRWLockForReading * \sa SDL_TryLockRWLockForWriting @@ -553,7 +553,7 @@ extern SDL_DECLSPEC void SDLCALL SDL_LockRWLockForWriting(SDL_RWLock *rwlock) SD * \param rwlock the rwlock to try to lock. * \returns true on success, false if the lock would block. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_LockRWLockForReading * \sa SDL_TryLockRWLockForWriting @@ -583,7 +583,7 @@ extern SDL_DECLSPEC bool SDLCALL SDL_TryLockRWLockForReading(SDL_RWLock *rwlock) * \param rwlock the rwlock to try to lock. * \returns true on success, false if the lock would block. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_LockRWLockForWriting * \sa SDL_TryLockRWLockForReading @@ -607,7 +607,7 @@ extern SDL_DECLSPEC bool SDLCALL SDL_TryLockRWLockForWriting(SDL_RWLock *rwlock) * * \param rwlock the rwlock to unlock. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_LockRWLockForReading * \sa SDL_LockRWLockForWriting @@ -627,7 +627,7 @@ extern SDL_DECLSPEC void SDLCALL SDL_UnlockRWLock(SDL_RWLock *rwlock) SDL_RELEAS * * \param rwlock the rwlock to destroy. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_CreateRWLock */ @@ -653,7 +653,7 @@ extern SDL_DECLSPEC void SDLCALL SDL_DestroyRWLock(SDL_RWLock *rwlock); * * https://en.wikipedia.org/wiki/Semaphore_(programming) * - * \since This struct is available since SDL 3.1.3. + * \since This struct is available since SDL 3.2.0. */ typedef struct SDL_Semaphore SDL_Semaphore; @@ -670,7 +670,7 @@ typedef struct SDL_Semaphore SDL_Semaphore; * \returns a new semaphore or NULL on failure; call SDL_GetError() for more * information. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_DestroySemaphore * \sa SDL_SignalSemaphore @@ -689,7 +689,7 @@ extern SDL_DECLSPEC SDL_Semaphore * SDLCALL SDL_CreateSemaphore(Uint32 initial_v * * \param sem the semaphore to destroy. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_CreateSemaphore */ @@ -707,7 +707,7 @@ extern SDL_DECLSPEC void SDLCALL SDL_DestroySemaphore(SDL_Semaphore *sem); * * \param sem the semaphore wait on. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_SignalSemaphore * \sa SDL_TryWaitSemaphore @@ -726,7 +726,7 @@ extern SDL_DECLSPEC void SDLCALL SDL_WaitSemaphore(SDL_Semaphore *sem); * \param sem the semaphore to wait on. * \returns true if the wait succeeds, false if the wait would block. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_SignalSemaphore * \sa SDL_WaitSemaphore @@ -746,7 +746,7 @@ extern SDL_DECLSPEC bool SDLCALL SDL_TryWaitSemaphore(SDL_Semaphore *sem); * indefinitely. * \returns true if the wait succeeds or false if the wait times out. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_SignalSemaphore * \sa SDL_TryWaitSemaphore @@ -759,7 +759,7 @@ extern SDL_DECLSPEC bool SDLCALL SDL_WaitSemaphoreTimeout(SDL_Semaphore *sem, Si * * \param sem the semaphore to increment. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_TryWaitSemaphore * \sa SDL_WaitSemaphore @@ -773,7 +773,7 @@ extern SDL_DECLSPEC void SDLCALL SDL_SignalSemaphore(SDL_Semaphore *sem); * \param sem the semaphore to query. * \returns the current value of the semaphore. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. */ extern SDL_DECLSPEC Uint32 SDLCALL SDL_GetSemaphoreValue(SDL_Semaphore *sem); @@ -796,7 +796,7 @@ extern SDL_DECLSPEC Uint32 SDLCALL SDL_GetSemaphoreValue(SDL_Semaphore *sem); * * https://en.wikipedia.org/wiki/Condition_variable * - * \since This struct is available since SDL 3.1.3. + * \since This struct is available since SDL 3.2.0. */ typedef struct SDL_Condition SDL_Condition; @@ -806,7 +806,7 @@ typedef struct SDL_Condition SDL_Condition; * \returns a new condition variable or NULL on failure; call SDL_GetError() * for more information. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_BroadcastCondition * \sa SDL_SignalCondition @@ -821,7 +821,7 @@ extern SDL_DECLSPEC SDL_Condition * SDLCALL SDL_CreateCondition(void); * * \param cond the condition variable to destroy. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_CreateCondition */ @@ -834,7 +834,7 @@ extern SDL_DECLSPEC void SDLCALL SDL_DestroyCondition(SDL_Condition *cond); * * \threadsafety It is safe to call this function from any thread. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_BroadcastCondition * \sa SDL_WaitCondition @@ -849,7 +849,7 @@ extern SDL_DECLSPEC void SDLCALL SDL_SignalCondition(SDL_Condition *cond); * * \threadsafety It is safe to call this function from any thread. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_SignalCondition * \sa SDL_WaitCondition @@ -877,7 +877,7 @@ extern SDL_DECLSPEC void SDLCALL SDL_BroadcastCondition(SDL_Condition *cond); * * \threadsafety It is safe to call this function from any thread. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_BroadcastCondition * \sa SDL_SignalCondition @@ -907,7 +907,7 @@ extern SDL_DECLSPEC void SDLCALL SDL_WaitCondition(SDL_Condition *cond, SDL_Mute * * \threadsafety It is safe to call this function from any thread. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_BroadcastCondition * \sa SDL_SignalCondition @@ -926,7 +926,7 @@ extern SDL_DECLSPEC bool SDLCALL SDL_WaitConditionTimeout(SDL_Condition *cond, /** * The current status of an SDL_InitState structure. * - * \since This enum is available since SDL 3.1.3. + * \since This enum is available since SDL 3.2.0. */ typedef enum SDL_InitStatus { @@ -990,7 +990,7 @@ typedef enum SDL_InitStatus * should use other mechanisms to protect those, if that's a concern for your * code. * - * \since This struct is available since SDL 3.1.3. + * \since This struct is available since SDL 3.2.0. */ typedef struct SDL_InitState { @@ -1015,7 +1015,7 @@ typedef struct SDL_InitState * * \threadsafety It is safe to call this function from any thread. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_SetInitialized * \sa SDL_ShouldQuit @@ -1036,7 +1036,7 @@ extern SDL_DECLSPEC bool SDLCALL SDL_ShouldInit(SDL_InitState *state); * * \threadsafety It is safe to call this function from any thread. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_SetInitialized * \sa SDL_ShouldInit @@ -1055,7 +1055,7 @@ extern SDL_DECLSPEC bool SDLCALL SDL_ShouldQuit(SDL_InitState *state); * * \threadsafety It is safe to call this function from any thread. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_ShouldInit * \sa SDL_ShouldQuit diff --git a/include/SDL3/SDL_pen.h b/include/SDL3/SDL_pen.h index 61305905a13b2..7e5c2d9ececd1 100644 --- a/include/SDL3/SDL_pen.h +++ b/include/SDL3/SDL_pen.h @@ -57,21 +57,21 @@ extern "C" { * consistent as long as SDL can recognize a tool to be the same pen; but if a * pen physically leaves the area and returns, it might get a new ID. * - * \since This datatype is available since SDL 3.1.3. + * \since This datatype is available since SDL 3.2.0. */ typedef Uint32 SDL_PenID; /** * The SDL_MouseID for mouse events simulated with pen input. * - * \since This macro is available since SDL 3.1.3. + * \since This macro is available since SDL 3.2.0. */ #define SDL_PEN_MOUSEID ((SDL_MouseID)-2) /** * The SDL_TouchID for touch events simulated with pen input. * - * \since This macro is available since SDL 3.1.3. + * \since This macro is available since SDL 3.2.0. */ #define SDL_PEN_TOUCHID ((SDL_TouchID)-2) @@ -79,7 +79,7 @@ typedef Uint32 SDL_PenID; /** * Pen input flags, as reported by various pen events' `pen_state` field. * - * \since This datatype is available since SDL 3.1.3. + * \since This datatype is available since SDL 3.2.0. */ typedef Uint32 SDL_PenInputFlags; @@ -104,7 +104,7 @@ typedef Uint32 SDL_PenInputFlags; * * `SDL_sinf(xtilt * SDL_PI_F / 180.0)`. * - * \since This enum is available since SDL 3.1.3 + * \since This enum is available since SDL 3.2.0 */ typedef enum SDL_PenAxis { diff --git a/include/SDL3/SDL_pixels.h b/include/SDL3/SDL_pixels.h index a20ede6e187c5..b6f38acbe3bb0 100644 --- a/include/SDL3/SDL_pixels.h +++ b/include/SDL3/SDL_pixels.h @@ -93,7 +93,7 @@ extern "C" { /** * A fully opaque 8-bit alpha value. * - * \since This macro is available since SDL 3.1.3. + * \since This macro is available since SDL 3.2.0. * * \sa SDL_ALPHA_TRANSPARENT */ @@ -102,7 +102,7 @@ extern "C" { /** * A fully opaque floating point alpha value. * - * \since This macro is available since SDL 3.1.3. + * \since This macro is available since SDL 3.2.0. * * \sa SDL_ALPHA_TRANSPARENT_FLOAT */ @@ -111,7 +111,7 @@ extern "C" { /** * A fully transparent 8-bit alpha value. * - * \since This macro is available since SDL 3.1.3. + * \since This macro is available since SDL 3.2.0. * * \sa SDL_ALPHA_OPAQUE */ @@ -120,7 +120,7 @@ extern "C" { /** * A fully transparent floating point alpha value. * - * \since This macro is available since SDL 3.1.3. + * \since This macro is available since SDL 3.2.0. * * \sa SDL_ALPHA_OPAQUE_FLOAT */ @@ -129,7 +129,7 @@ extern "C" { /** * Pixel type. * - * \since This enum is available since SDL 3.1.3. + * \since This enum is available since SDL 3.2.0. */ typedef enum SDL_PixelType { @@ -152,7 +152,7 @@ typedef enum SDL_PixelType /** * Bitmap pixel order, high bit -> low bit. * - * \since This enum is available since SDL 3.1.3. + * \since This enum is available since SDL 3.2.0. */ typedef enum SDL_BitmapOrder { @@ -164,7 +164,7 @@ typedef enum SDL_BitmapOrder /** * Packed component order, high bit -> low bit. * - * \since This enum is available since SDL 3.1.3. + * \since This enum is available since SDL 3.2.0. */ typedef enum SDL_PackedOrder { @@ -182,7 +182,7 @@ typedef enum SDL_PackedOrder /** * Array component order, low byte -> high byte. * - * \since This enum is available since SDL 3.1.3. + * \since This enum is available since SDL 3.2.0. */ typedef enum SDL_ArrayOrder { @@ -198,7 +198,7 @@ typedef enum SDL_ArrayOrder /** * Packed component layout. * - * \since This enum is available since SDL 3.1.3. + * \since This enum is available since SDL 3.2.0. */ typedef enum SDL_PackedLayout { @@ -230,7 +230,7 @@ typedef enum SDL_PackedLayout * * \threadsafety It is safe to call this macro from any thread. * - * \since This macro is available since SDL 3.1.3. + * \since This macro is available since SDL 3.2.0. */ #define SDL_DEFINE_PIXELFOURCC(A, B, C, D) SDL_FOURCC(A, B, C, D) @@ -254,7 +254,7 @@ typedef enum SDL_PackedLayout * * \threadsafety It is safe to call this macro from any thread. * - * \since This macro is available since SDL 3.1.3. + * \since This macro is available since SDL 3.2.0. */ #define SDL_DEFINE_PIXELFORMAT(type, order, layout, bits, bytes) \ ((1 << 28) | ((type) << 24) | ((order) << 20) | ((layout) << 16) | \ @@ -271,7 +271,7 @@ typedef enum SDL_PackedLayout * * \threadsafety It is safe to call this macro from any thread. * - * \since This macro is available since SDL 3.1.3. + * \since This macro is available since SDL 3.2.0. */ #define SDL_PIXELFLAG(format) (((format) >> 28) & 0x0F) @@ -285,7 +285,7 @@ typedef enum SDL_PackedLayout * * \threadsafety It is safe to call this macro from any thread. * - * \since This macro is available since SDL 3.1.3. + * \since This macro is available since SDL 3.2.0. */ #define SDL_PIXELTYPE(format) (((format) >> 24) & 0x0F) @@ -300,7 +300,7 @@ typedef enum SDL_PackedLayout * * \threadsafety It is safe to call this macro from any thread. * - * \since This macro is available since SDL 3.1.3. + * \since This macro is available since SDL 3.2.0. */ #define SDL_PIXELORDER(format) (((format) >> 20) & 0x0F) @@ -315,7 +315,7 @@ typedef enum SDL_PackedLayout * * \threadsafety It is safe to call this macro from any thread. * - * \since This macro is available since SDL 3.1.3. + * \since This macro is available since SDL 3.2.0. */ #define SDL_PIXELLAYOUT(format) (((format) >> 16) & 0x0F) @@ -333,7 +333,7 @@ typedef enum SDL_PackedLayout * * \threadsafety It is safe to call this macro from any thread. * - * \since This macro is available since SDL 3.1.3. + * \since This macro is available since SDL 3.2.0. * * \sa SDL_BYTESPERPIXEL */ @@ -354,7 +354,7 @@ typedef enum SDL_PackedLayout * * \threadsafety It is safe to call this macro from any thread. * - * \since This macro is available since SDL 3.1.3. + * \since This macro is available since SDL 3.2.0. * * \sa SDL_BITSPERPIXEL */ @@ -377,7 +377,7 @@ typedef enum SDL_PackedLayout * * \threadsafety It is safe to call this macro from any thread. * - * \since This macro is available since SDL 3.1.3. + * \since This macro is available since SDL 3.2.0. */ #define SDL_ISPIXELFORMAT_INDEXED(format) \ (!SDL_ISPIXELFORMAT_FOURCC(format) && \ @@ -397,7 +397,7 @@ typedef enum SDL_PackedLayout * * \threadsafety It is safe to call this macro from any thread. * - * \since This macro is available since SDL 3.1.3. + * \since This macro is available since SDL 3.2.0. */ #define SDL_ISPIXELFORMAT_PACKED(format) \ (!SDL_ISPIXELFORMAT_FOURCC(format) && \ @@ -416,7 +416,7 @@ typedef enum SDL_PackedLayout * * \threadsafety It is safe to call this macro from any thread. * - * \since This macro is available since SDL 3.1.3. + * \since This macro is available since SDL 3.2.0. */ #define SDL_ISPIXELFORMAT_ARRAY(format) \ (!SDL_ISPIXELFORMAT_FOURCC(format) && \ @@ -437,7 +437,7 @@ typedef enum SDL_PackedLayout * * \threadsafety It is safe to call this macro from any thread. * - * \since This macro is available since SDL 3.1.3. + * \since This macro is available since SDL 3.2.0. */ #define SDL_ISPIXELFORMAT_10BIT(format) \ (!SDL_ISPIXELFORMAT_FOURCC(format) && \ @@ -455,7 +455,7 @@ typedef enum SDL_PackedLayout * * \threadsafety It is safe to call this macro from any thread. * - * \since This macro is available since SDL 3.1.3. + * \since This macro is available since SDL 3.2.0. */ #define SDL_ISPIXELFORMAT_FLOAT(format) \ (!SDL_ISPIXELFORMAT_FOURCC(format) && \ @@ -473,7 +473,7 @@ typedef enum SDL_PackedLayout * * \threadsafety It is safe to call this macro from any thread. * - * \since This macro is available since SDL 3.1.3. + * \since This macro is available since SDL 3.2.0. */ #define SDL_ISPIXELFORMAT_ALPHA(format) \ ((SDL_ISPIXELFORMAT_PACKED(format) && \ @@ -501,7 +501,7 @@ typedef enum SDL_PackedLayout * * \threadsafety It is safe to call this macro from any thread. * - * \since This macro is available since SDL 3.1.3. + * \since This macro is available since SDL 3.2.0. */ #define SDL_ISPIXELFORMAT_FOURCC(format) /* The flag is set to 1 because 0x1? is not in the printable ASCII range */ \ ((format) && (SDL_PIXELFLAG(format) != 1)) @@ -543,7 +543,7 @@ typedef enum SDL_PackedLayout * an alias for ABGR8888 on little-endian CPUs like x86, or an alias for * RGBA8888 on big-endian CPUs. * - * \since This enum is available since SDL 3.1.3. + * \since This enum is available since SDL 3.2.0. */ typedef enum SDL_PixelFormat { @@ -701,7 +701,7 @@ typedef enum SDL_PixelFormat /** * Colorspace color type. * - * \since This enum is available since SDL 3.1.3. + * \since This enum is available since SDL 3.2.0. */ typedef enum SDL_ColorType { @@ -714,7 +714,7 @@ typedef enum SDL_ColorType * Colorspace color range, as described by * https://www.itu.int/rec/R-REC-BT.2100-2-201807-I/en * - * \since This enum is available since SDL 3.1.3. + * \since This enum is available since SDL 3.2.0. */ typedef enum SDL_ColorRange { @@ -727,7 +727,7 @@ typedef enum SDL_ColorRange * Colorspace color primaries, as described by * https://www.itu.int/rec/T-REC-H.273-201612-S/en * - * \since This enum is available since SDL 3.1.3. + * \since This enum is available since SDL 3.2.0. */ typedef enum SDL_ColorPrimaries { @@ -752,7 +752,7 @@ typedef enum SDL_ColorPrimaries * * These are as described by https://www.itu.int/rec/T-REC-H.273-201612-S/en * - * \since This enum is available since SDL 3.1.3. + * \since This enum is available since SDL 3.2.0. */ typedef enum SDL_TransferCharacteristics { @@ -782,7 +782,7 @@ typedef enum SDL_TransferCharacteristics * * These are as described by https://www.itu.int/rec/T-REC-H.273-201612-S/en * - * \since This enum is available since SDL 3.1.3. + * \since This enum is available since SDL 3.2.0. */ typedef enum SDL_MatrixCoefficients { @@ -806,7 +806,7 @@ typedef enum SDL_MatrixCoefficients /** * Colorspace chroma sample location. * - * \since This enum is available since SDL 3.1.3. + * \since This enum is available since SDL 3.2.0. */ typedef enum SDL_ChromaLocation { @@ -847,7 +847,7 @@ typedef enum SDL_ChromaLocation * * \threadsafety It is safe to call this macro from any thread. * - * \since This macro is available since SDL 3.1.3. + * \since This macro is available since SDL 3.2.0. */ #define SDL_DEFINE_COLORSPACE(type, range, primaries, transfer, matrix, chroma) \ (((Uint32)(type) << 28) | ((Uint32)(range) << 24) | ((Uint32)(chroma) << 20) | \ @@ -861,7 +861,7 @@ typedef enum SDL_ChromaLocation * * \threadsafety It is safe to call this macro from any thread. * - * \since This macro is available since SDL 3.1.3. + * \since This macro is available since SDL 3.2.0. */ #define SDL_COLORSPACETYPE(cspace) (SDL_ColorType)(((cspace) >> 28) & 0x0F) @@ -873,7 +873,7 @@ typedef enum SDL_ChromaLocation * * \threadsafety It is safe to call this macro from any thread. * - * \since This macro is available since SDL 3.1.3. + * \since This macro is available since SDL 3.2.0. */ #define SDL_COLORSPACERANGE(cspace) (SDL_ColorRange)(((cspace) >> 24) & 0x0F) @@ -885,7 +885,7 @@ typedef enum SDL_ChromaLocation * * \threadsafety It is safe to call this macro from any thread. * - * \since This macro is available since SDL 3.1.3. + * \since This macro is available since SDL 3.2.0. */ #define SDL_COLORSPACECHROMA(cspace) (SDL_ChromaLocation)(((cspace) >> 20) & 0x0F) @@ -897,7 +897,7 @@ typedef enum SDL_ChromaLocation * * \threadsafety It is safe to call this macro from any thread. * - * \since This macro is available since SDL 3.1.3. + * \since This macro is available since SDL 3.2.0. */ #define SDL_COLORSPACEPRIMARIES(cspace) (SDL_ColorPrimaries)(((cspace) >> 10) & 0x1F) @@ -909,7 +909,7 @@ typedef enum SDL_ChromaLocation * * \threadsafety It is safe to call this macro from any thread. * - * \since This macro is available since SDL 3.1.3. + * \since This macro is available since SDL 3.2.0. */ #define SDL_COLORSPACETRANSFER(cspace) (SDL_TransferCharacteristics)(((cspace) >> 5) & 0x1F) @@ -921,7 +921,7 @@ typedef enum SDL_ChromaLocation * * \threadsafety It is safe to call this macro from any thread. * - * \since This macro is available since SDL 3.1.3. + * \since This macro is available since SDL 3.2.0. */ #define SDL_COLORSPACEMATRIX(cspace) (SDL_MatrixCoefficients)((cspace) & 0x1F) @@ -937,7 +937,7 @@ typedef enum SDL_ChromaLocation * * \threadsafety It is safe to call this macro from any thread. * - * \since This macro is available since SDL 3.1.3. + * \since This macro is available since SDL 3.2.0. */ #define SDL_ISCOLORSPACE_MATRIX_BT601(cspace) (SDL_COLORSPACEMATRIX(cspace) == SDL_MATRIX_COEFFICIENTS_BT601 || SDL_COLORSPACEMATRIX(cspace) == SDL_MATRIX_COEFFICIENTS_BT470BG) @@ -949,7 +949,7 @@ typedef enum SDL_ChromaLocation * * \threadsafety It is safe to call this macro from any thread. * - * \since This macro is available since SDL 3.1.3. + * \since This macro is available since SDL 3.2.0. */ #define SDL_ISCOLORSPACE_MATRIX_BT709(cspace) (SDL_COLORSPACEMATRIX(cspace) == SDL_MATRIX_COEFFICIENTS_BT709) @@ -962,7 +962,7 @@ typedef enum SDL_ChromaLocation * * \threadsafety It is safe to call this macro from any thread. * - * \since This macro is available since SDL 3.1.3. + * \since This macro is available since SDL 3.2.0. */ #define SDL_ISCOLORSPACE_MATRIX_BT2020_NCL(cspace) (SDL_COLORSPACEMATRIX(cspace) == SDL_MATRIX_COEFFICIENTS_BT2020_NCL) @@ -974,7 +974,7 @@ typedef enum SDL_ChromaLocation * * \threadsafety It is safe to call this macro from any thread. * - * \since This macro is available since SDL 3.1.3. + * \since This macro is available since SDL 3.2.0. */ #define SDL_ISCOLORSPACE_LIMITED_RANGE(cspace) (SDL_COLORSPACERANGE(cspace) != SDL_COLOR_RANGE_FULL) @@ -986,7 +986,7 @@ typedef enum SDL_ChromaLocation * * \threadsafety It is safe to call this macro from any thread. * - * \since This macro is available since SDL 3.1.3. + * \since This macro is available since SDL 3.2.0. */ #define SDL_ISCOLORSPACE_FULL_RANGE(cspace) (SDL_COLORSPACERANGE(cspace) == SDL_COLOR_RANGE_FULL) @@ -997,7 +997,7 @@ typedef enum SDL_ChromaLocation * function, etc.), this is not an exhaustive list, but rather a * representative sample of the kinds of colorspaces supported in SDL. * - * \since This enum is available since SDL 3.1.3. + * \since This enum is available since SDL 3.2.0. * * \sa SDL_ColorPrimaries * \sa SDL_ColorRange @@ -1104,7 +1104,7 @@ typedef enum SDL_Colorspace * (SDL_PIXELFORMAT_ABGR8888 on little-endian systems and * SDL_PIXELFORMAT_RGBA8888 on big-endian systems). * - * \since This struct is available since SDL 3.1.3. + * \since This struct is available since SDL 3.2.0. */ typedef struct SDL_Color { @@ -1118,7 +1118,7 @@ typedef struct SDL_Color * The bits of this structure can be directly reinterpreted as a float-packed * color which uses the SDL_PIXELFORMAT_RGBA128_FLOAT format * - * \since This struct is available since SDL 3.1.3. + * \since This struct is available since SDL 3.2.0. */ typedef struct SDL_FColor { @@ -1131,7 +1131,7 @@ typedef struct SDL_FColor /** * A set of indexed colors representing a palette. * - * \since This struct is available since SDL 3.1.3. + * \since This struct is available since SDL 3.2.0. * * \sa SDL_SetPaletteColors */ @@ -1146,7 +1146,7 @@ typedef struct SDL_Palette /** * Details about the format of a pixel. * - * \since This struct is available since SDL 3.1.3. + * \since This struct is available since SDL 3.2.0. */ typedef struct SDL_PixelFormatDetails { @@ -1177,7 +1177,7 @@ typedef struct SDL_PixelFormatDetails * * \threadsafety It is safe to call this function from any thread. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. */ extern SDL_DECLSPEC const char * SDLCALL SDL_GetPixelFormatName(SDL_PixelFormat format); @@ -1195,7 +1195,7 @@ extern SDL_DECLSPEC const char * SDLCALL SDL_GetPixelFormatName(SDL_PixelFormat * * \threadsafety It is safe to call this function from any thread. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_GetPixelFormatForMasks */ @@ -1217,7 +1217,7 @@ extern SDL_DECLSPEC bool SDLCALL SDL_GetMasksForPixelFormat(SDL_PixelFormat form * * \threadsafety It is safe to call this function from any thread. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_GetMasksForPixelFormat */ @@ -1236,7 +1236,7 @@ extern SDL_DECLSPEC SDL_PixelFormat SDLCALL SDL_GetPixelFormatForMasks(int bpp, * * \threadsafety It is safe to call this function from any thread. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. */ extern SDL_DECLSPEC const SDL_PixelFormatDetails * SDLCALL SDL_GetPixelFormatDetails(SDL_PixelFormat format); @@ -1252,7 +1252,7 @@ extern SDL_DECLSPEC const SDL_PixelFormatDetails * SDLCALL SDL_GetPixelFormatDet * * \threadsafety It is safe to call this function from any thread. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_DestroyPalette * \sa SDL_SetPaletteColors @@ -1273,7 +1273,7 @@ extern SDL_DECLSPEC SDL_Palette * SDLCALL SDL_CreatePalette(int ncolors); * \threadsafety It is safe to call this function from any thread, as long as * the palette is not modified or destroyed in another thread. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. */ extern SDL_DECLSPEC bool SDLCALL SDL_SetPaletteColors(SDL_Palette *palette, const SDL_Color *colors, int firstcolor, int ncolors); @@ -1285,7 +1285,7 @@ extern SDL_DECLSPEC bool SDLCALL SDL_SetPaletteColors(SDL_Palette *palette, cons * \threadsafety It is safe to call this function from any thread, as long as * the palette is not modified or destroyed in another thread. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_CreatePalette */ @@ -1320,7 +1320,7 @@ extern SDL_DECLSPEC void SDLCALL SDL_DestroyPalette(SDL_Palette *palette); * \threadsafety It is safe to call this function from any thread, as long as * the palette is not modified. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_GetPixelFormatDetails * \sa SDL_GetRGB @@ -1359,7 +1359,7 @@ extern SDL_DECLSPEC Uint32 SDLCALL SDL_MapRGB(const SDL_PixelFormatDetails *form * \threadsafety It is safe to call this function from any thread, as long as * the palette is not modified. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_GetPixelFormatDetails * \sa SDL_GetRGBA @@ -1387,7 +1387,7 @@ extern SDL_DECLSPEC Uint32 SDLCALL SDL_MapRGBA(const SDL_PixelFormatDetails *for * \threadsafety It is safe to call this function from any thread, as long as * the palette is not modified. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_GetPixelFormatDetails * \sa SDL_GetRGBA @@ -1419,7 +1419,7 @@ extern SDL_DECLSPEC void SDLCALL SDL_GetRGB(Uint32 pixel, const SDL_PixelFormatD * \threadsafety It is safe to call this function from any thread, as long as * the palette is not modified. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_GetPixelFormatDetails * \sa SDL_GetRGB diff --git a/include/SDL3/SDL_platform.h b/include/SDL3/SDL_platform.h index 9e8ce42f468e4..e40f009bad6df 100644 --- a/include/SDL3/SDL_platform.h +++ b/include/SDL3/SDL_platform.h @@ -51,7 +51,7 @@ extern "C" { * \returns the name of the platform. If the correct platform name is not * available, returns a string beginning with the text "Unknown". * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. */ extern SDL_DECLSPEC const char * SDLCALL SDL_GetPlatform(void); diff --git a/include/SDL3/SDL_platform_defines.h b/include/SDL3/SDL_platform_defines.h index 59710a5eaa07d..7e9a0a92a28d3 100644 --- a/include/SDL3/SDL_platform_defines.h +++ b/include/SDL3/SDL_platform_defines.h @@ -33,7 +33,7 @@ /** * A preprocessor macro that is only defined if compiling for AIX. * - * \since This macro is available since SDL 3.1.3. + * \since This macro is available since SDL 3.2.0. */ #define SDL_PLATFORM_AIX 1 #endif @@ -43,7 +43,7 @@ /** * A preprocessor macro that is only defined if compiling for Haiku OS. * - * \since This macro is available since SDL 3.1.3. + * \since This macro is available since SDL 3.2.0. */ #define SDL_PLATFORM_HAIKU 1 #endif @@ -53,7 +53,7 @@ /** * A preprocessor macro that is only defined if compiling for BSDi * - * \since This macro is available since SDL 3.1.3. + * \since This macro is available since SDL 3.2.0. */ #define SDL_PLATFORM_BSDI 1 #endif @@ -63,7 +63,7 @@ /** * A preprocessor macro that is only defined if compiling for FreeBSD. * - * \since This macro is available since SDL 3.1.3. + * \since This macro is available since SDL 3.2.0. */ #define SDL_PLATFORM_FREEBSD 1 #endif @@ -73,7 +73,7 @@ /** * A preprocessor macro that is only defined if compiling for HP-UX. * - * \since This macro is available since SDL 3.1.3. + * \since This macro is available since SDL 3.2.0. */ #define SDL_PLATFORM_HPUX 1 #endif @@ -83,7 +83,7 @@ /** * A preprocessor macro that is only defined if compiling for IRIX. * - * \since This macro is available since SDL 3.1.3. + * \since This macro is available since SDL 3.2.0. */ #define SDL_PLATFORM_IRIX 1 #endif @@ -96,7 +96,7 @@ * Note that Android, although ostensibly a Linux-based system, will not * define this. It defines SDL_PLATFORM_ANDROID instead. * - * \since This macro is available since SDL 3.1.3. + * \since This macro is available since SDL 3.2.0. */ #define SDL_PLATFORM_LINUX 1 #endif @@ -106,7 +106,7 @@ /** * A preprocessor macro that is only defined if compiling for Android. * - * \since This macro is available since SDL 3.1.3. + * \since This macro is available since SDL 3.2.0. */ #define SDL_PLATFORM_ANDROID 1 #undef SDL_PLATFORM_LINUX @@ -121,7 +121,7 @@ * Other platforms, like Linux, might define this in addition to their primary * define. * - * \since This macro is available since SDL 3.1.3. + * \since This macro is available since SDL 3.2.0. */ #define SDL_PLATFORM_UNIX 1 #endif @@ -133,7 +133,7 @@ * * iOS, macOS, etc will additionally define a more specific platform macro. * - * \since This macro is available since SDL 3.1.3. + * \since This macro is available since SDL 3.2.0. * * \sa SDL_PLATFORM_MACOS * \sa SDL_PLATFORM_IOS @@ -180,7 +180,7 @@ /** * A preprocessor macro that is only defined if compiling for tvOS. * - * \since This macro is available since SDL 3.1.3. + * \since This macro is available since SDL 3.2.0. * * \sa SDL_PLATFORM_APPLE */ @@ -192,7 +192,7 @@ /** * A preprocessor macro that is only defined if compiling for VisionOS. * - * \since This macro is available since SDL 3.1.3. + * \since This macro is available since SDL 3.2.0. * * \sa SDL_PLATFORM_APPLE */ @@ -204,7 +204,7 @@ /** * A preprocessor macro that is only defined if compiling for iOS. * - * \since This macro is available since SDL 3.1.3. + * \since This macro is available since SDL 3.2.0. * * \sa SDL_PLATFORM_APPLE */ @@ -215,7 +215,7 @@ /** * A preprocessor macro that is only defined if compiling for macOS. * - * \since This macro is available since SDL 3.1.3. + * \since This macro is available since SDL 3.2.0. * * \sa SDL_PLATFORM_APPLE */ @@ -232,7 +232,7 @@ /** * A preprocessor macro that is only defined if compiling for Emscripten. * - * \since This macro is available since SDL 3.1.3. + * \since This macro is available since SDL 3.2.0. */ #define SDL_PLATFORM_EMSCRIPTEN 1 #endif @@ -242,7 +242,7 @@ /** * A preprocessor macro that is only defined if compiling for NetBSD. * - * \since This macro is available since SDL 3.1.3. + * \since This macro is available since SDL 3.2.0. */ #define SDL_PLATFORM_NETBSD 1 #endif @@ -252,7 +252,7 @@ /** * A preprocessor macro that is only defined if compiling for OpenBSD. * - * \since This macro is available since SDL 3.1.3. + * \since This macro is available since SDL 3.2.0. */ #define SDL_PLATFORM_OPENBSD 1 #endif @@ -262,7 +262,7 @@ /** * A preprocessor macro that is only defined if compiling for OS/2. * - * \since This macro is available since SDL 3.1.3. + * \since This macro is available since SDL 3.2.0. */ #define SDL_PLATFORM_OS2 1 #endif @@ -272,7 +272,7 @@ /** * A preprocessor macro that is only defined if compiling for Tru64 (OSF/1). * - * \since This macro is available since SDL 3.1.3. + * \since This macro is available since SDL 3.2.0. */ #define SDL_PLATFORM_OSF 1 #endif @@ -282,7 +282,7 @@ /** * A preprocessor macro that is only defined if compiling for QNX Neutrino. * - * \since This macro is available since SDL 3.1.3. + * \since This macro is available since SDL 3.2.0. */ #define SDL_PLATFORM_QNXNTO 1 #endif @@ -292,7 +292,7 @@ /** * A preprocessor macro that is only defined if compiling for RISC OS. * - * \since This macro is available since SDL 3.1.3. + * \since This macro is available since SDL 3.2.0. */ #define SDL_PLATFORM_RISCOS 1 #endif @@ -302,7 +302,7 @@ /** * A preprocessor macro that is only defined if compiling for SunOS/Solaris. * - * \since This macro is available since SDL 3.1.3. + * \since This macro is available since SDL 3.2.0. */ #define SDL_PLATFORM_SOLARIS 1 #endif @@ -312,7 +312,7 @@ /** * A preprocessor macro that is only defined if compiling for Cygwin. * - * \since This macro is available since SDL 3.1.3. + * \since This macro is available since SDL 3.2.0. */ #define SDL_PLATFORM_CYGWIN 1 #endif @@ -325,7 +325,7 @@ * This also covers several other platforms, like Microsoft GDK, Xbox, WinRT, * etc. Each will have their own more-specific platform macros, too. * - * \since This macro is available since SDL 3.1.3. + * \since This macro is available since SDL 3.2.0. * * \sa SDL_PLATFORM_WIN32 * \sa SDL_PLATFORM_XBOXONE @@ -362,7 +362,7 @@ /** * A preprocessor macro that defined to 1 if compiling for Windows Phone. * - * \since This macro is available since SDL 3.1.3. + * \since This macro is available since SDL 3.2.0. */ #define SDL_WINAPI_FAMILY_PHONE (WINAPI_FAMILY == WINAPI_FAMILY_PHONE_APP) @@ -381,7 +381,7 @@ * A preprocessor macro that is only defined if compiling for Microsoft GDK * for Windows. * - * \since This macro is available since SDL 3.1.3. + * \since This macro is available since SDL 3.2.0. */ #define SDL_PLATFORM_WINGDK 1 @@ -390,7 +390,7 @@ /** * A preprocessor macro that is only defined if compiling for Xbox One. * - * \since This macro is available since SDL 3.1.3. + * \since This macro is available since SDL 3.2.0. */ #define SDL_PLATFORM_XBOXONE 1 @@ -399,7 +399,7 @@ /** * A preprocessor macro that is only defined if compiling for Xbox Series. * - * \since This macro is available since SDL 3.1.3. + * \since This macro is available since SDL 3.2.0. */ #define SDL_PLATFORM_XBOXSERIES 1 @@ -412,7 +412,7 @@ * convention, its system layer tends to still be referred to as "the Win32 * API." * - * \since This macro is available since SDL 3.1.3. + * \since This macro is available since SDL 3.2.0. */ #define SDL_PLATFORM_WIN32 1 @@ -427,7 +427,7 @@ * A preprocessor macro that is only defined if compiling for Microsoft GDK on * any platform. * - * \since This macro is available since SDL 3.1.3. + * \since This macro is available since SDL 3.2.0. */ #define SDL_PLATFORM_GDK 1 #endif @@ -437,7 +437,7 @@ /** * A preprocessor macro that is only defined if compiling for Sony PSP. * - * \since This macro is available since SDL 3.1.3. + * \since This macro is available since SDL 3.2.0. */ #define SDL_PLATFORM_PSP 1 #endif @@ -448,7 +448,7 @@ * A preprocessor macro that is only defined if compiling for Sony PlayStation * 2. * - * \since This macro is available since SDL 3.1.3. + * \since This macro is available since SDL 3.2.0. */ #define SDL_PLATFORM_PS2 1 #endif @@ -458,7 +458,7 @@ /** * A preprocessor macro that is only defined if compiling for Sony Vita. * - * \since This macro is available since SDL 3.1.3. + * \since This macro is available since SDL 3.2.0. */ #define SDL_PLATFORM_VITA 1 #endif @@ -468,7 +468,7 @@ /** * A preprocessor macro that is only defined if compiling for Nintendo 3DS. * - * \since This macro is available since SDL 3.1.3. + * \since This macro is available since SDL 3.2.0. */ #define SDL_PLATFORM_3DS 1 diff --git a/include/SDL3/SDL_power.h b/include/SDL3/SDL_power.h index 1df471b9f8e80..6f265ca326961 100644 --- a/include/SDL3/SDL_power.h +++ b/include/SDL3/SDL_power.h @@ -51,7 +51,7 @@ extern "C" { * * These are results returned by SDL_GetPowerInfo(). * - * \since This enum is available since SDL 3.1.3 + * \since This enum is available since SDL 3.2.0 */ typedef enum SDL_PowerState { @@ -89,7 +89,7 @@ typedef enum SDL_PowerState * \returns the current battery state or `SDL_POWERSTATE_ERROR` on failure; * call SDL_GetError() for more information. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. */ extern SDL_DECLSPEC SDL_PowerState SDLCALL SDL_GetPowerInfo(int *seconds, int *percent); diff --git a/include/SDL3/SDL_process.h b/include/SDL3/SDL_process.h index e237723eed3ee..2cc77395bc687 100644 --- a/include/SDL3/SDL_process.h +++ b/include/SDL3/SDL_process.h @@ -57,7 +57,7 @@ extern "C" { /** * An opaque handle representing a system process. * - * \since This datatype is available since SDL 3.1.3. + * \since This datatype is available since SDL 3.2.0. * * \sa SDL_CreateProcess */ @@ -92,7 +92,7 @@ typedef struct SDL_Process SDL_Process; * * \threadsafety It is safe to call this function from any thread. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_CreateProcessWithProperties * \sa SDL_GetProcessProperties @@ -139,7 +139,7 @@ extern SDL_DECLSPEC SDL_Process *SDLCALL SDL_CreateProcess(const char * const *a * `SDL_PROP_IOSTREAM_FILE_DESCRIPTOR_NUMBER` set. This is true for streams * representing files and process I/O. * - * \since This enum is available since SDL 3.1.3. + * \since This enum is available since SDL 3.2.0. * * \sa SDL_CreateProcessWithProperties * \sa SDL_GetProcessProperties @@ -204,7 +204,7 @@ typedef enum SDL_ProcessIO * * \threadsafety It is safe to call this function from any thread. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_CreateProcess * \sa SDL_GetProcessProperties @@ -252,7 +252,7 @@ extern SDL_DECLSPEC SDL_Process *SDLCALL SDL_CreateProcessWithProperties(SDL_Pro * * \threadsafety It is safe to call this function from any thread. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_CreateProcess * \sa SDL_CreateProcessWithProperties @@ -288,7 +288,7 @@ extern SDL_DECLSPEC SDL_PropertiesID SDLCALL SDL_GetProcessProperties(SDL_Proces * * \threadsafety This function is not thread safe. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_CreateProcess * \sa SDL_CreateProcessWithProperties @@ -314,7 +314,7 @@ extern SDL_DECLSPEC void * SDLCALL SDL_ReadProcess(SDL_Process *process, size_t * * \threadsafety It is safe to call this function from any thread. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_CreateProcess * \sa SDL_CreateProcessWithProperties @@ -338,7 +338,7 @@ extern SDL_DECLSPEC SDL_IOStream *SDLCALL SDL_GetProcessInput(SDL_Process *proce * * \threadsafety It is safe to call this function from any thread. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_CreateProcess * \sa SDL_CreateProcessWithProperties @@ -360,7 +360,7 @@ extern SDL_DECLSPEC SDL_IOStream *SDLCALL SDL_GetProcessOutput(SDL_Process *proc * * \threadsafety This function is not thread safe. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_CreateProcess * \sa SDL_CreateProcessWithProperties @@ -393,7 +393,7 @@ extern SDL_DECLSPEC bool SDLCALL SDL_KillProcess(SDL_Process *process, bool forc * * \threadsafety This function is not thread safe. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_CreateProcess * \sa SDL_CreateProcessWithProperties @@ -413,7 +413,7 @@ extern SDL_DECLSPEC bool SDLCALL SDL_WaitProcess(SDL_Process *process, bool bloc * * \threadsafety This function is not thread safe. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_CreateProcess * \sa SDL_CreateProcessWithProperties diff --git a/include/SDL3/SDL_properties.h b/include/SDL3/SDL_properties.h index 7b3d570fe3bc4..1f47d5f4ad838 100644 --- a/include/SDL3/SDL_properties.h +++ b/include/SDL3/SDL_properties.h @@ -61,14 +61,14 @@ extern "C" { /** * SDL properties ID * - * \since This datatype is available since SDL 3.1.3. + * \since This datatype is available since SDL 3.2.0. */ typedef Uint32 SDL_PropertiesID; /** * SDL property type * - * \since This enum is available since SDL 3.1.3. + * \since This enum is available since SDL 3.2.0. */ typedef enum SDL_PropertyType { @@ -86,7 +86,7 @@ typedef enum SDL_PropertyType * \returns a valid property ID on success or 0 on failure; call * SDL_GetError() for more information. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. */ extern SDL_DECLSPEC SDL_PropertiesID SDLCALL SDL_GetGlobalProperties(void); @@ -100,7 +100,7 @@ extern SDL_DECLSPEC SDL_PropertiesID SDLCALL SDL_GetGlobalProperties(void); * * \threadsafety It is safe to call this function from any thread. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_DestroyProperties */ @@ -121,7 +121,7 @@ extern SDL_DECLSPEC SDL_PropertiesID SDLCALL SDL_CreateProperties(void); * * \threadsafety It is safe to call this function from any thread. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. */ extern SDL_DECLSPEC bool SDLCALL SDL_CopyProperties(SDL_PropertiesID src, SDL_PropertiesID dst); @@ -143,7 +143,7 @@ extern SDL_DECLSPEC bool SDLCALL SDL_CopyProperties(SDL_PropertiesID src, SDL_Pr * * \threadsafety It is safe to call this function from any thread. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_UnlockProperties */ @@ -156,7 +156,7 @@ extern SDL_DECLSPEC bool SDLCALL SDL_LockProperties(SDL_PropertiesID props); * * \threadsafety It is safe to call this function from any thread. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_LockProperties */ @@ -180,7 +180,7 @@ extern SDL_DECLSPEC void SDLCALL SDL_UnlockProperties(SDL_PropertiesID props); * \threadsafety This callback may fire without any locks held; if this is a * concern, the app should provide its own locking. * - * \since This datatype is available since SDL 3.1.3. + * \since This datatype is available since SDL 3.2.0. * * \sa SDL_SetPointerPropertyWithCleanup */ @@ -209,7 +209,7 @@ typedef void (SDLCALL *SDL_CleanupPropertyCallback)(void *userdata, void *value) * * \threadsafety It is safe to call this function from any thread. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_GetPointerProperty * \sa SDL_SetPointerProperty @@ -228,7 +228,7 @@ extern SDL_DECLSPEC bool SDLCALL SDL_SetPointerPropertyWithCleanup(SDL_Propertie * * \threadsafety It is safe to call this function from any thread. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_GetPointerProperty * \sa SDL_HasProperty @@ -254,7 +254,7 @@ extern SDL_DECLSPEC bool SDLCALL SDL_SetPointerProperty(SDL_PropertiesID props, * * \threadsafety It is safe to call this function from any thread. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_GetStringProperty */ @@ -271,7 +271,7 @@ extern SDL_DECLSPEC bool SDLCALL SDL_SetStringProperty(SDL_PropertiesID props, c * * \threadsafety It is safe to call this function from any thread. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_GetNumberProperty */ @@ -288,7 +288,7 @@ extern SDL_DECLSPEC bool SDLCALL SDL_SetNumberProperty(SDL_PropertiesID props, c * * \threadsafety It is safe to call this function from any thread. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_GetFloatProperty */ @@ -305,7 +305,7 @@ extern SDL_DECLSPEC bool SDLCALL SDL_SetFloatProperty(SDL_PropertiesID props, co * * \threadsafety It is safe to call this function from any thread. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_GetBooleanProperty */ @@ -320,7 +320,7 @@ extern SDL_DECLSPEC bool SDLCALL SDL_SetBooleanProperty(SDL_PropertiesID props, * * \threadsafety It is safe to call this function from any thread. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_GetPropertyType */ @@ -336,7 +336,7 @@ extern SDL_DECLSPEC bool SDLCALL SDL_HasProperty(SDL_PropertiesID props, const c * * \threadsafety It is safe to call this function from any thread. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_HasProperty */ @@ -363,7 +363,7 @@ extern SDL_DECLSPEC SDL_PropertyType SDLCALL SDL_GetPropertyType(SDL_PropertiesI * If you need to avoid this, use SDL_LockProperties() and * SDL_UnlockProperties(). * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_GetBooleanProperty * \sa SDL_GetFloatProperty @@ -391,7 +391,7 @@ extern SDL_DECLSPEC void * SDLCALL SDL_GetPointerProperty(SDL_PropertiesID props * If you need to avoid this, use SDL_LockProperties() and * SDL_UnlockProperties(). * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_GetPropertyType * \sa SDL_HasProperty @@ -413,7 +413,7 @@ extern SDL_DECLSPEC const char * SDLCALL SDL_GetStringProperty(SDL_PropertiesID * * \threadsafety It is safe to call this function from any thread. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_GetPropertyType * \sa SDL_HasProperty @@ -435,7 +435,7 @@ extern SDL_DECLSPEC Sint64 SDLCALL SDL_GetNumberProperty(SDL_PropertiesID props, * * \threadsafety It is safe to call this function from any thread. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_GetPropertyType * \sa SDL_HasProperty @@ -457,7 +457,7 @@ extern SDL_DECLSPEC float SDLCALL SDL_GetFloatProperty(SDL_PropertiesID props, c * * \threadsafety It is safe to call this function from any thread. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_GetPropertyType * \sa SDL_HasProperty @@ -475,7 +475,7 @@ extern SDL_DECLSPEC bool SDLCALL SDL_GetBooleanProperty(SDL_PropertiesID props, * * \threadsafety It is safe to call this function from any thread. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. */ extern SDL_DECLSPEC bool SDLCALL SDL_ClearProperty(SDL_PropertiesID props, const char *name); @@ -492,7 +492,7 @@ extern SDL_DECLSPEC bool SDLCALL SDL_ClearProperty(SDL_PropertiesID props, const * \threadsafety SDL_EnumerateProperties holds a lock on `props` during this * callback. * - * \since This datatype is available since SDL 3.1.3. + * \since This datatype is available since SDL 3.2.0. * * \sa SDL_EnumerateProperties */ @@ -512,7 +512,7 @@ typedef void (SDLCALL *SDL_EnumeratePropertiesCallback)(void *userdata, SDL_Prop * * \threadsafety It is safe to call this function from any thread. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. */ extern SDL_DECLSPEC bool SDLCALL SDL_EnumerateProperties(SDL_PropertiesID props, SDL_EnumeratePropertiesCallback callback, void *userdata); @@ -528,7 +528,7 @@ extern SDL_DECLSPEC bool SDLCALL SDL_EnumerateProperties(SDL_PropertiesID props, * locked or other threads might be setting or getting values * from these properties. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_CreateProperties */ diff --git a/include/SDL3/SDL_rect.h b/include/SDL3/SDL_rect.h index a9a8c158d47e3..8998de6f45fe3 100644 --- a/include/SDL3/SDL_rect.h +++ b/include/SDL3/SDL_rect.h @@ -41,7 +41,7 @@ extern "C" { /** * The structure that defines a point (using integers). * - * \since This struct is available since SDL 3.1.3. + * \since This struct is available since SDL 3.2.0. * * \sa SDL_GetRectEnclosingPoints * \sa SDL_PointInRect @@ -55,7 +55,7 @@ typedef struct SDL_Point /** * The structure that defines a point (using floating point values). * - * \since This struct is available since SDL 3.1.3. + * \since This struct is available since SDL 3.2.0. * * \sa SDL_GetRectEnclosingPointsFloat * \sa SDL_PointInRectFloat @@ -70,7 +70,7 @@ typedef struct SDL_FPoint /** * A rectangle, with the origin at the upper left (using integers). * - * \since This struct is available since SDL 3.1.3. + * \since This struct is available since SDL 3.2.0. * * \sa SDL_RectEmpty * \sa SDL_RectsEqual @@ -91,7 +91,7 @@ typedef struct SDL_Rect * A rectangle, with the origin at the upper left (using floating point * values). * - * \since This struct is available since SDL 3.1.3. + * \since This struct is available since SDL 3.2.0. * * \sa SDL_RectEmptyFloat * \sa SDL_RectsEqualFloat @@ -121,7 +121,7 @@ typedef struct SDL_FRect * * \threadsafety It is safe to call this function from any thread. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. */ SDL_FORCE_INLINE void SDL_RectToFRect(const SDL_Rect *rect, SDL_FRect *frect) { @@ -150,7 +150,7 @@ SDL_FORCE_INLINE void SDL_RectToFRect(const SDL_Rect *rect, SDL_FRect *frect) * * \threadsafety It is safe to call this function from any thread. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. */ SDL_FORCE_INLINE bool SDL_PointInRect(const SDL_Point *p, const SDL_Rect *r) { @@ -174,7 +174,7 @@ SDL_FORCE_INLINE bool SDL_PointInRect(const SDL_Point *p, const SDL_Rect *r) * * \threadsafety It is safe to call this function from any thread. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. */ SDL_FORCE_INLINE bool SDL_RectEmpty(const SDL_Rect *r) { @@ -198,7 +198,7 @@ SDL_FORCE_INLINE bool SDL_RectEmpty(const SDL_Rect *r) * * \threadsafety It is safe to call this function from any thread. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. */ SDL_FORCE_INLINE bool SDL_RectsEqual(const SDL_Rect *a, const SDL_Rect *b) { @@ -217,7 +217,7 @@ SDL_FORCE_INLINE bool SDL_RectsEqual(const SDL_Rect *a, const SDL_Rect *b) * * \threadsafety It is safe to call this function from any thread. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_GetRectIntersection */ @@ -234,7 +234,7 @@ extern SDL_DECLSPEC bool SDLCALL SDL_HasRectIntersection(const SDL_Rect *A, cons * rectangles `A` and `B`. * \returns true if there is an intersection, false otherwise. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_HasRectIntersection */ @@ -250,7 +250,7 @@ extern SDL_DECLSPEC bool SDLCALL SDL_GetRectIntersection(const SDL_Rect *A, cons * \returns true on success or false on failure; call SDL_GetError() for more * information. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. */ extern SDL_DECLSPEC bool SDLCALL SDL_GetRectUnion(const SDL_Rect *A, const SDL_Rect *B, SDL_Rect *result); @@ -269,7 +269,7 @@ extern SDL_DECLSPEC bool SDLCALL SDL_GetRectUnion(const SDL_Rect *A, const SDL_R * \returns true if any points were enclosed or false if all the points were * outside of the clipping rectangle. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. */ extern SDL_DECLSPEC bool SDLCALL SDL_GetRectEnclosingPoints(const SDL_Point *points, int count, const SDL_Rect *clip, SDL_Rect *result); @@ -289,7 +289,7 @@ extern SDL_DECLSPEC bool SDLCALL SDL_GetRectEnclosingPoints(const SDL_Point *poi * \param Y2 a pointer to the ending Y-coordinate of the line. * \returns true if there is an intersection, false otherwise. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. */ extern SDL_DECLSPEC bool SDLCALL SDL_GetRectAndLineIntersection(const SDL_Rect *rect, int *X1, int *Y1, int *X2, int *Y2); @@ -315,7 +315,7 @@ extern SDL_DECLSPEC bool SDLCALL SDL_GetRectAndLineIntersection(const SDL_Rect * * * \threadsafety It is safe to call this function from any thread. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. */ SDL_FORCE_INLINE bool SDL_PointInRectFloat(const SDL_FPoint *p, const SDL_FRect *r) { @@ -339,7 +339,7 @@ SDL_FORCE_INLINE bool SDL_PointInRectFloat(const SDL_FPoint *p, const SDL_FRect * * \threadsafety It is safe to call this function from any thread. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. */ SDL_FORCE_INLINE bool SDL_RectEmptyFloat(const SDL_FRect *r) { @@ -367,7 +367,7 @@ SDL_FORCE_INLINE bool SDL_RectEmptyFloat(const SDL_FRect *r) * * \threadsafety It is safe to call this function from any thread. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_RectsEqualFloat */ @@ -402,7 +402,7 @@ SDL_FORCE_INLINE bool SDL_RectsEqualEpsilon(const SDL_FRect *a, const SDL_FRect * * \threadsafety It is safe to call this function from any thread. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_RectsEqualEpsilon */ @@ -420,7 +420,7 @@ SDL_FORCE_INLINE bool SDL_RectsEqualFloat(const SDL_FRect *a, const SDL_FRect *b * \param B an SDL_FRect structure representing the second rectangle. * \returns true if there is an intersection, false otherwise. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_GetRectIntersection */ @@ -437,7 +437,7 @@ extern SDL_DECLSPEC bool SDLCALL SDL_HasRectIntersectionFloat(const SDL_FRect *A * rectangles `A` and `B`. * \returns true if there is an intersection, false otherwise. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_HasRectIntersectionFloat */ @@ -453,7 +453,7 @@ extern SDL_DECLSPEC bool SDLCALL SDL_GetRectIntersectionFloat(const SDL_FRect *A * \returns true on success or false on failure; call SDL_GetError() for more * information. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. */ extern SDL_DECLSPEC bool SDLCALL SDL_GetRectUnionFloat(const SDL_FRect *A, const SDL_FRect *B, SDL_FRect *result); @@ -473,7 +473,7 @@ extern SDL_DECLSPEC bool SDLCALL SDL_GetRectUnionFloat(const SDL_FRect *A, const * \returns true if any points were enclosed or false if all the points were * outside of the clipping rectangle. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. */ extern SDL_DECLSPEC bool SDLCALL SDL_GetRectEnclosingPointsFloat(const SDL_FPoint *points, int count, const SDL_FRect *clip, SDL_FRect *result); @@ -494,7 +494,7 @@ extern SDL_DECLSPEC bool SDLCALL SDL_GetRectEnclosingPointsFloat(const SDL_FPoin * \param Y2 a pointer to the ending Y-coordinate of the line. * \returns true if there is an intersection, false otherwise. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. */ extern SDL_DECLSPEC bool SDLCALL SDL_GetRectAndLineIntersectionFloat(const SDL_FRect *rect, float *X1, float *Y1, float *X2, float *Y2); diff --git a/include/SDL3/SDL_render.h b/include/SDL3/SDL_render.h index 5cd37654ed759..891e9945240a5 100644 --- a/include/SDL3/SDL_render.h +++ b/include/SDL3/SDL_render.h @@ -69,14 +69,14 @@ extern "C" { /** * The name of the software renderer. * - * \since This macro is available since SDL 3.1.3. + * \since This macro is available since SDL 3.2.0. */ #define SDL_SOFTWARE_RENDERER "software" /** * Vertex structure. * - * \since This struct is available since SDL 3.1.3. + * \since This struct is available since SDL 3.2.0. */ typedef struct SDL_Vertex { @@ -88,7 +88,7 @@ typedef struct SDL_Vertex /** * The access pattern allowed for a texture. * - * \since This enum is available since SDL 3.1.3. + * \since This enum is available since SDL 3.2.0. */ typedef enum SDL_TextureAccess { @@ -100,7 +100,7 @@ typedef enum SDL_TextureAccess /** * How the logical size is mapped to the output. * - * \since This enum is available since SDL 3.1.3. + * \since This enum is available since SDL 3.2.0. */ typedef enum SDL_RendererLogicalPresentation { @@ -114,7 +114,7 @@ typedef enum SDL_RendererLogicalPresentation /** * A structure representing rendering state * - * \since This struct is available since SDL 3.1.3. + * \since This struct is available since SDL 3.2.0. */ typedef struct SDL_Renderer SDL_Renderer; @@ -123,7 +123,7 @@ typedef struct SDL_Renderer SDL_Renderer; /** * An efficient driver-specific representation of pixel data * - * \since This struct is available since SDL 3.1.3. + * \since This struct is available since SDL 3.2.0. * * \sa SDL_CreateTexture * \sa SDL_CreateTextureFromSurface @@ -157,7 +157,7 @@ typedef struct SDL_Texture SDL_Texture; * * \threadsafety It is safe to call this function from any thread. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_CreateRenderer * \sa SDL_GetRenderDriver @@ -182,7 +182,7 @@ extern SDL_DECLSPEC int SDLCALL SDL_GetNumRenderDrivers(void); * * \threadsafety It is safe to call this function from any thread. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_GetNumRenderDrivers */ @@ -203,7 +203,7 @@ extern SDL_DECLSPEC const char * SDLCALL SDL_GetRenderDriver(int index); * * \threadsafety This function should only be called on the main thread. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_CreateRenderer * \sa SDL_CreateWindow @@ -234,7 +234,7 @@ extern SDL_DECLSPEC bool SDLCALL SDL_CreateWindowAndRenderer(const char *title, * * \threadsafety This function should only be called on the main thread. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_CreateRendererWithProperties * \sa SDL_CreateSoftwareRenderer @@ -288,7 +288,7 @@ extern SDL_DECLSPEC SDL_Renderer * SDLCALL SDL_CreateRenderer(SDL_Window *window * * \threadsafety This function should only be called on the main thread. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_CreateProperties * \sa SDL_CreateRenderer @@ -325,7 +325,7 @@ extern SDL_DECLSPEC SDL_Renderer * SDLCALL SDL_CreateRendererWithProperties(SDL_ * * \threadsafety This function should only be called on the main thread. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_DestroyRenderer */ @@ -340,7 +340,7 @@ extern SDL_DECLSPEC SDL_Renderer * SDLCALL SDL_CreateSoftwareRenderer(SDL_Surfac * * \threadsafety It is safe to call this function from any thread. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. */ extern SDL_DECLSPEC SDL_Renderer * SDLCALL SDL_GetRenderer(SDL_Window *window); @@ -353,7 +353,7 @@ extern SDL_DECLSPEC SDL_Renderer * SDLCALL SDL_GetRenderer(SDL_Window *window); * * \threadsafety It is safe to call this function from any thread. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. */ extern SDL_DECLSPEC SDL_Window * SDLCALL SDL_GetRenderWindow(SDL_Renderer *renderer); @@ -366,7 +366,7 @@ extern SDL_DECLSPEC SDL_Window * SDLCALL SDL_GetRenderWindow(SDL_Renderer *rende * * \threadsafety It is safe to call this function from any thread. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_CreateRenderer * \sa SDL_CreateRendererWithProperties @@ -455,7 +455,7 @@ extern SDL_DECLSPEC const char * SDLCALL SDL_GetRendererName(SDL_Renderer *rende * * \threadsafety It is safe to call this function from any thread. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. */ extern SDL_DECLSPEC SDL_PropertiesID SDLCALL SDL_GetRendererProperties(SDL_Renderer *renderer); @@ -498,7 +498,7 @@ extern SDL_DECLSPEC SDL_PropertiesID SDLCALL SDL_GetRendererProperties(SDL_Rende * * \threadsafety This function should only be called on the main thread. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_GetCurrentRenderOutputSize */ @@ -520,7 +520,7 @@ extern SDL_DECLSPEC bool SDLCALL SDL_GetRenderOutputSize(SDL_Renderer *renderer, * * \threadsafety This function should only be called on the main thread. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_GetRenderOutputSize */ @@ -541,7 +541,7 @@ extern SDL_DECLSPEC bool SDLCALL SDL_GetCurrentRenderOutputSize(SDL_Renderer *re * * \threadsafety This function should only be called on the main thread. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_CreateTextureFromSurface * \sa SDL_CreateTextureWithProperties @@ -571,7 +571,7 @@ extern SDL_DECLSPEC SDL_Texture * SDLCALL SDL_CreateTexture(SDL_Renderer *render * * \threadsafety This function should only be called on the main thread. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_CreateTexture * \sa SDL_CreateTextureWithProperties @@ -680,7 +680,7 @@ extern SDL_DECLSPEC SDL_Texture * SDLCALL SDL_CreateTextureFromSurface(SDL_Rende * * \threadsafety This function should only be called on the main thread. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_CreateProperties * \sa SDL_CreateTexture @@ -799,7 +799,7 @@ extern SDL_DECLSPEC SDL_Texture * SDLCALL SDL_CreateTextureWithProperties(SDL_Re * * \threadsafety It is safe to call this function from any thread. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. */ extern SDL_DECLSPEC SDL_PropertiesID SDLCALL SDL_GetTextureProperties(SDL_Texture *texture); @@ -839,7 +839,7 @@ extern SDL_DECLSPEC SDL_PropertiesID SDLCALL SDL_GetTextureProperties(SDL_Textur * * \threadsafety It is safe to call this function from any thread. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. */ extern SDL_DECLSPEC SDL_Renderer * SDLCALL SDL_GetRendererFromTexture(SDL_Texture *texture); @@ -856,7 +856,7 @@ extern SDL_DECLSPEC SDL_Renderer * SDLCALL SDL_GetRendererFromTexture(SDL_Textur * * \threadsafety This function should only be called on the main thread. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. */ extern SDL_DECLSPEC bool SDLCALL SDL_GetTextureSize(SDL_Texture *texture, float *w, float *h); @@ -881,7 +881,7 @@ extern SDL_DECLSPEC bool SDLCALL SDL_GetTextureSize(SDL_Texture *texture, float * * \threadsafety This function should only be called on the main thread. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_GetTextureColorMod * \sa SDL_SetTextureAlphaMod @@ -911,7 +911,7 @@ extern SDL_DECLSPEC bool SDLCALL SDL_SetTextureColorMod(SDL_Texture *texture, Ui * * \threadsafety This function should only be called on the main thread. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_GetTextureColorModFloat * \sa SDL_SetTextureAlphaModFloat @@ -932,7 +932,7 @@ extern SDL_DECLSPEC bool SDLCALL SDL_SetTextureColorModFloat(SDL_Texture *textur * * \threadsafety This function should only be called on the main thread. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_GetTextureAlphaMod * \sa SDL_GetTextureColorModFloat @@ -952,7 +952,7 @@ extern SDL_DECLSPEC bool SDLCALL SDL_GetTextureColorMod(SDL_Texture *texture, Ui * * \threadsafety This function should only be called on the main thread. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_GetTextureAlphaModFloat * \sa SDL_GetTextureColorMod @@ -978,7 +978,7 @@ extern SDL_DECLSPEC bool SDLCALL SDL_GetTextureColorModFloat(SDL_Texture *textur * * \threadsafety This function should only be called on the main thread. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_GetTextureAlphaMod * \sa SDL_SetTextureAlphaModFloat @@ -1004,7 +1004,7 @@ extern SDL_DECLSPEC bool SDLCALL SDL_SetTextureAlphaMod(SDL_Texture *texture, Ui * * \threadsafety This function should only be called on the main thread. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_GetTextureAlphaModFloat * \sa SDL_SetTextureAlphaMod @@ -1022,7 +1022,7 @@ extern SDL_DECLSPEC bool SDLCALL SDL_SetTextureAlphaModFloat(SDL_Texture *textur * * \threadsafety This function should only be called on the main thread. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_GetTextureAlphaModFloat * \sa SDL_GetTextureColorMod @@ -1040,7 +1040,7 @@ extern SDL_DECLSPEC bool SDLCALL SDL_GetTextureAlphaMod(SDL_Texture *texture, Ui * * \threadsafety This function should only be called on the main thread. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_GetTextureAlphaMod * \sa SDL_GetTextureColorModFloat @@ -1061,7 +1061,7 @@ extern SDL_DECLSPEC bool SDLCALL SDL_GetTextureAlphaModFloat(SDL_Texture *textur * * \threadsafety This function should only be called on the main thread. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_GetTextureBlendMode */ @@ -1077,7 +1077,7 @@ extern SDL_DECLSPEC bool SDLCALL SDL_SetTextureBlendMode(SDL_Texture *texture, S * * \threadsafety This function should only be called on the main thread. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_SetTextureBlendMode */ @@ -1097,7 +1097,7 @@ extern SDL_DECLSPEC bool SDLCALL SDL_GetTextureBlendMode(SDL_Texture *texture, S * * \threadsafety This function should only be called on the main thread. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_GetTextureScaleMode */ @@ -1113,7 +1113,7 @@ extern SDL_DECLSPEC bool SDLCALL SDL_SetTextureScaleMode(SDL_Texture *texture, S * * \threadsafety This function should only be called on the main thread. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_SetTextureScaleMode */ @@ -1144,7 +1144,7 @@ extern SDL_DECLSPEC bool SDLCALL SDL_GetTextureScaleMode(SDL_Texture *texture, S * * \threadsafety This function should only be called on the main thread. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_LockTexture * \sa SDL_UnlockTexture @@ -1178,7 +1178,7 @@ extern SDL_DECLSPEC bool SDLCALL SDL_UpdateTexture(SDL_Texture *texture, const S * * \threadsafety This function should only be called on the main thread. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_UpdateNVTexture * \sa SDL_UpdateTexture @@ -1210,7 +1210,7 @@ extern SDL_DECLSPEC bool SDLCALL SDL_UpdateYUVTexture(SDL_Texture *texture, * * \threadsafety This function should only be called on the main thread. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_UpdateTexture * \sa SDL_UpdateYUVTexture @@ -1245,7 +1245,7 @@ extern SDL_DECLSPEC bool SDLCALL SDL_UpdateNVTexture(SDL_Texture *texture, * * \threadsafety This function should only be called on the main thread. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_LockTextureToSurface * \sa SDL_UnlockTexture @@ -1283,7 +1283,7 @@ extern SDL_DECLSPEC bool SDLCALL SDL_LockTexture(SDL_Texture *texture, * * \threadsafety This function should only be called on the main thread. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_LockTexture * \sa SDL_UnlockTexture @@ -1305,7 +1305,7 @@ extern SDL_DECLSPEC bool SDLCALL SDL_LockTextureToSurface(SDL_Texture *texture, * * \threadsafety This function should only be called on the main thread. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_LockTexture */ @@ -1327,7 +1327,7 @@ extern SDL_DECLSPEC void SDLCALL SDL_UnlockTexture(SDL_Texture *texture); * * \threadsafety This function should only be called on the main thread. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_GetRenderTarget */ @@ -1344,7 +1344,7 @@ extern SDL_DECLSPEC bool SDLCALL SDL_SetRenderTarget(SDL_Renderer *renderer, SDL * * \threadsafety This function should only be called on the main thread. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_SetRenderTarget */ @@ -1383,7 +1383,7 @@ extern SDL_DECLSPEC SDL_Texture * SDLCALL SDL_GetRenderTarget(SDL_Renderer *rend * * \threadsafety This function should only be called on the main thread. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_ConvertEventToRenderCoordinates * \sa SDL_GetRenderLogicalPresentation @@ -1406,7 +1406,7 @@ extern SDL_DECLSPEC bool SDLCALL SDL_SetRenderLogicalPresentation(SDL_Renderer * * * \threadsafety This function should only be called on the main thread. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_SetRenderLogicalPresentation */ @@ -1428,7 +1428,7 @@ extern SDL_DECLSPEC bool SDLCALL SDL_GetRenderLogicalPresentation(SDL_Renderer * * * \threadsafety This function should only be called on the main thread. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_SetRenderLogicalPresentation */ @@ -1454,7 +1454,7 @@ extern SDL_DECLSPEC bool SDLCALL SDL_GetRenderLogicalPresentationRect(SDL_Render * * \threadsafety This function should only be called on the main thread. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_SetRenderLogicalPresentation * \sa SDL_SetRenderScale @@ -1483,7 +1483,7 @@ extern SDL_DECLSPEC bool SDLCALL SDL_RenderCoordinatesFromWindow(SDL_Renderer *r * * \threadsafety This function should only be called on the main thread. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_SetRenderLogicalPresentation * \sa SDL_SetRenderScale @@ -1521,7 +1521,7 @@ extern SDL_DECLSPEC bool SDLCALL SDL_RenderCoordinatesToWindow(SDL_Renderer *ren * * \threadsafety This function should only be called on the main thread. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_RenderCoordinatesFromWindow */ @@ -1544,7 +1544,7 @@ extern SDL_DECLSPEC bool SDLCALL SDL_ConvertEventToRenderCoordinates(SDL_Rendere * * \threadsafety This function should only be called on the main thread. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_GetRenderViewport * \sa SDL_RenderViewportSet @@ -1561,7 +1561,7 @@ extern SDL_DECLSPEC bool SDLCALL SDL_SetRenderViewport(SDL_Renderer *renderer, c * * \threadsafety This function should only be called on the main thread. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_RenderViewportSet * \sa SDL_SetRenderViewport @@ -1581,7 +1581,7 @@ extern SDL_DECLSPEC bool SDLCALL SDL_GetRenderViewport(SDL_Renderer *renderer, S * * \threadsafety This function should only be called on the main thread. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_GetRenderViewport * \sa SDL_SetRenderViewport @@ -1606,7 +1606,7 @@ extern SDL_DECLSPEC bool SDLCALL SDL_RenderViewportSet(SDL_Renderer *renderer); * * \threadsafety This function should only be called on the main thread. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. */ extern SDL_DECLSPEC bool SDLCALL SDL_GetRenderSafeArea(SDL_Renderer *renderer, SDL_Rect *rect); @@ -1621,7 +1621,7 @@ extern SDL_DECLSPEC bool SDLCALL SDL_GetRenderSafeArea(SDL_Renderer *renderer, S * * \threadsafety This function should only be called on the main thread. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_GetRenderClipRect * \sa SDL_RenderClipEnabled @@ -1639,7 +1639,7 @@ extern SDL_DECLSPEC bool SDLCALL SDL_SetRenderClipRect(SDL_Renderer *renderer, c * * \threadsafety This function should only be called on the main thread. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_RenderClipEnabled * \sa SDL_SetRenderClipRect @@ -1655,7 +1655,7 @@ extern SDL_DECLSPEC bool SDLCALL SDL_GetRenderClipRect(SDL_Renderer *renderer, S * * \threadsafety This function should only be called on the main thread. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_GetRenderClipRect * \sa SDL_SetRenderClipRect @@ -1681,7 +1681,7 @@ extern SDL_DECLSPEC bool SDLCALL SDL_RenderClipEnabled(SDL_Renderer *renderer); * * \threadsafety This function should only be called on the main thread. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_GetRenderScale */ @@ -1698,7 +1698,7 @@ extern SDL_DECLSPEC bool SDLCALL SDL_SetRenderScale(SDL_Renderer *renderer, floa * * \threadsafety This function should only be called on the main thread. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_SetRenderScale */ @@ -1722,7 +1722,7 @@ extern SDL_DECLSPEC bool SDLCALL SDL_GetRenderScale(SDL_Renderer *renderer, floa * * \threadsafety This function should only be called on the main thread. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_GetRenderDrawColor * \sa SDL_SetRenderDrawColorFloat @@ -1747,7 +1747,7 @@ extern SDL_DECLSPEC bool SDLCALL SDL_SetRenderDrawColor(SDL_Renderer *renderer, * * \threadsafety This function should only be called on the main thread. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_GetRenderDrawColorFloat * \sa SDL_SetRenderDrawColor @@ -1771,7 +1771,7 @@ extern SDL_DECLSPEC bool SDLCALL SDL_SetRenderDrawColorFloat(SDL_Renderer *rende * * \threadsafety This function should only be called on the main thread. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_GetRenderDrawColorFloat * \sa SDL_SetRenderDrawColor @@ -1795,7 +1795,7 @@ extern SDL_DECLSPEC bool SDLCALL SDL_GetRenderDrawColor(SDL_Renderer *renderer, * * \threadsafety This function should only be called on the main thread. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_SetRenderDrawColorFloat * \sa SDL_GetRenderDrawColor @@ -1820,7 +1820,7 @@ extern SDL_DECLSPEC bool SDLCALL SDL_GetRenderDrawColorFloat(SDL_Renderer *rende * * \threadsafety This function should only be called on the main thread. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_GetRenderColorScale */ @@ -1836,7 +1836,7 @@ extern SDL_DECLSPEC bool SDLCALL SDL_SetRenderColorScale(SDL_Renderer *renderer, * * \threadsafety This function should only be called on the main thread. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_SetRenderColorScale */ @@ -1854,7 +1854,7 @@ extern SDL_DECLSPEC bool SDLCALL SDL_GetRenderColorScale(SDL_Renderer *renderer, * * \threadsafety This function should only be called on the main thread. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_GetRenderDrawBlendMode */ @@ -1870,7 +1870,7 @@ extern SDL_DECLSPEC bool SDLCALL SDL_SetRenderDrawBlendMode(SDL_Renderer *render * * \threadsafety This function should only be called on the main thread. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_SetRenderDrawBlendMode */ @@ -1890,7 +1890,7 @@ extern SDL_DECLSPEC bool SDLCALL SDL_GetRenderDrawBlendMode(SDL_Renderer *render * * \threadsafety This function should only be called on the main thread. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_SetRenderDrawColor */ @@ -1907,7 +1907,7 @@ extern SDL_DECLSPEC bool SDLCALL SDL_RenderClear(SDL_Renderer *renderer); * * \threadsafety This function should only be called on the main thread. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_RenderPoints */ @@ -1924,7 +1924,7 @@ extern SDL_DECLSPEC bool SDLCALL SDL_RenderPoint(SDL_Renderer *renderer, float x * * \threadsafety This function should only be called on the main thread. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_RenderPoint */ @@ -1943,7 +1943,7 @@ extern SDL_DECLSPEC bool SDLCALL SDL_RenderPoints(SDL_Renderer *renderer, const * * \threadsafety This function should only be called on the main thread. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_RenderLines */ @@ -1961,7 +1961,7 @@ extern SDL_DECLSPEC bool SDLCALL SDL_RenderLine(SDL_Renderer *renderer, float x1 * * \threadsafety This function should only be called on the main thread. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_RenderLine */ @@ -1978,7 +1978,7 @@ extern SDL_DECLSPEC bool SDLCALL SDL_RenderLines(SDL_Renderer *renderer, const S * * \threadsafety This function should only be called on the main thread. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_RenderRects */ @@ -1996,7 +1996,7 @@ extern SDL_DECLSPEC bool SDLCALL SDL_RenderRect(SDL_Renderer *renderer, const SD * * \threadsafety This function should only be called on the main thread. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_RenderRect */ @@ -2014,7 +2014,7 @@ extern SDL_DECLSPEC bool SDLCALL SDL_RenderRects(SDL_Renderer *renderer, const S * * \threadsafety This function should only be called on the main thread. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_RenderFillRects */ @@ -2032,7 +2032,7 @@ extern SDL_DECLSPEC bool SDLCALL SDL_RenderFillRect(SDL_Renderer *renderer, cons * * \threadsafety This function should only be called on the main thread. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_RenderFillRect */ @@ -2053,7 +2053,7 @@ extern SDL_DECLSPEC bool SDLCALL SDL_RenderFillRects(SDL_Renderer *renderer, con * * \threadsafety This function should only be called on the main thread. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_RenderTextureRotated * \sa SDL_RenderTextureTiled @@ -2082,7 +2082,7 @@ extern SDL_DECLSPEC bool SDLCALL SDL_RenderTexture(SDL_Renderer *renderer, SDL_T * * \threadsafety This function should only be called on the main thread. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_RenderTexture */ @@ -2113,7 +2113,7 @@ extern SDL_DECLSPEC bool SDLCALL SDL_RenderTextureRotated(SDL_Renderer *renderer * * \threadsafety You may only call this function from the main thread. * - * \since This function is available since SDL 3.1.8. + * \since This function is available since SDL 3.2.0. * * \sa SDL_RenderTexture */ @@ -2142,7 +2142,7 @@ extern SDL_DECLSPEC bool SDLCALL SDL_RenderTextureAffine(SDL_Renderer *renderer, * * \threadsafety This function should only be called on the main thread. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_RenderTexture */ @@ -2176,7 +2176,7 @@ extern SDL_DECLSPEC bool SDLCALL SDL_RenderTextureTiled(SDL_Renderer *renderer, * * \threadsafety This function should only be called on the main thread. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_RenderTexture */ @@ -2200,7 +2200,7 @@ extern SDL_DECLSPEC bool SDLCALL SDL_RenderTexture9Grid(SDL_Renderer *renderer, * * \threadsafety This function should only be called on the main thread. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_RenderGeometryRaw */ @@ -2232,7 +2232,7 @@ extern SDL_DECLSPEC bool SDLCALL SDL_RenderGeometry(SDL_Renderer *renderer, * * \threadsafety This function should only be called on the main thread. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_RenderGeometry */ @@ -2261,7 +2261,7 @@ extern SDL_DECLSPEC bool SDLCALL SDL_RenderGeometryRaw(SDL_Renderer *renderer, * * \threadsafety This function should only be called on the main thread. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. */ extern SDL_DECLSPEC SDL_Surface * SDLCALL SDL_RenderReadPixels(SDL_Renderer *renderer, const SDL_Rect *rect); @@ -2298,7 +2298,7 @@ extern SDL_DECLSPEC SDL_Surface * SDLCALL SDL_RenderReadPixels(SDL_Renderer *ren * * \threadsafety This function should only be called on the main thread. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_CreateRenderer * \sa SDL_RenderClear @@ -2325,7 +2325,7 @@ extern SDL_DECLSPEC bool SDLCALL SDL_RenderPresent(SDL_Renderer *renderer); * * \threadsafety This function should only be called on the main thread. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_CreateTexture * \sa SDL_CreateTextureFromSurface @@ -2342,7 +2342,7 @@ extern SDL_DECLSPEC void SDLCALL SDL_DestroyTexture(SDL_Texture *texture); * * \threadsafety This function should only be called on the main thread. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_CreateRenderer */ @@ -2377,7 +2377,7 @@ extern SDL_DECLSPEC void SDLCALL SDL_DestroyRenderer(SDL_Renderer *renderer); * * \threadsafety This function should only be called on the main thread. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. */ extern SDL_DECLSPEC bool SDLCALL SDL_FlushRenderer(SDL_Renderer *renderer); @@ -2393,7 +2393,7 @@ extern SDL_DECLSPEC bool SDLCALL SDL_FlushRenderer(SDL_Renderer *renderer); * * \threadsafety This function should only be called on the main thread. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_GetRenderMetalCommandEncoder */ @@ -2416,7 +2416,7 @@ extern SDL_DECLSPEC void * SDLCALL SDL_GetRenderMetalLayer(SDL_Renderer *rendere * * \threadsafety This function should only be called on the main thread. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_GetRenderMetalLayer */ @@ -2449,7 +2449,7 @@ extern SDL_DECLSPEC void * SDLCALL SDL_GetRenderMetalCommandEncoder(SDL_Renderer * \threadsafety It is **NOT** safe to call this function from two threads at * once. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. */ extern SDL_DECLSPEC bool SDLCALL SDL_AddVulkanRenderSemaphores(SDL_Renderer *renderer, Uint32 wait_stage_mask, Sint64 wait_semaphore, Sint64 signal_semaphore); @@ -2472,7 +2472,7 @@ extern SDL_DECLSPEC bool SDLCALL SDL_AddVulkanRenderSemaphores(SDL_Renderer *ren * * \threadsafety This function should only be called on the main thread. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_GetRenderVSync */ @@ -2492,7 +2492,7 @@ extern SDL_DECLSPEC bool SDLCALL SDL_SetRenderVSync(SDL_Renderer *renderer, int * * \threadsafety This function should only be called on the main thread. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_SetRenderVSync */ @@ -2543,7 +2543,7 @@ extern SDL_DECLSPEC bool SDLCALL SDL_GetRenderVSync(SDL_Renderer *renderer, int * * \threadsafety This function should only be called on the main thread. * - * \since This function is available since SDL 3.1.6. + * \since This function is available since SDL 3.2.0. * * \sa SDL_RenderDebugTextFormat * \sa SDL_DEBUG_TEXT_FONT_CHARACTER_SIZE @@ -2571,7 +2571,7 @@ extern SDL_DECLSPEC bool SDLCALL SDL_RenderDebugText(SDL_Renderer *renderer, flo * * \threadsafety This function should only be called on the main thread. * - * \since This function is available since SDL 3.1.8. + * \since This function is available since SDL 3.2.0. * * \sa SDL_RenderDebugText * \sa SDL_DEBUG_TEXT_FONT_CHARACTER_SIZE diff --git a/include/SDL3/SDL_revision.h b/include/SDL3/SDL_revision.h index 728032fe46114..f0f57cd59b672 100644 --- a/include/SDL3/SDL_revision.h +++ b/include/SDL3/SDL_revision.h @@ -44,7 +44,7 @@ * clue in debugging forensics and not something the app will parse in any * way. * - * \since This macro is available since SDL 3.1.3. + * \since This macro is available since SDL 3.2.0. */ #define SDL_REVISION "Some arbitrary string decided at SDL build time" #elif defined(SDL_VENDOR_INFO) diff --git a/include/SDL3/SDL_scancode.h b/include/SDL3/SDL_scancode.h index 27776a8a6f3d4..9650a6cfe358f 100644 --- a/include/SDL3/SDL_scancode.h +++ b/include/SDL3/SDL_scancode.h @@ -47,7 +47,7 @@ * The values in this enumeration are based on the USB usage page standard: * https://usb.org/sites/default/files/hut1_5.pdf * - * \since This enum is available since SDL 3.1.3. + * \since This enum is available since SDL 3.2.0. */ typedef enum SDL_Scancode { diff --git a/include/SDL3/SDL_sensor.h b/include/SDL3/SDL_sensor.h index 83e70839b3250..b220f0538c054 100644 --- a/include/SDL3/SDL_sensor.h +++ b/include/SDL3/SDL_sensor.h @@ -49,7 +49,7 @@ extern "C" { /** * The opaque structure used to identify an opened SDL sensor. * - * \since This struct is available since SDL 3.1.3. + * \since This struct is available since SDL 3.2.0. */ typedef struct SDL_Sensor SDL_Sensor; @@ -59,7 +59,7 @@ typedef struct SDL_Sensor SDL_Sensor; * * The value 0 is an invalid ID. * - * \since This datatype is available since SDL 3.1.3. + * \since This datatype is available since SDL 3.2.0. */ typedef Uint32 SDL_SensorID; @@ -71,7 +71,7 @@ typedef Uint32 SDL_SensorID; * rest will have an value of SDL_STANDARD_GRAVITY away from the center of the * earth, which is a positive Y value. * - * \since This macro is available since SDL 3.1.3. + * \since This macro is available since SDL 3.2.0. */ #define SDL_STANDARD_GRAVITY 9.80665f @@ -125,7 +125,7 @@ typedef Uint32 SDL_SensorID; * * The gyroscope axis data is not changed when the device is rotated. * - * \since This enum is available since SDL 3.1.3. + * \since This enum is available since SDL 3.2.0. * * \sa SDL_GetCurrentDisplayOrientation */ @@ -153,7 +153,7 @@ typedef enum SDL_SensorType * call SDL_GetError() for more information. This should be freed * with SDL_free() when it is no longer needed. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. */ extern SDL_DECLSPEC SDL_SensorID * SDLCALL SDL_GetSensors(int *count); @@ -165,7 +165,7 @@ extern SDL_DECLSPEC SDL_SensorID * SDLCALL SDL_GetSensors(int *count); * \param instance_id the sensor instance ID. * \returns the sensor name, or NULL if `instance_id` is not valid. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. */ extern SDL_DECLSPEC const char * SDLCALL SDL_GetSensorNameForID(SDL_SensorID instance_id); @@ -178,7 +178,7 @@ extern SDL_DECLSPEC const char * SDLCALL SDL_GetSensorNameForID(SDL_SensorID ins * \returns the SDL_SensorType, or `SDL_SENSOR_INVALID` if `instance_id` is * not valid. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. */ extern SDL_DECLSPEC SDL_SensorType SDLCALL SDL_GetSensorTypeForID(SDL_SensorID instance_id); @@ -191,7 +191,7 @@ extern SDL_DECLSPEC SDL_SensorType SDLCALL SDL_GetSensorTypeForID(SDL_SensorID i * \returns the sensor platform dependent type, or -1 if `instance_id` is not * valid. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. */ extern SDL_DECLSPEC int SDLCALL SDL_GetSensorNonPortableTypeForID(SDL_SensorID instance_id); @@ -202,7 +202,7 @@ extern SDL_DECLSPEC int SDLCALL SDL_GetSensorNonPortableTypeForID(SDL_SensorID i * \returns an SDL_Sensor object or NULL on failure; call SDL_GetError() for * more information. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. */ extern SDL_DECLSPEC SDL_Sensor * SDLCALL SDL_OpenSensor(SDL_SensorID instance_id); @@ -213,7 +213,7 @@ extern SDL_DECLSPEC SDL_Sensor * SDLCALL SDL_OpenSensor(SDL_SensorID instance_id * \returns an SDL_Sensor object or NULL on failure; call SDL_GetError() for * more information. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. */ extern SDL_DECLSPEC SDL_Sensor * SDLCALL SDL_GetSensorFromID(SDL_SensorID instance_id); @@ -224,7 +224,7 @@ extern SDL_DECLSPEC SDL_Sensor * SDLCALL SDL_GetSensorFromID(SDL_SensorID instan * \returns a valid property ID on success or 0 on failure; call * SDL_GetError() for more information. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. */ extern SDL_DECLSPEC SDL_PropertiesID SDLCALL SDL_GetSensorProperties(SDL_Sensor *sensor); @@ -235,7 +235,7 @@ extern SDL_DECLSPEC SDL_PropertiesID SDLCALL SDL_GetSensorProperties(SDL_Sensor * \returns the sensor name or NULL on failure; call SDL_GetError() for more * information. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. */ extern SDL_DECLSPEC const char * SDLCALL SDL_GetSensorName(SDL_Sensor *sensor); @@ -246,7 +246,7 @@ extern SDL_DECLSPEC const char * SDLCALL SDL_GetSensorName(SDL_Sensor *sensor); * \returns the SDL_SensorType type, or `SDL_SENSOR_INVALID` if `sensor` is * NULL. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. */ extern SDL_DECLSPEC SDL_SensorType SDLCALL SDL_GetSensorType(SDL_Sensor *sensor); @@ -256,7 +256,7 @@ extern SDL_DECLSPEC SDL_SensorType SDLCALL SDL_GetSensorType(SDL_Sensor *sensor) * \param sensor the SDL_Sensor object to inspect. * \returns the sensor platform dependent type, or -1 if `sensor` is NULL. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. */ extern SDL_DECLSPEC int SDLCALL SDL_GetSensorNonPortableType(SDL_Sensor *sensor); @@ -267,7 +267,7 @@ extern SDL_DECLSPEC int SDLCALL SDL_GetSensorNonPortableType(SDL_Sensor *sensor) * \returns the sensor instance ID, or 0 on failure; call SDL_GetError() for * more information. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. */ extern SDL_DECLSPEC SDL_SensorID SDLCALL SDL_GetSensorID(SDL_Sensor *sensor); @@ -282,7 +282,7 @@ extern SDL_DECLSPEC SDL_SensorID SDLCALL SDL_GetSensorID(SDL_Sensor *sensor); * \returns true on success or false on failure; call SDL_GetError() for more * information. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. */ extern SDL_DECLSPEC bool SDLCALL SDL_GetSensorData(SDL_Sensor *sensor, float *data, int num_values); @@ -291,7 +291,7 @@ extern SDL_DECLSPEC bool SDLCALL SDL_GetSensorData(SDL_Sensor *sensor, float *da * * \param sensor the SDL_Sensor object to close. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. */ extern SDL_DECLSPEC void SDLCALL SDL_CloseSensor(SDL_Sensor *sensor); @@ -304,7 +304,7 @@ extern SDL_DECLSPEC void SDLCALL SDL_CloseSensor(SDL_Sensor *sensor); * This needs to be called from the thread that initialized the sensor * subsystem. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. */ extern SDL_DECLSPEC void SDLCALL SDL_UpdateSensors(void); diff --git a/include/SDL3/SDL_stdinc.h b/include/SDL3/SDL_stdinc.h index c77cedc466f11..2e2b69f7f120d 100644 --- a/include/SDL3/SDL_stdinc.h +++ b/include/SDL3/SDL_stdinc.h @@ -147,7 +147,7 @@ void *alloca(size_t); * In modern times, it's generally expected to cover an entire linear address * space. But be careful! * - * \since This macro is available since SDL 3.1.3. + * \since This macro is available since SDL 3.2.0. */ #define SDL_SIZE_MAX SIZE_MAX @@ -187,7 +187,7 @@ void *alloca(size_t); * * \threadsafety This macro doesn't generate any code to run. * - * \since This macro is available since SDL 3.1.3. + * \since This macro is available since SDL 3.2.0. * * \sa SDL_assert */ @@ -220,7 +220,7 @@ void *alloca(size_t); * inside of `sizeof`, so there are no side-effects here, as expressions do * not actually run any code in these cases. * - * \since This macro is available since SDL 3.1.3. + * \since This macro is available since SDL 3.2.0. */ #define SDL_arraysize(array) (sizeof(array)/sizeof(array[0])) @@ -235,7 +235,7 @@ void *alloca(size_t); * * \param arg the text to turn into a string literal. * - * \since This macro is available since SDL 3.1.3. + * \since This macro is available since SDL 3.2.0. */ #define SDL_STRINGIFY_ARG(arg) #arg @@ -264,7 +264,7 @@ void *alloca(size_t); * * \threadsafety It is safe to call this macro from any thread. * - * \since This macro is available since SDL 3.1.3. + * \since This macro is available since SDL 3.2.0. * * \sa SDL_static_cast * \sa SDL_const_cast @@ -286,7 +286,7 @@ void *alloca(size_t); * * \threadsafety It is safe to call this macro from any thread. * - * \since This macro is available since SDL 3.1.3. + * \since This macro is available since SDL 3.2.0. * * \sa SDL_reinterpret_cast * \sa SDL_const_cast @@ -308,7 +308,7 @@ void *alloca(size_t); * * \threadsafety It is safe to call this macro from any thread. * - * \since This macro is available since SDL 3.1.3. + * \since This macro is available since SDL 3.2.0. * * \sa SDL_reinterpret_cast * \sa SDL_static_cast @@ -339,7 +339,7 @@ void *alloca(size_t); * * \threadsafety It is safe to call this macro from any thread. * - * \since This macro is available since SDL 3.1.3. + * \since This macro is available since SDL 3.2.0. */ #define SDL_FOURCC(A, B, C, D) \ ((SDL_static_cast(Uint32, SDL_static_cast(Uint8, (A))) << 0) | \ @@ -356,7 +356,7 @@ void *alloca(size_t); * 0xFFFFFFFF is overflowing a 32-bit value. Use `SDL_SINT64_C(0xFFFFFFFF1)` * instead of `0xFFFFFFFF1` by itself. * - * \since This macro is available since SDL 3.1.3. + * \since This macro is available since SDL 3.2.0. * * \sa SDL_UINT64_C */ @@ -369,7 +369,7 @@ void *alloca(size_t); * 0xFFFFFFFF is overflowing a 32-bit value. Use `SDL_UINT64_C(0xFFFFFFFF1)` * instead of `0xFFFFFFFF1` by itself. * - * \since This macro is available since SDL 3.1.3. + * \since This macro is available since SDL 3.2.0. * * \sa SDL_SINT64_C */ @@ -411,7 +411,7 @@ void *alloca(size_t); /** * A signed 8-bit integer type. * - * \since This macro is available since SDL 3.1.3. + * \since This macro is available since SDL 3.2.0. */ typedef int8_t Sint8; #define SDL_MAX_SINT8 ((Sint8)0x7F) /* 127 */ @@ -420,7 +420,7 @@ typedef int8_t Sint8; /** * An unsigned 8-bit integer type. * - * \since This macro is available since SDL 3.1.3. + * \since This macro is available since SDL 3.2.0. */ typedef uint8_t Uint8; #define SDL_MAX_UINT8 ((Uint8)0xFF) /* 255 */ @@ -429,7 +429,7 @@ typedef uint8_t Uint8; /** * A signed 16-bit integer type. * - * \since This macro is available since SDL 3.1.3. + * \since This macro is available since SDL 3.2.0. */ typedef int16_t Sint16; #define SDL_MAX_SINT16 ((Sint16)0x7FFF) /* 32767 */ @@ -438,7 +438,7 @@ typedef int16_t Sint16; /** * An unsigned 16-bit integer type. * - * \since This macro is available since SDL 3.1.3. + * \since This macro is available since SDL 3.2.0. */ typedef uint16_t Uint16; #define SDL_MAX_UINT16 ((Uint16)0xFFFF) /* 65535 */ @@ -447,7 +447,7 @@ typedef uint16_t Uint16; /** * A signed 32-bit integer type. * - * \since This macro is available since SDL 3.1.3. + * \since This macro is available since SDL 3.2.0. */ typedef int32_t Sint32; #define SDL_MAX_SINT32 ((Sint32)0x7FFFFFFF) /* 2147483647 */ @@ -456,7 +456,7 @@ typedef int32_t Sint32; /** * An unsigned 32-bit integer type. * - * \since This macro is available since SDL 3.1.3. + * \since This macro is available since SDL 3.2.0. */ typedef uint32_t Uint32; #define SDL_MAX_UINT32 ((Uint32)0xFFFFFFFFu) /* 4294967295 */ @@ -465,7 +465,7 @@ typedef uint32_t Uint32; /** * A signed 64-bit integer type. * - * \since This macro is available since SDL 3.1.3. + * \since This macro is available since SDL 3.2.0. * * \sa SDL_SINT64_C */ @@ -476,7 +476,7 @@ typedef int64_t Sint64; /** * An unsigned 64-bit integer type. * - * \since This macro is available since SDL 3.1.3. + * \since This macro is available since SDL 3.2.0. * * \sa SDL_UINT64_C */ @@ -492,7 +492,7 @@ typedef uint64_t Uint64; * and SDL_SECONDS_TO_NS(), and between Windows FILETIME values with * SDL_TimeToWindows() and SDL_TimeFromWindows(). * - * \since This macro is available since SDL 3.1.3. + * \since This macro is available since SDL 3.2.0. * * \sa SDL_MAX_SINT64 * \sa SDL_MIN_SINT64 @@ -518,7 +518,7 @@ typedef Sint64 SDL_Time; * Equals by default to platform-defined `FLT_EPSILON`, or * `1.1920928955078125e-07F` if that's not available. * - * \since This macro is available since SDL 3.1.3. + * \since This macro is available since SDL 3.2.0. */ #define SDL_FLT_EPSILON 1.1920928955078125e-07F /* 0x0.000002p0 */ #endif @@ -536,7 +536,7 @@ typedef Sint64 SDL_Time; * SDL_Log("There are %" SDL_PRIs64 " bottles of beer on the wall.", bottles); * ``` * - * \since This macro is available since SDL 3.1.3. + * \since This macro is available since SDL 3.2.0. */ #define SDL_PRIs64 "lld" @@ -549,7 +549,7 @@ typedef Sint64 SDL_Time; * SDL_Log("There are %" SDL_PRIu64 " bottles of beer on the wall.", bottles); * ``` * - * \since This macro is available since SDL 3.1.3. + * \since This macro is available since SDL 3.2.0. */ #define SDL_PRIu64 "llu" @@ -562,7 +562,7 @@ typedef Sint64 SDL_Time; * SDL_Log("There are %" SDL_PRIx64 " bottles of beer on the wall.", bottles); * ``` * - * \since This macro is available since SDL 3.1.3. + * \since This macro is available since SDL 3.2.0. */ #define SDL_PRIx64 "llx" @@ -575,7 +575,7 @@ typedef Sint64 SDL_Time; * SDL_Log("There are %" SDL_PRIX64 " bottles of beer on the wall.", bottles); * ``` * - * \since This macro is available since SDL 3.1.3. + * \since This macro is available since SDL 3.2.0. */ #define SDL_PRIX64 "llX" @@ -588,7 +588,7 @@ typedef Sint64 SDL_Time; * SDL_Log("There are %" SDL_PRIs32 " bottles of beer on the wall.", bottles); * ``` * - * \since This macro is available since SDL 3.1.3. + * \since This macro is available since SDL 3.2.0. */ #define SDL_PRIs32 "d" @@ -601,7 +601,7 @@ typedef Sint64 SDL_Time; * SDL_Log("There are %" SDL_PRIu32 " bottles of beer on the wall.", bottles); * ``` * - * \since This macro is available since SDL 3.1.3. + * \since This macro is available since SDL 3.2.0. */ #define SDL_PRIu32 "u" @@ -614,7 +614,7 @@ typedef Sint64 SDL_Time; * SDL_Log("There are %" SDL_PRIx32 " bottles of beer on the wall.", bottles); * ``` * - * \since This macro is available since SDL 3.1.3. + * \since This macro is available since SDL 3.2.0. */ #define SDL_PRIx32 "x" @@ -627,7 +627,7 @@ typedef Sint64 SDL_Time; * SDL_Log("There are %" SDL_PRIX32 " bottles of beer on the wall.", bottles); * ``` * - * \since This macro is available since SDL 3.1.3. + * \since This macro is available since SDL 3.2.0. */ #define SDL_PRIX32 "X" @@ -643,7 +643,7 @@ typedef Sint64 SDL_Time; * SDL_Log("There are %" SDL_PRILL_PREFIX "d bottles of beer on the wall.", bottles); * ``` * - * \since This macro is available since SDL 3.1.3. + * \since This macro is available since SDL 3.2.0. */ #define SDL_PRILL_PREFIX "ll" @@ -656,7 +656,7 @@ typedef Sint64 SDL_Time; * SDL_Log("There are %" SDL_PRILLd " bottles of beer on the wall.", bottles); * ``` * - * \since This macro is available since SDL 3.1.3. + * \since This macro is available since SDL 3.2.0. */ #define SDL_PRILLd SDL_PRILL_PREFIX "d" @@ -669,7 +669,7 @@ typedef Sint64 SDL_Time; * SDL_Log("There are %" SDL_PRILLu " bottles of beer on the wall.", bottles); * ``` * - * \since This macro is available since SDL 3.1.3. + * \since This macro is available since SDL 3.2.0. */ #define SDL_PRILLu SDL_PRILL_PREFIX "u" @@ -683,7 +683,7 @@ typedef Sint64 SDL_Time; * SDL_Log("There are %" SDL_PRILLx " bottles of beer on the wall.", bottles); * ``` * - * \since This macro is available since SDL 3.1.3. + * \since This macro is available since SDL 3.2.0. */ #define SDL_PRILLx SDL_PRILL_PREFIX "x" @@ -697,7 +697,7 @@ typedef Sint64 SDL_Time; * SDL_Log("There are %" SDL_PRILLX " bottles of beer on the wall.", bottles); * ``` * - * \since This macro is available since SDL 3.1.3. + * \since This macro is available since SDL 3.2.0. */ #define SDL_PRILLX SDL_PRILL_PREFIX "X" #endif /* SDL_WIKI_DOCUMENTATION_SECTION */ @@ -817,7 +817,7 @@ SDL_COMPILE_TIME_ASSERT(longlong_size64, sizeof(long long) == 8); /* using I64 f * * On compilers without this annotation mechanism, this is defined to nothing. * - * \since This macro is available since SDL 3.1.3. + * \since This macro is available since SDL 3.2.0. */ #define SDL_IN_BYTECAP(x) _In_bytecount_(x) @@ -837,7 +837,7 @@ SDL_COMPILE_TIME_ASSERT(longlong_size64, sizeof(long long) == 8); /* using I64 f * * On compilers without this annotation mechanism, this is defined to nothing. * - * \since This macro is available since SDL 3.1.3. + * \since This macro is available since SDL 3.2.0. */ #define SDL_INOUT_Z_CAP(x) _Inout_z_cap_(x) @@ -856,7 +856,7 @@ SDL_COMPILE_TIME_ASSERT(longlong_size64, sizeof(long long) == 8); /* using I64 f * * On compilers without this annotation mechanism, this is defined to nothing. * - * \since This macro is available since SDL 3.1.3. + * \since This macro is available since SDL 3.2.0. */ #define SDL_OUT_Z_CAP(x) _Out_z_cap_(x) @@ -878,7 +878,7 @@ SDL_COMPILE_TIME_ASSERT(longlong_size64, sizeof(long long) == 8); /* using I64 f * * On compilers without this annotation mechanism, this is defined to nothing. * - * \since This macro is available since SDL 3.1.3. + * \since This macro is available since SDL 3.2.0. */ #define SDL_OUT_CAP(x) _Out_cap_(x) @@ -897,7 +897,7 @@ SDL_COMPILE_TIME_ASSERT(longlong_size64, sizeof(long long) == 8); /* using I64 f * * On compilers without this annotation mechanism, this is defined to nothing. * - * \since This macro is available since SDL 3.1.3. + * \since This macro is available since SDL 3.2.0. */ #define SDL_OUT_BYTECAP(x) _Out_bytecap_(x) @@ -916,7 +916,7 @@ SDL_COMPILE_TIME_ASSERT(longlong_size64, sizeof(long long) == 8); /* using I64 f * * On compilers without this annotation mechanism, this is defined to nothing. * - * \since This macro is available since SDL 3.1.3. + * \since This macro is available since SDL 3.2.0. */ #define SDL_OUT_Z_BYTECAP(x) _Out_z_bytecap_(x) @@ -934,7 +934,7 @@ SDL_COMPILE_TIME_ASSERT(longlong_size64, sizeof(long long) == 8); /* using I64 f * * On compilers without this annotation mechanism, this is defined to nothing. * - * \since This macro is available since SDL 3.1.3. + * \since This macro is available since SDL 3.2.0. */ #define SDL_PRINTF_FORMAT_STRING _Printf_format_string_ @@ -952,7 +952,7 @@ SDL_COMPILE_TIME_ASSERT(longlong_size64, sizeof(long long) == 8); /* using I64 f * * On compilers without this annotation mechanism, this is defined to nothing. * - * \since This macro is available since SDL 3.1.3. + * \since This macro is available since SDL 3.2.0. */ #define SDL_SCANF_FORMAT_STRING _Scanf_format_string_impl_ @@ -974,7 +974,7 @@ SDL_COMPILE_TIME_ASSERT(longlong_size64, sizeof(long long) == 8); /* using I64 f * This can (and should) be used with SDL_PRINTF_FORMAT_STRING as well, which * between them will cover at least Visual Studio, GCC, and Clang. * - * \since This macro is available since SDL 3.1.3. + * \since This macro is available since SDL 3.2.0. */ #define SDL_PRINTF_VARARG_FUNC( fmtargnumber ) __attribute__ (( format( __printf__, fmtargnumber, fmtargnumber+1 ))) @@ -996,7 +996,7 @@ SDL_COMPILE_TIME_ASSERT(longlong_size64, sizeof(long long) == 8); /* using I64 f * This can (and should) be used with SDL_PRINTF_FORMAT_STRING as well, which * between them will cover at least Visual Studio, GCC, and Clang. * - * \since This macro is available since SDL 3.1.3. + * \since This macro is available since SDL 3.2.0. */ #define SDL_PRINTF_VARARG_FUNCV( fmtargnumber ) __attribute__(( format( __printf__, fmtargnumber, 0 ))) @@ -1018,7 +1018,7 @@ SDL_COMPILE_TIME_ASSERT(longlong_size64, sizeof(long long) == 8); /* using I64 f * This can (and should) be used with SDL_SCANF_FORMAT_STRING as well, which * between them will cover at least Visual Studio, GCC, and Clang. * - * \since This macro is available since SDL 3.1.3. + * \since This macro is available since SDL 3.2.0. */ #define SDL_SCANF_VARARG_FUNC( fmtargnumber ) __attribute__ (( format( __scanf__, fmtargnumber, fmtargnumber+1 ))) @@ -1040,7 +1040,7 @@ SDL_COMPILE_TIME_ASSERT(longlong_size64, sizeof(long long) == 8); /* using I64 f * This can (and should) be used with SDL_SCANF_FORMAT_STRING as well, which * between them will cover at least Visual Studio, GCC, and Clang. * - * \since This macro is available since SDL 3.1.3. + * \since This macro is available since SDL 3.2.0. */ #define SDL_SCANF_VARARG_FUNCV( fmtargnumber ) __attribute__(( format( __scanf__, fmtargnumber, 0 ))) @@ -1062,7 +1062,7 @@ SDL_COMPILE_TIME_ASSERT(longlong_size64, sizeof(long long) == 8); /* using I64 f * This can (and should) be used with SDL_PRINTF_FORMAT_STRING as well, which * between them will cover at least Visual Studio, GCC, and Clang. * - * \since This macro is available since SDL 3.1.3. + * \since This macro is available since SDL 3.2.0. */ #define SDL_WPRINTF_VARARG_FUNC( fmtargnumber ) /* __attribute__ (( format( __wprintf__, fmtargnumber, fmtargnumber+1 ))) */ @@ -1084,7 +1084,7 @@ SDL_COMPILE_TIME_ASSERT(longlong_size64, sizeof(long long) == 8); /* using I64 f * This can (and should) be used with SDL_PRINTF_FORMAT_STRING as well, which * between them will cover at least Visual Studio, GCC, and Clang. * - * \since This macro is available since SDL 3.1.3. + * \since This macro is available since SDL 3.2.0. */ #define SDL_WPRINTF_VARARG_FUNCV( fmtargnumber ) /* __attribute__ (( format( __wprintf__, fmtargnumber, 0 ))) */ @@ -1226,7 +1226,7 @@ extern "C" { * * \threadsafety It is safe to call this macro from any thread. * - * \since This macro is available since SDL 3.1.3. + * \since This macro is available since SDL 3.2.0. * * \sa SDL_IOStreamInterface * \sa SDL_StorageInterface @@ -1260,7 +1260,7 @@ extern "C" { * * \threadsafety It is safe to call this macro from any thread. * - * \since This macro is available since SDL 3.1.3. + * \since This macro is available since SDL 3.2.0. * * \sa SDL_stack_free */ @@ -1307,7 +1307,7 @@ extern "C" { * * \threadsafety It is safe to call this function from any thread. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_free * \sa SDL_calloc @@ -1329,7 +1329,7 @@ extern SDL_DECLSPEC SDL_MALLOC void * SDLCALL SDL_malloc(size_t size); * * \threadsafety It is safe to call this function from any thread. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_free * \sa SDL_malloc @@ -1364,7 +1364,7 @@ extern SDL_DECLSPEC SDL_MALLOC SDL_ALLOC_SIZE2(1, 2) void * SDLCALL SDL_calloc(s * * \threadsafety It is safe to call this function from any thread. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_free * \sa SDL_malloc @@ -1384,7 +1384,7 @@ extern SDL_DECLSPEC SDL_ALLOC_SIZE(2) void * SDLCALL SDL_realloc(void *mem, size * * \threadsafety It is safe to call this function from any thread. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_malloc * \sa SDL_calloc @@ -1402,7 +1402,7 @@ extern SDL_DECLSPEC void SDLCALL SDL_free(void *mem); * * \threadsafety It should be safe to call this callback from any thread. * - * \since This datatype is available since SDL 3.1.3. + * \since This datatype is available since SDL 3.2.0. * * \sa SDL_malloc * \sa SDL_GetOriginalMemoryFunctions @@ -1423,7 +1423,7 @@ typedef void *(SDLCALL *SDL_malloc_func)(size_t size); * * \threadsafety It should be safe to call this callback from any thread. * - * \since This datatype is available since SDL 3.1.3. + * \since This datatype is available since SDL 3.2.0. * * \sa SDL_calloc * \sa SDL_GetOriginalMemoryFunctions @@ -1444,7 +1444,7 @@ typedef void *(SDLCALL *SDL_calloc_func)(size_t nmemb, size_t size); * * \threadsafety It should be safe to call this callback from any thread. * - * \since This datatype is available since SDL 3.1.3. + * \since This datatype is available since SDL 3.2.0. * * \sa SDL_realloc * \sa SDL_GetOriginalMemoryFunctions @@ -1462,7 +1462,7 @@ typedef void *(SDLCALL *SDL_realloc_func)(void *mem, size_t size); * * \threadsafety It should be safe to call this callback from any thread. * - * \since This datatype is available since SDL 3.1.3. + * \since This datatype is available since SDL 3.2.0. * * \sa SDL_free * \sa SDL_GetOriginalMemoryFunctions @@ -1486,7 +1486,7 @@ typedef void (SDLCALL *SDL_free_func)(void *mem); * * \threadsafety It is safe to call this function from any thread. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. */ extern SDL_DECLSPEC void SDLCALL SDL_GetOriginalMemoryFunctions(SDL_malloc_func *malloc_func, SDL_calloc_func *calloc_func, @@ -1505,7 +1505,7 @@ extern SDL_DECLSPEC void SDLCALL SDL_GetOriginalMemoryFunctions(SDL_malloc_func * unlikely event of a background thread calling * SDL_SetMemoryFunctions simultaneously. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_SetMemoryFunctions * \sa SDL_GetOriginalMemoryFunctions @@ -1536,7 +1536,7 @@ extern SDL_DECLSPEC void SDLCALL SDL_GetMemoryFunctions(SDL_malloc_func *malloc_ * should not replace the memory functions once any allocations * are made! * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_GetMemoryFunctions * \sa SDL_GetOriginalMemoryFunctions @@ -1564,7 +1564,7 @@ extern SDL_DECLSPEC bool SDLCALL SDL_SetMemoryFunctions(SDL_malloc_func malloc_f * * \threadsafety It is safe to call this function from any thread. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_aligned_free */ @@ -1582,7 +1582,7 @@ extern SDL_DECLSPEC SDL_MALLOC void * SDLCALL SDL_aligned_alloc(size_t alignment * * \threadsafety It is safe to call this function from any thread. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_aligned_alloc */ @@ -1596,14 +1596,14 @@ extern SDL_DECLSPEC void SDLCALL SDL_aligned_free(void *mem); * * \threadsafety It is safe to call this function from any thread. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. */ extern SDL_DECLSPEC int SDLCALL SDL_GetNumAllocations(void); /** * A thread-safe set of environment variables * - * \since This struct is available since SDL 3.1.3. + * \since This struct is available since SDL 3.2.0. * * \sa SDL_GetEnvironment * \sa SDL_CreateEnvironment @@ -1629,7 +1629,7 @@ typedef struct SDL_Environment SDL_Environment; * * \threadsafety It is safe to call this function from any thread. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_GetEnvironmentVariable * \sa SDL_GetEnvironmentVariables @@ -1650,7 +1650,7 @@ extern SDL_DECLSPEC SDL_Environment * SDLCALL SDL_GetEnvironment(void); * from any thread, otherwise it is safe if no other threads are * calling setenv() or unsetenv() * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_GetEnvironmentVariable * \sa SDL_GetEnvironmentVariables @@ -1670,7 +1670,7 @@ extern SDL_DECLSPEC SDL_Environment * SDLCALL SDL_CreateEnvironment(bool populat * * \threadsafety It is safe to call this function from any thread. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_GetEnvironment * \sa SDL_CreateEnvironment @@ -1691,7 +1691,7 @@ extern SDL_DECLSPEC const char * SDLCALL SDL_GetEnvironmentVariable(SDL_Environm * * \threadsafety It is safe to call this function from any thread. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_GetEnvironment * \sa SDL_CreateEnvironment @@ -1715,7 +1715,7 @@ extern SDL_DECLSPEC char ** SDLCALL SDL_GetEnvironmentVariables(SDL_Environment * * \threadsafety It is safe to call this function from any thread. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_GetEnvironment * \sa SDL_CreateEnvironment @@ -1735,7 +1735,7 @@ extern SDL_DECLSPEC bool SDLCALL SDL_SetEnvironmentVariable(SDL_Environment *env * * \threadsafety It is safe to call this function from any thread. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_GetEnvironment * \sa SDL_CreateEnvironment @@ -1754,7 +1754,7 @@ extern SDL_DECLSPEC bool SDLCALL SDL_UnsetEnvironmentVariable(SDL_Environment *e * \threadsafety It is safe to call this function from any thread, as long as * the environment is no longer in use. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_CreateEnvironment */ @@ -1771,7 +1771,7 @@ extern SDL_DECLSPEC void SDLCALL SDL_DestroyEnvironment(SDL_Environment *env); * * \threadsafety It is safe to call this function from any thread. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. */ extern SDL_DECLSPEC const char * SDLCALL SDL_getenv(const char *name); @@ -1788,7 +1788,7 @@ extern SDL_DECLSPEC const char * SDLCALL SDL_getenv(const char *name); * \threadsafety This function is not thread safe, consider using SDL_getenv() * instead. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_getenv */ @@ -1806,7 +1806,7 @@ extern SDL_DECLSPEC const char * SDLCALL SDL_getenv_unsafe(const char *name); * \threadsafety This function is not thread safe, consider using * SDL_SetEnvironmentVariable() instead. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_SetEnvironmentVariable */ @@ -1821,7 +1821,7 @@ extern SDL_DECLSPEC int SDLCALL SDL_setenv_unsafe(const char *name, const char * * \threadsafety This function is not thread safe, consider using * SDL_UnsetEnvironmentVariable() instead. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_UnsetEnvironmentVariable */ @@ -1836,7 +1836,7 @@ extern SDL_DECLSPEC int SDLCALL SDL_unsetenv_unsafe(const char *name); * before `a`, 0 if they are equal. If two elements are equal, their * order in the sorted array is undefined. * - * \since This callback is available since SDL 3.1.3. + * \since This callback is available since SDL 3.2.0. * * \sa SDL_bsearch * \sa SDL_qsort @@ -1882,7 +1882,7 @@ typedef int (SDLCALL *SDL_CompareCallback)(const void *a, const void *b); * * \threadsafety It is safe to call this function from any thread. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_bsearch * \sa SDL_qsort_r @@ -1932,7 +1932,7 @@ extern SDL_DECLSPEC void SDLCALL SDL_qsort(void *base, size_t nmemb, size_t size * * \threadsafety It is safe to call this function from any thread. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_bsearch_r * \sa SDL_qsort @@ -1949,7 +1949,7 @@ extern SDL_DECLSPEC void * SDLCALL SDL_bsearch(const void *key, const void *base * before `a`, 0 if they are equal. If two elements are equal, their * order in the sorted array is undefined. * - * \since This callback is available since SDL 3.1.3. + * \since This callback is available since SDL 3.2.0. * * \sa SDL_qsort_r * \sa SDL_bsearch_r @@ -2002,7 +2002,7 @@ typedef int (SDLCALL *SDL_CompareCallback_r)(void *userdata, const void *a, cons * * \threadsafety It is safe to call this function from any thread. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_bsearch_r * \sa SDL_qsort @@ -2060,7 +2060,7 @@ extern SDL_DECLSPEC void SDLCALL SDL_qsort_r(void *base, size_t nmemb, size_t si * * \threadsafety It is safe to call this function from any thread. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_bsearch * \sa SDL_qsort_r @@ -2075,7 +2075,7 @@ extern SDL_DECLSPEC void * SDLCALL SDL_bsearch_r(const void *key, const void *ba * * \threadsafety It is safe to call this function from any thread. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. */ extern SDL_DECLSPEC int SDLCALL SDL_abs(int x); @@ -2093,7 +2093,7 @@ extern SDL_DECLSPEC int SDLCALL SDL_abs(int x); * * \threadsafety It is safe to call this macro from any thread. * - * \since This macro is available since SDL 3.1.3. + * \since This macro is available since SDL 3.2.0. */ #define SDL_min(x, y) (((x) < (y)) ? (x) : (y)) @@ -2111,7 +2111,7 @@ extern SDL_DECLSPEC int SDLCALL SDL_abs(int x); * * \threadsafety It is safe to call this macro from any thread. * - * \since This macro is available since SDL 3.1.3. + * \since This macro is available since SDL 3.2.0. */ #define SDL_max(x, y) (((x) > (y)) ? (x) : (y)) @@ -2135,7 +2135,7 @@ extern SDL_DECLSPEC int SDLCALL SDL_abs(int x); * * \threadsafety It is safe to call this macro from any thread. * - * \since This macro is available since SDL 3.1.3. + * \since This macro is available since SDL 3.2.0. */ #define SDL_clamp(x, a, b) (((x) < (a)) ? (a) : (((x) > (b)) ? (b) : (x))) @@ -2150,7 +2150,7 @@ extern SDL_DECLSPEC int SDLCALL SDL_abs(int x); * * \threadsafety It is safe to call this function from any thread. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. */ extern SDL_DECLSPEC int SDLCALL SDL_isalpha(int x); @@ -2165,7 +2165,7 @@ extern SDL_DECLSPEC int SDLCALL SDL_isalpha(int x); * * \threadsafety It is safe to call this function from any thread. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. */ extern SDL_DECLSPEC int SDLCALL SDL_isalnum(int x); @@ -2180,7 +2180,7 @@ extern SDL_DECLSPEC int SDLCALL SDL_isalnum(int x); * * \threadsafety It is safe to call this function from any thread. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. */ extern SDL_DECLSPEC int SDLCALL SDL_isblank(int x); @@ -2195,7 +2195,7 @@ extern SDL_DECLSPEC int SDLCALL SDL_isblank(int x); * * \threadsafety It is safe to call this function from any thread. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. */ extern SDL_DECLSPEC int SDLCALL SDL_iscntrl(int x); @@ -2210,7 +2210,7 @@ extern SDL_DECLSPEC int SDLCALL SDL_iscntrl(int x); * * \threadsafety It is safe to call this function from any thread. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. */ extern SDL_DECLSPEC int SDLCALL SDL_isdigit(int x); @@ -2225,7 +2225,7 @@ extern SDL_DECLSPEC int SDLCALL SDL_isdigit(int x); * * \threadsafety It is safe to call this function from any thread. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. */ extern SDL_DECLSPEC int SDLCALL SDL_isxdigit(int x); @@ -2240,7 +2240,7 @@ extern SDL_DECLSPEC int SDLCALL SDL_isxdigit(int x); * * \threadsafety It is safe to call this function from any thread. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_isgraph * \sa SDL_isalnum @@ -2265,7 +2265,7 @@ extern SDL_DECLSPEC int SDLCALL SDL_ispunct(int x); * * \threadsafety It is safe to call this function from any thread. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. */ extern SDL_DECLSPEC int SDLCALL SDL_isspace(int x); @@ -2280,7 +2280,7 @@ extern SDL_DECLSPEC int SDLCALL SDL_isspace(int x); * * \threadsafety It is safe to call this function from any thread. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. */ extern SDL_DECLSPEC int SDLCALL SDL_isupper(int x); @@ -2295,7 +2295,7 @@ extern SDL_DECLSPEC int SDLCALL SDL_isupper(int x); * * \threadsafety It is safe to call this function from any thread. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. */ extern SDL_DECLSPEC int SDLCALL SDL_islower(int x); @@ -2314,7 +2314,7 @@ extern SDL_DECLSPEC int SDLCALL SDL_islower(int x); * * \threadsafety It is safe to call this function from any thread. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. */ extern SDL_DECLSPEC int SDLCALL SDL_isprint(int x); @@ -2333,7 +2333,7 @@ extern SDL_DECLSPEC int SDLCALL SDL_isprint(int x); * * \threadsafety It is safe to call this function from any thread. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_isprint */ @@ -2353,7 +2353,7 @@ extern SDL_DECLSPEC int SDLCALL SDL_isgraph(int x); * * \threadsafety It is safe to call this function from any thread. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. */ extern SDL_DECLSPEC int SDLCALL SDL_toupper(int x); @@ -2371,7 +2371,7 @@ extern SDL_DECLSPEC int SDLCALL SDL_toupper(int x); * * \threadsafety It is safe to call this function from any thread. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. */ extern SDL_DECLSPEC int SDLCALL SDL_tolower(int x); @@ -2392,7 +2392,7 @@ extern SDL_DECLSPEC int SDLCALL SDL_tolower(int x); * * \threadsafety It is safe to call this function from any thread. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. */ extern SDL_DECLSPEC Uint16 SDLCALL SDL_crc16(Uint16 crc, const void *data, size_t len); @@ -2413,7 +2413,7 @@ extern SDL_DECLSPEC Uint16 SDLCALL SDL_crc16(Uint16 crc, const void *data, size_ * * \threadsafety It is safe to call this function from any thread. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. */ extern SDL_DECLSPEC Uint32 SDLCALL SDL_crc32(Uint32 crc, const void *data, size_t len); @@ -2439,7 +2439,7 @@ extern SDL_DECLSPEC Uint32 SDLCALL SDL_crc32(Uint32 crc, const void *data, size_ * * \threadsafety It is safe to call this function from any thread. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. */ extern SDL_DECLSPEC Uint32 SDLCALL SDL_murmur3_32(const void *data, size_t len, Uint32 seed); @@ -2457,7 +2457,7 @@ extern SDL_DECLSPEC Uint32 SDLCALL SDL_murmur3_32(const void *data, size_t len, * * \threadsafety It is safe to call this function from any thread. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_memmove */ @@ -2494,7 +2494,7 @@ extern SDL_DECLSPEC void * SDLCALL SDL_memcpy(SDL_OUT_BYTECAP(len) void *dst, SD * * \threadsafety It is safe to call this function from any thread. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. */ #define SDL_copyp(dst, src) \ { SDL_COMPILE_TIME_ASSERT(SDL_copyp, sizeof (*(dst)) == sizeof (*(src))); } \ @@ -2513,7 +2513,7 @@ extern SDL_DECLSPEC void * SDLCALL SDL_memcpy(SDL_OUT_BYTECAP(len) void *dst, SD * * \threadsafety It is safe to call this function from any thread. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_memcpy */ @@ -2543,7 +2543,7 @@ extern SDL_DECLSPEC void * SDLCALL SDL_memmove(SDL_OUT_BYTECAP(len) void *dst, S * * \threadsafety It is safe to call this function from any thread. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. */ extern SDL_DECLSPEC void * SDLCALL SDL_memset(SDL_OUT_BYTECAP(len) void *dst, int c, size_t len); @@ -2563,7 +2563,7 @@ extern SDL_DECLSPEC void * SDLCALL SDL_memset(SDL_OUT_BYTECAP(len) void *dst, in * * \threadsafety It is safe to call this function from any thread. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. */ extern SDL_DECLSPEC void * SDLCALL SDL_memset4(void *dst, Uint32 val, size_t dwords); @@ -2587,7 +2587,7 @@ extern SDL_DECLSPEC void * SDLCALL SDL_memset4(void *dst, Uint32 val, size_t dwo * * \threadsafety It is safe to call this macro from any thread. * - * \since This macro is available since SDL 3.1.3. + * \since This macro is available since SDL 3.2.0. * * \sa SDL_zerop * \sa SDL_zeroa @@ -2606,7 +2606,7 @@ extern SDL_DECLSPEC void * SDLCALL SDL_memset4(void *dst, Uint32 val, size_t dwo * * \threadsafety It is safe to call this macro from any thread. * - * \since This macro is available since SDL 3.1.3. + * \since This macro is available since SDL 3.2.0. * * \sa SDL_zero * \sa SDL_zeroa @@ -2625,7 +2625,7 @@ extern SDL_DECLSPEC void * SDLCALL SDL_memset4(void *dst, Uint32 val, size_t dwo * * \threadsafety It is safe to call this macro from any thread. * - * \since This macro is available since SDL 3.1.3. + * \since This macro is available since SDL 3.2.0. * * \sa SDL_zero * \sa SDL_zeroa @@ -2645,7 +2645,7 @@ extern SDL_DECLSPEC void * SDLCALL SDL_memset4(void *dst, Uint32 val, size_t dwo * * \threadsafety It is safe to call this function from any thread. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. */ extern SDL_DECLSPEC int SDLCALL SDL_memcmp(const void *s1, const void *s2, size_t len); @@ -2668,7 +2668,7 @@ extern SDL_DECLSPEC int SDLCALL SDL_memcmp(const void *s1, const void *s2, size_ * * \threadsafety It is safe to call this function from any thread. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_wcsnlen * \sa SDL_utf8strlen @@ -2699,7 +2699,7 @@ extern SDL_DECLSPEC size_t SDLCALL SDL_wcslen(const wchar_t *wstr); * * \threadsafety It is safe to call this function from any thread. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_wcslen * \sa SDL_utf8strlen @@ -2728,7 +2728,7 @@ extern SDL_DECLSPEC size_t SDLCALL SDL_wcsnlen(const wchar_t *wstr, size_t maxle * * \threadsafety It is safe to call this function from any thread. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_wcslcat */ @@ -2757,7 +2757,7 @@ extern SDL_DECLSPEC size_t SDLCALL SDL_wcslcpy(SDL_OUT_Z_CAP(maxlen) wchar_t *ds * * \threadsafety It is safe to call this function from any thread. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_wcslcpy */ @@ -2777,7 +2777,7 @@ extern SDL_DECLSPEC size_t SDLCALL SDL_wcslcat(SDL_INOUT_Z_CAP(maxlen) wchar_t * * * \threadsafety It is safe to call this function from any thread. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. */ extern SDL_DECLSPEC wchar_t * SDLCALL SDL_wcsdup(const wchar_t *wstr); @@ -2797,7 +2797,7 @@ extern SDL_DECLSPEC wchar_t * SDLCALL SDL_wcsdup(const wchar_t *wstr); * * \threadsafety It is safe to call this function from any thread. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. */ extern SDL_DECLSPEC wchar_t * SDLCALL SDL_wcsstr(const wchar_t *haystack, const wchar_t *needle); @@ -2822,7 +2822,7 @@ extern SDL_DECLSPEC wchar_t * SDLCALL SDL_wcsstr(const wchar_t *haystack, const * * \threadsafety It is safe to call this function from any thread. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. */ extern SDL_DECLSPEC wchar_t * SDLCALL SDL_wcsnstr(const wchar_t *haystack, const wchar_t *needle, size_t maxlen); @@ -2841,7 +2841,7 @@ extern SDL_DECLSPEC wchar_t * SDLCALL SDL_wcsnstr(const wchar_t *haystack, const * * \threadsafety It is safe to call this function from any thread. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. */ extern SDL_DECLSPEC int SDLCALL SDL_wcscmp(const wchar_t *str1, const wchar_t *str2); @@ -2872,7 +2872,7 @@ extern SDL_DECLSPEC int SDLCALL SDL_wcscmp(const wchar_t *str1, const wchar_t *s * * \threadsafety It is safe to call this function from any thread. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. */ extern SDL_DECLSPEC int SDLCALL SDL_wcsncmp(const wchar_t *str1, const wchar_t *str2, size_t maxlen); @@ -2902,7 +2902,7 @@ extern SDL_DECLSPEC int SDLCALL SDL_wcsncmp(const wchar_t *str1, const wchar_t * * * \threadsafety It is safe to call this function from any thread. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. */ extern SDL_DECLSPEC int SDLCALL SDL_wcscasecmp(const wchar_t *str1, const wchar_t *str2); @@ -2944,7 +2944,7 @@ extern SDL_DECLSPEC int SDLCALL SDL_wcscasecmp(const wchar_t *str1, const wchar_ * * \threadsafety It is safe to call this function from any thread. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. */ extern SDL_DECLSPEC int SDLCALL SDL_wcsncasecmp(const wchar_t *str1, const wchar_t *str2, size_t maxlen); @@ -2969,7 +2969,7 @@ extern SDL_DECLSPEC int SDLCALL SDL_wcsncasecmp(const wchar_t *str1, const wchar * * \threadsafety It is safe to call this function from any thread. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_strtol */ @@ -2987,7 +2987,7 @@ extern SDL_DECLSPEC long SDLCALL SDL_wcstol(const wchar_t *str, wchar_t **endp, * * \threadsafety It is safe to call this function from any thread. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_strnlen * \sa SDL_utf8strlen @@ -3011,7 +3011,7 @@ extern SDL_DECLSPEC size_t SDLCALL SDL_strlen(const char *str); * * \threadsafety It is safe to call this function from any thread. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_strlen * \sa SDL_utf8strlen @@ -3041,7 +3041,7 @@ extern SDL_DECLSPEC size_t SDLCALL SDL_strnlen(const char *str, size_t maxlen); * * \threadsafety It is safe to call this function from any thread. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_strlcat * \sa SDL_utf8strlcpy @@ -3070,7 +3070,7 @@ extern SDL_DECLSPEC size_t SDLCALL SDL_strlcpy(SDL_OUT_Z_CAP(maxlen) char *dst, * * \threadsafety It is safe to call this function from any thread. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_strlcpy */ @@ -3098,7 +3098,7 @@ extern SDL_DECLSPEC size_t SDLCALL SDL_utf8strlcpy(SDL_OUT_Z_CAP(dst_bytes) char * * \threadsafety It is safe to call this function from any thread. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_strlcpy */ @@ -3118,7 +3118,7 @@ extern SDL_DECLSPEC size_t SDLCALL SDL_strlcat(SDL_INOUT_Z_CAP(maxlen) char *dst * * \threadsafety It is safe to call this function from any thread. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. */ extern SDL_DECLSPEC SDL_MALLOC char * SDLCALL SDL_strdup(const char *str); @@ -3143,7 +3143,7 @@ extern SDL_DECLSPEC SDL_MALLOC char * SDLCALL SDL_strdup(const char *str); * * \threadsafety It is safe to call this function from any thread. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. */ extern SDL_DECLSPEC SDL_MALLOC char * SDLCALL SDL_strndup(const char *str, size_t maxlen); @@ -3164,7 +3164,7 @@ extern SDL_DECLSPEC SDL_MALLOC char * SDLCALL SDL_strndup(const char *str, size_ * * \threadsafety It is safe to call this function from any thread. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. */ extern SDL_DECLSPEC char * SDLCALL SDL_strrev(char *str); @@ -3183,7 +3183,7 @@ extern SDL_DECLSPEC char * SDLCALL SDL_strrev(char *str); * * \threadsafety It is safe to call this function from any thread. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_strlwr */ @@ -3204,7 +3204,7 @@ extern SDL_DECLSPEC char * SDLCALL SDL_strupr(char *str); * * \threadsafety It is safe to call this function from any thread. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_strupr */ @@ -3226,7 +3226,7 @@ extern SDL_DECLSPEC char * SDLCALL SDL_strlwr(char *str); * * \threadsafety It is safe to call this function from any thread. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. */ extern SDL_DECLSPEC char * SDLCALL SDL_strchr(const char *str, int c); @@ -3245,7 +3245,7 @@ extern SDL_DECLSPEC char * SDLCALL SDL_strchr(const char *str, int c); * * \threadsafety It is safe to call this function from any thread. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. */ extern SDL_DECLSPEC char * SDLCALL SDL_strrchr(const char *str, int c); @@ -3265,7 +3265,7 @@ extern SDL_DECLSPEC char * SDLCALL SDL_strrchr(const char *str, int c); * * \threadsafety It is safe to call this function from any thread. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. */ extern SDL_DECLSPEC char * SDLCALL SDL_strstr(const char *haystack, const char *needle); @@ -3288,7 +3288,7 @@ extern SDL_DECLSPEC char * SDLCALL SDL_strstr(const char *haystack, const char * * * \threadsafety It is safe to call this function from any thread. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. */ extern SDL_DECLSPEC char * SDLCALL SDL_strnstr(const char *haystack, const char *needle, size_t maxlen); @@ -3316,7 +3316,7 @@ extern SDL_DECLSPEC char * SDLCALL SDL_strnstr(const char *haystack, const char * * \threadsafety It is safe to call this function from any thread. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. */ extern SDL_DECLSPEC char * SDLCALL SDL_strcasestr(const char *haystack, const char *needle); @@ -3345,7 +3345,7 @@ extern SDL_DECLSPEC char * SDLCALL SDL_strcasestr(const char *haystack, const ch * * \threadsafety It is safe to call this function from any thread. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. */ extern SDL_DECLSPEC char * SDLCALL SDL_strtok_r(char *str, const char *delim, char **saveptr); @@ -3370,7 +3370,7 @@ extern SDL_DECLSPEC char * SDLCALL SDL_strtok_r(char *str, const char *delim, ch * * \threadsafety It is safe to call this function from any thread. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_utf8strnlen * \sa SDL_strlen @@ -3403,7 +3403,7 @@ extern SDL_DECLSPEC size_t SDLCALL SDL_utf8strlen(const char *str); * * \threadsafety It is safe to call this function from any thread. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_utf8strlen * \sa SDL_strnlen @@ -3430,7 +3430,7 @@ extern SDL_DECLSPEC size_t SDLCALL SDL_utf8strnlen(const char *str, size_t bytes * * \threadsafety It is safe to call this function from any thread. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_uitoa * \sa SDL_ltoa @@ -3458,7 +3458,7 @@ extern SDL_DECLSPEC char * SDLCALL SDL_itoa(int value, char *str, int radix); * * \threadsafety It is safe to call this function from any thread. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_itoa * \sa SDL_ultoa @@ -3486,7 +3486,7 @@ extern SDL_DECLSPEC char * SDLCALL SDL_uitoa(unsigned int value, char *str, int * * \threadsafety It is safe to call this function from any thread. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_ultoa * \sa SDL_itoa @@ -3514,7 +3514,7 @@ extern SDL_DECLSPEC char * SDLCALL SDL_ltoa(long value, char *str, int radix); * * \threadsafety It is safe to call this function from any thread. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_ltoa * \sa SDL_uitoa @@ -3544,7 +3544,7 @@ extern SDL_DECLSPEC char * SDLCALL SDL_ultoa(unsigned long value, char *str, int * * \threadsafety It is safe to call this function from any thread. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_ulltoa * \sa SDL_itoa @@ -3572,7 +3572,7 @@ extern SDL_DECLSPEC char * SDLCALL SDL_lltoa(long long value, char *str, int rad * * \threadsafety It is safe to call this function from any thread. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_lltoa * \sa SDL_uitoa @@ -3592,7 +3592,7 @@ extern SDL_DECLSPEC char * SDLCALL SDL_ulltoa(unsigned long long value, char *st * * \threadsafety It is safe to call this function from any thread. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_atof * \sa SDL_strtol @@ -3615,7 +3615,7 @@ extern SDL_DECLSPEC int SDLCALL SDL_atoi(const char *str); * * \threadsafety It is safe to call this function from any thread. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_atoi * \sa SDL_strtol @@ -3647,7 +3647,7 @@ extern SDL_DECLSPEC double SDLCALL SDL_atof(const char *str); * * \threadsafety It is safe to call this function from any thread. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_atoi * \sa SDL_atof @@ -3681,7 +3681,7 @@ extern SDL_DECLSPEC long SDLCALL SDL_strtol(const char *str, char **endp, int ba * * \threadsafety It is safe to call this function from any thread. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_atoi * \sa SDL_atof @@ -3716,7 +3716,7 @@ extern SDL_DECLSPEC unsigned long SDLCALL SDL_strtoul(const char *str, char **en * * \threadsafety It is safe to call this function from any thread. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_atoi * \sa SDL_atof @@ -3750,7 +3750,7 @@ extern SDL_DECLSPEC long long SDLCALL SDL_strtoll(const char *str, char **endp, * * \threadsafety It is safe to call this function from any thread. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_atoi * \sa SDL_atof @@ -3781,7 +3781,7 @@ extern SDL_DECLSPEC unsigned long long SDLCALL SDL_strtoull(const char *str, cha * * \threadsafety It is safe to call this function from any thread. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_atoi * \sa SDL_atof @@ -3808,7 +3808,7 @@ extern SDL_DECLSPEC double SDLCALL SDL_strtod(const char *str, char **endp); * * \threadsafety It is safe to call this function from any thread. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. */ extern SDL_DECLSPEC int SDLCALL SDL_strcmp(const char *str1, const char *str2); @@ -3838,7 +3838,7 @@ extern SDL_DECLSPEC int SDLCALL SDL_strcmp(const char *str1, const char *str2); * * \threadsafety It is safe to call this function from any thread. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. */ extern SDL_DECLSPEC int SDLCALL SDL_strncmp(const char *str1, const char *str2, size_t maxlen); @@ -3866,7 +3866,7 @@ extern SDL_DECLSPEC int SDLCALL SDL_strncmp(const char *str1, const char *str2, * * \threadsafety It is safe to call this function from any thread. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. */ extern SDL_DECLSPEC int SDLCALL SDL_strcasecmp(const char *str1, const char *str2); @@ -3906,7 +3906,7 @@ extern SDL_DECLSPEC int SDLCALL SDL_strcasecmp(const char *str1, const char *str * * \threadsafety It is safe to call this function from any thread. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. */ extern SDL_DECLSPEC int SDLCALL SDL_strncasecmp(const char *str1, const char *str2, size_t maxlen); @@ -3924,7 +3924,7 @@ extern SDL_DECLSPEC int SDLCALL SDL_strncasecmp(const char *str1, const char *st * * \threadsafety It is safe to call this function from any thread. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. */ extern SDL_DECLSPEC char * SDLCALL SDL_strpbrk(const char *str, const char *breakset); @@ -3936,7 +3936,7 @@ extern SDL_DECLSPEC char * SDLCALL SDL_strpbrk(const char *str, const char *brea * * This tends to render as something like a question mark in most places. * - * \since This macro is available since SDL 3.1.3. + * \since This macro is available since SDL 3.2.0. * * \sa SDL_StepBackUTF8 * \sa SDL_StepUTF8 @@ -3984,7 +3984,7 @@ extern SDL_DECLSPEC char * SDLCALL SDL_strpbrk(const char *str, const char *brea * * \threadsafety It is safe to call this function from any thread. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. */ extern SDL_DECLSPEC Uint32 SDLCALL SDL_StepUTF8(const char **pstr, size_t *pslen); @@ -4015,7 +4015,7 @@ extern SDL_DECLSPEC Uint32 SDLCALL SDL_StepUTF8(const char **pstr, size_t *pslen * * \threadsafety It is safe to call this function from any thread. * - * \since This function is available since SDL 3.1.6. + * \since This function is available since SDL 3.2.0. */ extern SDL_DECLSPEC Uint32 SDLCALL SDL_StepBackUTF8(const char *start, const char **pstr); @@ -4044,7 +4044,7 @@ extern SDL_DECLSPEC Uint32 SDLCALL SDL_StepBackUTF8(const char *start, const cha * * \threadsafety It is safe to call this function from any thread. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. */ extern SDL_DECLSPEC char * SDLCALL SDL_UCS4ToUTF8(Uint32 codepoint, char *dst); @@ -4061,7 +4061,7 @@ extern SDL_DECLSPEC char * SDLCALL SDL_UCS4ToUTF8(Uint32 codepoint, char *dst); * * \threadsafety It is safe to call this function from any thread. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. */ extern SDL_DECLSPEC int SDLCALL SDL_sscanf(const char *text, SDL_SCANF_FORMAT_STRING const char *fmt, ...) SDL_SCANF_VARARG_FUNC(2); @@ -4080,7 +4080,7 @@ extern SDL_DECLSPEC int SDLCALL SDL_sscanf(const char *text, SDL_SCANF_FORMAT_ST * * \threadsafety It is safe to call this function from any thread. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. */ extern SDL_DECLSPEC int SDLCALL SDL_vsscanf(const char *text, SDL_SCANF_FORMAT_STRING const char *fmt, va_list ap) SDL_SCANF_VARARG_FUNCV(2); @@ -4113,7 +4113,7 @@ extern SDL_DECLSPEC int SDLCALL SDL_vsscanf(const char *text, SDL_SCANF_FORMAT_S * * \threadsafety It is safe to call this function from any thread. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. */ extern SDL_DECLSPEC int SDLCALL SDL_snprintf(SDL_OUT_Z_CAP(maxlen) char *text, size_t maxlen, SDL_PRINTF_FORMAT_STRING const char *fmt, ...) SDL_PRINTF_VARARG_FUNC(3); @@ -4147,7 +4147,7 @@ extern SDL_DECLSPEC int SDLCALL SDL_snprintf(SDL_OUT_Z_CAP(maxlen) char *text, s * * \threadsafety It is safe to call this function from any thread. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. */ extern SDL_DECLSPEC int SDLCALL SDL_swprintf(SDL_OUT_Z_CAP(maxlen) wchar_t *text, size_t maxlen, SDL_PRINTF_FORMAT_STRING const wchar_t *fmt, ...) SDL_WPRINTF_VARARG_FUNC(3); @@ -4167,7 +4167,7 @@ extern SDL_DECLSPEC int SDLCALL SDL_swprintf(SDL_OUT_Z_CAP(maxlen) wchar_t *text * * \threadsafety It is safe to call this function from any thread. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. */ extern SDL_DECLSPEC int SDLCALL SDL_vsnprintf(SDL_OUT_Z_CAP(maxlen) char *text, size_t maxlen, SDL_PRINTF_FORMAT_STRING const char *fmt, va_list ap) SDL_PRINTF_VARARG_FUNCV(3); @@ -4188,7 +4188,7 @@ extern SDL_DECLSPEC int SDLCALL SDL_vsnprintf(SDL_OUT_Z_CAP(maxlen) char *text, * * \threadsafety It is safe to call this function from any thread. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. */ extern SDL_DECLSPEC int SDLCALL SDL_vswprintf(SDL_OUT_Z_CAP(maxlen) wchar_t *text, size_t maxlen, SDL_PRINTF_FORMAT_STRING const wchar_t *fmt, va_list ap) SDL_WPRINTF_VARARG_FUNCV(3); @@ -4217,7 +4217,7 @@ extern SDL_DECLSPEC int SDLCALL SDL_vswprintf(SDL_OUT_Z_CAP(maxlen) wchar_t *tex * * \threadsafety It is safe to call this function from any thread. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. */ extern SDL_DECLSPEC int SDLCALL SDL_asprintf(char **strp, SDL_PRINTF_FORMAT_STRING const char *fmt, ...) SDL_PRINTF_VARARG_FUNC(2); @@ -4236,7 +4236,7 @@ extern SDL_DECLSPEC int SDLCALL SDL_asprintf(char **strp, SDL_PRINTF_FORMAT_STRI * * \threadsafety It is safe to call this function from any thread. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. */ extern SDL_DECLSPEC int SDLCALL SDL_vasprintf(char **strp, SDL_PRINTF_FORMAT_STRING const char *fmt, va_list ap) SDL_PRINTF_VARARG_FUNCV(2); @@ -4252,7 +4252,7 @@ extern SDL_DECLSPEC int SDLCALL SDL_vasprintf(char **strp, SDL_PRINTF_FORMAT_STR * \threadsafety This should be called on the same thread that calls * SDL_rand*() * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_rand * \sa SDL_rand_bits @@ -4287,7 +4287,7 @@ extern SDL_DECLSPEC void SDLCALL SDL_srand(Uint64 seed); * * \threadsafety All calls should be made from a single thread * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_srand * \sa SDL_randf @@ -4310,7 +4310,7 @@ extern SDL_DECLSPEC Sint32 SDLCALL SDL_rand(Sint32 n); * * \threadsafety All calls should be made from a single thread * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_srand * \sa SDL_rand @@ -4332,7 +4332,7 @@ extern SDL_DECLSPEC float SDLCALL SDL_randf(void); * * \threadsafety All calls should be made from a single thread * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_rand * \sa SDL_randf @@ -4367,7 +4367,7 @@ extern SDL_DECLSPEC Uint32 SDLCALL SDL_rand_bits(void); * \threadsafety This function is thread-safe, as long as the state pointer * isn't shared between threads. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_rand * \sa SDL_rand_bits_r @@ -4394,7 +4394,7 @@ extern SDL_DECLSPEC Sint32 SDLCALL SDL_rand_r(Uint64 *state, Sint32 n); * \threadsafety This function is thread-safe, as long as the state pointer * isn't shared between threads. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_rand_bits_r * \sa SDL_rand_r @@ -4420,7 +4420,7 @@ extern SDL_DECLSPEC float SDLCALL SDL_randf_r(Uint64 *state); * \threadsafety This function is thread-safe, as long as the state pointer * isn't shared between threads. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_rand_r * \sa SDL_randf_r @@ -4432,7 +4432,7 @@ extern SDL_DECLSPEC Uint32 SDLCALL SDL_rand_bits_r(Uint64 *state); /** * The value of Pi, as a double-precision floating point literal. * - * \since This macro is available since SDL 3.1.3. + * \since This macro is available since SDL 3.2.0. * * \sa SDL_PI_F */ @@ -4444,7 +4444,7 @@ extern SDL_DECLSPEC Uint32 SDLCALL SDL_rand_bits_r(Uint64 *state); /** * The value of Pi, as a single-precision floating point literal. * - * \since This macro is available since SDL 3.1.3. + * \since This macro is available since SDL 3.2.0. * * \sa SDL_PI_D */ @@ -4473,7 +4473,7 @@ extern SDL_DECLSPEC Uint32 SDLCALL SDL_rand_bits_r(Uint64 *state); * * \threadsafety It is safe to call this function from any thread. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_acosf * \sa SDL_asin @@ -4503,7 +4503,7 @@ extern SDL_DECLSPEC double SDLCALL SDL_acos(double x); * * \threadsafety It is safe to call this function from any thread. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_acos * \sa SDL_asinf @@ -4533,7 +4533,7 @@ extern SDL_DECLSPEC float SDLCALL SDL_acosf(float x); * * \threadsafety It is safe to call this function from any thread. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_asinf * \sa SDL_acos @@ -4563,7 +4563,7 @@ extern SDL_DECLSPEC double SDLCALL SDL_asin(double x); * * \threadsafety It is safe to call this function from any thread. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_asin * \sa SDL_acosf @@ -4595,7 +4595,7 @@ extern SDL_DECLSPEC float SDLCALL SDL_asinf(float x); * * \threadsafety It is safe to call this function from any thread. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_atanf * \sa SDL_atan2 @@ -4627,7 +4627,7 @@ extern SDL_DECLSPEC double SDLCALL SDL_atan(double x); * * \threadsafety It is safe to call this function from any thread. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_atan * \sa SDL_atan2f @@ -4663,7 +4663,7 @@ extern SDL_DECLSPEC float SDLCALL SDL_atanf(float x); * * \threadsafety It is safe to call this function from any thread. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_atan2f * \sa SDL_atan @@ -4699,7 +4699,7 @@ extern SDL_DECLSPEC double SDLCALL SDL_atan2(double y, double x); * * \threadsafety It is safe to call this function from any thread. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_atan2f * \sa SDL_atan @@ -4725,7 +4725,7 @@ extern SDL_DECLSPEC float SDLCALL SDL_atan2f(float y, float x); * * \threadsafety It is safe to call this function from any thread. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_ceilf * \sa SDL_floor @@ -4753,7 +4753,7 @@ extern SDL_DECLSPEC double SDLCALL SDL_ceil(double x); * * \threadsafety It is safe to call this function from any thread. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_ceil * \sa SDL_floorf @@ -4782,7 +4782,7 @@ extern SDL_DECLSPEC float SDLCALL SDL_ceilf(float x); * * \threadsafety It is safe to call this function from any thread. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_copysignf * \sa SDL_fabs @@ -4808,7 +4808,7 @@ extern SDL_DECLSPEC double SDLCALL SDL_copysign(double x, double y); * * \threadsafety It is safe to call this function from any thread. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_copysignf * \sa SDL_fabsf @@ -4835,7 +4835,7 @@ extern SDL_DECLSPEC float SDLCALL SDL_copysignf(float x, float y); * * \threadsafety It is safe to call this function from any thread. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_cosf * \sa SDL_acos @@ -4863,7 +4863,7 @@ extern SDL_DECLSPEC double SDLCALL SDL_cos(double x); * * \threadsafety It is safe to call this function from any thread. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_cos * \sa SDL_acosf @@ -4896,7 +4896,7 @@ extern SDL_DECLSPEC float SDLCALL SDL_cosf(float x); * * \threadsafety It is safe to call this function from any thread. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_expf * \sa SDL_log @@ -4928,7 +4928,7 @@ extern SDL_DECLSPEC double SDLCALL SDL_exp(double x); * * \threadsafety It is safe to call this function from any thread. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_exp * \sa SDL_logf @@ -4950,7 +4950,7 @@ extern SDL_DECLSPEC float SDLCALL SDL_expf(float x); * * \threadsafety It is safe to call this function from any thread. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_fabsf */ @@ -4971,7 +4971,7 @@ extern SDL_DECLSPEC double SDLCALL SDL_fabs(double x); * * \threadsafety It is safe to call this function from any thread. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_fabs */ @@ -4995,7 +4995,7 @@ extern SDL_DECLSPEC float SDLCALL SDL_fabsf(float x); * * \threadsafety It is safe to call this function from any thread. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_floorf * \sa SDL_ceil @@ -5023,7 +5023,7 @@ extern SDL_DECLSPEC double SDLCALL SDL_floor(double x); * * \threadsafety It is safe to call this function from any thread. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_floor * \sa SDL_ceilf @@ -5051,7 +5051,7 @@ extern SDL_DECLSPEC float SDLCALL SDL_floorf(float x); * * \threadsafety It is safe to call this function from any thread. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_truncf * \sa SDL_fmod @@ -5080,7 +5080,7 @@ extern SDL_DECLSPEC double SDLCALL SDL_trunc(double x); * * \threadsafety It is safe to call this function from any thread. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_trunc * \sa SDL_fmodf @@ -5109,7 +5109,7 @@ extern SDL_DECLSPEC float SDLCALL SDL_truncf(float x); * * \threadsafety It is safe to call this function from any thread. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_fmodf * \sa SDL_modf @@ -5139,7 +5139,7 @@ extern SDL_DECLSPEC double SDLCALL SDL_fmod(double x, double y); * * \threadsafety It is safe to call this function from any thread. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_fmod * \sa SDL_truncf @@ -5159,7 +5159,7 @@ extern SDL_DECLSPEC float SDLCALL SDL_fmodf(float x, float y); * * \threadsafety It is safe to call this function from any thread. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_isinff */ @@ -5173,7 +5173,7 @@ extern SDL_DECLSPEC int SDLCALL SDL_isinf(double x); * * \threadsafety It is safe to call this function from any thread. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_isinf */ @@ -5187,7 +5187,7 @@ extern SDL_DECLSPEC int SDLCALL SDL_isinff(float x); * * \threadsafety It is safe to call this function from any thread. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_isnanf */ @@ -5201,7 +5201,7 @@ extern SDL_DECLSPEC int SDLCALL SDL_isnan(double x); * * \threadsafety It is safe to call this function from any thread. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_isnan */ @@ -5229,7 +5229,7 @@ extern SDL_DECLSPEC int SDLCALL SDL_isnanf(float x); * * \threadsafety It is safe to call this function from any thread. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_logf * \sa SDL_log10 @@ -5259,7 +5259,7 @@ extern SDL_DECLSPEC double SDLCALL SDL_log(double x); * * \threadsafety It is safe to call this function from any thread. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_log * \sa SDL_expf @@ -5288,7 +5288,7 @@ extern SDL_DECLSPEC float SDLCALL SDL_logf(float x); * * \threadsafety It is safe to call this function from any thread. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_log10f * \sa SDL_log @@ -5318,7 +5318,7 @@ extern SDL_DECLSPEC double SDLCALL SDL_log10(double x); * * \threadsafety It is safe to call this function from any thread. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_log10 * \sa SDL_logf @@ -5338,7 +5338,7 @@ extern SDL_DECLSPEC float SDLCALL SDL_log10f(float x); * * \threadsafety It is safe to call this function from any thread. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_modff * \sa SDL_trunc @@ -5358,7 +5358,7 @@ extern SDL_DECLSPEC double SDLCALL SDL_modf(double x, double *y); * * \threadsafety It is safe to call this function from any thread. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_modf * \sa SDL_truncf @@ -5390,7 +5390,7 @@ extern SDL_DECLSPEC float SDLCALL SDL_modff(float x, float *y); * * \threadsafety It is safe to call this function from any thread. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_powf * \sa SDL_exp @@ -5422,7 +5422,7 @@ extern SDL_DECLSPEC double SDLCALL SDL_pow(double x, double y); * * \threadsafety It is safe to call this function from any thread. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_pow * \sa SDL_expf @@ -5449,7 +5449,7 @@ extern SDL_DECLSPEC float SDLCALL SDL_powf(float x, float y); * * \threadsafety It is safe to call this function from any thread. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_roundf * \sa SDL_lround @@ -5478,7 +5478,7 @@ extern SDL_DECLSPEC double SDLCALL SDL_round(double x); * * \threadsafety It is safe to call this function from any thread. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_round * \sa SDL_lroundf @@ -5507,7 +5507,7 @@ extern SDL_DECLSPEC float SDLCALL SDL_roundf(float x); * * \threadsafety It is safe to call this function from any thread. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_lroundf * \sa SDL_round @@ -5536,7 +5536,7 @@ extern SDL_DECLSPEC long SDLCALL SDL_lround(double x); * * \threadsafety It is safe to call this function from any thread. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_lround * \sa SDL_roundf @@ -5564,7 +5564,7 @@ extern SDL_DECLSPEC long SDLCALL SDL_lroundf(float x); * * \threadsafety It is safe to call this function from any thread. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_scalbnf * \sa SDL_pow @@ -5589,7 +5589,7 @@ extern SDL_DECLSPEC double SDLCALL SDL_scalbn(double x, int n); * * \threadsafety It is safe to call this function from any thread. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_scalbn * \sa SDL_powf @@ -5616,7 +5616,7 @@ extern SDL_DECLSPEC float SDLCALL SDL_scalbnf(float x, int n); * * \threadsafety It is safe to call this function from any thread. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_sinf * \sa SDL_asin @@ -5644,7 +5644,7 @@ extern SDL_DECLSPEC double SDLCALL SDL_sin(double x); * * \threadsafety It is safe to call this function from any thread. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_sin * \sa SDL_asinf @@ -5672,7 +5672,7 @@ extern SDL_DECLSPEC float SDLCALL SDL_sinf(float x); * * \threadsafety It is safe to call this function from any thread. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_sqrtf */ @@ -5698,7 +5698,7 @@ extern SDL_DECLSPEC double SDLCALL SDL_sqrt(double x); * * \threadsafety It is safe to call this function from any thread. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_sqrt */ @@ -5724,7 +5724,7 @@ extern SDL_DECLSPEC float SDLCALL SDL_sqrtf(float x); * * \threadsafety It is safe to call this function from any thread. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_tanf * \sa SDL_sin @@ -5754,7 +5754,7 @@ extern SDL_DECLSPEC double SDLCALL SDL_tan(double x); * * \threadsafety It is safe to call this function from any thread. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_tan * \sa SDL_sinf @@ -5767,7 +5767,7 @@ extern SDL_DECLSPEC float SDLCALL SDL_tanf(float x); /** * An opaque handle representing string encoding conversion state. * - * \since This datatype is available since SDL 3.1.3. + * \since This datatype is available since SDL 3.2.0. * * \sa SDL_iconv_open */ @@ -5782,7 +5782,7 @@ typedef struct SDL_iconv_data_t *SDL_iconv_t; * \returns a handle that must be freed with SDL_iconv_close, or * SDL_ICONV_ERROR on failure. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_iconv * \sa SDL_iconv_close @@ -5797,7 +5797,7 @@ extern SDL_DECLSPEC SDL_iconv_t SDLCALL SDL_iconv_open(const char *tocode, * \param cd The character set conversion handle. * \returns 0 on success, or -1 on failure. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_iconv * \sa SDL_iconv_open @@ -5835,7 +5835,7 @@ extern SDL_DECLSPEC int SDLCALL SDL_iconv_close(SDL_iconv_t cd); * \param outbytesleft The number of bytes in the output buffer. * \returns the number of conversions on success, or a negative error code. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_iconv_open * \sa SDL_iconv_close @@ -5870,7 +5870,7 @@ extern SDL_DECLSPEC size_t SDLCALL SDL_iconv(SDL_iconv_t cd, const char **inbuf, * \param inbytesleft the size of the input string _in bytes_. * \returns a new string, converted to the new encoding, or NULL on error. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_iconv_open * \sa SDL_iconv_close @@ -5893,7 +5893,7 @@ extern SDL_DECLSPEC char * SDLCALL SDL_iconv_string(const char *tocode, * \param S the string to convert. * \returns a new string, converted to the new encoding, or NULL on error. * - * \since This macro is available since SDL 3.1.3. + * \since This macro is available since SDL 3.2.0. */ #define SDL_iconv_utf8_locale(S) SDL_iconv_string("", "UTF-8", S, SDL_strlen(S)+1) @@ -5907,7 +5907,7 @@ extern SDL_DECLSPEC char * SDLCALL SDL_iconv_string(const char *tocode, * \param S the string to convert. * \returns a new string, converted to the new encoding, or NULL on error. * - * \since This macro is available since SDL 3.1.3. + * \since This macro is available since SDL 3.2.0. */ #define SDL_iconv_utf8_ucs2(S) (Uint16 *)SDL_iconv_string("UCS-2", "UTF-8", S, SDL_strlen(S)+1) @@ -5921,7 +5921,7 @@ extern SDL_DECLSPEC char * SDLCALL SDL_iconv_string(const char *tocode, * \param S the string to convert. * \returns a new string, converted to the new encoding, or NULL on error. * - * \since This macro is available since SDL 3.1.3. + * \since This macro is available since SDL 3.2.0. */ #define SDL_iconv_utf8_ucs4(S) (Uint32 *)SDL_iconv_string("UCS-4", "UTF-8", S, SDL_strlen(S)+1) @@ -5935,7 +5935,7 @@ extern SDL_DECLSPEC char * SDLCALL SDL_iconv_string(const char *tocode, * \param S the string to convert. * \returns a new string, converted to the new encoding, or NULL on error. * - * \since This macro is available since SDL 3.1.3. + * \since This macro is available since SDL 3.2.0. */ #define SDL_iconv_wchar_utf8(S) SDL_iconv_string("UTF-8", "WCHAR_T", (char *)S, (SDL_wcslen(S)+1)*sizeof(wchar_t)) @@ -6026,7 +6026,7 @@ char *strdup(const char *str); * * \threadsafety It is safe to call this function from any thread. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. */ SDL_FORCE_INLINE bool SDL_size_mul_check_overflow(size_t a, size_t b, size_t *ret) { @@ -6065,7 +6065,7 @@ SDL_FORCE_INLINE bool SDL_size_mul_check_overflow_builtin(size_t a, size_t b, si * * \threadsafety It is safe to call this function from any thread. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. */ SDL_FORCE_INLINE bool SDL_size_add_check_overflow(size_t a, size_t b, size_t *ret) { @@ -6104,7 +6104,7 @@ SDL_FORCE_INLINE bool SDL_size_add_check_overflow_builtin(size_t a, size_t b, si * perhaps to work around a compiler or existing code, you can define * `SDL_FUNCTION_POINTER_IS_VOID_POINTER` before including any SDL headers. * - * \since This datatype is available since SDL 3.1.3. + * \since This datatype is available since SDL 3.2.0. */ typedef void (*SDL_FunctionPointer)(void); #elif defined(SDL_FUNCTION_POINTER_IS_VOID_POINTER) diff --git a/include/SDL3/SDL_storage.h b/include/SDL3/SDL_storage.h index 25e19f317bc73..8b89ace18dd72 100644 --- a/include/SDL3/SDL_storage.h +++ b/include/SDL3/SDL_storage.h @@ -267,7 +267,7 @@ extern "C" { * * This structure should be initialized using SDL_INIT_INTERFACE() * - * \since This struct is available since SDL 3.1.3. + * \since This struct is available since SDL 3.2.0. * * \sa SDL_INIT_INTERFACE */ @@ -327,7 +327,7 @@ SDL_COMPILE_TIME_ASSERT(SDL_StorageInterface_SIZE, * functions like SDL_OpenTitleStorage or SDL_OpenUserStorage, etc, or create * an object with a custom implementation using SDL_OpenStorage. * - * \since This struct is available since SDL 3.1.3. + * \since This struct is available since SDL 3.2.0. */ typedef struct SDL_Storage SDL_Storage; @@ -339,7 +339,7 @@ typedef struct SDL_Storage SDL_Storage; * \returns a title storage container on success or NULL on failure; call * SDL_GetError() for more information. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_CloseStorage * \sa SDL_GetStorageFileSize @@ -362,7 +362,7 @@ extern SDL_DECLSPEC SDL_Storage * SDLCALL SDL_OpenTitleStorage(const char *overr * \returns a user storage container on success or NULL on failure; call * SDL_GetError() for more information. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_CloseStorage * \sa SDL_GetStorageFileSize @@ -386,7 +386,7 @@ extern SDL_DECLSPEC SDL_Storage * SDLCALL SDL_OpenUserStorage(const char *org, c * \returns a filesystem storage container on success or NULL on failure; call * SDL_GetError() for more information. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_CloseStorage * \sa SDL_GetStorageFileSize @@ -415,7 +415,7 @@ extern SDL_DECLSPEC SDL_Storage * SDLCALL SDL_OpenFileStorage(const char *path); * \returns a storage container on success or NULL on failure; call * SDL_GetError() for more information. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_CloseStorage * \sa SDL_GetStorageFileSize @@ -436,7 +436,7 @@ extern SDL_DECLSPEC SDL_Storage * SDLCALL SDL_OpenStorage(const SDL_StorageInter * returns an error, the container data will be freed; the error is * only for informational purposes. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_OpenFileStorage * \sa SDL_OpenStorage @@ -455,7 +455,7 @@ extern SDL_DECLSPEC bool SDLCALL SDL_CloseStorage(SDL_Storage *storage); * \param storage a storage container to query. * \returns true if the container is ready, false otherwise. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. */ extern SDL_DECLSPEC bool SDLCALL SDL_StorageReady(SDL_Storage *storage); @@ -468,7 +468,7 @@ extern SDL_DECLSPEC bool SDLCALL SDL_StorageReady(SDL_Storage *storage); * \returns true if the file could be queried or false on failure; call * SDL_GetError() for more information. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_ReadStorageFile * \sa SDL_StorageReady @@ -490,7 +490,7 @@ extern SDL_DECLSPEC bool SDLCALL SDL_GetStorageFileSize(SDL_Storage *storage, co * \returns true if the file was read or false on failure; call SDL_GetError() * for more information. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_GetStorageFileSize * \sa SDL_StorageReady @@ -508,7 +508,7 @@ extern SDL_DECLSPEC bool SDLCALL SDL_ReadStorageFile(SDL_Storage *storage, const * \returns true if the file was written or false on failure; call * SDL_GetError() for more information. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_GetStorageSpaceRemaining * \sa SDL_ReadStorageFile @@ -524,7 +524,7 @@ extern SDL_DECLSPEC bool SDLCALL SDL_WriteStorageFile(SDL_Storage *storage, cons * \returns true on success or false on failure; call SDL_GetError() for more * information. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_StorageReady */ @@ -553,7 +553,7 @@ extern SDL_DECLSPEC bool SDLCALL SDL_CreateStorageDirectory(SDL_Storage *storage * \returns true on success or false on failure; call SDL_GetError() for more * information. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_StorageReady */ @@ -567,7 +567,7 @@ extern SDL_DECLSPEC bool SDLCALL SDL_EnumerateStorageDirectory(SDL_Storage *stor * \returns true on success or false on failure; call SDL_GetError() for more * information. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_StorageReady */ @@ -582,7 +582,7 @@ extern SDL_DECLSPEC bool SDLCALL SDL_RemoveStoragePath(SDL_Storage *storage, con * \returns true on success or false on failure; call SDL_GetError() for more * information. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_StorageReady */ @@ -597,7 +597,7 @@ extern SDL_DECLSPEC bool SDLCALL SDL_RenameStoragePath(SDL_Storage *storage, con * \returns true on success or false on failure; call SDL_GetError() for more * information. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_StorageReady */ @@ -613,7 +613,7 @@ extern SDL_DECLSPEC bool SDLCALL SDL_CopyStorageFile(SDL_Storage *storage, const * \returns true on success or false if the file doesn't exist, or another * failure; call SDL_GetError() for more information. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_StorageReady */ @@ -625,7 +625,7 @@ extern SDL_DECLSPEC bool SDLCALL SDL_GetStoragePathInfo(SDL_Storage *storage, co * \param storage a storage container to query. * \returns the amount of remaining space, in bytes. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_StorageReady * \sa SDL_WriteStorageFile @@ -668,7 +668,7 @@ extern SDL_DECLSPEC Uint64 SDLCALL SDL_GetStorageSpaceRemaining(SDL_Storage *sto * \threadsafety It is safe to call this function from any thread, assuming * the `storage` object is thread-safe. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. */ extern SDL_DECLSPEC char ** SDLCALL SDL_GlobStorageDirectory(SDL_Storage *storage, const char *path, const char *pattern, SDL_GlobFlags flags, int *count); diff --git a/include/SDL3/SDL_surface.h b/include/SDL3/SDL_surface.h index db3103142dda7..0752f53072cb4 100644 --- a/include/SDL3/SDL_surface.h +++ b/include/SDL3/SDL_surface.h @@ -59,7 +59,7 @@ extern "C" { * * These are generally considered read-only. * - * \since This datatype is available since SDL 3.1.3. + * \since This datatype is available since SDL 3.2.0. */ typedef Uint32 SDL_SurfaceFlags; @@ -71,14 +71,14 @@ typedef Uint32 SDL_SurfaceFlags; /** * Evaluates to true if the surface needs to be locked before access. * - * \since This macro is available since SDL 3.1.3. + * \since This macro is available since SDL 3.2.0. */ #define SDL_MUSTLOCK(S) ((((S)->flags & SDL_SURFACE_LOCK_NEEDED)) == SDL_SURFACE_LOCK_NEEDED) /** * The scaling mode. * - * \since This enum is available since SDL 3.1.3. + * \since This enum is available since SDL 3.2.0. */ typedef enum SDL_ScaleMode { @@ -89,7 +89,7 @@ typedef enum SDL_ScaleMode /** * The flip mode. * - * \since This enum is available since SDL 3.1.3. + * \since This enum is available since SDL 3.2.0. */ typedef enum SDL_FlipMode { @@ -120,7 +120,7 @@ typedef enum SDL_FlipMode * format with a pitch of 32 would consist of 32x32 bytes of Y plane followed * by 32x16 bytes of UV plane. * - * \since This struct is available since SDL 3.1.3. + * \since This struct is available since SDL 3.2.0. * * \sa SDL_CreateSurface * \sa SDL_DestroySurface @@ -153,7 +153,7 @@ typedef struct SDL_Surface SDL_Surface; * \returns the new SDL_Surface structure that is created or NULL on failure; * call SDL_GetError() for more information. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_CreateSurfaceFrom * \sa SDL_DestroySurface @@ -181,7 +181,7 @@ extern SDL_DECLSPEC SDL_Surface * SDLCALL SDL_CreateSurface(int width, int heigh * \returns the new SDL_Surface structure that is created or NULL on failure; * call SDL_GetError() for more information. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_CreateSurface * \sa SDL_DestroySurface @@ -195,7 +195,7 @@ extern SDL_DECLSPEC SDL_Surface * SDLCALL SDL_CreateSurfaceFrom(int width, int h * * \param surface the SDL_Surface to free. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_CreateSurface * \sa SDL_CreateSurfaceFrom @@ -226,7 +226,7 @@ extern SDL_DECLSPEC void SDLCALL SDL_DestroySurface(SDL_Surface *surface); * \returns a valid property ID on success or 0 on failure; call * SDL_GetError() for more information. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. */ extern SDL_DECLSPEC SDL_PropertiesID SDLCALL SDL_GetSurfaceProperties(SDL_Surface *surface); @@ -246,7 +246,7 @@ extern SDL_DECLSPEC SDL_PropertiesID SDLCALL SDL_GetSurfaceProperties(SDL_Surfac * \returns true on success or false on failure; call SDL_GetError() for more * information. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_GetSurfaceColorspace */ @@ -263,7 +263,7 @@ extern SDL_DECLSPEC bool SDLCALL SDL_SetSurfaceColorspace(SDL_Surface *surface, * \returns the colorspace used by the surface, or SDL_COLORSPACE_UNKNOWN if * the surface is NULL. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_SetSurfaceColorspace */ @@ -291,7 +291,7 @@ extern SDL_DECLSPEC SDL_Colorspace SDLCALL SDL_GetSurfaceColorspace(SDL_Surface * the surface didn't have an index format); call SDL_GetError() for * more information. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_SetPaletteColors */ @@ -307,7 +307,7 @@ extern SDL_DECLSPEC SDL_Palette * SDLCALL SDL_CreateSurfacePalette(SDL_Surface * * \returns true on success or false on failure; call SDL_GetError() for more * information. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_CreatePalette * \sa SDL_GetSurfacePalette @@ -321,7 +321,7 @@ extern SDL_DECLSPEC bool SDLCALL SDL_SetSurfacePalette(SDL_Surface *surface, SDL * \returns a pointer to the palette used by the surface, or NULL if there is * no palette used. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_SetSurfacePalette */ @@ -344,7 +344,7 @@ extern SDL_DECLSPEC SDL_Palette * SDLCALL SDL_GetSurfacePalette(SDL_Surface *sur * \returns true on success or false on failure; call SDL_GetError() for more * information. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_RemoveSurfaceAlternateImages * \sa SDL_GetSurfaceImages @@ -358,7 +358,7 @@ extern SDL_DECLSPEC bool SDLCALL SDL_AddSurfaceAlternateImage(SDL_Surface *surfa * \param surface the SDL_Surface structure to query. * \returns true if alternate versions are available or false otherwise. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_AddSurfaceAlternateImage * \sa SDL_RemoveSurfaceAlternateImages @@ -383,7 +383,7 @@ extern SDL_DECLSPEC bool SDLCALL SDL_SurfaceHasAlternateImages(SDL_Surface *surf * failure; call SDL_GetError() for more information. This should be * freed with SDL_free() when it is no longer needed. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_AddSurfaceAlternateImage * \sa SDL_RemoveSurfaceAlternateImages @@ -399,7 +399,7 @@ extern SDL_DECLSPEC SDL_Surface ** SDLCALL SDL_GetSurfaceImages(SDL_Surface *sur * * \param surface the SDL_Surface structure to update. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_AddSurfaceAlternateImage * \sa SDL_GetSurfaceImages @@ -423,7 +423,7 @@ extern SDL_DECLSPEC void SDLCALL SDL_RemoveSurfaceAlternateImages(SDL_Surface *s * \returns true on success or false on failure; call SDL_GetError() for more * information. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_MUSTLOCK * \sa SDL_UnlockSurface @@ -435,7 +435,7 @@ extern SDL_DECLSPEC bool SDLCALL SDL_LockSurface(SDL_Surface *surface); * * \param surface the SDL_Surface structure to be unlocked. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_LockSurface */ @@ -453,7 +453,7 @@ extern SDL_DECLSPEC void SDLCALL SDL_UnlockSurface(SDL_Surface *surface); * \returns a pointer to a new SDL_Surface structure or NULL on failure; call * SDL_GetError() for more information. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_DestroySurface * \sa SDL_LoadBMP @@ -471,7 +471,7 @@ extern SDL_DECLSPEC SDL_Surface * SDLCALL SDL_LoadBMP_IO(SDL_IOStream *src, bool * \returns a pointer to a new SDL_Surface structure or NULL on failure; call * SDL_GetError() for more information. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_DestroySurface * \sa SDL_LoadBMP_IO @@ -495,7 +495,7 @@ extern SDL_DECLSPEC SDL_Surface * SDLCALL SDL_LoadBMP(const char *file); * \returns true on success or false on failure; call SDL_GetError() for more * information. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_LoadBMP_IO * \sa SDL_SaveBMP @@ -516,7 +516,7 @@ extern SDL_DECLSPEC bool SDLCALL SDL_SaveBMP_IO(SDL_Surface *surface, SDL_IOStre * \returns true on success or false on failure; call SDL_GetError() for more * information. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_LoadBMP * \sa SDL_SaveBMP_IO @@ -534,7 +534,7 @@ extern SDL_DECLSPEC bool SDLCALL SDL_SaveBMP(SDL_Surface *surface, const char *f * \returns true on success or false on failure; call SDL_GetError() for more * information. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_BlitSurface * \sa SDL_LockSurface @@ -550,7 +550,7 @@ extern SDL_DECLSPEC bool SDLCALL SDL_SetSurfaceRLE(SDL_Surface *surface, bool en * \param surface the SDL_Surface structure to query. * \returns true if the surface is RLE enabled, false otherwise. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_SetSurfaceRLE */ @@ -572,7 +572,7 @@ extern SDL_DECLSPEC bool SDLCALL SDL_SurfaceHasRLE(SDL_Surface *surface); * \returns true on success or false on failure; call SDL_GetError() for more * information. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_GetSurfaceColorKey * \sa SDL_SetSurfaceRLE @@ -588,7 +588,7 @@ extern SDL_DECLSPEC bool SDLCALL SDL_SetSurfaceColorKey(SDL_Surface *surface, bo * \param surface the SDL_Surface structure to query. * \returns true if the surface has a color key, false otherwise. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_SetSurfaceColorKey * \sa SDL_GetSurfaceColorKey @@ -608,7 +608,7 @@ extern SDL_DECLSPEC bool SDLCALL SDL_SurfaceHasColorKey(SDL_Surface *surface); * \returns true on success or false on failure; call SDL_GetError() for more * information. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_SetSurfaceColorKey * \sa SDL_SurfaceHasColorKey @@ -631,7 +631,7 @@ extern SDL_DECLSPEC bool SDLCALL SDL_GetSurfaceColorKey(SDL_Surface *surface, Ui * \returns true on success or false on failure; call SDL_GetError() for more * information. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_GetSurfaceColorMod * \sa SDL_SetSurfaceAlphaMod @@ -649,7 +649,7 @@ extern SDL_DECLSPEC bool SDLCALL SDL_SetSurfaceColorMod(SDL_Surface *surface, Ui * \returns true on success or false on failure; call SDL_GetError() for more * information. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_GetSurfaceAlphaMod * \sa SDL_SetSurfaceColorMod @@ -669,7 +669,7 @@ extern SDL_DECLSPEC bool SDLCALL SDL_GetSurfaceColorMod(SDL_Surface *surface, Ui * \returns true on success or false on failure; call SDL_GetError() for more * information. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_GetSurfaceAlphaMod * \sa SDL_SetSurfaceColorMod @@ -684,7 +684,7 @@ extern SDL_DECLSPEC bool SDLCALL SDL_SetSurfaceAlphaMod(SDL_Surface *surface, Ui * \returns true on success or false on failure; call SDL_GetError() for more * information. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_GetSurfaceColorMod * \sa SDL_SetSurfaceAlphaMod @@ -703,7 +703,7 @@ extern SDL_DECLSPEC bool SDLCALL SDL_GetSurfaceAlphaMod(SDL_Surface *surface, Ui * \returns true on success or false on failure; call SDL_GetError() for more * information. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_GetSurfaceBlendMode */ @@ -717,7 +717,7 @@ extern SDL_DECLSPEC bool SDLCALL SDL_SetSurfaceBlendMode(SDL_Surface *surface, S * \returns true on success or false on failure; call SDL_GetError() for more * information. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_SetSurfaceBlendMode */ @@ -738,7 +738,7 @@ extern SDL_DECLSPEC bool SDLCALL SDL_GetSurfaceBlendMode(SDL_Surface *surface, S * \returns true if the rectangle intersects the surface, otherwise false and * blits will be completely clipped. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_GetSurfaceClipRect */ @@ -757,7 +757,7 @@ extern SDL_DECLSPEC bool SDLCALL SDL_SetSurfaceClipRect(SDL_Surface *surface, co * \returns true on success or false on failure; call SDL_GetError() for more * information. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_SetSurfaceClipRect */ @@ -771,7 +771,7 @@ extern SDL_DECLSPEC bool SDLCALL SDL_GetSurfaceClipRect(SDL_Surface *surface, SD * \returns true on success or false on failure; call SDL_GetError() for more * information. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. */ extern SDL_DECLSPEC bool SDLCALL SDL_FlipSurface(SDL_Surface *surface, SDL_FlipMode flip); @@ -787,7 +787,7 @@ extern SDL_DECLSPEC bool SDLCALL SDL_FlipSurface(SDL_Surface *surface, SDL_FlipM * \returns a copy of the surface or NULL on failure; call SDL_GetError() for * more information. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_DestroySurface */ @@ -806,7 +806,7 @@ extern SDL_DECLSPEC SDL_Surface * SDLCALL SDL_DuplicateSurface(SDL_Surface *surf * \returns a copy of the surface or NULL on failure; call SDL_GetError() for * more information. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_DestroySurface */ @@ -831,7 +831,7 @@ extern SDL_DECLSPEC SDL_Surface * SDLCALL SDL_ScaleSurface(SDL_Surface *surface, * \returns the new SDL_Surface structure that is created or NULL on failure; * call SDL_GetError() for more information. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_ConvertSurfaceAndColorspace * \sa SDL_DestroySurface @@ -857,7 +857,7 @@ extern SDL_DECLSPEC SDL_Surface * SDLCALL SDL_ConvertSurface(SDL_Surface *surfac * \returns the new SDL_Surface structure that is created or NULL on failure; * call SDL_GetError() for more information. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_ConvertSurface * \sa SDL_DestroySurface @@ -878,7 +878,7 @@ extern SDL_DECLSPEC SDL_Surface * SDLCALL SDL_ConvertSurfaceAndColorspace(SDL_Su * \returns true on success or false on failure; call SDL_GetError() for more * information. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_ConvertPixelsAndColorspace */ @@ -907,7 +907,7 @@ extern SDL_DECLSPEC bool SDLCALL SDL_ConvertPixels(int width, int height, SDL_Pi * \returns true on success or false on failure; call SDL_GetError() for more * information. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_ConvertPixels */ @@ -931,7 +931,7 @@ extern SDL_DECLSPEC bool SDLCALL SDL_ConvertPixelsAndColorspace(int width, int h * \returns true on success or false on failure; call SDL_GetError() for more * information. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. */ extern SDL_DECLSPEC bool SDLCALL SDL_PremultiplyAlpha(int width, int height, SDL_PixelFormat src_format, const void *src, int src_pitch, SDL_PixelFormat dst_format, void *dst, int dst_pitch, bool linear); @@ -946,7 +946,7 @@ extern SDL_DECLSPEC bool SDLCALL SDL_PremultiplyAlpha(int width, int height, SDL * \returns true on success or false on failure; call SDL_GetError() for more * information. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. */ extern SDL_DECLSPEC bool SDLCALL SDL_PremultiplySurfaceAlpha(SDL_Surface *surface, bool linear); @@ -966,7 +966,7 @@ extern SDL_DECLSPEC bool SDLCALL SDL_PremultiplySurfaceAlpha(SDL_Surface *surfac * \returns true on success or false on failure; call SDL_GetError() for more * information. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. */ extern SDL_DECLSPEC bool SDLCALL SDL_ClearSurface(SDL_Surface *surface, float r, float g, float b, float a); @@ -989,7 +989,7 @@ extern SDL_DECLSPEC bool SDLCALL SDL_ClearSurface(SDL_Surface *surface, float r, * \returns true on success or false on failure; call SDL_GetError() for more * information. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_FillSurfaceRects */ @@ -1014,7 +1014,7 @@ extern SDL_DECLSPEC bool SDLCALL SDL_FillSurfaceRect(SDL_Surface *dst, const SDL * \returns true on success or false on failure; call SDL_GetError() for more * information. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_FillSurfaceRect */ @@ -1091,7 +1091,7 @@ extern SDL_DECLSPEC bool SDLCALL SDL_FillSurfaceRects(SDL_Surface *dst, const SD * threads at once. It is safe to use the same source surface * from multiple threads. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_BlitSurfaceScaled */ @@ -1116,7 +1116,7 @@ extern SDL_DECLSPEC bool SDLCALL SDL_BlitSurface(SDL_Surface *src, const SDL_Rec * threads at once. It is safe to use the same source surface * from multiple threads. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_BlitSurface */ @@ -1141,7 +1141,7 @@ extern SDL_DECLSPEC bool SDLCALL SDL_BlitSurfaceUnchecked(SDL_Surface *src, cons * threads at once. It is safe to use the same source surface * from multiple threads. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_BlitSurface */ @@ -1167,7 +1167,7 @@ extern SDL_DECLSPEC bool SDLCALL SDL_BlitSurfaceScaled(SDL_Surface *src, const S * threads at once. It is safe to use the same source surface * from multiple threads. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_BlitSurfaceScaled */ @@ -1193,7 +1193,7 @@ extern SDL_DECLSPEC bool SDLCALL SDL_BlitSurfaceUncheckedScaled(SDL_Surface *src * threads at once. It is safe to use the same source surface * from multiple threads. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_BlitSurface */ @@ -1223,7 +1223,7 @@ extern SDL_DECLSPEC bool SDLCALL SDL_BlitSurfaceTiled(SDL_Surface *src, const SD * threads at once. It is safe to use the same source surface * from multiple threads. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_BlitSurface */ @@ -1260,7 +1260,7 @@ extern SDL_DECLSPEC bool SDLCALL SDL_BlitSurfaceTiledWithScale(SDL_Surface *src, * threads at once. It is safe to use the same source surface * from multiple threads. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_BlitSurface */ @@ -1290,7 +1290,7 @@ extern SDL_DECLSPEC bool SDLCALL SDL_BlitSurface9Grid(SDL_Surface *src, const SD * \param b the blue component of the pixel in the range 0-255. * \returns a pixel value. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_MapSurfaceRGBA */ @@ -1321,7 +1321,7 @@ extern SDL_DECLSPEC Uint32 SDLCALL SDL_MapSurfaceRGB(SDL_Surface *surface, Uint8 * \param a the alpha component of the pixel in the range 0-255. * \returns a pixel value. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_MapSurfaceRGB */ @@ -1350,7 +1350,7 @@ extern SDL_DECLSPEC Uint32 SDLCALL SDL_MapSurfaceRGBA(SDL_Surface *surface, Uint * \returns true on success or false on failure; call SDL_GetError() for more * information. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. */ extern SDL_DECLSPEC bool SDLCALL SDL_ReadSurfacePixel(SDL_Surface *surface, int x, int y, Uint8 *r, Uint8 *g, Uint8 *b, Uint8 *a); @@ -1374,7 +1374,7 @@ extern SDL_DECLSPEC bool SDLCALL SDL_ReadSurfacePixel(SDL_Surface *surface, int * \returns true on success or false on failure; call SDL_GetError() for more * information. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. */ extern SDL_DECLSPEC bool SDLCALL SDL_ReadSurfacePixelFloat(SDL_Surface *surface, int x, int y, float *r, float *g, float *b, float *a); @@ -1397,7 +1397,7 @@ extern SDL_DECLSPEC bool SDLCALL SDL_ReadSurfacePixelFloat(SDL_Surface *surface, * \returns true on success or false on failure; call SDL_GetError() for more * information. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. */ extern SDL_DECLSPEC bool SDLCALL SDL_WriteSurfacePixel(SDL_Surface *surface, int x, int y, Uint8 r, Uint8 g, Uint8 b, Uint8 a); @@ -1417,7 +1417,7 @@ extern SDL_DECLSPEC bool SDLCALL SDL_WriteSurfacePixel(SDL_Surface *surface, int * \returns true on success or false on failure; call SDL_GetError() for more * information. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. */ extern SDL_DECLSPEC bool SDLCALL SDL_WriteSurfacePixelFloat(SDL_Surface *surface, int x, int y, float r, float g, float b, float a); diff --git a/include/SDL3/SDL_system.h b/include/SDL3/SDL_system.h index b59c42016a70e..294089ff4a337 100644 --- a/include/SDL3/SDL_system.h +++ b/include/SDL3/SDL_system.h @@ -70,7 +70,7 @@ typedef struct tagMSG MSG; * \threadsafety This may only be called (by SDL) from the thread handling the * Windows event loop. * - * \since This datatype is available since SDL 3.1.3. + * \since This datatype is available since SDL 3.2.0. * * \sa SDL_SetWindowsMessageHook * \sa SDL_HINT_WINDOWS_ENABLE_MESSAGELOOP @@ -86,7 +86,7 @@ typedef bool (SDLCALL *SDL_WindowsMessageHook)(void *userdata, MSG *msg); * \param callback the SDL_WindowsMessageHook function to call. * \param userdata a pointer to pass to every iteration of `callback`. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_WindowsMessageHook * \sa SDL_HINT_WINDOWS_ENABLE_MESSAGELOOP @@ -107,7 +107,7 @@ extern SDL_DECLSPEC void SDLCALL SDL_SetWindowsMessageHook(SDL_WindowsMessageHoo * \returns the D3D9 adapter index on success or -1 on failure; call * SDL_GetError() for more information. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. */ extern SDL_DECLSPEC int SDLCALL SDL_GetDirect3D9AdapterIndex(SDL_DisplayID displayID); @@ -124,7 +124,7 @@ extern SDL_DECLSPEC int SDLCALL SDL_GetDirect3D9AdapterIndex(SDL_DisplayID displ * \returns true on success or false on failure; call SDL_GetError() for more * information. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. */ extern SDL_DECLSPEC bool SDLCALL SDL_GetDXGIOutputInfo(SDL_DisplayID displayID, int *adapterIndex, int *outputIndex); @@ -154,7 +154,7 @@ typedef union _XEvent XEvent; * \threadsafety This may only be called (by SDL) from the thread handling the * X11 event loop. * - * \since This datatype is available since SDL 3.1.3. + * \since This datatype is available since SDL 3.2.0. * * \sa SDL_SetX11EventHook */ @@ -169,7 +169,7 @@ typedef bool (SDLCALL *SDL_X11EventHook)(void *userdata, XEvent *xevent); * \param callback the SDL_X11EventHook function to call. * \param userdata a pointer to pass to every iteration of `callback`. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. */ extern SDL_DECLSPEC void SDLCALL SDL_SetX11EventHook(SDL_X11EventHook callback, void *userdata); @@ -186,7 +186,7 @@ extern SDL_DECLSPEC void SDLCALL SDL_SetX11EventHook(SDL_X11EventHook callback, * \returns true on success or false on failure; call SDL_GetError() for more * information. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. */ extern SDL_DECLSPEC bool SDLCALL SDL_SetLinuxThreadPriority(Sint64 threadID, int priority); @@ -202,7 +202,7 @@ extern SDL_DECLSPEC bool SDLCALL SDL_SetLinuxThreadPriority(Sint64 threadID, int * \returns true on success or false on failure; call SDL_GetError() for more * information. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. */ extern SDL_DECLSPEC bool SDLCALL SDL_SetLinuxThreadPriorityAndPolicy(Sint64 threadID, int sdlPriority, int schedPolicy); @@ -225,7 +225,7 @@ extern SDL_DECLSPEC bool SDLCALL SDL_SetLinuxThreadPriorityAndPolicy(Sint64 thre * \param userdata what was passed as `callbackParam` to * SDL_SetiOSAnimationCallback as `callbackParam`. * - * \since This datatype is available since SDL 3.1.3. + * \since This datatype is available since SDL 3.2.0. * * \sa SDL_SetiOSAnimationCallback */ @@ -264,7 +264,7 @@ typedef void (SDLCALL *SDL_iOSAnimationCallback)(void *userdata); * \returns true on success or false on failure; call SDL_GetError() for more * information. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_SetiOSEventPump */ @@ -277,7 +277,7 @@ extern SDL_DECLSPEC bool SDLCALL SDL_SetiOSAnimationCallback(SDL_Window *window, * * \param enabled true to enable the event pump, false to disable it. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_SetiOSAnimationCallback */ @@ -307,7 +307,7 @@ extern SDL_DECLSPEC void SDLCALL SDL_SetiOSEventPump(bool enabled); * * \threadsafety It is safe to call this function from any thread. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_GetAndroidActivity */ @@ -332,7 +332,7 @@ extern SDL_DECLSPEC void * SDLCALL SDL_GetAndroidJNIEnv(void); * * \threadsafety It is safe to call this function from any thread. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_GetAndroidJNIEnv */ @@ -370,7 +370,7 @@ extern SDL_DECLSPEC void * SDLCALL SDL_GetAndroidActivity(void); * * \returns the Android API level. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. */ extern SDL_DECLSPEC int SDLCALL SDL_GetAndroidSDKVersion(void); @@ -379,7 +379,7 @@ extern SDL_DECLSPEC int SDLCALL SDL_GetAndroidSDKVersion(void); * * \returns true if this is a Chromebook, false otherwise. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. */ extern SDL_DECLSPEC bool SDLCALL SDL_IsChromebook(void); @@ -388,7 +388,7 @@ extern SDL_DECLSPEC bool SDLCALL SDL_IsChromebook(void); * * \returns true if this is a DeX docking station, false otherwise. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. */ extern SDL_DECLSPEC bool SDLCALL SDL_IsDeXMode(void); @@ -397,7 +397,7 @@ extern SDL_DECLSPEC bool SDLCALL SDL_IsDeXMode(void); * * \threadsafety It is safe to call this function from any thread. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. */ extern SDL_DECLSPEC void SDLCALL SDL_SendAndroidBackButton(void); @@ -405,7 +405,7 @@ extern SDL_DECLSPEC void SDLCALL SDL_SendAndroidBackButton(void); * See the official Android developer guide for more information: * http://developer.android.com/guide/topics/data/data-storage.html * - * \since This macro is available since SDL 3.1.3. + * \since This macro is available since SDL 3.2.0. */ #define SDL_ANDROID_EXTERNAL_STORAGE_READ 0x01 @@ -413,7 +413,7 @@ extern SDL_DECLSPEC void SDLCALL SDL_SendAndroidBackButton(void); * See the official Android developer guide for more information: * http://developer.android.com/guide/topics/data/data-storage.html * - * \since This macro is available since SDL 3.1.3. + * \since This macro is available since SDL 3.2.0. */ #define SDL_ANDROID_EXTERNAL_STORAGE_WRITE 0x02 @@ -433,7 +433,7 @@ extern SDL_DECLSPEC void SDLCALL SDL_SendAndroidBackButton(void); * \returns the path used for internal storage or NULL on failure; call * SDL_GetError() for more information. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_GetAndroidExternalStoragePath * \sa SDL_GetAndroidCachePath @@ -451,7 +451,7 @@ extern SDL_DECLSPEC const char * SDLCALL SDL_GetAndroidInternalStoragePath(void) * \returns the current state of external storage, or 0 if external storage is * currently unavailable. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_GetAndroidExternalStoragePath */ @@ -473,7 +473,7 @@ extern SDL_DECLSPEC Uint32 SDLCALL SDL_GetAndroidExternalStorageState(void); * \returns the path used for external storage for this application on success * or NULL on failure; call SDL_GetError() for more information. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_GetAndroidExternalStorageState * \sa SDL_GetAndroidInternalStoragePath @@ -496,7 +496,7 @@ extern SDL_DECLSPEC const char * SDLCALL SDL_GetAndroidExternalStoragePath(void) * \returns the path used for caches for this application on success or NULL * on failure; call SDL_GetError() for more information. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_GetAndroidInternalStoragePath * \sa SDL_GetAndroidExternalStoragePath @@ -510,7 +510,7 @@ extern SDL_DECLSPEC const char * SDLCALL SDL_GetAndroidCachePath(void); * \param permission the Android-specific permission name that was requested. * \param granted true if permission is granted, false if denied. * - * \since This datatype is available since SDL 3.1.3. + * \since This datatype is available since SDL 3.2.0. * * \sa SDL_RequestAndroidPermission */ @@ -548,7 +548,7 @@ typedef void (SDLCALL *SDL_RequestAndroidPermissionCallback)(void *userdata, con * * \threadsafety It is safe to call this function from any thread. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. */ extern SDL_DECLSPEC bool SDLCALL SDL_RequestAndroidPermission(const char *permission, SDL_RequestAndroidPermissionCallback cb, void *userdata); @@ -576,7 +576,7 @@ extern SDL_DECLSPEC bool SDLCALL SDL_RequestAndroidPermission(const char *permis * * \threadsafety It is safe to call this function from any thread. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. */ extern SDL_DECLSPEC bool SDLCALL SDL_ShowAndroidToast(const char *message, int duration, int gravity, int xoffset, int yoffset); @@ -592,7 +592,7 @@ extern SDL_DECLSPEC bool SDLCALL SDL_ShowAndroidToast(const char *message, int d * * \threadsafety It is safe to call this function from any thread. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. */ extern SDL_DECLSPEC bool SDLCALL SDL_SendAndroidMessage(Uint32 command, int param); @@ -605,7 +605,7 @@ extern SDL_DECLSPEC bool SDLCALL SDL_SendAndroidMessage(Uint32 command, int para * * \returns true if the device is a tablet, false otherwise. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. */ extern SDL_DECLSPEC bool SDLCALL SDL_IsTablet(void); @@ -616,7 +616,7 @@ extern SDL_DECLSPEC bool SDLCALL SDL_IsTablet(void); * * \returns true if the device is a TV, false otherwise. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. */ extern SDL_DECLSPEC bool SDLCALL SDL_IsTV(void); @@ -640,7 +640,7 @@ typedef enum SDL_Sandbox * \returns the application sandbox environment or SDL_SANDBOX_NONE if the * application is not running in a sandbox environment. * - * \since This function is available since SDL 3.1.6. + * \since This function is available since SDL 3.2.0. */ extern SDL_DECLSPEC SDL_Sandbox SDLCALL SDL_GetSandbox(void); @@ -660,7 +660,7 @@ extern SDL_DECLSPEC SDL_Sandbox SDLCALL SDL_GetSandbox(void); * * \threadsafety It is safe to call this function from any thread. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. */ extern SDL_DECLSPEC void SDLCALL SDL_OnApplicationWillTerminate(void); @@ -677,7 +677,7 @@ extern SDL_DECLSPEC void SDLCALL SDL_OnApplicationWillTerminate(void); * * \threadsafety It is safe to call this function from any thread. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. */ extern SDL_DECLSPEC void SDLCALL SDL_OnApplicationDidReceiveMemoryWarning(void); @@ -694,7 +694,7 @@ extern SDL_DECLSPEC void SDLCALL SDL_OnApplicationDidReceiveMemoryWarning(void); * * \threadsafety It is safe to call this function from any thread. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. */ extern SDL_DECLSPEC void SDLCALL SDL_OnApplicationWillEnterBackground(void); @@ -711,7 +711,7 @@ extern SDL_DECLSPEC void SDLCALL SDL_OnApplicationWillEnterBackground(void); * * \threadsafety It is safe to call this function from any thread. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. */ extern SDL_DECLSPEC void SDLCALL SDL_OnApplicationDidEnterBackground(void); @@ -728,7 +728,7 @@ extern SDL_DECLSPEC void SDLCALL SDL_OnApplicationDidEnterBackground(void); * * \threadsafety It is safe to call this function from any thread. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. */ extern SDL_DECLSPEC void SDLCALL SDL_OnApplicationWillEnterForeground(void); @@ -745,7 +745,7 @@ extern SDL_DECLSPEC void SDLCALL SDL_OnApplicationWillEnterForeground(void); * * \threadsafety It is safe to call this function from any thread. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. */ extern SDL_DECLSPEC void SDLCALL SDL_OnApplicationDidEnterForeground(void); @@ -764,7 +764,7 @@ extern SDL_DECLSPEC void SDLCALL SDL_OnApplicationDidEnterForeground(void); * * \threadsafety It is safe to call this function from any thread. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. */ extern SDL_DECLSPEC void SDLCALL SDL_OnApplicationDidChangeStatusBarOrientation(void); #endif @@ -788,7 +788,7 @@ typedef struct XUser *XUserHandle; * \returns true on success or false on failure; call SDL_GetError() for more * information. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. */ extern SDL_DECLSPEC bool SDLCALL SDL_GetGDKTaskQueue(XTaskQueueHandle *outTaskQueue); @@ -803,7 +803,7 @@ extern SDL_DECLSPEC bool SDLCALL SDL_GetGDKTaskQueue(XTaskQueueHandle *outTaskQu * \returns true if success or false on failure; call SDL_GetError() for more * information. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. */ extern SDL_DECLSPEC bool SDLCALL SDL_GetGDKDefaultUser(XUserHandle *outUserHandle); diff --git a/include/SDL3/SDL_thread.h b/include/SDL3/SDL_thread.h index 240812db1717e..a82352edfa2e9 100644 --- a/include/SDL3/SDL_thread.h +++ b/include/SDL3/SDL_thread.h @@ -62,7 +62,7 @@ extern "C" { * * These are opaque data. * - * \since This datatype is available since SDL 3.1.3. + * \since This datatype is available since SDL 3.2.0. * * \sa SDL_CreateThread * \sa SDL_WaitThread @@ -76,7 +76,7 @@ typedef struct SDL_Thread SDL_Thread; * application will operate on, but having a way to uniquely identify a thread * can be useful at times. * - * \since This datatype is available since SDL 3.1.3. + * \since This datatype is available since SDL 3.2.0. * * \sa SDL_GetThreadID * \sa SDL_GetCurrentThreadID @@ -89,7 +89,7 @@ typedef Uint64 SDL_ThreadID; * 0 is the invalid ID. An app can create these and then set data for these * IDs that is unique to each thread. * - * \since This datatype is available since SDL 3.1.3. + * \since This datatype is available since SDL 3.2.0. * * \sa SDL_GetTLS * \sa SDL_SetTLS @@ -105,7 +105,7 @@ typedef SDL_AtomicInt SDL_TLSID; * state. SDL_HINT_THREAD_PRIORITY_POLICY can be used to control aspects of * this behavior. * - * \since This enum is available since SDL 3.1.3. + * \since This enum is available since SDL 3.2.0. */ typedef enum SDL_ThreadPriority { SDL_THREAD_PRIORITY_LOW, @@ -119,7 +119,7 @@ typedef enum SDL_ThreadPriority { * * The current state of a thread can be checked by calling SDL_GetThreadState. * - * \since This enum is available since SDL 3.1.3. + * \since This enum is available since SDL 3.2.0. * * \sa SDL_GetThreadState */ @@ -137,7 +137,7 @@ typedef enum SDL_ThreadState * \param data what was passed as `data` to SDL_CreateThread(). * \returns a value that can be reported through SDL_WaitThread(). * - * \since This datatype is available since SDL 3.1.3. + * \since This datatype is available since SDL 3.2.0. */ typedef int (SDLCALL * SDL_ThreadFunction) (void *data); @@ -207,7 +207,7 @@ typedef int (SDLCALL * SDL_ThreadFunction) (void *data); * new thread could not be created; call SDL_GetError() for more * information. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_CreateThreadWithProperties * \sa SDL_WaitThread @@ -273,7 +273,7 @@ extern SDL_DECLSPEC SDL_Thread * SDLCALL SDL_CreateThread(SDL_ThreadFunction fn, * new thread could not be created; call SDL_GetError() for more * information. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_CreateThread * \sa SDL_WaitThread @@ -362,7 +362,7 @@ extern SDL_DECLSPEC SDL_Thread * SDLCALL SDL_CreateThreadWithPropertiesRuntime(S * \returns a pointer to a UTF-8 string that names the specified thread, or * NULL if it doesn't have a name. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. */ extern SDL_DECLSPEC const char * SDLCALL SDL_GetThreadName(SDL_Thread *thread); @@ -378,7 +378,7 @@ extern SDL_DECLSPEC const char * SDLCALL SDL_GetThreadName(SDL_Thread *thread); * * \returns the ID of the current thread. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_GetThreadID */ @@ -395,7 +395,7 @@ extern SDL_DECLSPEC SDL_ThreadID SDLCALL SDL_GetCurrentThreadID(void); * \returns the ID of the specified thread, or the ID of the current thread if * `thread` is NULL. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_GetCurrentThreadID */ @@ -412,7 +412,7 @@ extern SDL_DECLSPEC SDL_ThreadID SDLCALL SDL_GetThreadID(SDL_Thread *thread); * \returns true on success or false on failure; call SDL_GetError() for more * information. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. */ extern SDL_DECLSPEC bool SDLCALL SDL_SetCurrentThreadPriority(SDL_ThreadPriority priority); @@ -444,7 +444,7 @@ extern SDL_DECLSPEC bool SDLCALL SDL_SetCurrentThreadPriority(SDL_ThreadPriority * function by its 'return', or -1 if the thread has been * detached or isn't valid, may be NULL. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_CreateThread * \sa SDL_DetachThread @@ -458,7 +458,7 @@ extern SDL_DECLSPEC void SDLCALL SDL_WaitThread(SDL_Thread *thread, int *status) * \returns the current state of a thread, or SDL_THREAD_UNKNOWN if the thread * isn't valid. * - * \since This function is available since SDL 3.1.8. + * \since This function is available since SDL 3.2.0. * * \sa SDL_ThreadState */ @@ -493,7 +493,7 @@ extern SDL_DECLSPEC SDL_ThreadState SDLCALL SDL_GetThreadState(SDL_Thread *threa * \param thread the SDL_Thread pointer that was returned from the * SDL_CreateThread() call that started this thread. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_CreateThread * \sa SDL_WaitThread @@ -509,7 +509,7 @@ extern SDL_DECLSPEC void SDLCALL SDL_DetachThread(SDL_Thread *thread); * * \threadsafety It is safe to call this function from any thread. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_SetTLS */ @@ -522,7 +522,7 @@ extern SDL_DECLSPEC void * SDLCALL SDL_GetTLS(SDL_TLSID *id); * * \param value a pointer previously handed to SDL_SetTLS. * - * \since This datatype is available since SDL 3.1.3. + * \since This datatype is available since SDL 3.2.0. * * \sa SDL_SetTLS */ @@ -550,7 +550,7 @@ typedef void (SDLCALL *SDL_TLSDestructorCallback)(void *value); * * \threadsafety It is safe to call this function from any thread. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_GetTLS */ @@ -565,7 +565,7 @@ extern SDL_DECLSPEC bool SDLCALL SDL_SetTLS(SDL_TLSID *id, const void *value, SD * * \threadsafety It is safe to call this function from any thread. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. */ extern SDL_DECLSPEC void SDLCALL SDL_CleanupTLS(void); diff --git a/include/SDL3/SDL_time.h b/include/SDL3/SDL_time.h index cc611984de56f..b6d3f6d0d8018 100644 --- a/include/SDL3/SDL_time.h +++ b/include/SDL3/SDL_time.h @@ -49,7 +49,7 @@ extern "C" { * A structure holding a calendar date and time broken down into its * components. * - * \since This struct is available since SDL 3.1.3. + * \since This struct is available since SDL 3.2.0. */ typedef struct SDL_DateTime { @@ -67,7 +67,7 @@ typedef struct SDL_DateTime /** * The preferred date format of the current system locale. * - * \since This enum is available since SDL 3.1.3. + * \since This enum is available since SDL 3.2.0. * * \sa SDL_GetDateTimeLocalePreferences */ @@ -81,7 +81,7 @@ typedef enum SDL_DateFormat /** * The preferred time format of the current system locale. * - * \since This enum is available since SDL 3.1.3. + * \since This enum is available since SDL 3.2.0. * * \sa SDL_GetDateTimeLocalePreferences */ @@ -106,7 +106,7 @@ typedef enum SDL_TimeFormat * \returns true on success or false on failure; call SDL_GetError() for more * information. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. */ extern SDL_DECLSPEC bool SDLCALL SDL_GetDateTimeLocalePreferences(SDL_DateFormat *dateFormat, SDL_TimeFormat *timeFormat); @@ -118,7 +118,7 @@ extern SDL_DECLSPEC bool SDLCALL SDL_GetDateTimeLocalePreferences(SDL_DateFormat * \returns true on success or false on failure; call SDL_GetError() for more * information. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. */ extern SDL_DECLSPEC bool SDLCALL SDL_GetCurrentTime(SDL_Time *ticks); @@ -134,7 +134,7 @@ extern SDL_DECLSPEC bool SDLCALL SDL_GetCurrentTime(SDL_Time *ticks); * \returns true on success or false on failure; call SDL_GetError() for more * information. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. */ extern SDL_DECLSPEC bool SDLCALL SDL_TimeToDateTime(SDL_Time ticks, SDL_DateTime *dt, bool localTime); @@ -149,7 +149,7 @@ extern SDL_DECLSPEC bool SDLCALL SDL_TimeToDateTime(SDL_Time ticks, SDL_DateTime * \returns true on success or false on failure; call SDL_GetError() for more * information. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. */ extern SDL_DECLSPEC bool SDLCALL SDL_DateTimeToTime(const SDL_DateTime *dt, SDL_Time *ticks); @@ -165,7 +165,7 @@ extern SDL_DECLSPEC bool SDLCALL SDL_DateTimeToTime(const SDL_DateTime *dt, SDL_ * \param dwHighDateTime a pointer filled in with the high portion of the * Windows FILETIME value. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. */ extern SDL_DECLSPEC void SDLCALL SDL_TimeToWindows(SDL_Time ticks, Uint32 *dwLowDateTime, Uint32 *dwHighDateTime); @@ -180,7 +180,7 @@ extern SDL_DECLSPEC void SDLCALL SDL_TimeToWindows(SDL_Time ticks, Uint32 *dwLow * \param dwHighDateTime the high portion of the Windows FILETIME value. * \returns the converted SDL time. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. */ extern SDL_DECLSPEC SDL_Time SDLCALL SDL_TimeFromWindows(Uint32 dwLowDateTime, Uint32 dwHighDateTime); @@ -192,7 +192,7 @@ extern SDL_DECLSPEC SDL_Time SDLCALL SDL_TimeFromWindows(Uint32 dwLowDateTime, U * \returns the number of days in the requested month or -1 on failure; call * SDL_GetError() for more information. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. */ extern SDL_DECLSPEC int SDLCALL SDL_GetDaysInMonth(int year, int month); @@ -205,7 +205,7 @@ extern SDL_DECLSPEC int SDLCALL SDL_GetDaysInMonth(int year, int month); * \returns the day of year [0-365] if the date is valid or -1 on failure; * call SDL_GetError() for more information. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. */ extern SDL_DECLSPEC int SDLCALL SDL_GetDayOfYear(int year, int month, int day); @@ -218,7 +218,7 @@ extern SDL_DECLSPEC int SDLCALL SDL_GetDayOfYear(int year, int month, int day); * \returns a value between 0 and 6 (0 being Sunday) if the date is valid or * -1 on failure; call SDL_GetError() for more information. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. */ extern SDL_DECLSPEC int SDLCALL SDL_GetDayOfWeek(int year, int month, int day); diff --git a/include/SDL3/SDL_timer.h b/include/SDL3/SDL_timer.h index 24815880db159..cf94881d570d0 100644 --- a/include/SDL3/SDL_timer.h +++ b/include/SDL3/SDL_timer.h @@ -57,7 +57,7 @@ extern "C" { * * This is always 1000. * - * \since This macro is available since SDL 3.1.3. + * \since This macro is available since SDL 3.2.0. */ #define SDL_MS_PER_SECOND 1000 @@ -66,7 +66,7 @@ extern "C" { * * This is always 1000000. * - * \since This macro is available since SDL 3.1.3. + * \since This macro is available since SDL 3.2.0. */ #define SDL_US_PER_SECOND 1000000 @@ -75,7 +75,7 @@ extern "C" { * * This is always 1000000000. * - * \since This macro is available since SDL 3.1.3. + * \since This macro is available since SDL 3.2.0. */ #define SDL_NS_PER_SECOND 1000000000LL @@ -84,7 +84,7 @@ extern "C" { * * This is always 1000000. * - * \since This macro is available since SDL 3.1.3. + * \since This macro is available since SDL 3.2.0. */ #define SDL_NS_PER_MS 1000000 @@ -93,7 +93,7 @@ extern "C" { * * This is always 1000. * - * \since This macro is available since SDL 3.1.3. + * \since This macro is available since SDL 3.2.0. */ #define SDL_NS_PER_US 1000 @@ -107,7 +107,7 @@ extern "C" { * * \threadsafety It is safe to call this macro from any thread. * - * \since This macro is available since SDL 3.1.3. + * \since This macro is available since SDL 3.2.0. */ #define SDL_SECONDS_TO_NS(S) (((Uint64)(S)) * SDL_NS_PER_SECOND) @@ -122,7 +122,7 @@ extern "C" { * * \threadsafety It is safe to call this macro from any thread. * - * \since This macro is available since SDL 3.1.3. + * \since This macro is available since SDL 3.2.0. */ #define SDL_NS_TO_SECONDS(NS) ((NS) / SDL_NS_PER_SECOND) @@ -136,7 +136,7 @@ extern "C" { * * \threadsafety It is safe to call this macro from any thread. * - * \since This macro is available since SDL 3.1.3. + * \since This macro is available since SDL 3.2.0. */ #define SDL_MS_TO_NS(MS) (((Uint64)(MS)) * SDL_NS_PER_MS) @@ -151,7 +151,7 @@ extern "C" { * * \threadsafety It is safe to call this macro from any thread. * - * \since This macro is available since SDL 3.1.3. + * \since This macro is available since SDL 3.2.0. */ #define SDL_NS_TO_MS(NS) ((NS) / SDL_NS_PER_MS) @@ -165,7 +165,7 @@ extern "C" { * * \threadsafety It is safe to call this macro from any thread. * - * \since This macro is available since SDL 3.1.3. + * \since This macro is available since SDL 3.2.0. */ #define SDL_US_TO_NS(US) (((Uint64)(US)) * SDL_NS_PER_US) @@ -180,7 +180,7 @@ extern "C" { * * \threadsafety It is safe to call this macro from any thread. * - * \since This macro is available since SDL 3.1.3. + * \since This macro is available since SDL 3.2.0. */ #define SDL_NS_TO_US(NS) ((NS) / SDL_NS_PER_US) @@ -192,7 +192,7 @@ extern "C" { * * \threadsafety It is safe to call this function from any thread. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. */ extern SDL_DECLSPEC Uint64 SDLCALL SDL_GetTicks(void); @@ -204,7 +204,7 @@ extern SDL_DECLSPEC Uint64 SDLCALL SDL_GetTicks(void); * * \threadsafety It is safe to call this function from any thread. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. */ extern SDL_DECLSPEC Uint64 SDLCALL SDL_GetTicksNS(void); @@ -221,7 +221,7 @@ extern SDL_DECLSPEC Uint64 SDLCALL SDL_GetTicksNS(void); * * \threadsafety It is safe to call this function from any thread. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_GetPerformanceFrequency */ @@ -234,7 +234,7 @@ extern SDL_DECLSPEC Uint64 SDLCALL SDL_GetPerformanceCounter(void); * * \threadsafety It is safe to call this function from any thread. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_GetPerformanceCounter */ @@ -251,7 +251,7 @@ extern SDL_DECLSPEC Uint64 SDLCALL SDL_GetPerformanceFrequency(void); * * \threadsafety It is safe to call this function from any thread. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_DelayNS * \sa SDL_DelayPrecise @@ -269,7 +269,7 @@ extern SDL_DECLSPEC void SDLCALL SDL_Delay(Uint32 ms); * * \threadsafety It is safe to call this function from any thread. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_Delay * \sa SDL_DelayPrecise @@ -287,7 +287,7 @@ extern SDL_DECLSPEC void SDLCALL SDL_DelayNS(Uint64 ns); * * \threadsafety It is safe to call this function from any thread. * - * \since This function is available since SDL 3.1.6. + * \since This function is available since SDL 3.2.0. * * \sa SDL_Delay * \sa SDL_DelayNS @@ -297,7 +297,7 @@ extern SDL_DECLSPEC void SDLCALL SDL_DelayPrecise(Uint64 ns); /** * Definition of the timer ID type. * - * \since This datatype is available since SDL 3.1.3. + * \since This datatype is available since SDL 3.2.0. */ typedef Uint32 SDL_TimerID; @@ -321,7 +321,7 @@ typedef Uint32 SDL_TimerID; * thread; the application is responsible for locking resources * the callback touches that need to be protected. * - * \since This datatype is available since SDL 3.1.3. + * \since This datatype is available since SDL 3.2.0. * * \sa SDL_AddTimer */ @@ -356,7 +356,7 @@ typedef Uint32 (SDLCALL *SDL_TimerCallback)(void *userdata, SDL_TimerID timerID, * * \threadsafety It is safe to call this function from any thread. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_AddTimerNS * \sa SDL_RemoveTimer @@ -383,7 +383,7 @@ extern SDL_DECLSPEC SDL_TimerID SDLCALL SDL_AddTimer(Uint32 interval, SDL_TimerC * thread; the application is responsible for locking resources * the callback touches that need to be protected. * - * \since This datatype is available since SDL 3.1.3. + * \since This datatype is available since SDL 3.2.0. * * \sa SDL_AddTimerNS */ @@ -418,7 +418,7 @@ typedef Uint64 (SDLCALL *SDL_NSTimerCallback)(void *userdata, SDL_TimerID timerI * * \threadsafety It is safe to call this function from any thread. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_AddTimer * \sa SDL_RemoveTimer @@ -434,7 +434,7 @@ extern SDL_DECLSPEC SDL_TimerID SDLCALL SDL_AddTimerNS(Uint64 interval, SDL_NSTi * * \threadsafety It is safe to call this function from any thread. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_AddTimer */ diff --git a/include/SDL3/SDL_touch.h b/include/SDL3/SDL_touch.h index 1260f573d2f18..64845a1568260 100644 --- a/include/SDL3/SDL_touch.h +++ b/include/SDL3/SDL_touch.h @@ -57,7 +57,7 @@ extern "C" { * * The value 0 is an invalid ID. * - * \since This datatype is available since SDL 3.1.3. + * \since This datatype is available since SDL 3.2.0. */ typedef Uint64 SDL_TouchID; @@ -71,14 +71,14 @@ typedef Uint64 SDL_TouchID; * * The value 0 is an invalid ID. * - * \since This datatype is available since SDL 3.1.3. + * \since This datatype is available since SDL 3.2.0. */ typedef Uint64 SDL_FingerID; /** * An enum that describes the type of a touch device. * - * \since This enum is available since SDL 3.1.3. + * \since This enum is available since SDL 3.2.0. */ typedef enum SDL_TouchDeviceType { @@ -95,7 +95,7 @@ typedef enum SDL_TouchDeviceType * contact with the touch device (so a "touch" can be a "multitouch," in * reality), and this struct reports details of the specific fingers. * - * \since This struct is available since SDL 3.1.3. + * \since This struct is available since SDL 3.2.0. * * \sa SDL_GetTouchFingers */ @@ -110,14 +110,14 @@ typedef struct SDL_Finger /** * The SDL_MouseID for mouse events simulated with touch input. * - * \since This macro is available since SDL 3.1.3. + * \since This macro is available since SDL 3.2.0. */ #define SDL_TOUCH_MOUSEID ((SDL_MouseID)-1) /** * The SDL_TouchID for touch events simulated with mouse input. * - * \since This macro is available since SDL 3.1.3. + * \since This macro is available since SDL 3.2.0. */ #define SDL_MOUSE_TOUCHID ((SDL_TouchID)-1) @@ -135,7 +135,7 @@ typedef struct SDL_Finger * SDL_GetError() for more information. This should be freed with * SDL_free() when it is no longer needed. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. */ extern SDL_DECLSPEC SDL_TouchID * SDLCALL SDL_GetTouchDevices(int *count); @@ -146,7 +146,7 @@ extern SDL_DECLSPEC SDL_TouchID * SDLCALL SDL_GetTouchDevices(int *count); * \returns touch device name, or NULL on failure; call SDL_GetError() for * more information. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. */ extern SDL_DECLSPEC const char * SDLCALL SDL_GetTouchDeviceName(SDL_TouchID touchID); @@ -156,7 +156,7 @@ extern SDL_DECLSPEC const char * SDLCALL SDL_GetTouchDeviceName(SDL_TouchID touc * \param touchID the ID of a touch device. * \returns touch device type. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. */ extern SDL_DECLSPEC SDL_TouchDeviceType SDLCALL SDL_GetTouchDeviceType(SDL_TouchID touchID); @@ -171,7 +171,7 @@ extern SDL_DECLSPEC SDL_TouchDeviceType SDLCALL SDL_GetTouchDeviceType(SDL_Touch * allocation that should be freed with SDL_free() when it is no * longer needed. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. */ extern SDL_DECLSPEC SDL_Finger ** SDLCALL SDL_GetTouchFingers(SDL_TouchID touchID, int *count); diff --git a/include/SDL3/SDL_tray.h b/include/SDL3/SDL_tray.h index 83bd3b787c632..0b05db25b1c01 100644 --- a/include/SDL3/SDL_tray.h +++ b/include/SDL3/SDL_tray.h @@ -112,7 +112,7 @@ typedef void (SDLCALL *SDL_TrayCallback)(void *userdata, SDL_TrayEntry *entry); * * \threadsafety This function should only be called on the main thread. * - * \since This function is available since SDL 3.1.8. + * \since This function is available since SDL 3.2.0. * * \sa SDL_CreateTrayMenu * \sa SDL_GetTrayMenu @@ -129,7 +129,7 @@ extern SDL_DECLSPEC SDL_Tray *SDLCALL SDL_CreateTray(SDL_Surface *icon, const ch * \threadsafety This function should be called on the thread that created the * tray. * - * \since This function is available since SDL 3.1.8. + * \since This function is available since SDL 3.2.0. * * \sa SDL_CreateTray */ @@ -144,7 +144,7 @@ extern SDL_DECLSPEC void SDLCALL SDL_SetTrayIcon(SDL_Tray *tray, SDL_Surface *ic * \threadsafety This function should be called on the thread that created the * tray. * - * \since This function is available since SDL 3.1.8. + * \since This function is available since SDL 3.2.0. * * \sa SDL_CreateTray */ @@ -166,7 +166,7 @@ extern SDL_DECLSPEC void SDLCALL SDL_SetTrayTooltip(SDL_Tray *tray, const char * * \threadsafety This function should be called on the thread that created the * tray. * - * \since This function is available since SDL 3.1.8. + * \since This function is available since SDL 3.2.0. * * \sa SDL_CreateTray * \sa SDL_GetTrayMenu @@ -190,7 +190,7 @@ extern SDL_DECLSPEC SDL_TrayMenu *SDLCALL SDL_CreateTrayMenu(SDL_Tray *tray); * \threadsafety This function should be called on the thread that created the * tray. * - * \since This function is available since SDL 3.1.8. + * \since This function is available since SDL 3.2.0. * * \sa SDL_InsertTrayEntryAt * \sa SDL_GetTraySubmenu @@ -215,7 +215,7 @@ extern SDL_DECLSPEC SDL_TrayMenu *SDLCALL SDL_CreateTraySubmenu(SDL_TrayEntry *e * \threadsafety This function should be called on the thread that created the * tray. * - * \since This function is available since SDL 3.1.8. + * \since This function is available since SDL 3.2.0. * * \sa SDL_CreateTray * \sa SDL_CreateTrayMenu @@ -239,7 +239,7 @@ extern SDL_DECLSPEC SDL_TrayMenu *SDLCALL SDL_GetTrayMenu(SDL_Tray *tray); * \threadsafety This function should be called on the thread that created the * tray. * - * \since This function is available since SDL 3.1.8. + * \since This function is available since SDL 3.2.0. * * \sa SDL_InsertTrayEntryAt * \sa SDL_CreateTraySubmenu @@ -259,7 +259,7 @@ extern SDL_DECLSPEC SDL_TrayMenu *SDLCALL SDL_GetTraySubmenu(SDL_TrayEntry *entr * \threadsafety This function should be called on the thread that created the * tray. * - * \since This function is available since SDL 3.1.8. + * \since This function is available since SDL 3.2.0. * * \sa SDL_RemoveTrayEntry * \sa SDL_InsertTrayEntryAt @@ -274,7 +274,7 @@ extern SDL_DECLSPEC const SDL_TrayEntry **SDLCALL SDL_GetTrayEntries(SDL_TrayMen * \threadsafety This function should be called on the thread that created the * tray. * - * \since This function is available since SDL 3.1.8. + * \since This function is available since SDL 3.2.0. * * \sa SDL_GetTrayEntries * \sa SDL_InsertTrayEntryAt @@ -300,7 +300,7 @@ extern SDL_DECLSPEC void SDLCALL SDL_RemoveTrayEntry(SDL_TrayEntry *entry); * \threadsafety This function should be called on the thread that created the * tray. * - * \since This function is available since SDL 3.1.8. + * \since This function is available since SDL 3.2.0. * * \sa SDL_TrayEntryFlags * \sa SDL_GetTrayEntries @@ -323,7 +323,7 @@ extern SDL_DECLSPEC SDL_TrayEntry *SDLCALL SDL_InsertTrayEntryAt(SDL_TrayMenu *m * \threadsafety This function should be called on the thread that created the * tray. * - * \since This function is available since SDL 3.1.8. + * \since This function is available since SDL 3.2.0. * * \sa SDL_GetTrayEntries * \sa SDL_InsertTrayEntryAt @@ -342,7 +342,7 @@ extern SDL_DECLSPEC void SDLCALL SDL_SetTrayEntryLabel(SDL_TrayEntry *entry, con * \threadsafety This function should be called on the thread that created the * tray. * - * \since This function is available since SDL 3.1.8. + * \since This function is available since SDL 3.2.0. * * \sa SDL_GetTrayEntries * \sa SDL_InsertTrayEntryAt @@ -361,7 +361,7 @@ extern SDL_DECLSPEC const char *SDLCALL SDL_GetTrayEntryLabel(SDL_TrayEntry *ent * \threadsafety This function should be called on the thread that created the * tray. * - * \since This function is available since SDL 3.1.8. + * \since This function is available since SDL 3.2.0. * * \sa SDL_GetTrayEntries * \sa SDL_InsertTrayEntryAt @@ -380,7 +380,7 @@ extern SDL_DECLSPEC void SDLCALL SDL_SetTrayEntryChecked(SDL_TrayEntry *entry, b * \threadsafety This function should be called on the thread that created the * tray. * - * \since This function is available since SDL 3.1.8. + * \since This function is available since SDL 3.2.0. * * \sa SDL_GetTrayEntries * \sa SDL_InsertTrayEntryAt @@ -397,7 +397,7 @@ extern SDL_DECLSPEC bool SDLCALL SDL_GetTrayEntryChecked(SDL_TrayEntry *entry); * \threadsafety This function should be called on the thread that created the * tray. * - * \since This function is available since SDL 3.1.8. + * \since This function is available since SDL 3.2.0. * * \sa SDL_GetTrayEntries * \sa SDL_InsertTrayEntryAt @@ -414,7 +414,7 @@ extern SDL_DECLSPEC void SDLCALL SDL_SetTrayEntryEnabled(SDL_TrayEntry *entry, b * \threadsafety This function should be called on the thread that created the * tray. * - * \since This function is available since SDL 3.1.8. + * \since This function is available since SDL 3.2.0. * * \sa SDL_GetTrayEntries * \sa SDL_InsertTrayEntryAt @@ -433,7 +433,7 @@ extern SDL_DECLSPEC bool SDLCALL SDL_GetTrayEntryEnabled(SDL_TrayEntry *entry); * \threadsafety This function should be called on the thread that created the * tray. * - * \since This function is available since SDL 3.1.8. + * \since This function is available since SDL 3.2.0. * * \sa SDL_GetTrayEntries * \sa SDL_InsertTrayEntryAt @@ -448,7 +448,7 @@ extern SDL_DECLSPEC void SDLCALL SDL_SetTrayEntryCallback(SDL_TrayEntry *entry, * \threadsafety This function should be called on the thread that created the * tray. * - * \since This function is available since SDL 3.1.10. + * \since This function is available since SDL 3.2.0. */ extern SDL_DECLSPEC void SDLCALL SDL_ClickTrayEntry(SDL_TrayEntry *entry); @@ -462,7 +462,7 @@ extern SDL_DECLSPEC void SDLCALL SDL_ClickTrayEntry(SDL_TrayEntry *entry); * \threadsafety This function should be called on the thread that created the * tray. * - * \since This function is available since SDL 3.1.8. + * \since This function is available since SDL 3.2.0. * * \sa SDL_CreateTray */ @@ -477,7 +477,7 @@ extern SDL_DECLSPEC void SDLCALL SDL_DestroyTray(SDL_Tray *tray); * \threadsafety This function should be called on the thread that created the * tray. * - * \since This function is available since SDL 3.1.8. + * \since This function is available since SDL 3.2.0. * * \sa SDL_InsertTrayEntryAt */ @@ -496,7 +496,7 @@ extern SDL_DECLSPEC SDL_TrayMenu *SDLCALL SDL_GetTrayEntryParent(SDL_TrayEntry * * \threadsafety This function should be called on the thread that created the * tray. * - * \since This function is available since SDL 3.1.8. + * \since This function is available since SDL 3.2.0. * * \sa SDL_CreateTraySubmenu * \sa SDL_GetTrayMenuParentTray @@ -516,7 +516,7 @@ extern SDL_DECLSPEC SDL_TrayEntry *SDLCALL SDL_GetTrayMenuParentEntry(SDL_TrayMe * \threadsafety This function should be called on the thread that created the * tray. * - * \since This function is available since SDL 3.1.8. + * \since This function is available since SDL 3.2.0. * * \sa SDL_CreateTrayMenu * \sa SDL_GetTrayMenuParentEntry diff --git a/include/SDL3/SDL_version.h b/include/SDL3/SDL_version.h index 6f10351aafa8a..55014e3c1b724 100644 --- a/include/SDL3/SDL_version.h +++ b/include/SDL3/SDL_version.h @@ -42,7 +42,7 @@ extern "C" { * * If this were SDL version 3.2.1, this value would be 3. * - * \since This macro is available since SDL 3.1.3. + * \since This macro is available since SDL 3.2.0. */ #define SDL_MAJOR_VERSION 3 @@ -51,7 +51,7 @@ extern "C" { * * If this were SDL version 3.2.1, this value would be 2. * - * \since This macro is available since SDL 3.1.3. + * \since This macro is available since SDL 3.2.0. */ #define SDL_MINOR_VERSION 2 @@ -60,7 +60,7 @@ extern "C" { * * If this were SDL version 3.2.1, this value would be 1. * - * \since This macro is available since SDL 3.1.3. + * \since This macro is available since SDL 3.2.0. */ #define SDL_MICRO_VERSION 0 @@ -73,7 +73,7 @@ extern "C" { * \param minor the minorversion number. * \param patch the patch version number. * - * \since This macro is available since SDL 3.1.3. + * \since This macro is available since SDL 3.2.0. */ #define SDL_VERSIONNUM(major, minor, patch) \ ((major) * 1000000 + (minor) * 1000 + (patch)) @@ -85,7 +85,7 @@ extern "C" { * * \param version the version number. * - * \since This macro is available since SDL 3.1.3. + * \since This macro is available since SDL 3.2.0. */ #define SDL_VERSIONNUM_MAJOR(version) ((version) / 1000000) @@ -96,7 +96,7 @@ extern "C" { * * \param version the version number. * - * \since This macro is available since SDL 3.1.3. + * \since This macro is available since SDL 3.2.0. */ #define SDL_VERSIONNUM_MINOR(version) (((version) / 1000) % 1000) @@ -107,14 +107,14 @@ extern "C" { * * \param version the version number. * - * \since This macro is available since SDL 3.1.3. + * \since This macro is available since SDL 3.2.0. */ #define SDL_VERSIONNUM_MICRO(version) ((version) % 1000) /** * This is the version number macro for the current SDL version. * - * \since This macro is available since SDL 3.1.3. + * \since This macro is available since SDL 3.2.0. * * \sa SDL_GetVersion */ @@ -124,7 +124,7 @@ extern "C" { /** * This macro will evaluate to true if compiled with SDL at least X.Y.Z. * - * \since This macro is available since SDL 3.1.3. + * \since This macro is available since SDL 3.2.0. */ #define SDL_VERSION_ATLEAST(X, Y, Z) \ (SDL_VERSION >= SDL_VERSIONNUM(X, Y, Z)) @@ -141,7 +141,7 @@ extern "C" { * * \returns the version of the linked library. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_GetRevision */ @@ -167,7 +167,7 @@ extern SDL_DECLSPEC int SDLCALL SDL_GetVersion(void); * \returns an arbitrary string, uniquely identifying the exact revision of * the SDL library in use. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_GetVersion */ diff --git a/include/SDL3/SDL_video.h b/include/SDL3/SDL_video.h index 180526f708957..a7afc3267b324 100644 --- a/include/SDL3/SDL_video.h +++ b/include/SDL3/SDL_video.h @@ -70,7 +70,7 @@ extern "C" { * * The value 0 is an invalid ID. * - * \since This datatype is available since SDL 3.1.3. + * \since This datatype is available since SDL 3.2.0. */ typedef Uint32 SDL_DisplayID; @@ -79,7 +79,7 @@ typedef Uint32 SDL_DisplayID; * * The value 0 is an invalid ID. * - * \since This datatype is available since SDL 3.1.3. + * \since This datatype is available since SDL 3.2.0. */ typedef Uint32 SDL_WindowID; @@ -103,7 +103,7 @@ typedef Uint32 SDL_WindowID; /** * System theme. * - * \since This enum is available since SDL 3.1.3. + * \since This enum is available since SDL 3.2.0. */ typedef enum SDL_SystemTheme { @@ -117,7 +117,7 @@ typedef enum SDL_SystemTheme * * This lives as a field in SDL_DisplayMode, as opaque data. * - * \since This struct is available since SDL 3.1.3. + * \since This struct is available since SDL 3.2.0. * * \sa SDL_DisplayMode */ @@ -126,7 +126,7 @@ typedef struct SDL_DisplayModeData SDL_DisplayModeData; /** * The structure that defines a display mode. * - * \since This struct is available since SDL 3.1.3. + * \since This struct is available since SDL 3.2.0. * * \sa SDL_GetFullscreenDisplayModes * \sa SDL_GetDesktopDisplayMode @@ -152,7 +152,7 @@ typedef struct SDL_DisplayMode /** * Display orientation values; the way a display is rotated. * - * \since This enum is available since SDL 3.1.3. + * \since This enum is available since SDL 3.2.0. */ typedef enum SDL_DisplayOrientation { @@ -166,7 +166,7 @@ typedef enum SDL_DisplayOrientation /** * The struct used as an opaque handle to a window. * - * \since This struct is available since SDL 3.1.3. + * \since This struct is available since SDL 3.2.0. * * \sa SDL_CreateWindow */ @@ -180,7 +180,7 @@ typedef struct SDL_Window SDL_Window; * changed on existing windows by the app, and some of it might be altered by * the user or system outside of the app's control. * - * \since This datatype is available since SDL 3.1.3. + * \since This datatype is available since SDL 3.2.0. * * \sa SDL_GetWindowFlags */ @@ -219,7 +219,7 @@ typedef Uint64 SDL_WindowFlags; * Generally this macro isn't used directly, but rather through * SDL_WINDOWPOS_UNDEFINED or SDL_WINDOWPOS_UNDEFINED_DISPLAY. * - * \since This macro is available since SDL 3.1.3. + * \since This macro is available since SDL 3.2.0. */ #define SDL_WINDOWPOS_UNDEFINED_MASK 0x1FFF0000u @@ -231,7 +231,7 @@ typedef Uint64 SDL_WindowFlags; * * \param X the SDL_DisplayID of the display to use. * - * \since This macro is available since SDL 3.1.3. + * \since This macro is available since SDL 3.2.0. */ #define SDL_WINDOWPOS_UNDEFINED_DISPLAY(X) (SDL_WINDOWPOS_UNDEFINED_MASK|(X)) @@ -240,7 +240,7 @@ typedef Uint64 SDL_WindowFlags; * * This always uses the primary display. * - * \since This macro is available since SDL 3.1.3. + * \since This macro is available since SDL 3.2.0. */ #define SDL_WINDOWPOS_UNDEFINED SDL_WINDOWPOS_UNDEFINED_DISPLAY(0) @@ -249,7 +249,7 @@ typedef Uint64 SDL_WindowFlags; * * \param X the window position value. * - * \since This macro is available since SDL 3.1.3. + * \since This macro is available since SDL 3.2.0. */ #define SDL_WINDOWPOS_ISUNDEFINED(X) (((X)&0xFFFF0000) == SDL_WINDOWPOS_UNDEFINED_MASK) @@ -259,7 +259,7 @@ typedef Uint64 SDL_WindowFlags; * Generally this macro isn't used directly, but rather through * SDL_WINDOWPOS_CENTERED or SDL_WINDOWPOS_CENTERED_DISPLAY. * - * \since This macro is available since SDL 3.1.3. + * \since This macro is available since SDL 3.2.0. */ #define SDL_WINDOWPOS_CENTERED_MASK 0x2FFF0000u @@ -271,7 +271,7 @@ typedef Uint64 SDL_WindowFlags; * * \param X the SDL_DisplayID of the display to use. * - * \since This macro is available since SDL 3.1.3. + * \since This macro is available since SDL 3.2.0. */ #define SDL_WINDOWPOS_CENTERED_DISPLAY(X) (SDL_WINDOWPOS_CENTERED_MASK|(X)) @@ -280,7 +280,7 @@ typedef Uint64 SDL_WindowFlags; * * This always uses the primary display. * - * \since This macro is available since SDL 3.1.3. + * \since This macro is available since SDL 3.2.0. */ #define SDL_WINDOWPOS_CENTERED SDL_WINDOWPOS_CENTERED_DISPLAY(0) @@ -289,7 +289,7 @@ typedef Uint64 SDL_WindowFlags; * * \param X the window position value. * - * \since This macro is available since SDL 3.1.3. + * \since This macro is available since SDL 3.2.0. */ #define SDL_WINDOWPOS_ISCENTERED(X) \ (((X)&0xFFFF0000) == SDL_WINDOWPOS_CENTERED_MASK) @@ -298,7 +298,7 @@ typedef Uint64 SDL_WindowFlags; /** * Window flash operation. * - * \since This enum is available since SDL 3.1.3. + * \since This enum is available since SDL 3.2.0. */ typedef enum SDL_FlashOperation { @@ -310,7 +310,7 @@ typedef enum SDL_FlashOperation /** * An opaque handle to an OpenGL context. * - * \since This datatype is available since SDL 3.1.3. + * \since This datatype is available since SDL 3.2.0. * * \sa SDL_GL_CreateContext */ @@ -319,35 +319,35 @@ typedef struct SDL_GLContextState *SDL_GLContext; /** * Opaque type for an EGL display. * - * \since This datatype is available since SDL 3.1.3. + * \since This datatype is available since SDL 3.2.0. */ typedef void *SDL_EGLDisplay; /** * Opaque type for an EGL config. * - * \since This datatype is available since SDL 3.1.3. + * \since This datatype is available since SDL 3.2.0. */ typedef void *SDL_EGLConfig; /** * Opaque type for an EGL surface. * - * \since This datatype is available since SDL 3.1.3. + * \since This datatype is available since SDL 3.2.0. */ typedef void *SDL_EGLSurface; /** * An EGL attribute, used when creating an EGL context. * - * \since This datatype is available since SDL 3.1.3. + * \since This datatype is available since SDL 3.2.0. */ typedef intptr_t SDL_EGLAttrib; /** * An EGL integer attribute, used when creating an EGL surface. * - * \since This datatype is available since SDL 3.1.3. + * \since This datatype is available since SDL 3.2.0. */ typedef int SDL_EGLint; @@ -370,7 +370,7 @@ typedef int SDL_EGLint; * \param userdata an app-controlled pointer that is passed to the callback. * \returns a newly-allocated array of attributes, terminated with `EGL_NONE`. * - * \since This datatype is available since SDL 3.1.3. + * \since This datatype is available since SDL 3.2.0. * * \sa SDL_EGL_SetAttributeCallbacks */ @@ -401,7 +401,7 @@ typedef SDL_EGLAttrib *(SDLCALL *SDL_EGLAttribArrayCallback)(void *userdata); * \param config the EGL config to be used. * \returns a newly-allocated array of attributes, terminated with `EGL_NONE`. * - * \since This datatype is available since SDL 3.1.3. + * \since This datatype is available since SDL 3.2.0. * * \sa SDL_EGL_SetAttributeCallbacks */ @@ -422,7 +422,7 @@ typedef SDL_EGLint *(SDLCALL *SDL_EGLIntArrayCallback)(void *userdata, SDL_EGLDi * fail if the GL can't provide your requested attributes at a minimum, but * you should check to see exactly what you got. * - * \since This enum is available since SDL 3.1.3. + * \since This enum is available since SDL 3.2.0. */ typedef enum SDL_GLAttr { @@ -459,7 +459,7 @@ typedef enum SDL_GLAttr /** * Possible values to be set for the SDL_GL_CONTEXT_PROFILE_MASK attribute. * - * \since This datatype is available since SDL 3.1.3. + * \since This datatype is available since SDL 3.2.0. */ typedef Uint32 SDL_GLProfile; @@ -471,7 +471,7 @@ typedef Uint32 SDL_GLProfile; /** * Possible flags to be set for the SDL_GL_CONTEXT_FLAGS attribute. * - * \since This datatype is available since SDL 3.1.3. + * \since This datatype is available since SDL 3.2.0. */ typedef Uint32 SDL_GLContextFlag; @@ -485,7 +485,7 @@ typedef Uint32 SDL_GLContextFlag; * Possible values to be set for the SDL_GL_CONTEXT_RELEASE_BEHAVIOR * attribute. * - * \since This datatype is available since SDL 3.1.3. + * \since This datatype is available since SDL 3.2.0. */ typedef Uint32 SDL_GLContextReleaseFlag; @@ -496,7 +496,7 @@ typedef Uint32 SDL_GLContextReleaseFlag; /** * Possible values to be set SDL_GL_CONTEXT_RESET_NOTIFICATION attribute. * - * \since This datatype is available since SDL 3.1.3. + * \since This datatype is available since SDL 3.2.0. */ typedef Uint32 SDL_GLContextResetNotification; @@ -513,7 +513,7 @@ typedef Uint32 SDL_GLContextResetNotification; * * \threadsafety This function should only be called on the main thread. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_GetVideoDriver */ @@ -534,7 +534,7 @@ extern SDL_DECLSPEC int SDLCALL SDL_GetNumVideoDrivers(void); * * \threadsafety This function should only be called on the main thread. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_GetNumVideoDrivers */ @@ -552,7 +552,7 @@ extern SDL_DECLSPEC const char * SDLCALL SDL_GetVideoDriver(int index); * * \threadsafety This function should only be called on the main thread. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_GetNumVideoDrivers * \sa SDL_GetVideoDriver @@ -566,7 +566,7 @@ extern SDL_DECLSPEC const char * SDLCALL SDL_GetCurrentVideoDriver(void); * * \threadsafety This function should only be called on the main thread. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. */ extern SDL_DECLSPEC SDL_SystemTheme SDLCALL SDL_GetSystemTheme(void); @@ -581,7 +581,7 @@ extern SDL_DECLSPEC SDL_SystemTheme SDLCALL SDL_GetSystemTheme(void); * * \threadsafety This function should only be called on the main thread. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. */ extern SDL_DECLSPEC SDL_DisplayID * SDLCALL SDL_GetDisplays(int *count); @@ -593,7 +593,7 @@ extern SDL_DECLSPEC SDL_DisplayID * SDLCALL SDL_GetDisplays(int *count); * * \threadsafety This function should only be called on the main thread. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_GetDisplays */ @@ -623,7 +623,7 @@ extern SDL_DECLSPEC SDL_DisplayID SDLCALL SDL_GetPrimaryDisplay(void); * * \threadsafety This function should only be called on the main thread. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. */ extern SDL_DECLSPEC SDL_PropertiesID SDLCALL SDL_GetDisplayProperties(SDL_DisplayID displayID); @@ -639,7 +639,7 @@ extern SDL_DECLSPEC SDL_PropertiesID SDLCALL SDL_GetDisplayProperties(SDL_Displa * * \threadsafety This function should only be called on the main thread. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_GetDisplays */ @@ -658,7 +658,7 @@ extern SDL_DECLSPEC const char * SDLCALL SDL_GetDisplayName(SDL_DisplayID displa * * \threadsafety This function should only be called on the main thread. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_GetDisplayUsableBounds * \sa SDL_GetDisplays @@ -684,7 +684,7 @@ extern SDL_DECLSPEC bool SDLCALL SDL_GetDisplayBounds(SDL_DisplayID displayID, S * * \threadsafety This function should only be called on the main thread. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_GetDisplayBounds * \sa SDL_GetDisplays @@ -700,7 +700,7 @@ extern SDL_DECLSPEC bool SDLCALL SDL_GetDisplayUsableBounds(SDL_DisplayID displa * * \threadsafety This function should only be called on the main thread. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_GetDisplays */ @@ -715,7 +715,7 @@ extern SDL_DECLSPEC SDL_DisplayOrientation SDLCALL SDL_GetNaturalDisplayOrientat * * \threadsafety This function should only be called on the main thread. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_GetDisplays */ @@ -741,7 +741,7 @@ extern SDL_DECLSPEC SDL_DisplayOrientation SDLCALL SDL_GetCurrentDisplayOrientat * * \threadsafety This function should only be called on the main thread. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_GetWindowDisplayScale * \sa SDL_GetDisplays @@ -770,7 +770,7 @@ extern SDL_DECLSPEC float SDLCALL SDL_GetDisplayContentScale(SDL_DisplayID displ * * \threadsafety This function should only be called on the main thread. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_GetDisplays */ @@ -800,7 +800,7 @@ extern SDL_DECLSPEC SDL_DisplayMode ** SDLCALL SDL_GetFullscreenDisplayModes(SDL * * \threadsafety This function should only be called on the main thread. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_GetDisplays * \sa SDL_GetFullscreenDisplayModes @@ -821,7 +821,7 @@ extern SDL_DECLSPEC bool SDLCALL SDL_GetClosestFullscreenDisplayMode(SDL_Display * * \threadsafety This function should only be called on the main thread. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_GetCurrentDisplayMode * \sa SDL_GetDisplays @@ -842,7 +842,7 @@ extern SDL_DECLSPEC const SDL_DisplayMode * SDLCALL SDL_GetDesktopDisplayMode(SD * * \threadsafety This function should only be called on the main thread. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_GetDesktopDisplayMode * \sa SDL_GetDisplays @@ -858,7 +858,7 @@ extern SDL_DECLSPEC const SDL_DisplayMode * SDLCALL SDL_GetCurrentDisplayMode(SD * * \threadsafety This function should only be called on the main thread. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_GetDisplayBounds * \sa SDL_GetDisplays @@ -875,7 +875,7 @@ extern SDL_DECLSPEC SDL_DisplayID SDLCALL SDL_GetDisplayForPoint(const SDL_Point * * \threadsafety This function should only be called on the main thread. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_GetDisplayBounds * \sa SDL_GetDisplays @@ -892,7 +892,7 @@ extern SDL_DECLSPEC SDL_DisplayID SDLCALL SDL_GetDisplayForRect(const SDL_Rect * * * \threadsafety This function should only be called on the main thread. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_GetDisplayBounds * \sa SDL_GetDisplays @@ -912,7 +912,7 @@ extern SDL_DECLSPEC SDL_DisplayID SDLCALL SDL_GetDisplayForWindow(SDL_Window *wi * * \threadsafety This function should only be called on the main thread. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_GetWindowDisplayScale */ @@ -938,7 +938,7 @@ extern SDL_DECLSPEC float SDLCALL SDL_GetWindowPixelDensity(SDL_Window *window); * * \threadsafety This function should only be called on the main thread. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. */ extern SDL_DECLSPEC float SDLCALL SDL_GetWindowDisplayScale(SDL_Window *window); @@ -969,7 +969,7 @@ extern SDL_DECLSPEC float SDLCALL SDL_GetWindowDisplayScale(SDL_Window *window); * * \threadsafety This function should only be called on the main thread. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_GetWindowFullscreenMode * \sa SDL_SetWindowFullscreen @@ -986,7 +986,7 @@ extern SDL_DECLSPEC bool SDLCALL SDL_SetWindowFullscreenMode(SDL_Window *window, * * \threadsafety This function should only be called on the main thread. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_SetWindowFullscreenMode * \sa SDL_SetWindowFullscreen @@ -1004,7 +1004,7 @@ extern SDL_DECLSPEC const SDL_DisplayMode * SDLCALL SDL_GetWindowFullscreenMode( * * \threadsafety This function should only be called on the main thread. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. */ extern SDL_DECLSPEC void * SDLCALL SDL_GetWindowICCProfile(SDL_Window *window, size_t *size); @@ -1018,7 +1018,7 @@ extern SDL_DECLSPEC void * SDLCALL SDL_GetWindowICCProfile(SDL_Window *window, s * * \threadsafety This function should only be called on the main thread. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. */ extern SDL_DECLSPEC SDL_PixelFormat SDLCALL SDL_GetWindowPixelFormat(SDL_Window *window); @@ -1034,7 +1034,7 @@ extern SDL_DECLSPEC SDL_PixelFormat SDLCALL SDL_GetWindowPixelFormat(SDL_Window * * \threadsafety This function should only be called on the main thread. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. */ extern SDL_DECLSPEC SDL_Window ** SDLCALL SDL_GetWindows(int *count); @@ -1115,7 +1115,7 @@ extern SDL_DECLSPEC SDL_Window ** SDLCALL SDL_GetWindows(int *count); * * \threadsafety This function should only be called on the main thread. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_CreateWindowAndRenderer * \sa SDL_CreatePopupWindow @@ -1177,7 +1177,7 @@ extern SDL_DECLSPEC SDL_Window * SDLCALL SDL_CreateWindow(const char *title, int * * \threadsafety This function should only be called on the main thread. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_CreateWindow * \sa SDL_CreateWindowWithProperties @@ -1299,7 +1299,7 @@ extern SDL_DECLSPEC SDL_Window * SDLCALL SDL_CreatePopupWindow(SDL_Window *paren * * \threadsafety This function should only be called on the main thread. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_CreateProperties * \sa SDL_CreateWindow @@ -1354,7 +1354,7 @@ extern SDL_DECLSPEC SDL_Window * SDLCALL SDL_CreateWindowWithProperties(SDL_Prop * * \threadsafety This function should only be called on the main thread. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_GetWindowFromID */ @@ -1372,7 +1372,7 @@ extern SDL_DECLSPEC SDL_WindowID SDLCALL SDL_GetWindowID(SDL_Window *window); * * \threadsafety This function should only be called on the main thread. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_GetWindowID */ @@ -1387,7 +1387,7 @@ extern SDL_DECLSPEC SDL_Window * SDLCALL SDL_GetWindowFromID(SDL_WindowID id); * * \threadsafety This function should only be called on the main thread. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_CreatePopupWindow */ @@ -1511,7 +1511,7 @@ extern SDL_DECLSPEC SDL_Window * SDLCALL SDL_GetWindowParent(SDL_Window *window) * * \threadsafety This function should only be called on the main thread. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. */ extern SDL_DECLSPEC SDL_PropertiesID SDLCALL SDL_GetWindowProperties(SDL_Window *window); @@ -1559,7 +1559,7 @@ extern SDL_DECLSPEC SDL_PropertiesID SDLCALL SDL_GetWindowProperties(SDL_Window * * \threadsafety This function should only be called on the main thread. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_CreateWindow * \sa SDL_HideWindow @@ -1583,7 +1583,7 @@ extern SDL_DECLSPEC SDL_WindowFlags SDLCALL SDL_GetWindowFlags(SDL_Window *windo * * \threadsafety This function should only be called on the main thread. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_GetWindowTitle */ @@ -1598,7 +1598,7 @@ extern SDL_DECLSPEC bool SDLCALL SDL_SetWindowTitle(SDL_Window *window, const ch * * \threadsafety This function should only be called on the main thread. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_SetWindowTitle */ @@ -1624,7 +1624,7 @@ extern SDL_DECLSPEC const char * SDLCALL SDL_GetWindowTitle(SDL_Window *window); * * \threadsafety This function should only be called on the main thread. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. */ extern SDL_DECLSPEC bool SDLCALL SDL_SetWindowIcon(SDL_Window *window, SDL_Surface *icon); @@ -1662,7 +1662,7 @@ extern SDL_DECLSPEC bool SDLCALL SDL_SetWindowIcon(SDL_Window *window, SDL_Surfa * * \threadsafety This function should only be called on the main thread. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_GetWindowPosition * \sa SDL_SyncWindow @@ -1688,7 +1688,7 @@ extern SDL_DECLSPEC bool SDLCALL SDL_SetWindowPosition(SDL_Window *window, int x * * \threadsafety This function should only be called on the main thread. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_SetWindowPosition */ @@ -1723,7 +1723,7 @@ extern SDL_DECLSPEC bool SDLCALL SDL_GetWindowPosition(SDL_Window *window, int * * * \threadsafety This function should only be called on the main thread. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_GetWindowSize * \sa SDL_SetWindowFullscreenMode @@ -1746,7 +1746,7 @@ extern SDL_DECLSPEC bool SDLCALL SDL_SetWindowSize(SDL_Window *window, int w, in * * \threadsafety This function should only be called on the main thread. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_GetRenderOutputSize * \sa SDL_GetWindowSizeInPixels @@ -1772,7 +1772,7 @@ extern SDL_DECLSPEC bool SDLCALL SDL_GetWindowSize(SDL_Window *window, int *w, i * * \threadsafety This function should only be called on the main thread. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. */ extern SDL_DECLSPEC bool SDLCALL SDL_GetWindowSafeArea(SDL_Window *window, SDL_Rect *rect); @@ -1810,7 +1810,7 @@ extern SDL_DECLSPEC bool SDLCALL SDL_GetWindowSafeArea(SDL_Window *window, SDL_R * * \threadsafety This function should only be called on the main thread. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_GetWindowAspectRatio * \sa SDL_SyncWindow @@ -1830,7 +1830,7 @@ extern SDL_DECLSPEC bool SDLCALL SDL_SetWindowAspectRatio(SDL_Window *window, fl * * \threadsafety This function should only be called on the main thread. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_SetWindowAspectRatio */ @@ -1867,7 +1867,7 @@ extern SDL_DECLSPEC bool SDLCALL SDL_GetWindowAspectRatio(SDL_Window *window, fl * * \threadsafety This function should only be called on the main thread. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_GetWindowSize */ @@ -1886,7 +1886,7 @@ extern SDL_DECLSPEC bool SDLCALL SDL_GetWindowBordersSize(SDL_Window *window, in * * \threadsafety This function should only be called on the main thread. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_CreateWindow * \sa SDL_GetWindowSize @@ -1904,7 +1904,7 @@ extern SDL_DECLSPEC bool SDLCALL SDL_GetWindowSizeInPixels(SDL_Window *window, i * * \threadsafety This function should only be called on the main thread. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_GetWindowMinimumSize * \sa SDL_SetWindowMaximumSize @@ -1924,7 +1924,7 @@ extern SDL_DECLSPEC bool SDLCALL SDL_SetWindowMinimumSize(SDL_Window *window, in * * \threadsafety This function should only be called on the main thread. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_GetWindowMaximumSize * \sa SDL_SetWindowMinimumSize @@ -1942,7 +1942,7 @@ extern SDL_DECLSPEC bool SDLCALL SDL_GetWindowMinimumSize(SDL_Window *window, in * * \threadsafety This function should only be called on the main thread. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_GetWindowMaximumSize * \sa SDL_SetWindowMinimumSize @@ -1962,7 +1962,7 @@ extern SDL_DECLSPEC bool SDLCALL SDL_SetWindowMaximumSize(SDL_Window *window, in * * \threadsafety This function should only be called on the main thread. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_GetWindowMinimumSize * \sa SDL_SetWindowMaximumSize @@ -1985,7 +1985,7 @@ extern SDL_DECLSPEC bool SDLCALL SDL_GetWindowMaximumSize(SDL_Window *window, in * * \threadsafety This function should only be called on the main thread. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_GetWindowFlags */ @@ -2007,7 +2007,7 @@ extern SDL_DECLSPEC bool SDLCALL SDL_SetWindowBordered(SDL_Window *window, bool * * \threadsafety This function should only be called on the main thread. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_GetWindowFlags */ @@ -2026,7 +2026,7 @@ extern SDL_DECLSPEC bool SDLCALL SDL_SetWindowResizable(SDL_Window *window, bool * * \threadsafety This function should only be called on the main thread. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_GetWindowFlags */ @@ -2041,7 +2041,7 @@ extern SDL_DECLSPEC bool SDLCALL SDL_SetWindowAlwaysOnTop(SDL_Window *window, bo * * \threadsafety This function should only be called on the main thread. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_HideWindow * \sa SDL_RaiseWindow @@ -2057,7 +2057,7 @@ extern SDL_DECLSPEC bool SDLCALL SDL_ShowWindow(SDL_Window *window); * * \threadsafety This function should only be called on the main thread. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_ShowWindow * \sa SDL_WINDOW_HIDDEN @@ -2080,7 +2080,7 @@ extern SDL_DECLSPEC bool SDLCALL SDL_HideWindow(SDL_Window *window); * * \threadsafety This function should only be called on the main thread. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. */ extern SDL_DECLSPEC bool SDLCALL SDL_RaiseWindow(SDL_Window *window); @@ -2110,7 +2110,7 @@ extern SDL_DECLSPEC bool SDLCALL SDL_RaiseWindow(SDL_Window *window); * * \threadsafety This function should only be called on the main thread. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_MinimizeWindow * \sa SDL_RestoreWindow @@ -2139,7 +2139,7 @@ extern SDL_DECLSPEC bool SDLCALL SDL_MaximizeWindow(SDL_Window *window); * * \threadsafety This function should only be called on the main thread. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_MaximizeWindow * \sa SDL_RestoreWindow @@ -2169,7 +2169,7 @@ extern SDL_DECLSPEC bool SDLCALL SDL_MinimizeWindow(SDL_Window *window); * * \threadsafety This function should only be called on the main thread. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_MaximizeWindow * \sa SDL_MinimizeWindow @@ -2200,7 +2200,7 @@ extern SDL_DECLSPEC bool SDLCALL SDL_RestoreWindow(SDL_Window *window); * * \threadsafety This function should only be called on the main thread. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_GetWindowFullscreenMode * \sa SDL_SetWindowFullscreenMode @@ -2228,7 +2228,7 @@ extern SDL_DECLSPEC bool SDLCALL SDL_SetWindowFullscreen(SDL_Window *window, boo * * \threadsafety This function should only be called on the main thread. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_SetWindowSize * \sa SDL_SetWindowPosition @@ -2249,7 +2249,7 @@ extern SDL_DECLSPEC bool SDLCALL SDL_SyncWindow(SDL_Window *window); * * \threadsafety This function should only be called on the main thread. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_GetWindowSurface */ @@ -2275,7 +2275,7 @@ extern SDL_DECLSPEC bool SDLCALL SDL_WindowHasSurface(SDL_Window *window); * * \threadsafety This function should only be called on the main thread. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_DestroyWindowSurface * \sa SDL_WindowHasSurface @@ -2304,7 +2304,7 @@ extern SDL_DECLSPEC SDL_Surface * SDLCALL SDL_GetWindowSurface(SDL_Window *windo * * \threadsafety This function should only be called on the main thread. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_GetWindowSurfaceVSync */ @@ -2324,7 +2324,7 @@ extern SDL_DECLSPEC bool SDLCALL SDL_SetWindowSurfaceVSync(SDL_Window *window, i * * \threadsafety This function should only be called on the main thread. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_SetWindowSurfaceVSync */ @@ -2344,7 +2344,7 @@ extern SDL_DECLSPEC bool SDLCALL SDL_GetWindowSurfaceVSync(SDL_Window *window, i * * \threadsafety This function should only be called on the main thread. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_GetWindowSurface * \sa SDL_UpdateWindowSurfaceRects @@ -2373,7 +2373,7 @@ extern SDL_DECLSPEC bool SDLCALL SDL_UpdateWindowSurface(SDL_Window *window); * * \threadsafety This function should only be called on the main thread. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_GetWindowSurface * \sa SDL_UpdateWindowSurface @@ -2389,7 +2389,7 @@ extern SDL_DECLSPEC bool SDLCALL SDL_UpdateWindowSurfaceRects(SDL_Window *window * * \threadsafety This function should only be called on the main thread. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_GetWindowSurface * \sa SDL_WindowHasSurface @@ -2422,7 +2422,7 @@ extern SDL_DECLSPEC bool SDLCALL SDL_DestroyWindowSurface(SDL_Window *window); * * \threadsafety This function should only be called on the main thread. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_GetWindowKeyboardGrab * \sa SDL_SetWindowMouseGrab @@ -2441,7 +2441,7 @@ extern SDL_DECLSPEC bool SDLCALL SDL_SetWindowKeyboardGrab(SDL_Window *window, b * * \threadsafety This function should only be called on the main thread. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_GetWindowMouseRect * \sa SDL_SetWindowMouseRect @@ -2458,7 +2458,7 @@ extern SDL_DECLSPEC bool SDLCALL SDL_SetWindowMouseGrab(SDL_Window *window, bool * * \threadsafety This function should only be called on the main thread. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_SetWindowKeyboardGrab */ @@ -2472,7 +2472,7 @@ extern SDL_DECLSPEC bool SDLCALL SDL_GetWindowKeyboardGrab(SDL_Window *window); * * \threadsafety This function should only be called on the main thread. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_GetWindowMouseRect * \sa SDL_SetWindowMouseRect @@ -2488,7 +2488,7 @@ extern SDL_DECLSPEC bool SDLCALL SDL_GetWindowMouseGrab(SDL_Window *window); * * \threadsafety This function should only be called on the main thread. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_SetWindowMouseGrab * \sa SDL_SetWindowKeyboardGrab @@ -2509,7 +2509,7 @@ extern SDL_DECLSPEC SDL_Window * SDLCALL SDL_GetGrabbedWindow(void); * * \threadsafety This function should only be called on the main thread. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_GetWindowMouseRect * \sa SDL_GetWindowMouseGrab @@ -2526,7 +2526,7 @@ extern SDL_DECLSPEC bool SDLCALL SDL_SetWindowMouseRect(SDL_Window *window, cons * * \threadsafety This function should only be called on the main thread. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_SetWindowMouseRect * \sa SDL_GetWindowMouseGrab @@ -2549,7 +2549,7 @@ extern SDL_DECLSPEC const SDL_Rect * SDLCALL SDL_GetWindowMouseRect(SDL_Window * * * \threadsafety This function should only be called on the main thread. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_GetWindowOpacity */ @@ -2567,7 +2567,7 @@ extern SDL_DECLSPEC bool SDLCALL SDL_SetWindowOpacity(SDL_Window *window, float * * \threadsafety This function should only be called on the main thread. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_SetWindowOpacity */ @@ -2601,7 +2601,7 @@ extern SDL_DECLSPEC float SDLCALL SDL_GetWindowOpacity(SDL_Window *window); * * \threadsafety This function should only be called on the main thread. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_SetWindowModal */ @@ -2620,7 +2620,7 @@ extern SDL_DECLSPEC bool SDLCALL SDL_SetWindowParent(SDL_Window *window, SDL_Win * * \threadsafety This function should only be called on the main thread. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_SetWindowParent * \sa SDL_WINDOW_MODAL @@ -2637,7 +2637,7 @@ extern SDL_DECLSPEC bool SDLCALL SDL_SetWindowModal(SDL_Window *window, bool mod * * \threadsafety This function should only be called on the main thread. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. */ extern SDL_DECLSPEC bool SDLCALL SDL_SetWindowFocusable(SDL_Window *window, bool focusable); @@ -2663,7 +2663,7 @@ extern SDL_DECLSPEC bool SDLCALL SDL_SetWindowFocusable(SDL_Window *window, bool * * \threadsafety This function should only be called on the main thread. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. */ extern SDL_DECLSPEC bool SDLCALL SDL_ShowWindowSystemMenu(SDL_Window *window, int x, int y); @@ -2672,7 +2672,7 @@ extern SDL_DECLSPEC bool SDLCALL SDL_ShowWindowSystemMenu(SDL_Window *window, in * * \threadsafety This function should only be called on the main thread. * - * \since This enum is available since SDL 3.1.3. + * \since This enum is available since SDL 3.2.0. * * \sa SDL_HitTest */ @@ -2744,7 +2744,7 @@ typedef SDL_HitTestResult (SDLCALL *SDL_HitTest)(SDL_Window *win, * * \threadsafety This function should only be called on the main thread. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. */ extern SDL_DECLSPEC bool SDLCALL SDL_SetWindowHitTest(SDL_Window *window, SDL_HitTest callback, void *callback_data); @@ -2772,7 +2772,7 @@ extern SDL_DECLSPEC bool SDLCALL SDL_SetWindowHitTest(SDL_Window *window, SDL_Hi * * \threadsafety This function should only be called on the main thread. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. */ extern SDL_DECLSPEC bool SDLCALL SDL_SetWindowShape(SDL_Window *window, SDL_Surface *shape); @@ -2786,7 +2786,7 @@ extern SDL_DECLSPEC bool SDLCALL SDL_SetWindowShape(SDL_Window *window, SDL_Surf * * \threadsafety This function should only be called on the main thread. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. */ extern SDL_DECLSPEC bool SDLCALL SDL_FlashWindow(SDL_Window *window, SDL_FlashOperation operation); @@ -2804,7 +2804,7 @@ extern SDL_DECLSPEC bool SDLCALL SDL_FlashWindow(SDL_Window *window, SDL_FlashOp * * \threadsafety This function should only be called on the main thread. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_CreatePopupWindow * \sa SDL_CreateWindow @@ -2824,7 +2824,7 @@ extern SDL_DECLSPEC void SDLCALL SDL_DestroyWindow(SDL_Window *window); * * \threadsafety This function should only be called on the main thread. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_DisableScreenSaver * \sa SDL_EnableScreenSaver @@ -2839,7 +2839,7 @@ extern SDL_DECLSPEC bool SDLCALL SDL_ScreenSaverEnabled(void); * * \threadsafety This function should only be called on the main thread. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_DisableScreenSaver * \sa SDL_ScreenSaverEnabled @@ -2860,7 +2860,7 @@ extern SDL_DECLSPEC bool SDLCALL SDL_EnableScreenSaver(void); * * \threadsafety This function should only be called on the main thread. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_EnableScreenSaver * \sa SDL_ScreenSaverEnabled @@ -2890,7 +2890,7 @@ extern SDL_DECLSPEC bool SDLCALL SDL_DisableScreenSaver(void); * * \threadsafety This function should only be called on the main thread. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_GL_GetProcAddress * \sa SDL_GL_UnloadLibrary @@ -2944,7 +2944,7 @@ extern SDL_DECLSPEC bool SDLCALL SDL_GL_LoadLibrary(const char *path); * * \threadsafety This function should only be called on the main thread. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_GL_ExtensionSupported * \sa SDL_GL_LoadLibrary @@ -2965,7 +2965,7 @@ extern SDL_DECLSPEC SDL_FunctionPointer SDLCALL SDL_GL_GetProcAddress(const char * * \threadsafety This function should only be called on the main thread. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_EGL_GetCurrentDisplay */ @@ -2976,7 +2976,7 @@ extern SDL_DECLSPEC SDL_FunctionPointer SDLCALL SDL_EGL_GetProcAddress(const cha * * \threadsafety This function should only be called on the main thread. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_GL_LoadLibrary */ @@ -3001,7 +3001,7 @@ extern SDL_DECLSPEC void SDLCALL SDL_GL_UnloadLibrary(void); * * \threadsafety This function should only be called on the main thread. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. */ extern SDL_DECLSPEC bool SDLCALL SDL_GL_ExtensionSupported(const char *extension); @@ -3010,7 +3010,7 @@ extern SDL_DECLSPEC bool SDLCALL SDL_GL_ExtensionSupported(const char *extension * * \threadsafety This function should only be called on the main thread. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_GL_GetAttribute * \sa SDL_GL_SetAttribute @@ -3033,7 +3033,7 @@ extern SDL_DECLSPEC void SDLCALL SDL_GL_ResetAttributes(void); * * \threadsafety This function should only be called on the main thread. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_GL_GetAttribute * \sa SDL_GL_ResetAttributes @@ -3051,7 +3051,7 @@ extern SDL_DECLSPEC bool SDLCALL SDL_GL_SetAttribute(SDL_GLAttr attr, int value) * * \threadsafety This function should only be called on the main thread. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_GL_ResetAttributes * \sa SDL_GL_SetAttribute @@ -3075,7 +3075,7 @@ extern SDL_DECLSPEC bool SDLCALL SDL_GL_GetAttribute(SDL_GLAttr attr, int *value * * \threadsafety This function should only be called on the main thread. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_GL_DestroyContext * \sa SDL_GL_MakeCurrent @@ -3094,7 +3094,7 @@ extern SDL_DECLSPEC SDL_GLContext SDLCALL SDL_GL_CreateContext(SDL_Window *windo * * \threadsafety This function should only be called on the main thread. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_GL_CreateContext */ @@ -3108,7 +3108,7 @@ extern SDL_DECLSPEC bool SDLCALL SDL_GL_MakeCurrent(SDL_Window *window, SDL_GLCo * * \threadsafety This function should only be called on the main thread. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. */ extern SDL_DECLSPEC SDL_Window * SDLCALL SDL_GL_GetCurrentWindow(void); @@ -3120,7 +3120,7 @@ extern SDL_DECLSPEC SDL_Window * SDLCALL SDL_GL_GetCurrentWindow(void); * * \threadsafety This function should only be called on the main thread. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_GL_MakeCurrent */ @@ -3134,7 +3134,7 @@ extern SDL_DECLSPEC SDL_GLContext SDLCALL SDL_GL_GetCurrentContext(void); * * \threadsafety This function should only be called on the main thread. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. */ extern SDL_DECLSPEC SDL_EGLDisplay SDLCALL SDL_EGL_GetCurrentDisplay(void); @@ -3146,7 +3146,7 @@ extern SDL_DECLSPEC SDL_EGLDisplay SDLCALL SDL_EGL_GetCurrentDisplay(void); * * \threadsafety This function should only be called on the main thread. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. */ extern SDL_DECLSPEC SDL_EGLConfig SDLCALL SDL_EGL_GetCurrentConfig(void); @@ -3159,7 +3159,7 @@ extern SDL_DECLSPEC SDL_EGLConfig SDLCALL SDL_EGL_GetCurrentConfig(void); * * \threadsafety This function should only be called on the main thread. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. */ extern SDL_DECLSPEC SDL_EGLSurface SDLCALL SDL_EGL_GetWindowSurface(SDL_Window *window); @@ -3181,7 +3181,7 @@ extern SDL_DECLSPEC SDL_EGLSurface SDLCALL SDL_EGL_GetWindowSurface(SDL_Window * * * \threadsafety This function should only be called on the main thread. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. */ extern SDL_DECLSPEC void SDLCALL SDL_EGL_SetAttributeCallbacks(SDL_EGLAttribArrayCallback platformAttribCallback, SDL_EGLIntArrayCallback surfaceAttribCallback, @@ -3212,7 +3212,7 @@ extern SDL_DECLSPEC void SDLCALL SDL_EGL_SetAttributeCallbacks(SDL_EGLAttribArra * * \threadsafety This function should only be called on the main thread. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_GL_GetSwapInterval */ @@ -3233,7 +3233,7 @@ extern SDL_DECLSPEC bool SDLCALL SDL_GL_SetSwapInterval(int interval); * * \threadsafety This function should only be called on the main thread. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_GL_SetSwapInterval */ @@ -3255,7 +3255,7 @@ extern SDL_DECLSPEC bool SDLCALL SDL_GL_GetSwapInterval(int *interval); * * \threadsafety This function should only be called on the main thread. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. */ extern SDL_DECLSPEC bool SDLCALL SDL_GL_SwapWindow(SDL_Window *window); @@ -3268,7 +3268,7 @@ extern SDL_DECLSPEC bool SDLCALL SDL_GL_SwapWindow(SDL_Window *window); * * \threadsafety This function should only be called on the main thread. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_GL_CreateContext */ diff --git a/include/SDL3/SDL_vulkan.h b/include/SDL3/SDL_vulkan.h index e85efc9638a08..5a487561a8ee4 100644 --- a/include/SDL3/SDL_vulkan.h +++ b/include/SDL3/SDL_vulkan.h @@ -125,7 +125,7 @@ struct VkAllocationCallbacks; * * \threadsafety This function is not thread safe. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_Vulkan_GetVkGetInstanceProcAddr * \sa SDL_Vulkan_UnloadLibrary @@ -149,7 +149,7 @@ extern SDL_DECLSPEC bool SDLCALL SDL_Vulkan_LoadLibrary(const char *path); * \returns the function pointer for `vkGetInstanceProcAddr` or NULL on * failure; call SDL_GetError() for more information. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. */ extern SDL_DECLSPEC SDL_FunctionPointer SDLCALL SDL_Vulkan_GetVkGetInstanceProcAddr(void); @@ -169,7 +169,7 @@ extern SDL_DECLSPEC SDL_FunctionPointer SDLCALL SDL_Vulkan_GetVkGetInstanceProcA * * \threadsafety This function is not thread safe. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_Vulkan_LoadLibrary */ @@ -193,7 +193,7 @@ extern SDL_DECLSPEC void SDLCALL SDL_Vulkan_UnloadLibrary(void); * \returns an array of extension name strings on success, NULL on failure; * call SDL_GetError() for more information. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_Vulkan_CreateSurface */ @@ -218,7 +218,7 @@ extern SDL_DECLSPEC char const * const * SDLCALL SDL_Vulkan_GetInstanceExtension * \returns true on success or false on failure; call SDL_GetError() for more * information. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_Vulkan_GetInstanceExtensions * \sa SDL_Vulkan_DestroySurface @@ -246,7 +246,7 @@ extern SDL_DECLSPEC bool SDLCALL SDL_Vulkan_CreateSurface(SDL_Window *window, * \param allocator a VkAllocationCallbacks struct, which lets the app set the * allocator that destroys the surface. Can be NULL. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_Vulkan_GetInstanceExtensions * \sa SDL_Vulkan_CreateSurface @@ -268,7 +268,7 @@ extern SDL_DECLSPEC void SDLCALL SDL_Vulkan_DestroySurface(VkInstance instance, * device. * \returns true if supported, false if unsupported or an error occurred. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. * * \sa SDL_Vulkan_GetInstanceExtensions */ From ed2920afefbe3332ef42b9d92dbbf21776797ed5 Mon Sep 17 00:00:00 2001 From: Sam Lantinga Date: Tue, 21 Jan 2025 10:19:21 -0800 Subject: [PATCH 214/340] All SDL 3.0 release symbols are at version 3.2.0 --- include/SDL3/SDL_gpu.h | 152 ++++++++++++++++---------------- include/SDL3/SDL_hints.h | 2 +- include/SDL3/SDL_intrin.h | 28 +++--- include/SDL3/SDL_main.h | 10 +-- include/SDL3/SDL_pen.h | 2 +- include/SDL3/SDL_power.h | 2 +- include/SDL3/SDL_stdinc.h | 2 +- include/SDL3/SDL_test_compare.h | 2 +- include/SDL3/SDL_test_font.h | 12 +-- include/SDL3/SDL_thread.h | 4 +- 10 files changed, 108 insertions(+), 108 deletions(-) diff --git a/include/SDL3/SDL_gpu.h b/include/SDL3/SDL_gpu.h index 1de755b85ee86..fa870a5798c8d 100644 --- a/include/SDL3/SDL_gpu.h +++ b/include/SDL3/SDL_gpu.h @@ -321,7 +321,7 @@ extern "C" { /** * An opaque handle representing the SDL_GPU context. * - * \since This struct is available since SDL 3.2.0 + * \since This struct is available since SDL 3.2.0. */ typedef struct SDL_GPUDevice SDL_GPUDevice; @@ -331,7 +331,7 @@ typedef struct SDL_GPUDevice SDL_GPUDevice; * Used for vertices, indices, indirect draw commands, and general compute * data. * - * \since This struct is available since SDL 3.2.0 + * \since This struct is available since SDL 3.2.0. * * \sa SDL_CreateGPUBuffer * \sa SDL_UploadToGPUBuffer @@ -354,7 +354,7 @@ typedef struct SDL_GPUBuffer SDL_GPUBuffer; * * Used for transferring data to and from the device. * - * \since This struct is available since SDL 3.2.0 + * \since This struct is available since SDL 3.2.0. * * \sa SDL_CreateGPUTransferBuffer * \sa SDL_MapGPUTransferBuffer @@ -370,7 +370,7 @@ typedef struct SDL_GPUTransferBuffer SDL_GPUTransferBuffer; /** * An opaque handle representing a texture. * - * \since This struct is available since SDL 3.2.0 + * \since This struct is available since SDL 3.2.0. * * \sa SDL_CreateGPUTexture * \sa SDL_UploadToGPUTexture @@ -390,7 +390,7 @@ typedef struct SDL_GPUTexture SDL_GPUTexture; /** * An opaque handle representing a sampler. * - * \since This struct is available since SDL 3.2.0 + * \since This struct is available since SDL 3.2.0. * * \sa SDL_CreateGPUSampler * \sa SDL_BindGPUVertexSamplers @@ -402,7 +402,7 @@ typedef struct SDL_GPUSampler SDL_GPUSampler; /** * An opaque handle representing a compiled shader object. * - * \since This struct is available since SDL 3.2.0 + * \since This struct is available since SDL 3.2.0. * * \sa SDL_CreateGPUShader * \sa SDL_CreateGPUGraphicsPipeline @@ -415,7 +415,7 @@ typedef struct SDL_GPUShader SDL_GPUShader; * * Used during compute passes. * - * \since This struct is available since SDL 3.2.0 + * \since This struct is available since SDL 3.2.0. * * \sa SDL_CreateGPUComputePipeline * \sa SDL_BindGPUComputePipeline @@ -428,7 +428,7 @@ typedef struct SDL_GPUComputePipeline SDL_GPUComputePipeline; * * Used during render passes. * - * \since This struct is available since SDL 3.2.0 + * \since This struct is available since SDL 3.2.0. * * \sa SDL_CreateGPUGraphicsPipeline * \sa SDL_BindGPUGraphicsPipeline @@ -453,7 +453,7 @@ typedef struct SDL_GPUGraphicsPipeline SDL_GPUGraphicsPipeline; * In multi-threading scenarios, you should only access a command buffer on * the thread you acquired it from. * - * \since This struct is available since SDL 3.2.0 + * \since This struct is available since SDL 3.2.0. * * \sa SDL_AcquireGPUCommandBuffer * \sa SDL_SubmitGPUCommandBuffer @@ -467,7 +467,7 @@ typedef struct SDL_GPUCommandBuffer SDL_GPUCommandBuffer; * This handle is transient and should not be held or referenced after * SDL_EndGPURenderPass is called. * - * \since This struct is available since SDL 3.2.0 + * \since This struct is available since SDL 3.2.0. * * \sa SDL_BeginGPURenderPass * \sa SDL_EndGPURenderPass @@ -480,7 +480,7 @@ typedef struct SDL_GPURenderPass SDL_GPURenderPass; * This handle is transient and should not be held or referenced after * SDL_EndGPUComputePass is called. * - * \since This struct is available since SDL 3.2.0 + * \since This struct is available since SDL 3.2.0. * * \sa SDL_BeginGPUComputePass * \sa SDL_EndGPUComputePass @@ -493,7 +493,7 @@ typedef struct SDL_GPUComputePass SDL_GPUComputePass; * This handle is transient and should not be held or referenced after * SDL_EndGPUCopyPass is called. * - * \since This struct is available since SDL 3.2.0 + * \since This struct is available since SDL 3.2.0. * * \sa SDL_BeginGPUCopyPass * \sa SDL_EndGPUCopyPass @@ -503,7 +503,7 @@ typedef struct SDL_GPUCopyPass SDL_GPUCopyPass; /** * An opaque handle representing a fence. * - * \since This struct is available since SDL 3.2.0 + * \since This struct is available since SDL 3.2.0. * * \sa SDL_SubmitGPUCommandBufferAndAcquireFence * \sa SDL_QueryGPUFence @@ -529,7 +529,7 @@ typedef struct SDL_GPUFence SDL_GPUFence; * topology for both compatibility and performance reasons. You WILL regret * using it. * - * \since This enum is available since SDL 3.2.0 + * \since This enum is available since SDL 3.2.0. * * \sa SDL_CreateGPUGraphicsPipeline */ @@ -546,7 +546,7 @@ typedef enum SDL_GPUPrimitiveType * Specifies how the contents of a texture attached to a render pass are * treated at the beginning of the render pass. * - * \since This enum is available since SDL 3.2.0 + * \since This enum is available since SDL 3.2.0. * * \sa SDL_BeginGPURenderPass */ @@ -561,7 +561,7 @@ typedef enum SDL_GPULoadOp * Specifies how the contents of a texture attached to a render pass are * treated at the end of the render pass. * - * \since This enum is available since SDL 3.2.0 + * \since This enum is available since SDL 3.2.0. * * \sa SDL_BeginGPURenderPass */ @@ -576,7 +576,7 @@ typedef enum SDL_GPUStoreOp /** * Specifies the size of elements in an index buffer. * - * \since This enum is available since SDL 3.2.0 + * \since This enum is available since SDL 3.2.0. * * \sa SDL_CreateGPUGraphicsPipeline */ @@ -666,7 +666,7 @@ typedef enum SDL_GPUIndexElementSize * Unless D16_UNORM is sufficient for your purposes, always check which of * D24/D32 is supported before creating a depth-stencil texture! * - * \since This enum is available since SDL 3.2.0 + * \since This enum is available since SDL 3.2.0. * * \sa SDL_CreateGPUTexture * \sa SDL_GPUTextureSupportsFormat @@ -812,7 +812,7 @@ typedef enum SDL_GPUTextureFormat * within a compute pass. Note that SIMULTANEOUS usage is only supported by a * limited number of texture formats. * - * \since This datatype is available since SDL 3.2.0 + * \since This datatype is available since SDL 3.2.0. * * \sa SDL_CreateGPUTexture */ @@ -829,7 +829,7 @@ typedef Uint32 SDL_GPUTextureUsageFlags; /** * Specifies the type of a texture. * - * \since This enum is available since SDL 3.2.0 + * \since This enum is available since SDL 3.2.0. * * \sa SDL_CreateGPUTexture */ @@ -848,7 +848,7 @@ typedef enum SDL_GPUTextureType * Used in multisampling. Note that this value only applies when the texture * is used as a render target. * - * \since This enum is available since SDL 3.2.0 + * \since This enum is available since SDL 3.2.0. * * \sa SDL_CreateGPUTexture * \sa SDL_GPUTextureSupportsSampleCount @@ -867,7 +867,7 @@ typedef enum SDL_GPUSampleCount * * Can be passed in as the layer field in texture-related structs. * - * \since This enum is available since SDL 3.2.0 + * \since This enum is available since SDL 3.2.0. */ typedef enum SDL_GPUCubeMapFace { @@ -888,7 +888,7 @@ typedef enum SDL_GPUCubeMapFace * Unlike textures, READ | WRITE can be used for simultaneous read-write * usage. The same data synchronization concerns as textures apply. * - * \since This datatype is available since SDL 3.2.0 + * \since This datatype is available since SDL 3.2.0. * * \sa SDL_CreateGPUBuffer */ @@ -907,7 +907,7 @@ typedef Uint32 SDL_GPUBufferUsageFlags; * Note that mapping and copying FROM an upload transfer buffer or TO a * download transfer buffer is undefined behavior. * - * \since This enum is available since SDL 3.2.0 + * \since This enum is available since SDL 3.2.0. * * \sa SDL_CreateGPUTransferBuffer */ @@ -920,7 +920,7 @@ typedef enum SDL_GPUTransferBufferUsage /** * Specifies which stage a shader program corresponds to. * - * \since This enum is available since SDL 3.2.0 + * \since This enum is available since SDL 3.2.0. * * \sa SDL_CreateGPUShader */ @@ -935,7 +935,7 @@ typedef enum SDL_GPUShaderStage * * Each format corresponds to a specific backend that accepts it. * - * \since This datatype is available since SDL 3.2.0 + * \since This datatype is available since SDL 3.2.0. * * \sa SDL_CreateGPUShader */ @@ -952,7 +952,7 @@ typedef Uint32 SDL_GPUShaderFormat; /** * Specifies the format of a vertex attribute. * - * \since This enum is available since SDL 3.2.0 + * \since This enum is available since SDL 3.2.0. * * \sa SDL_CreateGPUGraphicsPipeline */ @@ -1018,7 +1018,7 @@ typedef enum SDL_GPUVertexElementFormat /** * Specifies the rate at which vertex attributes are pulled from buffers. * - * \since This enum is available since SDL 3.2.0 + * \since This enum is available since SDL 3.2.0. * * \sa SDL_CreateGPUGraphicsPipeline */ @@ -1031,7 +1031,7 @@ typedef enum SDL_GPUVertexInputRate /** * Specifies the fill mode of the graphics pipeline. * - * \since This enum is available since SDL 3.2.0 + * \since This enum is available since SDL 3.2.0. * * \sa SDL_CreateGPUGraphicsPipeline */ @@ -1044,7 +1044,7 @@ typedef enum SDL_GPUFillMode /** * Specifies the facing direction in which triangle faces will be culled. * - * \since This enum is available since SDL 3.2.0 + * \since This enum is available since SDL 3.2.0. * * \sa SDL_CreateGPUGraphicsPipeline */ @@ -1059,7 +1059,7 @@ typedef enum SDL_GPUCullMode * Specifies the vertex winding that will cause a triangle to be determined to * be front-facing. * - * \since This enum is available since SDL 3.2.0 + * \since This enum is available since SDL 3.2.0. * * \sa SDL_CreateGPUGraphicsPipeline */ @@ -1072,7 +1072,7 @@ typedef enum SDL_GPUFrontFace /** * Specifies a comparison operator for depth, stencil and sampler operations. * - * \since This enum is available since SDL 3.2.0 + * \since This enum is available since SDL 3.2.0. * * \sa SDL_CreateGPUGraphicsPipeline */ @@ -1093,7 +1093,7 @@ typedef enum SDL_GPUCompareOp * Specifies what happens to a stored stencil value if stencil tests fail or * pass. * - * \since This enum is available since SDL 3.2.0 + * \since This enum is available since SDL 3.2.0. * * \sa SDL_CreateGPUGraphicsPipeline */ @@ -1117,7 +1117,7 @@ typedef enum SDL_GPUStencilOp * The source color is the value written by the fragment shader. The * destination color is the value currently existing in the texture. * - * \since This enum is available since SDL 3.2.0 + * \since This enum is available since SDL 3.2.0. * * \sa SDL_CreateGPUGraphicsPipeline */ @@ -1138,7 +1138,7 @@ typedef enum SDL_GPUBlendOp * The source color is the value written by the fragment shader. The * destination color is the value currently existing in the texture. * - * \since This enum is available since SDL 3.2.0 + * \since This enum is available since SDL 3.2.0. * * \sa SDL_CreateGPUGraphicsPipeline */ @@ -1163,7 +1163,7 @@ typedef enum SDL_GPUBlendFactor /** * Specifies which color components are written in a graphics pipeline. * - * \since This datatype is available since SDL 3.2.0 + * \since This datatype is available since SDL 3.2.0. * * \sa SDL_CreateGPUGraphicsPipeline */ @@ -1177,7 +1177,7 @@ typedef Uint8 SDL_GPUColorComponentFlags; /** * Specifies a filter operation used by a sampler. * - * \since This enum is available since SDL 3.2.0 + * \since This enum is available since SDL 3.2.0. * * \sa SDL_CreateGPUSampler */ @@ -1190,7 +1190,7 @@ typedef enum SDL_GPUFilter /** * Specifies a mipmap mode used by a sampler. * - * \since This enum is available since SDL 3.2.0 + * \since This enum is available since SDL 3.2.0. * * \sa SDL_CreateGPUSampler */ @@ -1204,7 +1204,7 @@ typedef enum SDL_GPUSamplerMipmapMode * Specifies behavior of texture sampling when the coordinates exceed the 0-1 * range. * - * \since This enum is available since SDL 3.2.0 + * \since This enum is available since SDL 3.2.0. * * \sa SDL_CreateGPUSampler */ @@ -1234,7 +1234,7 @@ typedef enum SDL_GPUSamplerAddressMode * there is a pending image to present, the pending image is replaced by the * new image. Similar to VSYNC, but with reduced visual latency. * - * \since This enum is available since SDL 3.2.0 + * \since This enum is available since SDL 3.2.0. * * \sa SDL_SetGPUSwapchainParameters * \sa SDL_WindowSupportsGPUPresentMode @@ -1267,7 +1267,7 @@ typedef enum SDL_GPUPresentMode * - HDR10_ST2084: A2R10G10B10 or A2B10G10R10 swapchain. Pixel values are in * BT.2020 ST2084 (PQ) encoding. * - * \since This enum is available since SDL 3.2.0 + * \since This enum is available since SDL 3.2.0. * * \sa SDL_SetGPUSwapchainParameters * \sa SDL_WindowSupportsGPUSwapchainComposition @@ -1286,7 +1286,7 @@ typedef enum SDL_GPUSwapchainComposition /** * A structure specifying a viewport. * - * \since This struct is available since SDL 3.2.0 + * \since This struct is available since SDL 3.2.0. * * \sa SDL_SetGPUViewport */ @@ -1304,7 +1304,7 @@ typedef struct SDL_GPUViewport * A structure specifying parameters related to transferring data to or from a * texture. * - * \since This struct is available since SDL 3.2.0 + * \since This struct is available since SDL 3.2.0. * * \sa SDL_UploadToGPUTexture * \sa SDL_DownloadFromGPUTexture @@ -1322,7 +1322,7 @@ typedef struct SDL_GPUTextureTransferInfo * * Used when transferring buffer data to or from a transfer buffer. * - * \since This struct is available since SDL 3.2.0 + * \since This struct is available since SDL 3.2.0. * * \sa SDL_UploadToGPUBuffer * \sa SDL_DownloadFromGPUBuffer @@ -1338,7 +1338,7 @@ typedef struct SDL_GPUTransferBufferLocation * * Used when copying data from one texture to another. * - * \since This struct is available since SDL 3.2.0 + * \since This struct is available since SDL 3.2.0. * * \sa SDL_CopyGPUTextureToTexture */ @@ -1357,7 +1357,7 @@ typedef struct SDL_GPUTextureLocation * * Used when transferring data to or from a texture. * - * \since This struct is available since SDL 3.2.0 + * \since This struct is available since SDL 3.2.0. * * \sa SDL_UploadToGPUTexture * \sa SDL_DownloadFromGPUTexture @@ -1378,7 +1378,7 @@ typedef struct SDL_GPUTextureRegion /** * A structure specifying a region of a texture used in the blit operation. * - * \since This struct is available since SDL 3.2.0 + * \since This struct is available since SDL 3.2.0. * * \sa SDL_BlitGPUTexture */ @@ -1398,7 +1398,7 @@ typedef struct SDL_GPUBlitRegion * * Used when copying data between buffers. * - * \since This struct is available since SDL 3.2.0 + * \since This struct is available since SDL 3.2.0. * * \sa SDL_CopyGPUBufferToBuffer */ @@ -1413,7 +1413,7 @@ typedef struct SDL_GPUBufferLocation * * Used when transferring data to or from buffers. * - * \since This struct is available since SDL 3.2.0 + * \since This struct is available since SDL 3.2.0. * * \sa SDL_UploadToGPUBuffer * \sa SDL_DownloadFromGPUBuffer @@ -1435,7 +1435,7 @@ typedef struct SDL_GPUBufferRegion * only way to keep behavior consistent and portable is to always pass 0 for * the correlating parameter in the draw calls. * - * \since This struct is available since SDL 3.2.0 + * \since This struct is available since SDL 3.2.0. * * \sa SDL_DrawGPUPrimitivesIndirect */ @@ -1457,7 +1457,7 @@ typedef struct SDL_GPUIndirectDrawCommand * only way to keep behavior consistent and portable is to always pass 0 for * the correlating parameter in the draw calls. * - * \since This struct is available since SDL 3.2.0 + * \since This struct is available since SDL 3.2.0. * * \sa SDL_DrawGPUIndexedPrimitivesIndirect */ @@ -1473,7 +1473,7 @@ typedef struct SDL_GPUIndexedIndirectDrawCommand /** * A structure specifying the parameters of an indexed dispatch command. * - * \since This struct is available since SDL 3.2.0 + * \since This struct is available since SDL 3.2.0. * * \sa SDL_DispatchGPUComputeIndirect */ @@ -1489,7 +1489,7 @@ typedef struct SDL_GPUIndirectDispatchCommand /** * A structure specifying the parameters of a sampler. * - * \since This function is available since SDL 3.2.0 + * \since This function is available since SDL 3.2.0. * * \sa SDL_CreateGPUSampler */ @@ -1527,7 +1527,7 @@ typedef struct SDL_GPUSamplerCreateInfo * SDL_GPUVertexAttribute. For example, if an attribute has a buffer_slot of * 0, then that attribute belongs to the vertex buffer bound at slot 0. * - * \since This struct is available since SDL 3.2.0 + * \since This struct is available since SDL 3.2.0. * * \sa SDL_GPUVertexAttribute * \sa SDL_GPUVertexInputState @@ -1546,7 +1546,7 @@ typedef struct SDL_GPUVertexBufferDescription * All vertex attribute locations provided to an SDL_GPUVertexInputState must * be unique. * - * \since This struct is available since SDL 3.2.0 + * \since This struct is available since SDL 3.2.0. * * \sa SDL_GPUVertexBufferDescription * \sa SDL_GPUVertexInputState @@ -1563,7 +1563,7 @@ typedef struct SDL_GPUVertexAttribute * A structure specifying the parameters of a graphics pipeline vertex input * state. * - * \since This struct is available since SDL 3.2.0 + * \since This struct is available since SDL 3.2.0. * * \sa SDL_GPUGraphicsPipelineCreateInfo * \sa SDL_GPUVertexBufferDescription @@ -1580,7 +1580,7 @@ typedef struct SDL_GPUVertexInputState /** * A structure specifying the stencil operation state of a graphics pipeline. * - * \since This struct is available since SDL 3.2.0 + * \since This struct is available since SDL 3.2.0. * * \sa SDL_GPUDepthStencilState */ @@ -1595,7 +1595,7 @@ typedef struct SDL_GPUStencilOpState /** * A structure specifying the blend state of a color target. * - * \since This struct is available since SDL 3.2.0 + * \since This struct is available since SDL 3.2.0. * * \sa SDL_GPUColorTargetDescription */ @@ -1618,7 +1618,7 @@ typedef struct SDL_GPUColorTargetBlendState /** * A structure specifying code and metadata for creating a shader object. * - * \since This struct is available since SDL 3.2.0 + * \since This struct is available since SDL 3.2.0. * * \sa SDL_CreateGPUShader */ @@ -1644,7 +1644,7 @@ typedef struct SDL_GPUShaderCreateInfo * that certain usage combinations are invalid, for example SAMPLER and * GRAPHICS_STORAGE. * - * \since This struct is available since SDL 3.2.0 + * \since This struct is available since SDL 3.2.0. * * \sa SDL_CreateGPUTexture * \sa SDL_GPUTextureType @@ -1672,7 +1672,7 @@ typedef struct SDL_GPUTextureCreateInfo * Usage flags can be bitwise OR'd together for combinations of usages. Note * that certain combinations are invalid, for example VERTEX and INDEX. * - * \since This struct is available since SDL 3.2.0 + * \since This struct is available since SDL 3.2.0. * * \sa SDL_CreateGPUBuffer * \sa SDL_GPUBufferUsageFlags @@ -1688,7 +1688,7 @@ typedef struct SDL_GPUBufferCreateInfo /** * A structure specifying the parameters of a transfer buffer. * - * \since This struct is available since SDL 3.2.0 + * \since This struct is available since SDL 3.2.0. * * \sa SDL_CreateGPUTransferBuffer */ @@ -1711,7 +1711,7 @@ typedef struct SDL_GPUTransferBufferCreateInfo * consider enabling depth clip and then manually clamping depth in your * fragment shaders on Metal and Vulkan. * - * \since This struct is available since SDL 3.2.0 + * \since This struct is available since SDL 3.2.0. * * \sa SDL_GPUGraphicsPipelineCreateInfo */ @@ -1733,7 +1733,7 @@ typedef struct SDL_GPURasterizerState * A structure specifying the parameters of the graphics pipeline multisample * state. * - * \since This struct is available since SDL 3.2.0 + * \since This struct is available since SDL 3.2.0. * * \sa SDL_GPUGraphicsPipelineCreateInfo */ @@ -1751,7 +1751,7 @@ typedef struct SDL_GPUMultisampleState * A structure specifying the parameters of the graphics pipeline depth * stencil state. * - * \since This struct is available since SDL 3.2.0 + * \since This struct is available since SDL 3.2.0. * * \sa SDL_GPUGraphicsPipelineCreateInfo */ @@ -1774,7 +1774,7 @@ typedef struct SDL_GPUDepthStencilState * A structure specifying the parameters of color targets used in a graphics * pipeline. * - * \since This struct is available since SDL 3.2.0 + * \since This struct is available since SDL 3.2.0. * * \sa SDL_GPUGraphicsPipelineTargetInfo */ @@ -1788,7 +1788,7 @@ typedef struct SDL_GPUColorTargetDescription * A structure specifying the descriptions of render targets used in a * graphics pipeline. * - * \since This struct is available since SDL 3.2.0 + * \since This struct is available since SDL 3.2.0. * * \sa SDL_GPUGraphicsPipelineCreateInfo */ @@ -1806,7 +1806,7 @@ typedef struct SDL_GPUGraphicsPipelineTargetInfo /** * A structure specifying the parameters of a graphics pipeline state. * - * \since This struct is available since SDL 3.2.0 + * \since This struct is available since SDL 3.2.0. * * \sa SDL_CreateGPUGraphicsPipeline * \sa SDL_GPUVertexInputState @@ -1833,7 +1833,7 @@ typedef struct SDL_GPUGraphicsPipelineCreateInfo /** * A structure specifying the parameters of a compute pipeline state. * - * \since This struct is available since SDL 3.2.0 + * \since This struct is available since SDL 3.2.0. * * \sa SDL_CreateGPUComputePipeline */ @@ -1887,7 +1887,7 @@ typedef struct SDL_GPUComputePipelineCreateInfo * stores the multisample texture's contents. Not recommended as it requires * significant memory bandwidth. * - * \since This struct is available since SDL 3.2.0 + * \since This struct is available since SDL 3.2.0. * * \sa SDL_BeginGPURenderPass */ @@ -1948,7 +1948,7 @@ typedef struct SDL_GPUColorTargetInfo * * Note that depth/stencil targets do not support multisample resolves. * - * \since This struct is available since SDL 3.2.0 + * \since This struct is available since SDL 3.2.0. * * \sa SDL_BeginGPURenderPass */ @@ -1969,7 +1969,7 @@ typedef struct SDL_GPUDepthStencilTargetInfo /** * A structure containing parameters for a blit command. * - * \since This struct is available since SDL 3.2.0 + * \since This struct is available since SDL 3.2.0. * * \sa SDL_BlitGPUTexture */ @@ -1991,7 +1991,7 @@ typedef struct SDL_GPUBlitInfo { /** * A structure specifying parameters in a buffer binding call. * - * \since This struct is available since SDL 3.2.0 + * \since This struct is available since SDL 3.2.0. * * \sa SDL_BindGPUVertexBuffers * \sa SDL_BindGPUIndexBuffer @@ -2005,7 +2005,7 @@ typedef struct SDL_GPUBufferBinding /** * A structure specifying parameters in a sampler binding call. * - * \since This struct is available since SDL 3.2.0 + * \since This struct is available since SDL 3.2.0. * * \sa SDL_BindGPUVertexSamplers * \sa SDL_BindGPUFragmentSamplers @@ -2020,7 +2020,7 @@ typedef struct SDL_GPUTextureSamplerBinding * A structure specifying parameters related to binding buffers in a compute * pass. * - * \since This struct is available since SDL 3.2.0 + * \since This struct is available since SDL 3.2.0. * * \sa SDL_BeginGPUComputePass */ @@ -2037,7 +2037,7 @@ typedef struct SDL_GPUStorageBufferReadWriteBinding * A structure specifying parameters related to binding textures in a compute * pass. * - * \since This struct is available since SDL 3.2.0 + * \since This struct is available since SDL 3.2.0. * * \sa SDL_BeginGPUComputePass */ diff --git a/include/SDL3/SDL_hints.h b/include/SDL3/SDL_hints.h index 115499855fc61..8f2d074d19ad0 100644 --- a/include/SDL3/SDL_hints.h +++ b/include/SDL3/SDL_hints.h @@ -2369,7 +2369,7 @@ extern "C" { * * This hint can be set anytime. * - * \since This hint is available since 3.2.0 + * \since This hint is available since SDL 3.2.0. */ #define SDL_HINT_MAC_OPTION_AS_ALT "SDL_MAC_OPTION_AS_ALT" diff --git a/include/SDL3/SDL_intrin.h b/include/SDL3/SDL_intrin.h index f10fe5807f74d..bac6d7ad4fadc 100644 --- a/include/SDL3/SDL_intrin.h +++ b/include/SDL3/SDL_intrin.h @@ -58,7 +58,7 @@ * * If this macro is defined, SDL will have already included `` * - * \since This macro is available since 3.1.3. + * \since This macro is available since SDL 3.2.0. * * \sa SDL_LASX_INTRINSICS */ @@ -69,7 +69,7 @@ * * If this macro is defined, SDL will have already included `` * - * \since This macro is available since 3.1.3. + * \since This macro is available since SDL 3.2.0. * * \sa SDL_LASX_INTRINSICS */ @@ -81,7 +81,7 @@ * If this macro is defined, SDL will have already included `` * ``, ``, and ``, as appropriate. * - * \since This macro is available since 3.1.3. + * \since This macro is available since SDL 3.2.0. */ #define SDL_NEON_INTRINSICS 1 @@ -90,7 +90,7 @@ * * If this macro is defined, SDL will have already included `` * - * \since This macro is available since 3.1.3. + * \since This macro is available since SDL 3.2.0. */ #define SDL_ALTIVEC_INTRINSICS 1 @@ -99,7 +99,7 @@ * * If this macro is defined, SDL will have already included `` * - * \since This macro is available since 3.1.3. + * \since This macro is available since SDL 3.2.0. * * \sa SDL_SSE_INTRINSICS */ @@ -110,7 +110,7 @@ * * If this macro is defined, SDL will have already included `` * - * \since This macro is available since 3.1.3. + * \since This macro is available since SDL 3.2.0. * * \sa SDL_SSE2_INTRINSICS * \sa SDL_SSE3_INTRINSICS @@ -124,7 +124,7 @@ * * If this macro is defined, SDL will have already included `` * - * \since This macro is available since 3.1.3. + * \since This macro is available since SDL 3.2.0. * * \sa SDL_SSE_INTRINSICS * \sa SDL_SSE3_INTRINSICS @@ -138,7 +138,7 @@ * * If this macro is defined, SDL will have already included `` * - * \since This macro is available since 3.1.3. + * \since This macro is available since SDL 3.2.0. * * \sa SDL_SSE_INTRINSICS * \sa SDL_SSE2_INTRINSICS @@ -152,7 +152,7 @@ * * If this macro is defined, SDL will have already included `` * - * \since This macro is available since 3.1.3. + * \since This macro is available since SDL 3.2.0. * * \sa SDL_SSE_INTRINSICS * \sa SDL_SSE2_INTRINSICS @@ -166,7 +166,7 @@ * * If this macro is defined, SDL will have already included `` * - * \since This macro is available since 3.1.3. + * \since This macro is available since SDL 3.2.0. * * \sa SDL_SSE_INTRINSICS * \sa SDL_SSE2_INTRINSICS @@ -180,7 +180,7 @@ * * If this macro is defined, SDL will have already included `` * - * \since This macro is available since 3.1.3. + * \since This macro is available since SDL 3.2.0. * * \sa SDL_AVX2_INTRINSICS * \sa SDL_AVX512F_INTRINSICS @@ -192,7 +192,7 @@ * * If this macro is defined, SDL will have already included `` * - * \since This macro is available since 3.1.3. + * \since This macro is available since SDL 3.2.0. * * \sa SDL_AVX_INTRINSICS * \sa SDL_AVX512F_INTRINSICS @@ -206,7 +206,7 @@ * * If this macro is defined, SDL will have already included `` * - * \since This macro is available since 3.1.3. + * \since This macro is available since SDL 3.2.0. * * \sa SDL_AVX_INTRINSICS * \sa SDL_AVX2_INTRINSICS @@ -275,7 +275,7 @@ _m_prefetch(void *__P) * used directly by apps. Apps should probably just use SDL_TARGETING * directly, instead. * - * \since This macro is available since SDL 3.1.3. + * \since This macro is available since SDL 3.2.0. * * \sa SDL_TARGETING */ diff --git a/include/SDL3/SDL_main.h b/include/SDL3/SDL_main.h index 38f598a4c47c0..2e7a2ebb6c67e 100644 --- a/include/SDL3/SDL_main.h +++ b/include/SDL3/SDL_main.h @@ -69,7 +69,7 @@ * docs/README-main-functions.md in the source tree) for a more detailed * explanation. * - * \since This macro is used by the headers since SDL 3.1.3. + * \since This macro is used by the headers since SDL 3.2.0. */ #define SDL_MAIN_HANDLED 1 @@ -86,7 +86,7 @@ * docs/README-main-functions.md in the source tree) for a more detailed * explanation. * - * \since This macro is used by the headers since SDL 3.1.3. + * \since This macro is used by the headers since SDL 3.2.0. * * \sa SDL_AppInit * \sa SDL_AppEvent @@ -109,7 +109,7 @@ * * This macro is used internally by SDL, and apps probably shouldn't rely on it. * - * \since This macro is available since SDL 3.1.3. + * \since This macro is available since SDL 3.2.0. */ #define SDL_MAIN_AVAILABLE @@ -127,7 +127,7 @@ * * This macro is used internally by SDL, and apps probably shouldn't rely on it. * - * \since This macro is available since SDL 3.1.3. + * \since This macro is available since SDL 3.2.0. */ #define SDL_MAIN_NEEDED @@ -241,7 +241,7 @@ * External code rarely needs this, and if it needs something, it's almost * always SDL_DECLSPEC instead. * - * \since This macro is available since SDL 3.1.3. + * \since This macro is available since SDL 3.2.0. * * \sa SDL_DECLSPEC */ diff --git a/include/SDL3/SDL_pen.h b/include/SDL3/SDL_pen.h index 7e5c2d9ececd1..5182eeb0ce1dd 100644 --- a/include/SDL3/SDL_pen.h +++ b/include/SDL3/SDL_pen.h @@ -104,7 +104,7 @@ typedef Uint32 SDL_PenInputFlags; * * `SDL_sinf(xtilt * SDL_PI_F / 180.0)`. * - * \since This enum is available since SDL 3.2.0 + * \since This enum is available since SDL 3.2.0. */ typedef enum SDL_PenAxis { diff --git a/include/SDL3/SDL_power.h b/include/SDL3/SDL_power.h index 6f265ca326961..4056ce3c8e44e 100644 --- a/include/SDL3/SDL_power.h +++ b/include/SDL3/SDL_power.h @@ -51,7 +51,7 @@ extern "C" { * * These are results returned by SDL_GetPowerInfo(). * - * \since This enum is available since SDL 3.2.0 + * \since This enum is available since SDL 3.2.0. */ typedef enum SDL_PowerState { diff --git a/include/SDL3/SDL_stdinc.h b/include/SDL3/SDL_stdinc.h index 2e2b69f7f120d..4e15a3c642676 100644 --- a/include/SDL3/SDL_stdinc.h +++ b/include/SDL3/SDL_stdinc.h @@ -1278,7 +1278,7 @@ extern "C" { * * \threadsafety It is safe to call this macro from any thread. * - * \since This macro is available since SDL 3.1.3. + * \since This macro is available since SDL 3.2.0. * * \sa SDL_stack_alloc */ diff --git a/include/SDL3/SDL_test_compare.h b/include/SDL3/SDL_test_compare.h index 5b3b45f6ba3db..7ff247793a628 100644 --- a/include/SDL3/SDL_test_compare.h +++ b/include/SDL3/SDL_test_compare.h @@ -63,7 +63,7 @@ int SDLCALL SDLTest_CompareSurfaces(SDL_Surface *surface, SDL_Surface *reference * * \returns 0 if the left and right memory block are equal, non-zero if they are non-equal. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. */ int SDLCALL SDLTest_CompareMemory(const void *actual, size_t size_actual, const void *reference, size_t size_reference); diff --git a/include/SDL3/SDL_test_font.h b/include/SDL3/SDL_test_font.h index bfa64333dfdd4..fb407949720d2 100644 --- a/include/SDL3/SDL_test_font.h +++ b/include/SDL3/SDL_test_font.h @@ -91,7 +91,7 @@ typedef struct SDLTest_TextWindow * * \returns the new window, or NULL on failure. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. */ SDLTest_TextWindow * SDLCALL SDLTest_TextWindowCreate(float x, float y, float w, float h); @@ -103,7 +103,7 @@ SDLTest_TextWindow * SDLCALL SDLTest_TextWindowCreate(float x, float y, float w, * \param textwin The text output window * \param renderer The renderer to use for display * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. */ void SDLCALL SDLTest_TextWindowDisplay(SDLTest_TextWindow *textwin, SDL_Renderer *renderer); @@ -118,7 +118,7 @@ void SDLCALL SDLTest_TextWindowDisplay(SDLTest_TextWindow *textwin, SDL_Renderer * \param fmt A printf() style format string * \param ... additional parameters matching % tokens in the `fmt` string, if any * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. */ void SDLCALL SDLTest_TextWindowAddText(SDLTest_TextWindow *textwin, SDL_PRINTF_FORMAT_STRING const char *fmt, ...) SDL_PRINTF_VARARG_FUNC(2); @@ -133,7 +133,7 @@ void SDLCALL SDLTest_TextWindowAddText(SDLTest_TextWindow *textwin, SDL_PRINTF_F * \param text The text to add to the window * \param len The length, in bytes, of the text to add to the window * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. */ void SDLCALL SDLTest_TextWindowAddTextWithLength(SDLTest_TextWindow *textwin, const char *text, size_t len); @@ -142,7 +142,7 @@ void SDLCALL SDLTest_TextWindowAddTextWithLength(SDLTest_TextWindow *textwin, co * * \param textwin The text output window * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. */ void SDLCALL SDLTest_TextWindowClear(SDLTest_TextWindow *textwin); @@ -151,7 +151,7 @@ void SDLCALL SDLTest_TextWindowClear(SDLTest_TextWindow *textwin); * * \param textwin The text output window * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. */ void SDLCALL SDLTest_TextWindowDestroy(SDLTest_TextWindow *textwin); diff --git a/include/SDL3/SDL_thread.h b/include/SDL3/SDL_thread.h index a82352edfa2e9..277535fcb65cf 100644 --- a/include/SDL3/SDL_thread.h +++ b/include/SDL3/SDL_thread.h @@ -328,7 +328,7 @@ extern SDL_DECLSPEC SDL_Thread * SDLCALL SDL_CreateThreadWithProperties(SDL_Prop * new thread could not be created; call SDL_GetError() for more * information. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. */ extern SDL_DECLSPEC SDL_Thread * SDLCALL SDL_CreateThreadRuntime(SDL_ThreadFunction fn, const char *name, void *data, SDL_FunctionPointer pfnBeginThread, SDL_FunctionPointer pfnEndThread); @@ -342,7 +342,7 @@ extern SDL_DECLSPEC SDL_Thread * SDLCALL SDL_CreateThreadRuntime(SDL_ThreadFunct * new thread could not be created; call SDL_GetError() for more * information. * - * \since This function is available since SDL 3.1.3. + * \since This function is available since SDL 3.2.0. */ extern SDL_DECLSPEC SDL_Thread * SDLCALL SDL_CreateThreadWithPropertiesRuntime(SDL_PropertiesID props, SDL_FunctionPointer pfnBeginThread, SDL_FunctionPointer pfnEndThread); From 535d80badefc83c5c527ec5748f2a20d6a9310fe Mon Sep 17 00:00:00 2001 From: Sam Lantinga Date: Tue, 21 Jan 2025 10:51:21 -0800 Subject: [PATCH 215/340] Include the README and related files in the SDL framework --- Xcode/SDL/SDL.xcodeproj/project.pbxproj | 16 ++++++++ .../resources/framework/INSTALL.md | 41 +++++++++++++++++++ 2 files changed, 57 insertions(+) create mode 100644 Xcode/SDL/pkg-support/resources/framework/INSTALL.md diff --git a/Xcode/SDL/SDL.xcodeproj/project.pbxproj b/Xcode/SDL/SDL.xcodeproj/project.pbxproj index 73bd920af8c0c..bb6556065deae 100644 --- a/Xcode/SDL/SDL.xcodeproj/project.pbxproj +++ b/Xcode/SDL/SDL.xcodeproj/project.pbxproj @@ -384,6 +384,9 @@ F32DDAD42AB795A30041EAA5 /* SDL_audioresample.c in Sources */ = {isa = PBXBuildFile; fileRef = F32DDACE2AB795A30041EAA5 /* SDL_audioresample.c */; }; F338A1182D1B37D8007CDFDF /* SDL_tray.m in Sources */ = {isa = PBXBuildFile; fileRef = F338A1172D1B37D8007CDFDF /* SDL_tray.m */; }; F338A11A2D1B37E4007CDFDF /* SDL_tray.c in Sources */ = {isa = PBXBuildFile; fileRef = F338A1192D1B37E4007CDFDF /* SDL_tray.c */; }; + F34400342D40217A003F26D7 /* LICENSE.txt in Resources */ = {isa = PBXBuildFile; fileRef = F373DA182D388A1E002158FA /* LICENSE.txt */; }; + F34400362D40217A003F26D7 /* README.md in Resources */ = {isa = PBXBuildFile; fileRef = F373DA192D388A1E002158FA /* README.md */; }; + F344003D2D4022E1003F26D7 /* INSTALL.md in Resources */ = {isa = PBXBuildFile; fileRef = F344003C2D4022E1003F26D7 /* INSTALL.md */; }; F34B9895291DEFF500AAC96E /* SDL_hidapi_steam.c in Sources */ = {isa = PBXBuildFile; fileRef = A75FDAAC23E2795C00529352 /* SDL_hidapi_steam.c */; }; F362B9192B3349E200D30B94 /* controller_list.h in Headers */ = {isa = PBXBuildFile; fileRef = F362B9152B3349E200D30B94 /* controller_list.h */; }; F362B91A2B3349E200D30B94 /* SDL_gamepad_c.h in Headers */ = {isa = PBXBuildFile; fileRef = F362B9162B3349E200D30B94 /* SDL_gamepad_c.h */; }; @@ -929,6 +932,7 @@ F32DDACE2AB795A30041EAA5 /* SDL_audioresample.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SDL_audioresample.c; sourceTree = ""; }; F338A1172D1B37D8007CDFDF /* SDL_tray.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = SDL_tray.m; sourceTree = ""; }; F338A1192D1B37E4007CDFDF /* SDL_tray.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = SDL_tray.c; sourceTree = ""; }; + F344003C2D4022E1003F26D7 /* INSTALL.md */ = {isa = PBXFileReference; lastKnownFileType = net.daringfireball.markdown; path = INSTALL.md; sourceTree = ""; }; F362B9152B3349E200D30B94 /* controller_list.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = controller_list.h; sourceTree = ""; }; F362B9162B3349E200D30B94 /* SDL_gamepad_c.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDL_gamepad_c.h; sourceTree = ""; }; F362B9172B3349E200D30B94 /* SDL_steam_virtual_gamepad.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDL_steam_virtual_gamepad.h; sourceTree = ""; }; @@ -2311,6 +2315,14 @@ path = cocoa; sourceTree = ""; }; + F344003B2D40229E003F26D7 /* framework */ = { + isa = PBXGroup; + children = ( + F344003C2D4022E1003F26D7 /* INSTALL.md */, + ); + path = framework; + sourceTree = ""; + }; F36C7ACF294B9F5E004D61C3 /* core */ = { isa = PBXGroup; children = ( @@ -2408,6 +2420,7 @@ F59C710100D5CB5801000001 /* resources */ = { isa = PBXGroup; children = ( + F344003B2D40229E003F26D7 /* framework */, F37A8E1928405AA100C38E95 /* CMake */, F373DA182D388A1E002158FA /* LICENSE.txt */, F373DA192D388A1E002158FA /* README.md */, @@ -2754,6 +2767,9 @@ isa = PBXResourcesBuildPhase; buildActionMask = 2147483647; files = ( + F344003D2D4022E1003F26D7 /* INSTALL.md in Resources */, + F34400342D40217A003F26D7 /* LICENSE.txt in Resources */, + F34400362D40217A003F26D7 /* README.md in Resources */, F37A8E1A28405AA100C38E95 /* CMake in Resources */, ); runOnlyForDeploymentPostprocessing = 0; diff --git a/Xcode/SDL/pkg-support/resources/framework/INSTALL.md b/Xcode/SDL/pkg-support/resources/framework/INSTALL.md new file mode 100644 index 0000000000000..97e4ab6de0651 --- /dev/null +++ b/Xcode/SDL/pkg-support/resources/framework/INSTALL.md @@ -0,0 +1,41 @@ + +# Using this package + +This package contains SDL built for Xcode. + +To use this package in Xcode, drag `SDL3.framework` into your project. + +# Documentation + +An API reference, tutorials, and additional documentation is available at: + +https://wiki.libsdl.org/SDL3 + +# Example code + +There are simple example programs available at: + +https://examples.libsdl.org/SDL3 + +# Discussions + +## Discord + +You can join the official Discord server at: + +https://discord.com/invite/BwpFGBWsv8 + +## Forums/mailing lists + +You can join SDL development discussions at: + +https://discourse.libsdl.org/ + +Once you sign up, you can use the forum through the website or as a mailing list from your email client. + +## Announcement list + +You can sign up for the low traffic announcement list at: + +https://www.libsdl.org/mailing-list.php + From efa6e7aece0675a319954b293803a0c78c9d8299 Mon Sep 17 00:00:00 2001 From: Anonymous Maarten Date: Tue, 21 Jan 2025 20:20:17 +0100 Subject: [PATCH 216/340] android: add style to test apk's --- test/android/cmake/AndroidManifest.xml.cmake | 4 ++-- test/android/res/values/styles.xml | 7 +++++++ 2 files changed, 9 insertions(+), 2 deletions(-) create mode 100644 test/android/res/values/styles.xml diff --git a/test/android/cmake/AndroidManifest.xml.cmake b/test/android/cmake/AndroidManifest.xml.cmake index a9fc3d5688508..06d87af96cab0 100644 --- a/test/android/cmake/AndroidManifest.xml.cmake +++ b/test/android/cmake/AndroidManifest.xml.cmake @@ -43,8 +43,8 @@ android:roundIcon="@mipmap/sdl-test_round" android:label="@string/label" android:supportsRtl="true" - android:hardwareAccelerated="true" - tools:targetApi="31"> + android:theme="@style/AppTheme" + android:hardwareAccelerated="true"> + + + + From bb3c5b4f3ad134ced909b707d7428bf58b236d63 Mon Sep 17 00:00:00 2001 From: Klayism <94929502+klayism@users.noreply.github.com> Date: Tue, 21 Jan 2025 16:46:09 -0500 Subject: [PATCH 217/340] Fix multiple occurences of typo "an simple" to "a simple" --- examples/audio/01-simple-playback/README.txt | 2 +- examples/audio/01-simple-playback/simple-playback.c | 2 +- examples/audio/02-simple-playback-callback/README.txt | 2 +- .../02-simple-playback-callback/simple-playback-callback.c | 2 +- examples/audio/03-load-wav/README.txt | 2 +- examples/audio/03-load-wav/load-wav.c | 2 +- 6 files changed, 6 insertions(+), 6 deletions(-) diff --git a/examples/audio/01-simple-playback/README.txt b/examples/audio/01-simple-playback/README.txt index 9b3c07dd0e3e3..20ad0598ad6d7 100644 --- a/examples/audio/01-simple-playback/README.txt +++ b/examples/audio/01-simple-playback/README.txt @@ -1,5 +1,5 @@ If you're running this in a web browser, you need to click the window before you'll hear anything! -This example code creates an simple audio stream for playing sound, and +This example code creates a simple audio stream for playing sound, and generates a sine wave sound effect for it to play as time goes on. This is the simplest way to get up and running with procedural sound. diff --git a/examples/audio/01-simple-playback/simple-playback.c b/examples/audio/01-simple-playback/simple-playback.c index 35ddf8a84baec..330df800759ef 100644 --- a/examples/audio/01-simple-playback/simple-playback.c +++ b/examples/audio/01-simple-playback/simple-playback.c @@ -1,5 +1,5 @@ /* - * This example code creates an simple audio stream for playing sound, and + * This example code creates a simple audio stream for playing sound, and * generates a sine wave sound effect for it to play as time goes on. This * is the simplest way to get up and running with procedural sound. * diff --git a/examples/audio/02-simple-playback-callback/README.txt b/examples/audio/02-simple-playback-callback/README.txt index e719256d8c106..888ae3497c9fb 100644 --- a/examples/audio/02-simple-playback-callback/README.txt +++ b/examples/audio/02-simple-playback-callback/README.txt @@ -1,5 +1,5 @@ If you're running this in a web browser, you need to click the window before you'll hear anything! -This example code creates an simple audio stream for playing sound, and +This example code creates a simple audio stream for playing sound, and generates a sine wave sound effect for it to play as time goes on. Unlike the previous example, this uses a callback to generate sound. diff --git a/examples/audio/02-simple-playback-callback/simple-playback-callback.c b/examples/audio/02-simple-playback-callback/simple-playback-callback.c index 5a783619f7da5..c011c72710867 100644 --- a/examples/audio/02-simple-playback-callback/simple-playback-callback.c +++ b/examples/audio/02-simple-playback-callback/simple-playback-callback.c @@ -1,5 +1,5 @@ /* - * This example code creates an simple audio stream for playing sound, and + * This example code creates a simple audio stream for playing sound, and * generates a sine wave sound effect for it to play as time goes on. Unlike * the previous example, this uses a callback to generate sound. * diff --git a/examples/audio/03-load-wav/README.txt b/examples/audio/03-load-wav/README.txt index 5a6894c765a7b..57eb90ce06dee 100644 --- a/examples/audio/03-load-wav/README.txt +++ b/examples/audio/03-load-wav/README.txt @@ -1,5 +1,5 @@ If you're running this in a web browser, you need to click the window before you'll hear anything! -This example code creates an simple audio stream for playing sound, and +This example code creates a simple audio stream for playing sound, and loads a .wav file that is pushed through the stream in a loop. diff --git a/examples/audio/03-load-wav/load-wav.c b/examples/audio/03-load-wav/load-wav.c index 7a4adf0cb27e5..966fccb26baab 100644 --- a/examples/audio/03-load-wav/load-wav.c +++ b/examples/audio/03-load-wav/load-wav.c @@ -1,5 +1,5 @@ /* - * This example code creates an simple audio stream for playing sound, and + * This example code creates a simple audio stream for playing sound, and * loads a .wav file that is pushed through the stream in a loop. * * This code is public domain. Feel free to use it for any purpose! From 77b520e93ec655988ba39419e636af234ff5b753 Mon Sep 17 00:00:00 2001 From: Sam Lantinga Date: Tue, 21 Jan 2025 14:02:06 -0800 Subject: [PATCH 218/340] Updated to version 3.2.1 for development --- CMakeLists.txt | 2 +- Xcode/SDL/Info-Framework.plist | 4 ++-- Xcode/SDL/SDL.xcodeproj/project.pbxproj | 8 ++++---- Xcode/SDL/pkg-support/SDL.info | 2 +- .../app/src/main/java/org/libsdl/app/SDLActivity.java | 2 +- include/SDL3/SDL.h | 2 +- include/SDL3/SDL_version.h | 2 +- src/core/windows/version.rc | 8 ++++---- 8 files changed, 15 insertions(+), 15 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index ef42f644d741b..a18e2ca3195ef 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -5,7 +5,7 @@ if(NOT DEFINED CMAKE_BUILD_TYPE) endif() # See docs/release_checklist.md -project(SDL3 LANGUAGES C VERSION "3.2.0") +project(SDL3 LANGUAGES C VERSION "3.2.1") if(CMAKE_SOURCE_DIR STREQUAL PROJECT_SOURCE_DIR) set(SDL3_MAINPROJECT ON) diff --git a/Xcode/SDL/Info-Framework.plist b/Xcode/SDL/Info-Framework.plist index c9cb1e5c1304a..d7ec19f892437 100644 --- a/Xcode/SDL/Info-Framework.plist +++ b/Xcode/SDL/Info-Framework.plist @@ -19,10 +19,10 @@ CFBundlePackageType FMWK CFBundleShortVersionString - 3.2.0 + 3.2.1 CFBundleSignature SDLX CFBundleVersion - 3.2.0 + 3.2.1 diff --git a/Xcode/SDL/SDL.xcodeproj/project.pbxproj b/Xcode/SDL/SDL.xcodeproj/project.pbxproj index bb6556065deae..869ae6d9e904d 100644 --- a/Xcode/SDL/SDL.xcodeproj/project.pbxproj +++ b/Xcode/SDL/SDL.xcodeproj/project.pbxproj @@ -3062,7 +3062,7 @@ CLANG_ENABLE_OBJC_ARC = YES; DEPLOYMENT_POSTPROCESSING = YES; DYLIB_COMPATIBILITY_VERSION = 201.0.0; - DYLIB_CURRENT_VERSION = 201.0.0; + DYLIB_CURRENT_VERSION = 201.1.0; DYLIB_INSTALL_NAME_BASE = "@rpath"; ENABLE_STRICT_OBJC_MSGSEND = YES; GCC_ALTIVEC_EXTENSIONS = YES; @@ -3097,7 +3097,7 @@ "@loader_path/Frameworks", ); MACOSX_DEPLOYMENT_TARGET = 10.13; - MARKETING_VERSION = 3.2.0; + MARKETING_VERSION = 3.2.1; OTHER_LDFLAGS = "$(CONFIG_FRAMEWORK_LDFLAGS)"; PRODUCT_BUNDLE_IDENTIFIER = org.libsdl.SDL3; PRODUCT_NAME = SDL3; @@ -3126,7 +3126,7 @@ CLANG_ENABLE_MODULES = YES; CLANG_ENABLE_OBJC_ARC = YES; DYLIB_COMPATIBILITY_VERSION = 201.0.0; - DYLIB_CURRENT_VERSION = 201.0.0; + DYLIB_CURRENT_VERSION = 201.1.0; DYLIB_INSTALL_NAME_BASE = "@rpath"; ENABLE_STRICT_OBJC_MSGSEND = YES; ENABLE_TESTABILITY = YES; @@ -3158,7 +3158,7 @@ "@loader_path/Frameworks", ); MACOSX_DEPLOYMENT_TARGET = 10.13; - MARKETING_VERSION = 3.2.0; + MARKETING_VERSION = 3.2.1; ONLY_ACTIVE_ARCH = YES; OTHER_LDFLAGS = "$(CONFIG_FRAMEWORK_LDFLAGS)"; PRODUCT_BUNDLE_IDENTIFIER = org.libsdl.SDL3; diff --git a/Xcode/SDL/pkg-support/SDL.info b/Xcode/SDL/pkg-support/SDL.info index b80d1f58e98c1..a763e8c7ea03e 100644 --- a/Xcode/SDL/pkg-support/SDL.info +++ b/Xcode/SDL/pkg-support/SDL.info @@ -1,4 +1,4 @@ -Title SDL 3.2.0 +Title SDL 3.2.1 Version 1 Description SDL Library for macOS (http://www.libsdl.org) DefaultLocation /Library/Frameworks diff --git a/android-project/app/src/main/java/org/libsdl/app/SDLActivity.java b/android-project/app/src/main/java/org/libsdl/app/SDLActivity.java index 47bf3b31b1c17..0e32fed4e0d83 100644 --- a/android-project/app/src/main/java/org/libsdl/app/SDLActivity.java +++ b/android-project/app/src/main/java/org/libsdl/app/SDLActivity.java @@ -60,7 +60,7 @@ public class SDLActivity extends Activity implements View.OnSystemUiVisibilityCh private static final String TAG = "SDL"; private static final int SDL_MAJOR_VERSION = 3; private static final int SDL_MINOR_VERSION = 2; - private static final int SDL_MICRO_VERSION = 0; + private static final int SDL_MICRO_VERSION = 1; /* // Display InputType.SOURCE/CLASS of events and devices // diff --git a/include/SDL3/SDL.h b/include/SDL3/SDL.h index 861c404f50ed6..f4b1ac61dfd50 100644 --- a/include/SDL3/SDL.h +++ b/include/SDL3/SDL.h @@ -20,7 +20,7 @@ */ /** - * Main include header for the SDL library, version 3.2.0 + * Main include header for the SDL library, version 3.2.1 * * It is almost always best to include just this one header instead of * picking out individual headers included here. There are exceptions to diff --git a/include/SDL3/SDL_version.h b/include/SDL3/SDL_version.h index 55014e3c1b724..43a1807554366 100644 --- a/include/SDL3/SDL_version.h +++ b/include/SDL3/SDL_version.h @@ -62,7 +62,7 @@ extern "C" { * * \since This macro is available since SDL 3.2.0. */ -#define SDL_MICRO_VERSION 0 +#define SDL_MICRO_VERSION 1 /** * This macro turns the version numbers into a numeric value. diff --git a/src/core/windows/version.rc b/src/core/windows/version.rc index 83c5f6371d58d..bd878f9191adb 100644 --- a/src/core/windows/version.rc +++ b/src/core/windows/version.rc @@ -9,8 +9,8 @@ LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US // VS_VERSION_INFO VERSIONINFO - FILEVERSION 3,2,0,0 - PRODUCTVERSION 3,2,0,0 + FILEVERSION 3,2,1,0 + PRODUCTVERSION 3,2,1,0 FILEFLAGSMASK 0x3fL FILEFLAGS 0x0L FILEOS 0x40004L @@ -23,12 +23,12 @@ BEGIN BEGIN VALUE "CompanyName", "\0" VALUE "FileDescription", "SDL\0" - VALUE "FileVersion", "3, 2, 0, 0\0" + VALUE "FileVersion", "3, 2, 1, 0\0" VALUE "InternalName", "SDL\0" VALUE "LegalCopyright", "Copyright (C) 2025 Sam Lantinga\0" VALUE "OriginalFilename", "SDL3.dll\0" VALUE "ProductName", "Simple DirectMedia Layer\0" - VALUE "ProductVersion", "3, 2, 0, 0\0" + VALUE "ProductVersion", "3, 2, 1, 0\0" END END BLOCK "VarFileInfo" From 5d6a78045397aaeb39aaf24704ca56d4cb2545f5 Mon Sep 17 00:00:00 2001 From: SDL Wiki Bot Date: Tue, 21 Jan 2025 23:00:08 +0000 Subject: [PATCH 219/340] Sync SDL3 wiki -> header [ci skip] --- include/SDL3/SDL_gpu.h | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/include/SDL3/SDL_gpu.h b/include/SDL3/SDL_gpu.h index fa870a5798c8d..886785b46c483 100644 --- a/include/SDL3/SDL_gpu.h +++ b/include/SDL3/SDL_gpu.h @@ -888,6 +888,10 @@ typedef enum SDL_GPUCubeMapFace * Unlike textures, READ | WRITE can be used for simultaneous read-write * usage. The same data synchronization concerns as textures apply. * + * If you use a STORAGE flag, the data in the buffer must respect std140 + * layout conventions. In practical terms this means you must ensure that vec3 + * and vec4 fields are 16-byte aligned. + * * \since This datatype is available since SDL 3.2.0. * * \sa SDL_CreateGPUBuffer From 5bf077f1f1e9698ce55147e7a84375738f2cef58 Mon Sep 17 00:00:00 2001 From: SDL Wiki Bot Date: Tue, 21 Jan 2025 23:04:33 +0000 Subject: [PATCH 220/340] Sync SDL3 wiki -> header [ci skip] --- include/SDL3/SDL_gpu.h | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/include/SDL3/SDL_gpu.h b/include/SDL3/SDL_gpu.h index 886785b46c483..36b235b333db5 100644 --- a/include/SDL3/SDL_gpu.h +++ b/include/SDL3/SDL_gpu.h @@ -2814,6 +2814,10 @@ extern SDL_DECLSPEC void SDLCALL SDL_PushGPUVertexUniformData( * * Subsequent draw calls will use this uniform data. * + * The data being pushed must respect std140 layout conventions. In practical + * terms this means you must ensure that vec3 and vec4 fields are 16-byte + * aligned. + * * \param command_buffer a command buffer. * \param slot_index the fragment uniform slot to push data to. * \param data client data to write. From 799093799abbbe6f02b99ba5982cfdb2b561ba3b Mon Sep 17 00:00:00 2001 From: cosmonaut Date: Tue, 21 Jan 2025 15:07:34 -0800 Subject: [PATCH 221/340] GPU: Note buffer alignment requirements --- include/SDL3/SDL_gpu.h | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/include/SDL3/SDL_gpu.h b/include/SDL3/SDL_gpu.h index 36b235b333db5..8e7dc69e49cd9 100644 --- a/include/SDL3/SDL_gpu.h +++ b/include/SDL3/SDL_gpu.h @@ -2494,6 +2494,9 @@ extern SDL_DECLSPEC SDL_GPUTexture *SDLCALL SDL_CreateGPUTexture( * Note that certain combinations of usage flags are invalid. For example, a * buffer cannot have both the VERTEX and INDEX flags. * + * If you use a STORAGE flag, the data in the buffer must respect std140 layout conventions. + * In practical terms this means you must ensure that vec3 and vec4 fields are 16-byte aligned. + * * For better understanding of underlying concepts and memory management with * SDL GPU API, you may refer * [this blog post](https://moonside.games/posts/sdl-gpu-concepts-cycling/) @@ -2796,6 +2799,9 @@ extern SDL_DECLSPEC SDL_GPUCommandBuffer *SDLCALL SDL_AcquireGPUCommandBuffer( * * Subsequent draw calls will use this uniform data. * + * The data being pushed must respect std140 layout conventions. + * In practical terms this means you must ensure that vec3 and vec4 fields are 16-byte aligned. + * * \param command_buffer a command buffer. * \param slot_index the vertex uniform slot to push data to. * \param data client data to write. @@ -2835,6 +2841,9 @@ extern SDL_DECLSPEC void SDLCALL SDL_PushGPUFragmentUniformData( * Pushes data to a uniform slot on the command buffer. * * Subsequent draw calls will use this uniform data. + + * The data being pushed must respect std140 layout conventions. + * In practical terms this means you must ensure that vec3 and vec4 fields are 16-byte aligned. * * \param command_buffer a command buffer. * \param slot_index the uniform slot to push data to. From df3cfbc7975ae2f34ce6796689e44d4cd7f05aed Mon Sep 17 00:00:00 2001 From: SDL Wiki Bot Date: Tue, 21 Jan 2025 23:08:39 +0000 Subject: [PATCH 222/340] Sync SDL3 wiki -> header [ci skip] --- include/SDL3/SDL_gpu.h | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/include/SDL3/SDL_gpu.h b/include/SDL3/SDL_gpu.h index 8e7dc69e49cd9..06917d45e9ae7 100644 --- a/include/SDL3/SDL_gpu.h +++ b/include/SDL3/SDL_gpu.h @@ -2494,8 +2494,9 @@ extern SDL_DECLSPEC SDL_GPUTexture *SDLCALL SDL_CreateGPUTexture( * Note that certain combinations of usage flags are invalid. For example, a * buffer cannot have both the VERTEX and INDEX flags. * - * If you use a STORAGE flag, the data in the buffer must respect std140 layout conventions. - * In practical terms this means you must ensure that vec3 and vec4 fields are 16-byte aligned. + * If you use a STORAGE flag, the data in the buffer must respect std140 + * layout conventions. In practical terms this means you must ensure that vec3 + * and vec4 fields are 16-byte aligned. * * For better understanding of underlying concepts and memory management with * SDL GPU API, you may refer @@ -2799,8 +2800,9 @@ extern SDL_DECLSPEC SDL_GPUCommandBuffer *SDLCALL SDL_AcquireGPUCommandBuffer( * * Subsequent draw calls will use this uniform data. * - * The data being pushed must respect std140 layout conventions. - * In practical terms this means you must ensure that vec3 and vec4 fields are 16-byte aligned. + * The data being pushed must respect std140 layout conventions. In practical + * terms this means you must ensure that vec3 and vec4 fields are 16-byte + * aligned. * * \param command_buffer a command buffer. * \param slot_index the vertex uniform slot to push data to. @@ -2841,9 +2843,10 @@ extern SDL_DECLSPEC void SDLCALL SDL_PushGPUFragmentUniformData( * Pushes data to a uniform slot on the command buffer. * * Subsequent draw calls will use this uniform data. - - * The data being pushed must respect std140 layout conventions. - * In practical terms this means you must ensure that vec3 and vec4 fields are 16-byte aligned. + * + * The data being pushed must respect std140 layout conventions. In practical + * terms this means you must ensure that vec3 and vec4 fields are 16-byte + * aligned. * * \param command_buffer a command buffer. * \param slot_index the uniform slot to push data to. From cb3cc28809c08d7af4d1c7fe7bbcdd552918e75c Mon Sep 17 00:00:00 2001 From: Anonymous Maarten Date: Wed, 22 Jan 2025 01:07:52 +0100 Subject: [PATCH 223/340] emscripten: pass --no-sandbox to the chrome web driver This fixes running the Emscripten tests on Ubuntu 24.04. --- .github/workflows/create-test-plan.py | 10 ++++++++-- .github/workflows/generic.yml | 14 +++++++++----- test/emscripten/driver.py | 9 +++++---- 3 files changed, 22 insertions(+), 11 deletions(-) diff --git a/.github/workflows/create-test-plan.py b/.github/workflows/create-test-plan.py index 2ac30fbabaee9..925b994957ebb 100755 --- a/.github/workflows/create-test-plan.py +++ b/.github/workflows/create-test-plan.py @@ -129,7 +129,7 @@ class JobSpec: "android-cmake-lean": JobSpec(name="Android (CMake, lean)", os=JobOs.UbuntuLatest, platform=SdlPlatform.Android, artifact="SDL-lean-android-arm64", android_abi="arm64-v8a", android_arch="aarch64", android_platform=23, lean=True, ), "android-mk": JobSpec(name="Android (Android.mk)", os=JobOs.UbuntuLatest, platform=SdlPlatform.Android, artifact=None, no_cmake=True, android_mk=True, ), "android-gradle": JobSpec(name="Android (Gradle)", os=JobOs.UbuntuLatest, platform=SdlPlatform.Android, artifact=None, no_cmake=True, android_gradle=True, ), - "emscripten": JobSpec(name="Emscripten", os=JobOs.Ubuntu22_04, platform=SdlPlatform.Emscripten, artifact="SDL-emscripten", ), + "emscripten": JobSpec(name="Emscripten", os=JobOs.UbuntuLatest, platform=SdlPlatform.Emscripten, artifact="SDL-emscripten", ), "haiku": JobSpec(name="Haiku", os=JobOs.UbuntuLatest, platform=SdlPlatform.Haiku, artifact="SDL-haiku-x64", container="ghcr.io/haiku/cross-compiler:x86_64-r1beta5", ), "loongarch64": JobSpec(name="LoongArch64", os=JobOs.UbuntuLatest, platform=SdlPlatform.LoongArch64, artifact="SDL-loongarch64", ), "n3ds": JobSpec(name="Nintendo 3DS", os=JobOs.UbuntuLatest, platform=SdlPlatform.N3ds, artifact="SDL-n3ds", container="devkitpro/devkitarm:latest", ), @@ -223,6 +223,8 @@ class JobDetails: cpactions_install_cmd: str = "" setup_vita_gles_type: str = "" check_sources: bool = False + setup_python: bool = False + pypi_packages: list[str] = dataclasses.field(default_factory=list) def to_workflow(self, enable_artifacts: bool) -> dict[str, str|bool]: data = { @@ -287,6 +289,8 @@ def to_workflow(self, enable_artifacts: bool) -> dict[str, str|bool]: "setup-vita-gles-type": self.setup_vita_gles_type, "setup-gdk-folder": self.setup_gdk_folder, "check-sources": self.check_sources, + "setup-python": self.setup_python, + "pypi-packages": my_shlex_join(self.pypi_packages), } return {k: v for k, v in data.items() if v != ""} @@ -541,7 +545,6 @@ def spec_to_job(spec: JobSpec, key: str, trackmem_symbol_names: bool) -> JobDeta job.cmake_config_emulator = "emcmake" job.cmake_build_type = "Debug" job.test_pkg_config = False - job.apt_packages.append("python3-selenium") job.cmake_arguments.extend(( "-DSDLTEST_BROWSER=chrome", "-DSDLTEST_TIMEOUT_MULTIPLIER=4", @@ -561,6 +564,8 @@ def spec_to_job(spec: JobSpec, key: str, trackmem_symbol_names: bool) -> JobDeta "chromedriver --version", )) job.static_lib = StaticLibType.A + job.setup_python = True + job.pypi_packages.append("selenium") case SdlPlatform.Ps2: build_parallel = False job.shared = False @@ -713,6 +718,7 @@ def spec_to_job(spec: JobSpec, key: str, trackmem_symbol_names: bool) -> JobDeta if "ubuntu" in spec.name.lower(): job.check_sources = True + job.setup_python = True if not build_parallel: job.cmake_build_arguments.append("-j1") diff --git a/.github/workflows/generic.yml b/.github/workflows/generic.yml index d7bdb88291be9..0e42831759fbf 100644 --- a/.github/workflows/generic.yml +++ b/.github/workflows/generic.yml @@ -133,6 +133,15 @@ jobs: export HOMEBREW_NO_INSTALLED_DEPENDENTS_CHECK=1 brew update brew install ${{ matrix.platform.brew-packages }} + - name: 'Setup Python' + uses: 'actions/setup-python@main' + if: ${{ matrix.platform.setup-python }} + with: + python-version: '3.x' + - name: 'Install PyPI packages' + if: ${{ matrix.platform.pypi-packages != '' }} + run: | + python -m pip install --user ${{ matrix.platform.pypi-packages }} - name: 'Set up GLES for VITA' # Must be after apk if: ${{ matrix.platform.setup-vita-gles-type != '' }} uses: ./.github/actions/setup-vita-gles @@ -348,11 +357,6 @@ jobs: if: ${{ matrix.platform.xcode-sdk != '' }} run: | xcodebuild -project Xcode/SDL/SDL.xcodeproj -target SDL3 -configuration Release -sdk ${{ matrix.platform.xcode-sdk }} clean build - - name: 'Setup Python' - uses: 'actions/setup-python@main' - if: ${{ matrix.platform.check-sources }} - with: - python-version: '3.x' - name: 'Check Sources' if: ${{ matrix.platform.check-sources }} run: | diff --git a/test/emscripten/driver.py b/test/emscripten/driver.py index 9735e95b9255a..ee91610dfc01c 100755 --- a/test/emscripten/driver.py +++ b/test/emscripten/driver.py @@ -32,6 +32,10 @@ def __init__(self, server: str, test: str, arguments: list[str], browser: str, f self.failed_messages: list[str] = [] self.return_code = None + options = [ + "--headless", + ] + driver_contructor = None match browser: case "firefox": @@ -44,12 +48,9 @@ def __init__(self, server: str, test: str, arguments: list[str], browser: str, f driver_options = webdriver.ChromeOptions() if self.chrome_binary: driver_options.binary_location = self.chrome_binary + options.append("--no-sandbox") if driver_contructor is None: raise ValueError(f"Invalid {browser=}") - - options = [ - "--headless", - ] for o in options: driver_options.add_argument(o) logger.debug("About to create driver") From 6f3d0b3cdb38f89f86a31e2dcb05ffc02cb262f4 Mon Sep 17 00:00:00 2001 From: Sam Lantinga Date: Tue, 21 Jan 2025 17:23:08 -0800 Subject: [PATCH 224/340] Fixed build when using an older Xcode SDK Fixes https://github.com/libsdl-org/SDL/issues/12048 --- src/joystick/apple/SDL_mfijoystick.m | 4 +--- src/video/uikit/SDL_uikitpen.m | 29 ++++++++++++++++++++++++++-- 2 files changed, 28 insertions(+), 5 deletions(-) diff --git a/src/joystick/apple/SDL_mfijoystick.m b/src/joystick/apple/SDL_mfijoystick.m index 23d6b23f80535..811a9f1ae7606 100644 --- a/src/joystick/apple/SDL_mfijoystick.m +++ b/src/joystick/apple/SDL_mfijoystick.m @@ -50,9 +50,7 @@ #include -/* remove compilation warnings for strict builds by defining these selectors, even though - * they are only ever used indirectly through objc_msgSend - */ +// Fix build errors when using an older SDK by defining these selectors @interface GCController (SDL) #if !((__IPHONE_OS_VERSION_MAX_ALLOWED >= 140500) || (__APPLETV_OS_VERSION_MAX_ALLOWED >= 140500) || (__MAC_OS_X_VERSION_MAX_ALLOWED >= 110300)) @property(class, nonatomic, readwrite) BOOL shouldMonitorBackgroundEvents; diff --git a/src/video/uikit/SDL_uikitpen.m b/src/video/uikit/SDL_uikitpen.m index 622513c24d37a..520968163d476 100644 --- a/src/video/uikit/SDL_uikitpen.m +++ b/src/video/uikit/SDL_uikitpen.m @@ -28,6 +28,31 @@ #include "../../events/SDL_pen_c.h" +// Fix build errors when using an older SDK by defining these selectors +#if !defined(SDL_PLATFORM_TVOS) + +@interface UITouch (SDL) +#if !(__IPHONE_OS_VERSION_MAX_ALLOWED >= 170500) +@property (nonatomic, readonly) CGFloat rollAngle; +#endif +@end + +@interface UIHoverGestureRecognizer (SDL) +#if !(__IPHONE_OS_VERSION_MAX_ALLOWED >= 160100) +@property (nonatomic, readonly) CGFloat zOffset; +#endif +#if !(__IPHONE_OS_VERSION_MAX_ALLOWED >= 160400) +- (CGFloat) azimuthAngleInView:(UIView *) view; + +@property (nonatomic, readonly) CGFloat altitudeAngle; +#endif +#if !(__IPHONE_OS_VERSION_MAX_ALLOWED >= 170500) +@property (nonatomic, readonly) CGFloat rollAngle; +#endif +@end + +#endif // !SDL_PLATFORM_TVOS + static SDL_PenID apple_pencil_id = 0; bool UIKit_InitPen(SDL_VideoDevice *_this) @@ -142,11 +167,11 @@ extern void UIKit_HandlePenHover(SDL_uikitview *view, UIHoverGestureRecognizer * static void UIKit_HandlePenAxesFromUITouch(SDL_uikitview *view, UITouch *pencil) { float rollAngle = 0.0f; - #if !defined(SDL_PLATFORM_TVOS) +#if !defined(SDL_PLATFORM_TVOS) if (@available(iOS 17.5, *)) { rollAngle = (float) [pencil rollAngle]; } - #endif +#endif SDL_Window *window = [view getSDLWindow]; const CGPoint point = [pencil locationInView:view]; From 73fc2b03a3b398243c5131fc5c7624b610d73e2d Mon Sep 17 00:00:00 2001 From: Susko3 Date: Wed, 22 Jan 2025 04:54:57 +0000 Subject: [PATCH 225/340] Copy pen handling code from `SDLSurface` to `SDLControllerManager` --- .../main/java/org/libsdl/app/SDLControllerManager.java | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/android-project/app/src/main/java/org/libsdl/app/SDLControllerManager.java b/android-project/app/src/main/java/org/libsdl/app/SDLControllerManager.java index dc6fb9d12a6ce..e1c892e71bb49 100644 --- a/android-project/app/src/main/java/org/libsdl/app/SDLControllerManager.java +++ b/android-project/app/src/main/java/org/libsdl/app/SDLControllerManager.java @@ -705,9 +705,14 @@ public boolean onGenericMotion(View v, MotionEvent event) { x = event.getX(i); y = event.getY(i); float p = event.getPressure(i); + if (p > 1.0f) { + // may be larger than 1.0f on some devices + // see the documentation of getPressure(i) + p = 1.0f; + } - // BUTTON_STYLUS_PRIMARY is 2^5, so shift by 4 - int buttons = event.getButtonState() >> 4; + // BUTTON_STYLUS_PRIMARY is 2^5, so shift by 4, and apply SDL_PEN_INPUT_DOWN/SDL_PEN_INPUT_ERASER_TIP + int buttons = (event.getButtonState() >> 4) | (1 << (toolType == MotionEvent.TOOL_TYPE_STYLUS ? 0 : 30)); SDLActivity.onNativePen(event.getPointerId(i), buttons, action, x, y, p); consumed = true; From 1c21a72bda27fa738ba249e7e8ee6bbe702ff1d9 Mon Sep 17 00:00:00 2001 From: SDL Wiki Bot Date: Wed, 22 Jan 2025 17:20:25 +0000 Subject: [PATCH 226/340] Sync SDL3 wiki -> header [ci skip] --- include/SDL3/SDL_gpu.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/include/SDL3/SDL_gpu.h b/include/SDL3/SDL_gpu.h index 06917d45e9ae7..081ab4825525a 100644 --- a/include/SDL3/SDL_gpu.h +++ b/include/SDL3/SDL_gpu.h @@ -130,7 +130,8 @@ * It is optimal for apps to pre-compile the shader formats they might use, * but for ease of use SDL provides a separate project, * [SDL_shadercross](https://github.com/libsdl-org/SDL_shadercross) - * , for performing runtime shader cross-compilation. + * , for performing runtime shader cross-compilation. It also has a CLI + * interface for offline precompilation as well. * * This is an extremely quick overview that leaves out several important * details. Already, though, one can see that GPU programming can be quite From a437dbc7e35b686698dfb109ee6a5d2a71debce7 Mon Sep 17 00:00:00 2001 From: nightmareci Date: Wed, 22 Jan 2025 10:22:42 -0800 Subject: [PATCH 227/340] Improve log documentation --- include/SDL3/SDL_log.h | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/include/SDL3/SDL_log.h b/include/SDL3/SDL_log.h index a56476c6d2a4e..5610420ca83b9 100644 --- a/include/SDL3/SDL_log.h +++ b/include/SDL3/SDL_log.h @@ -56,6 +56,15 @@ * - Windows: debug output stream * - Android: log output * - Others: standard error output (stderr) + * + * You don't need to have a newline (`\n`) on the end of messages, the + * functions will do that for you. For consistent behavior cross-platform, you + * shouldn't have any newlines in messages, such as to log multiple lines in + * one call; unusual platform-specific behavior can be observed in such usage. + * Do one log call per line instead, with no newlines in messages. + * + * Each log call is atomic, so you won't see log messages cut off one another + * when logging from multiple threads. */ #ifndef SDL_log_h_ From 98c447802f2b19af56618626118b926d35a9879e Mon Sep 17 00:00:00 2001 From: Anonymous Maarten Date: Wed, 22 Jan 2025 18:43:49 +0100 Subject: [PATCH 228/340] ci: bump to NetBSD 10.1 --- .github/workflows/create-test-plan.py | 2 +- .github/workflows/generic.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/create-test-plan.py b/.github/workflows/create-test-plan.py index 925b994957ebb..dfdb2c5e2b117 100755 --- a/.github/workflows/create-test-plan.py +++ b/.github/workflows/create-test-plan.py @@ -709,7 +709,7 @@ def spec_to_job(spec: JobSpec, key: str, trackmem_symbol_names: bool) -> JobDeta )) case SdlPlatform.NetBSD: job.cpactions_os = "netbsd" - job.cpactions_version = "10.0" + job.cpactions_version = "10.1" job.cpactions_arch = "x86-64" job.cpactions_setup_cmd = "export PATH=\"/usr/pkg/sbin:/usr/pkg/bin:/sbin:$PATH\"; export PKG_CONFIG_PATH=\"/usr/pkg/lib/pkgconfig\";export PKG_PATH=\"https://cdn.netBSD.org/pub/pkgsrc/packages/NetBSD/$(uname -p)/$(uname -r|cut -f \"1 2\" -d.)/All/\";echo \"PKG_PATH=$PKG_PATH\";echo \"uname -a -> \"$(uname -a)\"\";sudo -E sysctl -w security.pax.aslr.enabled=0;sudo -E sysctl -w security.pax.aslr.global=0;sudo -E pkgin clean;sudo -E pkgin update" job.cpactions_install_cmd = "sudo -E pkgin -y install cmake dbus pkgconf ninja-build pulseaudio libxkbcommon wayland wayland-protocols libinotify libusb1" diff --git a/.github/workflows/generic.yml b/.github/workflows/generic.yml index 0e42831759fbf..6842b9054d147 100644 --- a/.github/workflows/generic.yml +++ b/.github/workflows/generic.yml @@ -290,7 +290,7 @@ jobs: - name: 'Build (cross-platform-actions, BSD)' id: cpactions if: ${{ matrix.platform.cpactions }} - uses: cross-platform-actions/action@v0.26.0 + uses: cross-platform-actions/action@v0.27.0 with: operating_system: '${{ matrix.platform.cpactions-os }}' architecture: '${{ matrix.platform.cpactions-arch }}' From 74536243dde05fb033d8079bfe8fae2c037e41e6 Mon Sep 17 00:00:00 2001 From: Sam Lantinga Date: Wed, 22 Jan 2025 12:56:32 -0800 Subject: [PATCH 229/340] Emscripten works well using the normal CMake workflow --- docs/INTRO-emscripten.md | 45 +++++++++++++++++++++++++--------------- 1 file changed, 28 insertions(+), 17 deletions(-) diff --git a/docs/INTRO-emscripten.md b/docs/INTRO-emscripten.md index 89831248cc823..a3f3572cf1bbc 100644 --- a/docs/INTRO-emscripten.md +++ b/docs/INTRO-emscripten.md @@ -1,35 +1,46 @@ # Introduction to SDL with Emscripten +The easiest way to use SDL is to include it as a subproject in your project. + +We'll start by creating a simple project to build and run [hello.c](hello.c) + First, you should have the Emscripten SDK installed from: https://emscripten.org/docs/getting_started/downloads.html -We'll start by creating a simple project to build and run [hello.c](hello.c) +Create the file CMakeLists.txt +```cmake +cmake_minimum_required(VERSION 3.16) +project(hello) -## Building SDL +# set the output directory for built objects. +# This makes sure that the dynamic library goes into the build directory automatically. +set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/$") +set(CMAKE_LIBRARY_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/$") -Once you have a command line interface with the Emscripten SDK set up and you've changed directory to the SDL directory, you can build SDL like this: +# This assumes the SDL source is available in vendored/SDL +add_subdirectory(vendored/SDL EXCLUDE_FROM_ALL) -```sh -mkdir hello -cd hello -emcmake cmake .. -emmake make -``` +# on Web targets, we need CMake to generate a HTML webpage. +if(EMSCRIPTEN) + set(CMAKE_EXECUTABLE_SUFFIX ".html" CACHE INTERNAL "") +endif() -## Building your app +# Create your game executable target as usual +add_executable(hello WIN32 hello.c) -In this case we'll just run a simple command to compile our source with the SDL library we just built: -```sh -emcc -o index.html ../docs/hello.c -I../include -L. -lSDL3 +# Link to the actual SDL3 library. +target_link_libraries(hello PRIVATE SDL3::SDL3) ``` -## Running your app - -You can now run your app by pointing a webserver at your build directory and connecting a web browser to it. +```sh +emcmake cmake -S . -B build +cd build +emmake make +``` -## More information +You can now run your app by pointing a webserver at your build directory and connecting a web browser to it, opening hello.html. A more complete example is available at: From c806c271c5e800a3a88ac2b6a0282540867e556e Mon Sep 17 00:00:00 2001 From: Sam Lantinga Date: Wed, 22 Jan 2025 13:05:44 -0800 Subject: [PATCH 230/340] Tweaked emscripten introduction --- docs/INTRO-emscripten.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/docs/INTRO-emscripten.md b/docs/INTRO-emscripten.md index a3f3572cf1bbc..a0541c8317507 100644 --- a/docs/INTRO-emscripten.md +++ b/docs/INTRO-emscripten.md @@ -34,13 +34,14 @@ add_executable(hello WIN32 hello.c) target_link_libraries(hello PRIVATE SDL3::SDL3) ``` +Build: ```sh emcmake cmake -S . -B build cd build emmake make ``` -You can now run your app by pointing a webserver at your build directory and connecting a web browser to it, opening hello.html. +You can now run your app by pointing a webserver at your build directory and connecting a web browser to it, opening hello.html A more complete example is available at: From 17625e20dfbcb156ae6a7ea464579d103e3486ce Mon Sep 17 00:00:00 2001 From: Sam Lantinga Date: Wed, 22 Jan 2025 13:26:11 -0800 Subject: [PATCH 231/340] Removed redundant step in Visual Studio instructions --- docs/INTRO-visualstudio.md | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/docs/INTRO-visualstudio.md b/docs/INTRO-visualstudio.md index 31a16e0a0a4e7..2cc6100cb8b5a 100644 --- a/docs/INTRO-visualstudio.md +++ b/docs/INTRO-visualstudio.md @@ -8,8 +8,7 @@ We'll start by creating a simple project to build and run [hello.c](hello.c) - Create a new project in Visual Studio, using the C++ Empty Project template - Add hello.c to the Source Files - Right click the solution, select add an existing project, navigate to VisualC/SDL and add SDL.vcxproj -- Select your main project and go to Project -> Project Dependencies and select SDL3 -- Select your main project and go to Project -> Properties, set the filter at the top to "All Configurations" and "All Platforms", select VC++ Directories and add the SDL include directory to "Include Directories" - Select your main project and go to Project -> Add Reference and select SDL3 +- Select your main project and go to Project -> Properties, set the filter at the top to "All Configurations" and "All Platforms", select VC++ Directories and add the SDL include directory to "Include Directories" - Build and run! From 718034f5fa6e796cf609db32ee8d702fc57d78aa Mon Sep 17 00:00:00 2001 From: nightmareci Date: Wed, 22 Jan 2025 12:59:57 -0800 Subject: [PATCH 232/340] Remove newlines from log messages --- VisualC-GDK/tests/testgdk/src/testgdk.cpp | 12 +- cmake/test/main_cli.c | 2 +- cmake/test/main_gui.c | 4 +- cmake/test/main_lib.c | 2 +- docs/README-migration.md | 12 +- docs/hello.c | 2 +- src/SDL_properties.c | 12 +- src/SDL_utils.c | 2 +- src/audio/SDL_sysaudio.h | 2 +- src/audio/aaudio/SDL_aaudio.c | 4 +- src/audio/coreaudio/SDL_coreaudio.m | 6 +- src/audio/disk/SDL_diskaudio.c | 2 +- src/events/SDL_events.c | 2 +- src/events/SDL_keyboard.c | 4 +- src/events/SDL_mouse.c | 6 +- src/filesystem/cocoa/SDL_sysfilesystem.m | 2 +- src/hidapi/android/hid.cpp | 2 +- src/joystick/android/SDL_sysjoystick.c | 2 +- src/joystick/hidapi/SDL_hidapi_ps3.c | 6 +- src/joystick/hidapi/SDL_hidapi_ps4.c | 16 +- src/joystick/hidapi/SDL_hidapi_ps5.c | 10 +- src/joystick/hidapi/SDL_hidapi_steam_hori.c | 2 +- src/joystick/hidapi/SDL_hidapi_switch.c | 14 +- src/joystick/hidapi/SDL_hidapi_wii.c | 8 +- src/joystick/hidapi/SDL_hidapi_xbox360w.c | 6 +- src/joystick/hidapi/SDL_hidapi_xboxone.c | 34 ++--- src/joystick/hidapi/SDL_hidapijoystick.c | 8 +- src/joystick/linux/SDL_sysjoystick.c | 58 ++++---- src/joystick/windows/SDL_rawinputjoystick.c | 12 +- src/render/direct3d11/SDL_render_d3d11.c | 8 +- src/render/direct3d12/SDL_render_d3d12.c | 6 +- src/render/opengl/SDL_shaders_gl.c | 5 +- src/render/opengles2/SDL_render_gles2.c | 2 +- src/render/vitagxm/SDL_render_vita_gxm.c | 4 +- .../vitagxm/SDL_render_vita_gxm_tools.c | 62 ++++---- src/render/vulkan/SDL_render_vulkan.c | 8 +- src/sensor/windows/SDL_windowssensor.c | 8 +- src/test/SDL_test_common.c | 138 +++++++++--------- src/video/SDL_egl.c | 2 +- src/video/cocoa/SDL_cocoakeyboard.m | 2 +- src/video/kmsdrm/SDL_kmsdrmdyn.c | 4 +- src/video/openvr/SDL_openvrvideo.c | 10 +- src/video/wayland/SDL_waylanddyn.c | 4 +- src/video/wayland/SDL_waylandvideo.c | 2 +- src/video/windows/SDL_windowsevents.c | 10 +- src/video/windows/SDL_windowsgameinput.c | 4 +- src/video/windows/SDL_windowsmodes.c | 2 +- src/video/windows/SDL_windowsvideo.c | 4 +- src/video/x11/SDL_x11events.c | 102 ++++++------- src/video/x11/SDL_x11keyboard.c | 16 +- src/video/x11/SDL_x11xinput2.c | 2 +- test/checkkeys.c | 22 +-- test/childprocess.c | 2 +- test/loopwave.c | 10 +- test/testatomic.c | 84 ++++++----- test/testaudiohotplug.c | 16 +- test/testaudioinfo.c | 60 ++++---- test/testaudiorecording.c | 34 ++--- test/testaudiostreamdynamicresample.c | 2 +- test/testcamera.c | 4 +- test/testclipboard.c | 10 +- test/testcolorspace.c | 22 +-- test/testcontroller.c | 58 ++++---- test/testdialog.c | 10 +- test/testdisplayinfo.c | 16 +- test/testdraw.c | 2 +- test/testdrawchessboard.c | 6 +- test/testerror.c | 12 +- test/testffmpeg.c | 36 ++--- test/testfile.c | 12 +- test/testfilesystem.c | 22 +-- test/testgeometry.c | 6 +- test/testgl.c | 64 ++++---- test/testgles.c | 56 +++---- test/testgles2.c | 60 ++++---- test/testgles2_sdf.c | 62 ++++---- test/testgpu_simple_clear.c | 10 +- test/testgpu_spinning_cube.c | 8 +- test/testhaptic.c | 103 ++++++------- test/testhittesting.c | 12 +- test/testhotplug.c | 42 +++--- test/testiconv.c | 6 +- test/testime.c | 50 +++---- test/testintersections.c | 6 +- test/testkeys.c | 4 +- test/testloadso.c | 18 +-- test/testlock.c | 22 +-- test/testmessage.c | 24 +-- test/testmodal.c | 6 +- test/testmouse.c | 6 +- test/testmultiaudio.c | 10 +- test/testnative.c | 14 +- test/testoffscreen.c | 10 +- test/testoverlay.c | 28 ++-- test/testplatform.c | 74 +++++----- test/testpower.c | 14 +- test/testqsort.c | 4 +- test/testrendercopyex.c | 2 +- test/testrendertarget.c | 6 +- test/testresample.c | 10 +- test/testrumble.c | 28 ++-- test/testrwlock.c | 16 +- test/testscale.c | 2 +- test/testsem.c | 36 +++-- test/testsensor.c | 18 +-- test/testshader.c | 23 +-- test/testshape.c | 14 +- test/testsprite.c | 8 +- test/testspriteminimal.c | 2 +- test/testspritesurface.c | 2 +- test/teststreaming.c | 14 +- test/testsurround.c | 16 +- test/testthread.c | 22 +-- test/testtimer.c | 44 +++--- test/testtray.c | 62 ++++---- test/testurl.c | 2 +- test/testutils.c | 2 +- test/testver.c | 8 +- test/testviewport.c | 2 +- test/testvulkan.c | 22 +-- test/testwm.c | 8 +- test/testyuv.c | 64 ++++---- test/torturethread.c | 10 +- 123 files changed, 1143 insertions(+), 1118 deletions(-) diff --git a/VisualC-GDK/tests/testgdk/src/testgdk.cpp b/VisualC-GDK/tests/testgdk/src/testgdk.cpp index d2a92091ee8f0..51fc75bc08cc5 100644 --- a/VisualC-GDK/tests/testgdk/src/testgdk.cpp +++ b/VisualC-GDK/tests/testgdk/src/testgdk.cpp @@ -198,7 +198,7 @@ LoadSprite(const char *file) return -1; } if (!SDL_SetTextureBlendMode(sprites[i], blendMode)) { - SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't set blend mode: %s\n", SDL_GetError()); + SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't set blend mode: %s", SDL_GetError()); SDL_DestroyTexture(sprites[i]); return -1; } @@ -405,7 +405,7 @@ main(int argc, char *argv[]) sprites = (SDL_Texture **) SDL_malloc(state->num_windows * sizeof(*sprites)); if (!sprites) { - SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Out of memory!\n"); + SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Out of memory!"); quit(2); } for (i = 0; i < state->num_windows; ++i) { @@ -420,13 +420,13 @@ main(int argc, char *argv[]) soundname = GetResourceFilename(argc > 1 ? argv[1] : NULL, "sample.wav"); if (!soundname) { - SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "%s\n", SDL_GetError()); + SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "%s", SDL_GetError()); quit(1); } /* Load the wave file into memory */ if (!SDL_LoadWAV(soundname, &wave.spec, &wave.sound, &wave.soundlen)) { - SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't load %s: %s\n", soundname, SDL_GetError()); + SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't load %s: %s", soundname, SDL_GetError()); quit(1); } @@ -436,11 +436,11 @@ main(int argc, char *argv[]) SDL_Log("%i: %s", i, SDL_GetAudioDriver(i)); } - SDL_Log("Using audio driver: %s\n", SDL_GetCurrentAudioDriver()); + SDL_Log("Using audio driver: %s", SDL_GetCurrentAudioDriver()); stream = SDL_OpenAudioDeviceStream(SDL_AUDIO_DEVICE_DEFAULT_PLAYBACK, &wave.spec, NULL, NULL); if (!stream) { - SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't create audio stream: %s\n", SDL_GetError()); + SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't create audio stream: %s", SDL_GetError()); return -1; } SDL_ResumeAudioDevice(SDL_GetAudioStreamDevice(stream)); diff --git a/cmake/test/main_cli.c b/cmake/test/main_cli.c index 5a1c0c62537f7..39c5ce2758c0f 100644 --- a/cmake/test/main_cli.c +++ b/cmake/test/main_cli.c @@ -6,7 +6,7 @@ int main(int argc, char *argv[]) { SDL_SetMainReady(); if (!SDL_Init(0)) { - SDL_Log("Could not initialize SDL: %s\n", SDL_GetError()); + SDL_Log("Could not initialize SDL: %s", SDL_GetError()); return 1; } SDL_Delay(100); diff --git a/cmake/test/main_gui.c b/cmake/test/main_gui.c index 3df64e5fd0492..18ed10107c417 100644 --- a/cmake/test/main_gui.c +++ b/cmake/test/main_gui.c @@ -6,12 +6,12 @@ int main(int argc, char *argv[]) SDL_Window *window = NULL; SDL_Surface *screenSurface = NULL; if (!SDL_Init(SDL_INIT_VIDEO)) { - SDL_Log("Could not initialize SDL: %s\n", SDL_GetError()); + SDL_Log("Could not initialize SDL: %s", SDL_GetError()); return 1; } window = SDL_CreateWindow("Hello SDL", 640, 480, 0); if (!window) { - SDL_Log("could not create window: %s\n", SDL_GetError()); + SDL_Log("could not create window: %s", SDL_GetError()); return 1; } screenSurface = SDL_GetWindowSurface(window); diff --git a/cmake/test/main_lib.c b/cmake/test/main_lib.c index a59150b4a69cf..6aec1f637458a 100644 --- a/cmake/test/main_lib.c +++ b/cmake/test/main_lib.c @@ -18,7 +18,7 @@ int MYLIBRARY_EXPORT mylibrary_work(void); int mylibrary_init(void) { SDL_SetMainReady(); if (!SDL_Init(0)) { - SDL_Log("Could not initialize SDL: %s\n", SDL_GetError()); + SDL_Log("Could not initialize SDL: %s", SDL_GetError()); return 1; } return 0; diff --git a/docs/README-migration.md b/docs/README-migration.md index 84bf315b41d5a..750a1f05447e0 100644 --- a/docs/README-migration.md +++ b/docs/README-migration.md @@ -193,7 +193,7 @@ Rather than iterating over audio devices using a device index, there are new fun if (devices) { for (i = 0; i < num_devices; ++i) { SDL_AudioDeviceID instance_id = devices[i]; - SDL_Log("AudioDevice %" SDL_PRIu32 ": %s\n", instance_id, SDL_GetAudioDeviceName(instance_id)); + SDL_Log("AudioDevice %" SDL_PRIu32 ": %s", instance_id, SDL_GetAudioDeviceName(instance_id)); } SDL_free(devices); } @@ -749,7 +749,7 @@ Rather than iterating over haptic devices using device index, there is a new fun if (haptics) { for (i = 0; i < num_haptics; ++i) { SDL_HapticID instance_id = haptics[i]; - SDL_Log("Haptic %" SDL_PRIu32 ": %s\n", instance_id, SDL_GetHapticNameForID(instance_id)); + SDL_Log("Haptic %" SDL_PRIu32 ": %s", instance_id, SDL_GetHapticNameForID(instance_id)); } SDL_free(haptics); } @@ -917,7 +917,7 @@ Rather than iterating over joysticks using device index, there is a new function const char *name = SDL_GetJoystickNameForID(instance_id); const char *path = SDL_GetJoystickPathForID(instance_id); - SDL_Log("Joystick %" SDL_PRIu32 ": %s%s%s VID 0x%.4x, PID 0x%.4x\n", + SDL_Log("Joystick %" SDL_PRIu32 ": %s%s%s VID 0x%.4x, PID 0x%.4x", instance_id, name ? name : "Unknown", path ? ", " : "", path ? path : "", SDL_GetJoystickVendorForID(instance_id), SDL_GetJoystickProductForID(instance_id)); } SDL_free(joysticks); @@ -1696,7 +1696,7 @@ Rather than iterating over sensors using device index, there is a new function S SDL_SensorID *sensors = SDL_GetSensors(&num_sensors); if (sensors) { for (i = 0; i < num_sensors; ++i) { - SDL_Log("Sensor %" SDL_PRIu32 ": %s, type %d, platform type %d\n", + SDL_Log("Sensor %" SDL_PRIu32 ": %s, type %d, platform type %d", sensors[i], SDL_GetSensorNameForID(sensors[i]), SDL_GetSensorTypeForID(sensors[i]), @@ -2121,7 +2121,7 @@ Rather than iterating over displays using display index, there is a new function SDL_DisplayID instance_id = displays[i]; const char *name = SDL_GetDisplayName(instance_id); - SDL_Log("Display %" SDL_PRIu32 ": %s\n", instance_id, name ? name : "Unknown"); + SDL_Log("Display %" SDL_PRIu32 ": %s", instance_id, name ? name : "Unknown"); } SDL_free(displays); } @@ -2167,7 +2167,7 @@ Rather than iterating over display modes using an index, there is a new function if (modes) { for (i = 0; i < num_modes; ++i) { SDL_DisplayMode *mode = modes[i]; - SDL_Log("Display %" SDL_PRIu32 " mode %d: %dx%d@%gx %gHz\n", + SDL_Log("Display %" SDL_PRIu32 " mode %d: %dx%d@%gx %gHz", display, i, mode->w, mode->h, mode->pixel_density, mode->refresh_rate); } SDL_free(modes); diff --git a/docs/hello.c b/docs/hello.c index 74a04bc246aa1..a825ea1c432f5 100644 --- a/docs/hello.c +++ b/docs/hello.c @@ -21,7 +21,7 @@ SDL_AppResult SDL_AppInit(void **appstate, int argc, char *argv[]) { /* Create the window */ if (!SDL_CreateWindowAndRenderer("Hello World", 800, 600, SDL_WINDOW_FULLSCREEN, &window, &renderer)) { - SDL_Log("Couldn't create window and renderer: %s\n", SDL_GetError()); + SDL_Log("Couldn't create window and renderer: %s", SDL_GetError()); return SDL_APP_FAILURE; } return SDL_APP_CONTINUE; diff --git a/src/SDL_properties.c b/src/SDL_properties.c index 9dc10a675c811..41c81e9e592ee 100644 --- a/src/SDL_properties.c +++ b/src/SDL_properties.c @@ -766,25 +766,25 @@ static void SDLCALL SDL_DumpPropertiesCallback(void *userdata, SDL_PropertiesID { switch (SDL_GetPropertyType(props, name)) { case SDL_PROPERTY_TYPE_POINTER: - SDL_Log("%s: %p\n", name, SDL_GetPointerProperty(props, name, NULL)); + SDL_Log("%s: %p", name, SDL_GetPointerProperty(props, name, NULL)); break; case SDL_PROPERTY_TYPE_STRING: - SDL_Log("%s: \"%s\"\n", name, SDL_GetStringProperty(props, name, "")); + SDL_Log("%s: \"%s\"", name, SDL_GetStringProperty(props, name, "")); break; case SDL_PROPERTY_TYPE_NUMBER: { Sint64 value = SDL_GetNumberProperty(props, name, 0); - SDL_Log("%s: %" SDL_PRIs64 " (%" SDL_PRIx64 ")\n", name, value, value); + SDL_Log("%s: %" SDL_PRIs64 " (%" SDL_PRIx64 ")", name, value, value); } break; case SDL_PROPERTY_TYPE_FLOAT: - SDL_Log("%s: %g\n", name, SDL_GetFloatProperty(props, name, 0.0f)); + SDL_Log("%s: %g", name, SDL_GetFloatProperty(props, name, 0.0f)); break; case SDL_PROPERTY_TYPE_BOOLEAN: - SDL_Log("%s: %s\n", name, SDL_GetBooleanProperty(props, name, false) ? "true" : "false"); + SDL_Log("%s: %s", name, SDL_GetBooleanProperty(props, name, false) ? "true" : "false"); break; default: - SDL_Log("%s UNKNOWN TYPE\n", name); + SDL_Log("%s UNKNOWN TYPE", name); break; } } diff --git a/src/SDL_utils.c b/src/SDL_utils.c index a877360f6218d..fb82aac14beb6 100644 --- a/src/SDL_utils.c +++ b/src/SDL_utils.c @@ -240,7 +240,7 @@ void SDL_SetObjectsInvalid(void) type = "unknown object"; break; } - SDL_Log("Leaked %s (%p)\n", type, object); + SDL_Log("Leaked %s (%p)", type, object); } SDL_assert(SDL_HashTableEmpty(SDL_objects)); diff --git a/src/audio/SDL_sysaudio.h b/src/audio/SDL_sysaudio.h index c5cce0e4c6db2..c8af24412a810 100644 --- a/src/audio/SDL_sysaudio.h +++ b/src/audio/SDL_sysaudio.h @@ -28,7 +28,7 @@ #define DEBUG_AUDIO_CONVERT 0 #if DEBUG_AUDIO_CONVERT -#define LOG_DEBUG_AUDIO_CONVERT(from, to) SDL_Log("SDL_AUDIO_CONVERT: Converting %s to %s.\n", from, to); +#define LOG_DEBUG_AUDIO_CONVERT(from, to) SDL_Log("SDL_AUDIO_CONVERT: Converting %s to %s.", from, to); #else #define LOG_DEBUG_AUDIO_CONVERT(from, to) #endif diff --git a/src/audio/aaudio/SDL_aaudio.c b/src/audio/aaudio/SDL_aaudio.c index fd075b53af847..8b1681b4e1086 100644 --- a/src/audio/aaudio/SDL_aaudio.c +++ b/src/audio/aaudio/SDL_aaudio.c @@ -315,10 +315,10 @@ static bool BuildAAudioStream(SDL_AudioDevice *device) ctx.AAudioStreamBuilder_setDataCallback(builder, AAUDIO_dataCallback, device); // Some devices have flat sounding audio when low latency mode is enabled, but this is a better experience for most people if (SDL_GetHintBoolean(SDL_HINT_ANDROID_LOW_LATENCY_AUDIO, true)) { - SDL_Log("Low latency audio enabled\n"); + SDL_Log("Low latency audio enabled"); ctx.AAudioStreamBuilder_setPerformanceMode(builder, AAUDIO_PERFORMANCE_MODE_LOW_LATENCY); } else { - SDL_Log("Low latency audio disabled\n"); + SDL_Log("Low latency audio disabled"); } LOGI("AAudio Try to open %u hz %s %u channels samples %u", diff --git a/src/audio/coreaudio/SDL_coreaudio.m b/src/audio/coreaudio/SDL_coreaudio.m index cfa0616da1800..cd0446eb730f6 100644 --- a/src/audio/coreaudio/SDL_coreaudio.m +++ b/src/audio/coreaudio/SDL_coreaudio.m @@ -31,7 +31,7 @@ #if DEBUG_COREAUDIO #define CHECK_RESULT(msg) \ if (result != noErr) { \ - SDL_Log("COREAUDIO: Got error %d from '%s'!\n", (int)result, msg); \ + SDL_Log("COREAUDIO: Got error %d from '%s'!", (int)result, msg); \ return SDL_SetError("CoreAudio error (%s): %d", msg, (int)result); \ } #else @@ -224,7 +224,7 @@ static void RefreshPhysicalDevices(void) name[len] = '\0'; #if DEBUG_COREAUDIO - SDL_Log("COREAUDIO: Found %s device #%d: '%s' (devid %d)\n", ((recording) ? "recording" : "playback"), (int)i, name, (int)dev); + SDL_Log("COREAUDIO: Found %s device #%d: '%s' (devid %d)", ((recording) ? "recording" : "playback"), (int)i, name, (int)dev); #endif SDLCoreAudioHandle *newhandle = (SDLCoreAudioHandle *) SDL_calloc(1, sizeof (*newhandle)); if (newhandle) { @@ -834,7 +834,7 @@ static bool PrepareAudioQueue(SDL_AudioDevice *device) } #if DEBUG_COREAUDIO - SDL_Log("COREAUDIO: numAudioBuffers == %d\n", numAudioBuffers); + SDL_Log("COREAUDIO: numAudioBuffers == %d", numAudioBuffers); #endif for (int i = 0; i < numAudioBuffers; i++) { diff --git a/src/audio/disk/SDL_diskaudio.c b/src/audio/disk/SDL_diskaudio.c index c59bd2ec608bd..99145c90dbd9b 100644 --- a/src/audio/disk/SDL_diskaudio.c +++ b/src/audio/disk/SDL_diskaudio.c @@ -136,7 +136,7 @@ static bool DISKAUDIO_OpenDevice(SDL_AudioDevice *device) } SDL_LogCritical(SDL_LOG_CATEGORY_AUDIO, "You are using the SDL disk i/o audio driver!"); - SDL_LogCritical(SDL_LOG_CATEGORY_AUDIO, " %s file [%s].\n", recording ? "Reading from" : "Writing to", fname); + SDL_LogCritical(SDL_LOG_CATEGORY_AUDIO, " %s file [%s].", recording ? "Reading from" : "Writing to", fname); return true; // We're ready to rock and roll. :-) } diff --git a/src/events/SDL_events.c b/src/events/SDL_events.c index ca11afffa36af..7404234380e01 100644 --- a/src/events/SDL_events.c +++ b/src/events/SDL_events.c @@ -847,7 +847,7 @@ void SDL_StopEventLoop(void) SDL_EventQ.active = false; if (report && SDL_atoi(report)) { - SDL_Log("SDL EVENT QUEUE: Maximum events in-flight: %d\n", + SDL_Log("SDL EVENT QUEUE: Maximum events in-flight: %d", SDL_EventQ.max_events_seen); } diff --git a/src/events/SDL_keyboard.c b/src/events/SDL_keyboard.c index e4664fba6d296..066c6e6aaa6ed 100644 --- a/src/events/SDL_keyboard.c +++ b/src/events/SDL_keyboard.c @@ -220,7 +220,7 @@ void SDL_ResetKeyboard(void) int scancode; #ifdef DEBUG_KEYBOARD - SDL_Log("Resetting keyboard\n"); + SDL_Log("Resetting keyboard"); #endif for (scancode = SDL_SCANCODE_UNKNOWN; scancode < SDL_SCANCODE_COUNT; ++scancode) { if (keyboard->keystate[scancode]) { @@ -517,7 +517,7 @@ static bool SDL_SendKeyboardKeyInternal(Uint64 timestamp, Uint32 flags, SDL_Keyb const Uint8 source = flags & KEYBOARD_SOURCE_MASK; #ifdef DEBUG_KEYBOARD - SDL_Log("The '%s' key has been %s\n", SDL_GetScancodeName(scancode), down ? "pressed" : "released"); + SDL_Log("The '%s' key has been %s", SDL_GetScancodeName(scancode), down ? "pressed" : "released"); #endif // Figure out what type of event this is diff --git a/src/events/SDL_mouse.c b/src/events/SDL_mouse.c index df89271531ce9..25dfef7f2a7f9 100644 --- a/src/events/SDL_mouse.c +++ b/src/events/SDL_mouse.c @@ -605,7 +605,7 @@ static bool SDL_UpdateMouseFocus(SDL_Window *window, float x, float y, Uint32 bu if (!inWindow) { if (window == mouse->focus) { #ifdef DEBUG_MOUSE - SDL_Log("Mouse left window, synthesizing move & focus lost event\n"); + SDL_Log("Mouse left window, synthesizing move & focus lost event"); #endif if (send_mouse_motion) { SDL_PrivateSendMouseMotion(0, window, SDL_GLOBAL_MOUSE_ID, false, x, y); @@ -617,7 +617,7 @@ static bool SDL_UpdateMouseFocus(SDL_Window *window, float x, float y, Uint32 bu if (window != mouse->focus) { #ifdef DEBUG_MOUSE - SDL_Log("Mouse entered window, synthesizing focus gain & move event\n"); + SDL_Log("Mouse entered window, synthesizing focus gain & move event"); #endif SDL_SetMouseFocus(window); if (send_mouse_motion) { @@ -740,7 +740,7 @@ static void SDL_PrivateSendMouseMotion(Uint64 timestamp, SDL_Window *window, SDL if (mouse->has_position && xrel == 0.0f && yrel == 0.0f) { // Drop events that don't change state #ifdef DEBUG_MOUSE - SDL_Log("Mouse event didn't change state - dropped!\n"); + SDL_Log("Mouse event didn't change state - dropped!"); #endif return; } diff --git a/src/filesystem/cocoa/SDL_sysfilesystem.m b/src/filesystem/cocoa/SDL_sysfilesystem.m index a5fa67bcdf768..5818764e55a8c 100644 --- a/src/filesystem/cocoa/SDL_sysfilesystem.m +++ b/src/filesystem/cocoa/SDL_sysfilesystem.m @@ -92,7 +92,7 @@ static bool shown = false; if (!shown) { shown = true; - SDL_LogCritical(SDL_LOG_CATEGORY_SYSTEM, "tvOS does not have persistent local storage! Use iCloud storage if you want your data to persist between sessions.\n"); + SDL_LogCritical(SDL_LOG_CATEGORY_SYSTEM, "tvOS does not have persistent local storage! Use iCloud storage if you want your data to persist between sessions."); } } diff --git a/src/hidapi/android/hid.cpp b/src/hidapi/android/hid.cpp index 1e43aa73f1d12..887390ed57e81 100644 --- a/src/hidapi/android/hid.cpp +++ b/src/hidapi/android/hid.cpp @@ -1028,7 +1028,7 @@ extern "C" static void SDLCALL RequestBluetoothPermissionCallback( void *userdata, const char *permission, bool granted ) { - SDL_Log( "Bluetooth permission %s\n", granted ? "granted" : "denied" ); + SDL_Log( "Bluetooth permission %s", granted ? "granted" : "denied" ); if ( granted && g_HIDDeviceManagerCallbackHandler ) { diff --git a/src/joystick/android/SDL_sysjoystick.c b/src/joystick/android/SDL_sysjoystick.c index 95ad99c0a2807..9a3402eb6af51 100644 --- a/src/joystick/android/SDL_sysjoystick.c +++ b/src/joystick/android/SDL_sysjoystick.c @@ -329,7 +329,7 @@ void Android_AddJoystick(int device_id, const char *name, const char *desc, int } #ifdef DEBUG_JOYSTICK - SDL_Log("Joystick: %s, descriptor %s, vendor = 0x%.4x, product = 0x%.4x, %d axes, %d hats\n", name, desc, vendor_id, product_id, naxes, nhats); + SDL_Log("Joystick: %s, descriptor %s, vendor = 0x%.4x, product = 0x%.4x, %d axes, %d hats", name, desc, vendor_id, product_id, naxes, nhats); #endif if (nhats > 0) { diff --git a/src/joystick/hidapi/SDL_hidapi_ps3.c b/src/joystick/hidapi/SDL_hidapi_ps3.c index bcb7d5b98e76a..6c82647c0bcd0 100644 --- a/src/joystick/hidapi/SDL_hidapi_ps3.c +++ b/src/joystick/hidapi/SDL_hidapi_ps3.c @@ -566,7 +566,7 @@ static bool HIDAPI_DriverPS3_UpdateDevice(SDL_HIDAPI_Device *device) break; default: #ifdef DEBUG_JOYSTICK - SDL_Log("Unknown PS3 packet: 0x%.2x\n", data[0]); + SDL_Log("Unknown PS3 packet: 0x%.2x", data[0]); #endif break; } @@ -1004,7 +1004,7 @@ static bool HIDAPI_DriverPS3ThirdParty_UpdateDevice(SDL_HIDAPI_Device *device) HIDAPI_DriverPS3ThirdParty_HandleStatePacket18(joystick, ctx, data, size); } else { #ifdef DEBUG_JOYSTICK - SDL_Log("Unknown PS3 packet, size %d\n", size); + SDL_Log("Unknown PS3 packet, size %d", size); #endif } } @@ -1357,7 +1357,7 @@ static bool HIDAPI_DriverPS3SonySixaxis_UpdateDevice(SDL_HIDAPI_Device *device) break; default: #ifdef DEBUG_JOYSTICK - SDL_Log("Unknown PS3 packet: 0x%.2x\n", data[0]); + SDL_Log("Unknown PS3 packet: 0x%.2x", data[0]); #endif break; } diff --git a/src/joystick/hidapi/SDL_hidapi_ps4.c b/src/joystick/hidapi/SDL_hidapi_ps4.c index 4fe7b03d77ed6..7404bf22687dc 100644 --- a/src/joystick/hidapi/SDL_hidapi_ps4.c +++ b/src/joystick/hidapi/SDL_hidapi_ps4.c @@ -323,7 +323,7 @@ static bool HIDAPI_DriverPS4_InitDevice(SDL_HIDAPI_Device *device) if (size > 0) { HIDAPI_DumpPacket("PS4 first packet: size = %d", data, size); } else { - SDL_Log("PS4 first packet: size = %d\n", size); + SDL_Log("PS4 first packet: size = %d", size); } #endif if (size > 0 && @@ -468,7 +468,7 @@ static bool HIDAPI_DriverPS4_LoadOfficialCalibrationData(SDL_HIDAPI_Device *devi if (!ctx->official_controller) { #ifdef DEBUG_PS4_CALIBRATION - SDL_Log("Not an official controller, ignoring calibration\n"); + SDL_Log("Not an official controller, ignoring calibration"); #endif return false; } @@ -478,7 +478,7 @@ static bool HIDAPI_DriverPS4_LoadOfficialCalibrationData(SDL_HIDAPI_Device *devi size = ReadFeatureReport(device->dev, k_ePS4FeatureReportIdGyroCalibration_USB, data, sizeof(data)); if (size < 35) { #ifdef DEBUG_PS4_CALIBRATION - SDL_Log("Short read of calibration data: %d, ignoring calibration\n", size); + SDL_Log("Short read of calibration data: %d, ignoring calibration", size); #endif return false; } @@ -487,7 +487,7 @@ static bool HIDAPI_DriverPS4_LoadOfficialCalibrationData(SDL_HIDAPI_Device *devi size = ReadFeatureReport(device->dev, k_ePS4FeatureReportIdGyroCalibration_BT, data, sizeof(data)); if (size < 35) { #ifdef DEBUG_PS4_CALIBRATION - SDL_Log("Short read of calibration data: %d, ignoring calibration\n", size); + SDL_Log("Short read of calibration data: %d, ignoring calibration", size); #endif return false; } @@ -590,19 +590,19 @@ static bool HIDAPI_DriverPS4_LoadOfficialCalibrationData(SDL_HIDAPI_Device *devi ctx->hardware_calibration = true; for (i = 0; i < 6; ++i) { #ifdef DEBUG_PS4_CALIBRATION - SDL_Log("calibration[%d] bias = %d, sensitivity = %f\n", i, ctx->calibration[i].bias, ctx->calibration[i].scale); + SDL_Log("calibration[%d] bias = %d, sensitivity = %f", i, ctx->calibration[i].bias, ctx->calibration[i].scale); #endif // Some controllers have a bad calibration if (SDL_abs(ctx->calibration[i].bias) > 1024 || SDL_fabsf(1.0f - ctx->calibration[i].scale) > 0.5f) { #ifdef DEBUG_PS4_CALIBRATION - SDL_Log("invalid calibration, ignoring\n"); + SDL_Log("invalid calibration, ignoring"); #endif ctx->hardware_calibration = false; } } } else { #ifdef DEBUG_PS4_CALIBRATION - SDL_Log("Calibration data not available\n"); + SDL_Log("Calibration data not available"); #endif } return ctx->hardware_calibration; @@ -1291,7 +1291,7 @@ static bool HIDAPI_DriverPS4_UpdateDevice(SDL_HIDAPI_Device *device) break; default: #ifdef DEBUG_JOYSTICK - SDL_Log("Unknown PS4 packet: 0x%.2x\n", data[0]); + SDL_Log("Unknown PS4 packet: 0x%.2x", data[0]); #endif break; } diff --git a/src/joystick/hidapi/SDL_hidapi_ps5.c b/src/joystick/hidapi/SDL_hidapi_ps5.c index 7226fa2092331..94b720d4246a7 100644 --- a/src/joystick/hidapi/SDL_hidapi_ps5.c +++ b/src/joystick/hidapi/SDL_hidapi_ps5.c @@ -402,7 +402,7 @@ static bool HIDAPI_DriverPS5_InitDevice(SDL_HIDAPI_Device *device) if (size > 0) { HIDAPI_DumpPacket("PS5 first packet: size = %d", data, size); } else { - SDL_Log("PS5 first packet: size = %d\n", size); + SDL_Log("PS5 first packet: size = %d", size); } #endif if (size == 64) { @@ -561,7 +561,7 @@ static void HIDAPI_DriverPS5_LoadCalibrationData(SDL_HIDAPI_Device *device) size = ReadFeatureReport(device->dev, k_EPS5FeatureReportIdCalibration, data, sizeof(data)); if (size < 35) { #ifdef DEBUG_PS5_CALIBRATION - SDL_Log("Short read of calibration data: %d, ignoring calibration\n", size); + SDL_Log("Short read of calibration data: %d, ignoring calibration", size); #endif return; } @@ -631,12 +631,12 @@ static void HIDAPI_DriverPS5_LoadCalibrationData(SDL_HIDAPI_Device *device) for (i = 0; i < 6; ++i) { float divisor = (i < 3 ? 64.0f : 1.0f); #ifdef DEBUG_PS5_CALIBRATION - SDL_Log("calibration[%d] bias = %d, sensitivity = %f\n", i, ctx->calibration[i].bias, ctx->calibration[i].sensitivity); + SDL_Log("calibration[%d] bias = %d, sensitivity = %f", i, ctx->calibration[i].bias, ctx->calibration[i].sensitivity); #endif // Some controllers have a bad calibration if ((SDL_abs(ctx->calibration[i].bias) > 1024) || (SDL_fabsf(1.0f - ctx->calibration[i].sensitivity / divisor) > 0.5f)) { #ifdef DEBUG_PS5_CALIBRATION - SDL_Log("invalid calibration, ignoring\n"); + SDL_Log("invalid calibration, ignoring"); #endif ctx->hardware_calibration = false; } @@ -1531,7 +1531,7 @@ static bool HIDAPI_DriverPS5_UpdateDevice(SDL_HIDAPI_Device *device) break; default: #ifdef DEBUG_JOYSTICK - SDL_Log("Unknown PS5 packet: 0x%.2x\n", data[0]); + SDL_Log("Unknown PS5 packet: 0x%.2x", data[0]); #endif break; } diff --git a/src/joystick/hidapi/SDL_hidapi_steam_hori.c b/src/joystick/hidapi/SDL_hidapi_steam_hori.c index ac547a197729a..0cd192d018c55 100644 --- a/src/joystick/hidapi/SDL_hidapi_steam_hori.c +++ b/src/joystick/hidapi/SDL_hidapi_steam_hori.c @@ -324,7 +324,7 @@ static void HIDAPI_DriverSteamHori_HandleStatePacket(SDL_Joystick *joystick, SDL SDL_SendJoystickSensor(timestamp, joystick, SDL_SENSOR_GYRO, sensor_timestamp, imu_data, 3); - // SDL_Log("%u %f, %f, %f \n", data[0], imu_data[0], imu_data[1], imu_data[2] ); + // SDL_Log("%u %f, %f, %f ", data[0], imu_data[0], imu_data[1], imu_data[2] ); imu_data[2] = LOAD16(data[18], data[19]) * accelScale; imu_data[1] = -1 * LOAD16(data[20], data[21]) * accelScale; imu_data[0] = LOAD16(data[22], data[23]) * accelScale; diff --git a/src/joystick/hidapi/SDL_hidapi_switch.c b/src/joystick/hidapi/SDL_hidapi_switch.c index 6d1e0b81c5fc6..85f551a4806fc 100644 --- a/src/joystick/hidapi/SDL_hidapi_switch.c +++ b/src/joystick/hidapi/SDL_hidapi_switch.c @@ -521,11 +521,11 @@ static bool WriteProprietary(SDL_DriverSwitch_Context *ctx, ESwitchProprietaryCo } if (!waitForReply || ReadProprietaryReply(ctx, ucCommand)) { - // SDL_Log("Succeeded%s after %d tries\n", ctx->m_bSyncWrite ? " (sync)" : "", nTries); + // SDL_Log("Succeeded%s after %d tries", ctx->m_bSyncWrite ? " (sync)" : "", nTries); return true; } } - // SDL_Log("Failed%s after %d tries\n", ctx->m_bSyncWrite ? " (sync)" : "", nTries); + // SDL_Log("Failed%s after %d tries", ctx->m_bSyncWrite ? " (sync)" : "", nTries); return false; } @@ -579,7 +579,7 @@ static void EncodeRumble(SwitchRumbleData_t *pRumble, Uint16 usHighFreq, Uint8 u pRumble->rgucData[3] = usLowFreqAmp & 0xFF; #ifdef DEBUG_RUMBLE - SDL_Log("Freq: %.2X %.2X %.2X, Amp: %.2X %.2X %.2X\n", + SDL_Log("Freq: %.2X %.2X %.2X, Amp: %.2X %.2X %.2X", usHighFreq & 0xFF, ((usHighFreq >> 8) & 0x01), ucLowFreq, ucHighFreqAmp, ((usLowFreqAmp >> 8) & 0x80), usLowFreqAmp & 0xFF); #endif @@ -1647,7 +1647,7 @@ static bool HIDAPI_DriverSwitch_SendPendingRumble(SDL_DriverSwitch_Context *ctx) Uint16 high_frequency_rumble = (Uint16)ctx->m_unRumblePending; #ifdef DEBUG_RUMBLE - SDL_Log("Sent pending rumble %d/%d, %d ms after previous rumble\n", low_frequency_rumble, high_frequency_rumble, SDL_GetTicks() - ctx->m_ulRumbleSent); + SDL_Log("Sent pending rumble %d/%d, %d ms after previous rumble", low_frequency_rumble, high_frequency_rumble, SDL_GetTicks() - ctx->m_ulRumbleSent); #endif ctx->m_bRumblePending = false; ctx->m_unRumblePending = 0; @@ -1659,7 +1659,7 @@ static bool HIDAPI_DriverSwitch_SendPendingRumble(SDL_DriverSwitch_Context *ctx) ctx->m_bRumbleZeroPending = false; #ifdef DEBUG_RUMBLE - SDL_Log("Sent pending zero rumble, %d ms after previous rumble\n", SDL_GetTicks() - ctx->m_ulRumbleSent); + SDL_Log("Sent pending zero rumble, %d ms after previous rumble", SDL_GetTicks() - ctx->m_ulRumbleSent); #endif return HIDAPI_DriverSwitch_ActuallyRumbleJoystick(ctx, 0, 0); } @@ -1709,7 +1709,7 @@ static bool HIDAPI_DriverSwitch_RumbleJoystick(SDL_HIDAPI_Device *device, SDL_Jo } #ifdef DEBUG_RUMBLE - SDL_Log("Sent rumble %d/%d\n", low_frequency_rumble, high_frequency_rumble); + SDL_Log("Sent rumble %d/%d", low_frequency_rumble, high_frequency_rumble); #endif return HIDAPI_DriverSwitch_ActuallyRumbleJoystick(ctx, low_frequency_rumble, high_frequency_rumble); @@ -2719,7 +2719,7 @@ static bool HIDAPI_DriverSwitch_UpdateDevice(SDL_HIDAPI_Device *device) } else if (ctx->m_bRumbleActive && now >= (ctx->m_ulRumbleSent + RUMBLE_REFRESH_FREQUENCY_MS)) { #ifdef DEBUG_RUMBLE - SDL_Log("Sent continuing rumble, %d ms after previous rumble\n", now - ctx->m_ulRumbleSent); + SDL_Log("Sent continuing rumble, %d ms after previous rumble", now - ctx->m_ulRumbleSent); #endif WriteRumble(ctx); } diff --git a/src/joystick/hidapi/SDL_hidapi_wii.c b/src/joystick/hidapi/SDL_hidapi_wii.c index c442cc5e504bd..fb3e164a8d070 100644 --- a/src/joystick/hidapi/SDL_hidapi_wii.c +++ b/src/joystick/hidapi/SDL_hidapi_wii.c @@ -1364,7 +1364,7 @@ static void HandleStatus(SDL_DriverWii_Context *ctx, SDL_Joystick *joystick) // The report data format has been reset, need to update it ResetButtonPacketType(ctx); - SDL_LogDebug(SDL_LOG_CATEGORY_INPUT, "HIDAPI Wii: Status update, extension %s\n", hasExtension ? "CONNECTED" : "DISCONNECTED"); + SDL_LogDebug(SDL_LOG_CATEGORY_INPUT, "HIDAPI Wii: Status update, extension %s", hasExtension ? "CONNECTED" : "DISCONNECTED"); /* When Motion Plus is active, we get extension connect/disconnect status * through the Motion Plus packets. Otherwise we can use the status here. @@ -1404,7 +1404,7 @@ static void HandleResponse(SDL_DriverWii_Context *ctx, SDL_Joystick *joystick) if (ParseExtensionIdentifyResponse(ctx, &extension)) { if ((extension & WII_EXTENSION_MOTIONPLUS_MASK) == WII_EXTENSION_MOTIONPLUS_ID) { // Motion Plus is currently active - SDL_LogDebug(SDL_LOG_CATEGORY_INPUT, "HIDAPI Wii: Motion Plus CONNECTED (stage %d)\n", ctx->m_eCommState == k_eWiiCommunicationState_CheckMotionPlusStage1 ? 1 : 2); + SDL_LogDebug(SDL_LOG_CATEGORY_INPUT, "HIDAPI Wii: Motion Plus CONNECTED (stage %d)", ctx->m_eCommState == k_eWiiCommunicationState_CheckMotionPlusStage1 ? 1 : 2); if (!ctx->m_bMotionPlusPresent) { // Reinitialize to get new sensor availability @@ -1420,7 +1420,7 @@ static void HandleResponse(SDL_DriverWii_Context *ctx, SDL_Joystick *joystick) } else { // Motion Plus is not present - SDL_LogDebug(SDL_LOG_CATEGORY_INPUT, "HIDAPI Wii: Motion Plus DISCONNECTED (stage %d)\n", ctx->m_eCommState == k_eWiiCommunicationState_CheckMotionPlusStage1 ? 1 : 2); + SDL_LogDebug(SDL_LOG_CATEGORY_INPUT, "HIDAPI Wii: Motion Plus DISCONNECTED (stage %d)", ctx->m_eCommState == k_eWiiCommunicationState_CheckMotionPlusStage1 ? 1 : 2); if (ctx->m_bMotionPlusPresent) { // Reinitialize to get new sensor availability @@ -1443,7 +1443,7 @@ static void HandleButtonPacket(SDL_DriverWii_Context *ctx, SDL_Joystick *joystic // FIXME: This should see if the data format is compatible rather than equal if (eExpectedReport != ctx->m_rgucReadBuffer[0]) { - SDL_LogDebug(SDL_LOG_CATEGORY_INPUT, "HIDAPI Wii: Resetting report mode to %d\n", eExpectedReport); + SDL_LogDebug(SDL_LOG_CATEGORY_INPUT, "HIDAPI Wii: Resetting report mode to %d", eExpectedReport); RequestButtonPacketType(ctx, eExpectedReport); } diff --git a/src/joystick/hidapi/SDL_hidapi_xbox360w.c b/src/joystick/hidapi/SDL_hidapi_xbox360w.c index a0d5262746d39..bf63707a0acf8 100644 --- a/src/joystick/hidapi/SDL_hidapi_xbox360w.c +++ b/src/joystick/hidapi/SDL_hidapi_xbox360w.c @@ -306,7 +306,7 @@ static bool HIDAPI_DriverXbox360W_UpdateDevice(SDL_HIDAPI_Device *device) if (size == 2 && data[0] == 0x08) { bool connected = (data[1] & 0x80) ? true : false; #ifdef DEBUG_JOYSTICK - SDL_Log("Connected = %s\n", connected ? "TRUE" : "FALSE"); + SDL_Log("Connected = %s", connected ? "TRUE" : "FALSE"); #endif if (connected != ctx->connected) { ctx->connected = connected; @@ -323,14 +323,14 @@ static bool HIDAPI_DriverXbox360W_UpdateDevice(SDL_HIDAPI_Device *device) } else if (size == 29 && data[0] == 0x00 && data[1] == 0x0f && data[2] == 0x00 && data[3] == 0xf0) { // Serial number is data[7-13] #ifdef DEBUG_JOYSTICK - SDL_Log("Battery status (initial): %d\n", data[17]); + SDL_Log("Battery status (initial): %d", data[17]); #endif if (joystick) { UpdatePowerLevel(joystick, data[17]); } } else if (size == 29 && data[0] == 0x00 && data[1] == 0x00 && data[2] == 0x00 && data[3] == 0x13) { #ifdef DEBUG_JOYSTICK - SDL_Log("Battery status: %d\n", data[4]); + SDL_Log("Battery status: %d", data[4]); #endif if (joystick) { UpdatePowerLevel(joystick, data[4]); diff --git a/src/joystick/hidapi/SDL_hidapi_xboxone.c b/src/joystick/hidapi/SDL_hidapi_xboxone.c index 5d4742f027cd3..d0c93cfcb414e 100644 --- a/src/joystick/hidapi/SDL_hidapi_xboxone.c +++ b/src/joystick/hidapi/SDL_hidapi_xboxone.c @@ -213,7 +213,7 @@ static void SDLCALL SDL_HomeLEDHintChanged(void *userdata, const char *name, con static void SetInitState(SDL_DriverXboxOne_Context *ctx, SDL_XboxOneInitState state) { #ifdef DEBUG_JOYSTICK - SDL_Log("Setting init state %d\n", state); + SDL_Log("Setting init state %d", state); #endif ctx->init_state = state; } @@ -391,7 +391,7 @@ static bool HIDAPI_DriverXboxOne_InitDevice(SDL_HIDAPI_Device *device) } #ifdef DEBUG_JOYSTICK - SDL_Log("Controller version: %d (0x%.4x)\n", device->version, device->version); + SDL_Log("Controller version: %d (0x%.4x)", device->version, device->version); #endif device->type = SDL_GAMEPAD_TYPE_XBOXONE; @@ -620,7 +620,7 @@ static void HIDAPI_DriverXboxOne_HandleUnmappedStatePacket(SDL_Joystick *joystic return; } #ifdef DEBUG_XBOX_PROTOCOL - SDL_Log(">>> Paddles: %d,%d,%d,%d mapped = %s\n", + SDL_Log(">>> Paddles: %d,%d,%d,%d mapped = %s", (data[paddle_index] & button1_bit) ? 1 : 0, (data[paddle_index] & button2_bit) ? 1 : 0, (data[paddle_index] & button3_bit) ? 1 : 0, @@ -654,7 +654,7 @@ static void HIDAPI_DriverXboxOne_HandleStatePacket(SDL_Joystick *joystick, SDL_D Uint8 packet[] = { 0x4d, 0x00, 0x00, 0x02, 0x07, 0x00 }; #ifdef DEBUG_JOYSTICK - SDL_Log("Enabling paddles on XBox Elite 2\n"); + SDL_Log("Enabling paddles on XBox Elite 2"); #endif SDL_HIDAPI_SendRumble(ctx->device, packet, sizeof(packet)); } @@ -787,7 +787,7 @@ static void HIDAPI_DriverXboxOne_HandleStatePacket(SDL_Joystick *joystick, SDL_D paddles_mapped = (data[20] != 0); } #ifdef DEBUG_XBOX_PROTOCOL - SDL_Log(">>> Paddles: %d,%d,%d,%d mapped = %s\n", + SDL_Log(">>> Paddles: %d,%d,%d,%d mapped = %s", (data[paddle_index] & button1_bit) ? 1 : 0, (data[paddle_index] & button2_bit) ? 1 : 0, (data[paddle_index] & button3_bit) ? 1 : 0, @@ -954,7 +954,7 @@ static void HIDAPI_DriverXboxOneBluetooth_HandleButtons(Uint64 timestamp, SDL_Jo } #ifdef DEBUG_XBOX_PROTOCOL - SDL_Log(">>> Paddles: %d,%d,%d,%d mapped = %s\n", + SDL_Log(">>> Paddles: %d,%d,%d,%d mapped = %s", (data[paddle_index] & button1_bit) ? 1 : 0, (data[paddle_index] & button2_bit) ? 1 : 0, (data[paddle_index] & button3_bit) ? 1 : 0, @@ -990,7 +990,7 @@ static void HIDAPI_DriverXboxOneBluetooth_HandleStatePacket(SDL_Joystick *joysti HIDAPI_DriverXboxOneBluetooth_HandleButtons(timestamp, joystick, ctx, data, size); } else { #ifdef DEBUG_XBOX_PROTOCOL - SDL_Log("Unknown Bluetooth state packet format\n"); + SDL_Log("Unknown Bluetooth state packet format"); #endif return; } @@ -1104,7 +1104,7 @@ static void HIDAPI_DriverXboxOne_HandleSerialIDPacket(SDL_DriverXboxOne_Context serial[i * 2] = '\0'; #ifdef DEBUG_JOYSTICK - SDL_Log("Setting serial number to %s\n", serial); + SDL_Log("Setting serial number to %s", serial); #endif HIDAPI_SetDeviceSerial(ctx->device, serial); } @@ -1129,7 +1129,7 @@ static bool HIDAPI_DriverXboxOne_UpdateInitState(SDL_DriverXboxOne_Context *ctx) if (SDL_GetTicks() >= (ctx->send_time + CONTROLLER_IDENTIFY_TIMEOUT_MS)) { // We haven't heard anything, let's move on #ifdef DEBUG_JOYSTICK - SDL_Log("Identification request timed out after %llu ms\n", (SDL_GetTicks() - ctx->send_time)); + SDL_Log("Identification request timed out after %llu ms", (SDL_GetTicks() - ctx->send_time)); #endif SetInitState(ctx, XBOX_ONE_INIT_STATE_STARTUP); } @@ -1146,7 +1146,7 @@ static bool HIDAPI_DriverXboxOne_UpdateInitState(SDL_DriverXboxOne_Context *ctx) case XBOX_ONE_INIT_STATE_PREPARE_INPUT: if (SDL_GetTicks() >= (ctx->send_time + CONTROLLER_PREPARE_INPUT_TIMEOUT_MS)) { #ifdef DEBUG_JOYSTICK - SDL_Log("Prepare input complete after %llu ms\n", (SDL_GetTicks() - ctx->send_time)); + SDL_Log("Prepare input complete after %llu ms", (SDL_GetTicks() - ctx->send_time)); #endif SetInitState(ctx, XBOX_ONE_INIT_STATE_COMPLETE); } @@ -1397,7 +1397,7 @@ static bool HIDAPI_GIP_DispatchPacket(SDL_Joystick *joystick, SDL_DriverXboxOne_ then 8 bytes of unknown data */ #ifdef DEBUG_JOYSTICK - SDL_Log("Controller announce after %llu ms\n", (SDL_GetTicks() - ctx->start_time)); + SDL_Log("Controller announce after %llu ms", (SDL_GetTicks() - ctx->start_time)); #endif SetInitState(ctx, XBOX_ONE_INIT_STATE_ANNOUNCED); break; @@ -1407,7 +1407,7 @@ static bool HIDAPI_GIP_DispatchPacket(SDL_Joystick *joystick, SDL_DriverXboxOne_ break; case GIP_CMD_IDENTIFY: #ifdef DEBUG_JOYSTICK - SDL_Log("Identification request completed after %llu ms\n", (SDL_GetTicks() - ctx->send_time)); + SDL_Log("Identification request completed after %llu ms", (SDL_GetTicks() - ctx->send_time)); #endif #ifdef DEBUG_XBOX_PROTOCOL HIDAPI_DumpPacket("Xbox One identification data: size = %d", data, size); @@ -1440,7 +1440,7 @@ static bool HIDAPI_GIP_DispatchPacket(SDL_Joystick *joystick, SDL_DriverXboxOne_ break; default: #ifdef DEBUG_JOYSTICK - SDL_Log("Unknown Xbox One packet: 0x%.2x\n", hdr->command); + SDL_Log("Unknown Xbox One packet: 0x%.2x", hdr->command); #endif break; } @@ -1452,7 +1452,7 @@ static bool HIDAPI_GIP_DispatchPacket(SDL_Joystick *joystick, SDL_DriverXboxOne_ // Ignore the first input, it may be spurious #ifdef DEBUG_JOYSTICK - SDL_Log("Controller ignoring spurious input\n"); + SDL_Log("Controller ignoring spurious input"); #endif break; } @@ -1469,7 +1469,7 @@ static bool HIDAPI_GIP_DispatchPacket(SDL_Joystick *joystick, SDL_DriverXboxOne_ break; default: #ifdef DEBUG_JOYSTICK - SDL_Log("Unknown Xbox One packet: 0x%.2x\n", hdr->command); + SDL_Log("Unknown Xbox One packet: 0x%.2x", hdr->command); #endif break; } @@ -1596,7 +1596,7 @@ static bool HIDAPI_DriverXboxOne_UpdateDevice(SDL_HIDAPI_Device *device) HIDAPI_DriverXboxOneBluetooth_HandleStatePacket(joystick, ctx, data, size); } else { #ifdef DEBUG_JOYSTICK - SDL_Log("Unknown Xbox One Bluetooth packet size: %d\n", size); + SDL_Log("Unknown Xbox One Bluetooth packet size: %d", size); #endif } break; @@ -1614,7 +1614,7 @@ static bool HIDAPI_DriverXboxOne_UpdateDevice(SDL_HIDAPI_Device *device) break; default: #ifdef DEBUG_JOYSTICK - SDL_Log("Unknown Xbox One packet: 0x%.2x\n", data[0]); + SDL_Log("Unknown Xbox One packet: 0x%.2x", data[0]); #endif break; } diff --git a/src/joystick/hidapi/SDL_hidapijoystick.c b/src/joystick/hidapi/SDL_hidapijoystick.c index c8ddd3d48c34a..d1f34eef6a729 100644 --- a/src/joystick/hidapi/SDL_hidapijoystick.c +++ b/src/joystick/hidapi/SDL_hidapijoystick.c @@ -955,7 +955,7 @@ static SDL_HIDAPI_Device *HIDAPI_AddDevice(const struct SDL_hid_device_info *inf return NULL; } - SDL_LogDebug(SDL_LOG_CATEGORY_INPUT, "Added HIDAPI device '%s' VID 0x%.4x, PID 0x%.4x, bluetooth %d, version %d, serial %s, interface %d, interface_class %d, interface_subclass %d, interface_protocol %d, usage page 0x%.4x, usage 0x%.4x, path = %s, driver = %s (%s)\n", device->name, device->vendor_id, device->product_id, device->is_bluetooth, device->version, + SDL_LogDebug(SDL_LOG_CATEGORY_INPUT, "Added HIDAPI device '%s' VID 0x%.4x, PID 0x%.4x, bluetooth %d, version %d, serial %s, interface %d, interface_class %d, interface_subclass %d, interface_protocol %d, usage page 0x%.4x, usage 0x%.4x, path = %s, driver = %s (%s)", device->name, device->vendor_id, device->product_id, device->is_bluetooth, device->version, device->serial ? device->serial : "NONE", device->interface_number, device->interface_class, device->interface_subclass, device->interface_protocol, device->usage_page, device->usage, device->path, device->driver ? device->driver->name : "NONE", device->driver && device->driver->enabled ? "ENABLED" : "DISABLED"); @@ -969,7 +969,7 @@ static void HIDAPI_DelDevice(SDL_HIDAPI_Device *device) SDL_AssertJoysticksLocked(); - SDL_LogDebug(SDL_LOG_CATEGORY_INPUT, "Removing HIDAPI device '%s' VID 0x%.4x, PID 0x%.4x, bluetooth %d, version %d, serial %s, interface %d, interface_class %d, interface_subclass %d, interface_protocol %d, usage page 0x%.4x, usage 0x%.4x, path = %s, driver = %s (%s)\n", device->name, device->vendor_id, device->product_id, device->is_bluetooth, device->version, + SDL_LogDebug(SDL_LOG_CATEGORY_INPUT, "Removing HIDAPI device '%s' VID 0x%.4x, PID 0x%.4x, bluetooth %d, version %d, serial %s, interface %d, interface_class %d, interface_subclass %d, interface_protocol %d, usage page 0x%.4x, usage 0x%.4x, path = %s, driver = %s (%s)", device->name, device->vendor_id, device->product_id, device->is_bluetooth, device->version, device->serial ? device->serial : "NONE", device->interface_number, device->interface_class, device->interface_subclass, device->interface_protocol, device->usage_page, device->usage, device->path, device->driver ? device->driver->name : "NONE", device->driver && device->driver->enabled ? "ENABLED" : "DISABLED"); @@ -1229,7 +1229,7 @@ bool HIDAPI_IsDeviceTypePresent(SDL_GamepadType type) SDL_UnlockJoysticks(); #ifdef DEBUG_HIDAPI - SDL_Log("HIDAPI_IsDeviceTypePresent() returning %s for %d\n", result ? "true" : "false", type); + SDL_Log("HIDAPI_IsDeviceTypePresent() returning %s for %d", result ? "true" : "false", type); #endif return result; } @@ -1280,7 +1280,7 @@ bool HIDAPI_IsDevicePresent(Uint16 vendor_id, Uint16 product_id, Uint16 version, SDL_UnlockJoysticks(); #ifdef DEBUG_HIDAPI - SDL_Log("HIDAPI_IsDevicePresent() returning %s for 0x%.4x / 0x%.4x\n", result ? "true" : "false", vendor_id, product_id); + SDL_Log("HIDAPI_IsDevicePresent() returning %s for 0x%.4x / 0x%.4x", result ? "true" : "false", vendor_id, product_id); #endif return result; } diff --git a/src/joystick/linux/SDL_sysjoystick.c b/src/joystick/linux/SDL_sysjoystick.c index 8fbaca99d024b..283f8050ce624 100644 --- a/src/joystick/linux/SDL_sysjoystick.c +++ b/src/joystick/linux/SDL_sysjoystick.c @@ -327,7 +327,7 @@ static bool IsJoystick(const char *path, int *fd, char **name_return, Uint16 *ve FixupDeviceInfoForMapping(*fd, &inpid); #ifdef DEBUG_JOYSTICK - SDL_Log("Joystick: %s, bustype = %d, vendor = 0x%.4x, product = 0x%.4x, version = %d\n", name, inpid.bustype, inpid.vendor, inpid.product, inpid.version); + SDL_Log("Joystick: %s, bustype = %d, vendor = 0x%.4x, product = 0x%.4x, version = %d", name, inpid.bustype, inpid.vendor, inpid.product, inpid.version); #endif if (SDL_ShouldIgnoreJoystick(inpid.vendor, inpid.product, inpid.version, name)) { @@ -470,12 +470,12 @@ static void MaybeAddDevice(const char *path) } #ifdef DEBUG_INPUT_EVENTS - SDL_Log("Checking %s\n", path); + SDL_Log("Checking %s", path); #endif if (IsJoystick(path, &fd, &name, &vendor, &product, &guid)) { #ifdef DEBUG_INPUT_EVENTS - SDL_Log("found joystick: %s\n", path); + SDL_Log("found joystick: %s", path); #endif item = (SDL_joylist_item *)SDL_calloc(1, sizeof(SDL_joylist_item)); if (!item) { @@ -516,7 +516,7 @@ static void MaybeAddDevice(const char *path) if (IsSensor(path, &fd)) { #ifdef DEBUG_INPUT_EVENTS - SDL_Log("found sensor: %s\n", path); + SDL_Log("found sensor: %s", path); #endif item_sensor = (SDL_sensorlist_item *)SDL_calloc(1, sizeof(SDL_sensorlist_item)); if (!item_sensor) { @@ -1217,7 +1217,7 @@ static void ConfigJoystick(SDL_Joystick *joystick, int fd, int fd_sensor) for (i = BTN_JOYSTICK; i < KEY_MAX; ++i) { if (test_bit(i, keybit)) { #ifdef DEBUG_INPUT_EVENTS - SDL_Log("Joystick has button: 0x%x\n", i); + SDL_Log("Joystick has button: 0x%x", i); #endif joystick->hwdata->key_map[i] = joystick->nbuttons; joystick->hwdata->has_key[i] = true; @@ -1227,7 +1227,7 @@ static void ConfigJoystick(SDL_Joystick *joystick, int fd, int fd_sensor) for (i = 0; i < BTN_JOYSTICK; ++i) { if (test_bit(i, keybit)) { #ifdef DEBUG_INPUT_EVENTS - SDL_Log("Joystick has button: 0x%x\n", i); + SDL_Log("Joystick has button: 0x%x", i); #endif joystick->hwdata->key_map[i] = joystick->nbuttons; joystick->hwdata->has_key[i] = true; @@ -1250,14 +1250,14 @@ static void ConfigJoystick(SDL_Joystick *joystick, int fd, int fd_sensor) const int hat_index = (i - ABS_HAT0X) / 2; struct hat_axis_correct *correct = &joystick->hwdata->hat_correct[hat_index]; #ifdef DEBUG_INPUT_EVENTS - SDL_Log("Joystick has digital hat: #%d\n", hat_index); + SDL_Log("Joystick has digital hat: #%d", hat_index); if (hat_x >= 0) { - SDL_Log("X Values = { val:%d, min:%d, max:%d, fuzz:%d, flat:%d, res:%d }\n", + SDL_Log("X Values = { val:%d, min:%d, max:%d, fuzz:%d, flat:%d, res:%d }", absinfo_x.value, absinfo_x.minimum, absinfo_x.maximum, absinfo_x.fuzz, absinfo_x.flat, absinfo_x.resolution); } if (hat_y >= 0) { - SDL_Log("Y Values = { val:%d, min:%d, max:%d, fuzz:%d, flat:%d, res:%d }\n", + SDL_Log("Y Values = { val:%d, min:%d, max:%d, fuzz:%d, flat:%d, res:%d }", absinfo_y.value, absinfo_y.minimum, absinfo_y.maximum, absinfo_y.fuzz, absinfo_y.flat, absinfo_y.resolution); } @@ -1285,8 +1285,8 @@ static void ConfigJoystick(SDL_Joystick *joystick, int fd, int fd_sensor) continue; } #ifdef DEBUG_INPUT_EVENTS - SDL_Log("Joystick has absolute axis: 0x%.2x\n", i); - SDL_Log("Values = { val:%d, min:%d, max:%d, fuzz:%d, flat:%d, res:%d }\n", + SDL_Log("Joystick has absolute axis: 0x%.2x", i); + SDL_Log("Values = { val:%d, min:%d, max:%d, fuzz:%d, flat:%d, res:%d }", absinfo.value, absinfo.minimum, absinfo.maximum, absinfo.fuzz, absinfo.flat, absinfo.resolution); #endif // DEBUG_INPUT_EVENTS @@ -1340,7 +1340,7 @@ static void ConfigJoystick(SDL_Joystick *joystick, int fd, int fd_sensor) for (i = 0; i < key_pam_size; ++i) { Uint16 code = joystick->hwdata->key_pam[i]; #ifdef DEBUG_INPUT_EVENTS - SDL_Log("Joystick has button: 0x%x\n", code); + SDL_Log("Joystick has button: 0x%x", code); #endif joystick->hwdata->key_map[code] = joystick->nbuttons; joystick->hwdata->has_key[code] = true; @@ -1366,7 +1366,7 @@ static void ConfigJoystick(SDL_Joystick *joystick, int fd, int fd_sensor) int hat_index = (code - ABS_HAT0X) / 2; if (!joystick->hwdata->has_hat[hat_index]) { #ifdef DEBUG_INPUT_EVENTS - SDL_Log("Joystick has digital hat: #%d\n", hat_index); + SDL_Log("Joystick has digital hat: #%d", hat_index); #endif joystick->hwdata->hats_indices[hat_index] = joystick->nhats++; joystick->hwdata->has_hat[hat_index] = true; @@ -1377,7 +1377,7 @@ static void ConfigJoystick(SDL_Joystick *joystick, int fd, int fd_sensor) } } else { #ifdef DEBUG_INPUT_EVENTS - SDL_Log("Joystick has absolute axis: 0x%.2x\n", code); + SDL_Log("Joystick has absolute axis: 0x%.2x", code); #endif joystick->hwdata->abs_map[code] = joystick->naxes; joystick->hwdata->has_abs[code] = true; @@ -1398,8 +1398,8 @@ static void ConfigJoystick(SDL_Joystick *joystick, int fd, int fd_sensor) } joystick->hwdata->accelerometer_scale[i] = absinfo.resolution; #ifdef DEBUG_INPUT_EVENTS - SDL_Log("Joystick has accelerometer axis: 0x%.2x\n", ABS_X + i); - SDL_Log("Values = { val:%d, min:%d, max:%d, fuzz:%d, flat:%d, res:%d }\n", + SDL_Log("Joystick has accelerometer axis: 0x%.2x", ABS_X + i); + SDL_Log("Values = { val:%d, min:%d, max:%d, fuzz:%d, flat:%d, res:%d }", absinfo.value, absinfo.minimum, absinfo.maximum, absinfo.fuzz, absinfo.flat, absinfo.resolution); #endif // DEBUG_INPUT_EVENTS @@ -1416,8 +1416,8 @@ static void ConfigJoystick(SDL_Joystick *joystick, int fd, int fd_sensor) } joystick->hwdata->gyro_scale[i] = absinfo.resolution; #ifdef DEBUG_INPUT_EVENTS - SDL_Log("Joystick has gyro axis: 0x%.2x\n", ABS_RX + i); - SDL_Log("Values = { val:%d, min:%d, max:%d, fuzz:%d, flat:%d, res:%d }\n", + SDL_Log("Joystick has gyro axis: 0x%.2x", ABS_RX + i); + SDL_Log("Values = { val:%d, min:%d, max:%d, fuzz:%d, flat:%d, res:%d }", absinfo.value, absinfo.minimum, absinfo.maximum, absinfo.fuzz, absinfo.flat, absinfo.resolution); #endif // DEBUG_INPUT_EVENTS @@ -1522,7 +1522,7 @@ static SDL_sensorlist_item *GetSensor(SDL_joylist_item *item) } close(fd_item); #ifdef DEBUG_INPUT_EVENTS - SDL_Log("Joystick UNIQ: %s\n", uniq_item); + SDL_Log("Joystick UNIQ: %s", uniq_item); #endif // DEBUG_INPUT_EVENTS for (item_sensor = SDL_sensorlist; item_sensor; item_sensor = item_sensor->next) { @@ -1544,7 +1544,7 @@ static SDL_sensorlist_item *GetSensor(SDL_joylist_item *item) } close(fd_sensor); #ifdef DEBUG_INPUT_EVENTS - SDL_Log("Sensor UNIQ: %s\n", uniq_sensor); + SDL_Log("Sensor UNIQ: %s", uniq_sensor); #endif // DEBUG_INPUT_EVENTS if (SDL_strcmp(uniq_item, uniq_sensor) == 0) { @@ -1800,7 +1800,7 @@ static void PollAllValues(Uint64 timestamp, SDL_Joystick *joystick) absinfo.value = AxisCorrect(joystick, i, absinfo.value); #ifdef DEBUG_INPUT_EVENTS - SDL_Log("Joystick : Re-read Axis %d (%d) val= %d\n", + SDL_Log("Joystick : Re-read Axis %d (%d) val= %d", joystick->hwdata->abs_map[i], i, absinfo.value); #endif SDL_SendJoystickAxis(timestamp, joystick, @@ -1831,7 +1831,7 @@ static void PollAllValues(Uint64 timestamp, SDL_Joystick *joystick) if (joystick->hwdata->has_key[i]) { bool down = test_bit(i, keyinfo); #ifdef DEBUG_INPUT_EVENTS - SDL_Log("Joystick : Re-read Button %d (%d) val= %d\n", + SDL_Log("Joystick : Re-read Button %d (%d) val= %d", joystick->hwdata->key_map[i], i, down); #endif SDL_SendJoystickButton(timestamp, joystick, @@ -1858,7 +1858,7 @@ static void PollAllSensors(Uint64 timestamp, SDL_Joystick *joystick) if (ioctl(joystick->hwdata->fd_sensor, EVIOCGABS(ABS_RX + i), &absinfo) >= 0) { data[i] = absinfo.value * (SDL_PI_F / 180.f) / joystick->hwdata->gyro_scale[i]; #ifdef DEBUG_INPUT_EVENTS - SDL_Log("Joystick : Re-read Gyro (axis %d) val= %f\n", i, data[i]); + SDL_Log("Joystick : Re-read Gyro (axis %d) val= %f", i, data[i]); #endif } } @@ -1870,7 +1870,7 @@ static void PollAllSensors(Uint64 timestamp, SDL_Joystick *joystick) if (ioctl(joystick->hwdata->fd_sensor, EVIOCGABS(ABS_X + i), &absinfo) >= 0) { data[i] = absinfo.value * SDL_STANDARD_GRAVITY / joystick->hwdata->accelerometer_scale[i]; #ifdef DEBUG_INPUT_EVENTS - SDL_Log("Joystick : Re-read Accelerometer (axis %d) val= %f\n", i, data[i]); + SDL_Log("Joystick : Re-read Accelerometer (axis %d) val= %f", i, data[i]); #endif } } @@ -1913,7 +1913,7 @@ static void HandleInputEvents(SDL_Joystick *joystick) switch (event->type) { case EV_KEY: #ifdef DEBUG_INPUT_EVENTS - SDL_Log("Key 0x%.2x %s\n", code, event->value ? "PRESSED" : "RELEASED"); + SDL_Log("Key 0x%.2x %s", code, event->value ? "PRESSED" : "RELEASED"); #endif SDL_SendJoystickButton(SDL_EVDEV_GetEventTimestamp(event), joystick, joystick->hwdata->key_map[code], @@ -1932,7 +1932,7 @@ static void HandleInputEvents(SDL_Joystick *joystick) hat_index = (code - ABS_HAT0X) / 2; if (joystick->hwdata->has_hat[hat_index]) { #ifdef DEBUG_INPUT_EVENTS - SDL_Log("Axis 0x%.2x = %d\n", code, event->value); + SDL_Log("Axis 0x%.2x = %d", code, event->value); #endif HandleHat(SDL_EVDEV_GetEventTimestamp(event), joystick, hat_index, code % 2, event->value); break; @@ -1940,7 +1940,7 @@ static void HandleInputEvents(SDL_Joystick *joystick) SDL_FALLTHROUGH; default: #ifdef DEBUG_INPUT_EVENTS - SDL_Log("Axis 0x%.2x = %d\n", code, event->value); + SDL_Log("Axis 0x%.2x = %d", code, event->value); #endif event->value = AxisCorrect(joystick, code, event->value); SDL_SendJoystickAxis(SDL_EVDEV_GetEventTimestamp(event), joystick, @@ -1964,7 +1964,7 @@ static void HandleInputEvents(SDL_Joystick *joystick) switch (code) { case SYN_DROPPED: #ifdef DEBUG_INPUT_EVENTS - SDL_Log("Event SYN_DROPPED detected\n"); + SDL_Log("Event SYN_DROPPED detected"); #endif joystick->hwdata->recovering_from_dropped = true; break; @@ -2047,7 +2047,7 @@ static void HandleInputEvents(SDL_Joystick *joystick) switch (code) { case SYN_DROPPED: #ifdef DEBUG_INPUT_EVENTS - SDL_Log("Event SYN_DROPPED detected\n"); + SDL_Log("Event SYN_DROPPED detected"); #endif joystick->hwdata->recovering_from_dropped_sensor = true; break; diff --git a/src/joystick/windows/SDL_rawinputjoystick.c b/src/joystick/windows/SDL_rawinputjoystick.c index 5ef4a302127db..d5adc2daa3500 100644 --- a/src/joystick/windows/SDL_rawinputjoystick.c +++ b/src/joystick/windows/SDL_rawinputjoystick.c @@ -935,7 +935,7 @@ static void RAWINPUT_AddDevice(HANDLE hDevice) device->joystick_id = SDL_GetNextObjectID(); #ifdef DEBUG_RAWINPUT - SDL_Log("Adding RAWINPUT device '%s' VID 0x%.4x, PID 0x%.4x, version %d, handle 0x%.8x\n", device->name, device->vendor_id, device->product_id, device->version, device->hDevice); + SDL_Log("Adding RAWINPUT device '%s' VID 0x%.4x, PID 0x%.4x, version %d, handle 0x%.8x", device->name, device->vendor_id, device->product_id, device->version, device->hDevice); #endif // Add it to the list @@ -985,7 +985,7 @@ static void RAWINPUT_DelDevice(SDL_RAWINPUT_Device *device, bool send_event) SDL_PrivateJoystickRemoved(device->joystick_id); #ifdef DEBUG_RAWINPUT - SDL_Log("Removing RAWINPUT device '%s' VID 0x%.4x, PID 0x%.4x, version %d, handle %p\n", device->name, device->vendor_id, device->product_id, device->version, device->hDevice); + SDL_Log("Removing RAWINPUT device '%s' VID 0x%.4x, PID 0x%.4x, version %d, handle %p", device->name, device->vendor_id, device->product_id, device->version, device->hDevice); #endif RAWINPUT_ReleaseDevice(device); return; @@ -1779,7 +1779,7 @@ static void RAWINPUT_UpdateOtherAPIs(SDL_Joystick *joystick) triggers for a frame. */ if (ctx->wgi_uncorrelate_count >= 5) { #ifdef DEBUG_RAWINPUT - SDL_Log("UN-Correlated joystick %d to WindowsGamingInput device #%d\n", joystick->instance_id, ctx->wgi_slot); + SDL_Log("UN-Correlated joystick %d to WindowsGamingInput device #%d", joystick->instance_id, ctx->wgi_slot); #endif RAWINPUT_MarkWindowsGamingInputSlotFree(ctx->wgi_slot); ctx->wgi_correlated = false; @@ -1811,7 +1811,7 @@ static void RAWINPUT_UpdateOtherAPIs(SDL_Joystick *joystick) // correlation stayed steady and uncontested across multiple frames, guaranteed match ctx->wgi_correlated = true; #ifdef DEBUG_RAWINPUT - SDL_Log("Correlated joystick %d to WindowsGamingInput device #%d\n", joystick->instance_id, slot_idx); + SDL_Log("Correlated joystick %d to WindowsGamingInput device #%d", joystick->instance_id, slot_idx); #endif correlated = true; RAWINPUT_MarkWindowsGamingInputSlotUsed(ctx->wgi_slot, ctx); @@ -1875,7 +1875,7 @@ static void RAWINPUT_UpdateOtherAPIs(SDL_Joystick *joystick) triggers for a frame. */ if (ctx->xinput_uncorrelate_count >= 5) { #ifdef DEBUG_RAWINPUT - SDL_Log("UN-Correlated joystick %d to XInput device #%d\n", joystick->instance_id, ctx->xinput_slot); + SDL_Log("UN-Correlated joystick %d to XInput device #%d", joystick->instance_id, ctx->xinput_slot); #endif RAWINPUT_MarkXInputSlotFree(ctx->xinput_slot); ctx->xinput_correlated = false; @@ -1907,7 +1907,7 @@ static void RAWINPUT_UpdateOtherAPIs(SDL_Joystick *joystick) // correlation stayed steady and uncontested across multiple frames, guaranteed match ctx->xinput_correlated = true; #ifdef DEBUG_RAWINPUT - SDL_Log("Correlated joystick %d to XInput device #%d\n", joystick->instance_id, slot_idx); + SDL_Log("Correlated joystick %d to XInput device #%d", joystick->instance_id, slot_idx); #endif correlated = true; RAWINPUT_MarkXInputSlotUsed(ctx->xinput_slot); diff --git a/src/render/direct3d11/SDL_render_d3d11.c b/src/render/direct3d11/SDL_render_d3d11.c index f84a5f05b3ff5..b723877a033ec 100644 --- a/src/render/direct3d11/SDL_render_d3d11.c +++ b/src/render/direct3d11/SDL_render_d3d11.c @@ -997,7 +997,7 @@ static HRESULT D3D11_CreateWindowSizeDependentResources(SDL_Renderer *renderer) */ SDL_GetWindowSizeInPixels(renderer->window, &w, &h); data->rotation = D3D11_GetCurrentRotation(); - // SDL_Log("%s: windowSize={%d,%d}, orientation=%d\n", __FUNCTION__, w, h, (int)data->rotation); + // SDL_Log("%s: windowSize={%d,%d}, orientation=%d", __FUNCTION__, w, h, (int)data->rotation); if (D3D11_IsDisplayRotated90Degrees(data->rotation)) { int tmp = w; w = h; @@ -1078,7 +1078,7 @@ static bool D3D11_HandleDeviceLost(SDL_Renderer *renderer) SUCCEEDED(D3D11_CreateWindowSizeDependentResources(renderer))) { recovered = true; } else { - SDL_LogError(SDL_LOG_CATEGORY_RENDER, "Renderer couldn't recover from device lost: %s\n", SDL_GetError()); + SDL_LogError(SDL_LOG_CATEGORY_RENDER, "Renderer couldn't recover from device lost: %s", SDL_GetError()); D3D11_ReleaseAll(renderer); } @@ -1990,7 +1990,7 @@ static bool D3D11_UpdateViewport(SDL_Renderer *renderer) * SDL_CreateRenderer is calling it, and will call it again later * with a non-empty viewport. */ - // SDL_Log("%s, no viewport was set!\n", __FUNCTION__); + // SDL_Log("%s, no viewport was set!", __FUNCTION__); return false; } @@ -2057,7 +2057,7 @@ static bool D3D11_UpdateViewport(SDL_Renderer *renderer) d3dviewport.Height = orientationAlignedViewport.h; d3dviewport.MinDepth = 0.0f; d3dviewport.MaxDepth = 1.0f; - // SDL_Log("%s: D3D viewport = {%f,%f,%f,%f}\n", __FUNCTION__, d3dviewport.TopLeftX, d3dviewport.TopLeftY, d3dviewport.Width, d3dviewport.Height); + // SDL_Log("%s: D3D viewport = {%f,%f,%f,%f}", __FUNCTION__, d3dviewport.TopLeftX, d3dviewport.TopLeftY, d3dviewport.Width, d3dviewport.Height); ID3D11DeviceContext_RSSetViewports(data->d3dContext, 1, &d3dviewport); data->viewportDirty = false; diff --git a/src/render/direct3d12/SDL_render_d3d12.c b/src/render/direct3d12/SDL_render_d3d12.c index 3233e19480bf2..3785a7d95be97 100644 --- a/src/render/direct3d12/SDL_render_d3d12.c +++ b/src/render/direct3d12/SDL_render_d3d12.c @@ -1453,7 +1453,7 @@ static bool D3D12_HandleDeviceLost(SDL_Renderer *renderer) SUCCEEDED(D3D12_CreateWindowSizeDependentResources(renderer))) { recovered = true; } else { - SDL_LogError(SDL_LOG_CATEGORY_RENDER, "Renderer couldn't recover from device lost: %s\n", SDL_GetError()); + SDL_LogError(SDL_LOG_CATEGORY_RENDER, "Renderer couldn't recover from device lost: %s", SDL_GetError()); D3D12_ReleaseAll(renderer); } @@ -2430,7 +2430,7 @@ static bool D3D12_UpdateViewport(SDL_Renderer *renderer) * SDL_CreateRenderer is calling it, and will call it again later * with a non-empty viewport. */ - // SDL_Log("%s, no viewport was set!\n", __FUNCTION__); + // SDL_Log("%s, no viewport was set!", __FUNCTION__); return false; } @@ -2497,7 +2497,7 @@ static bool D3D12_UpdateViewport(SDL_Renderer *renderer) d3dviewport.Height = orientationAlignedViewport.h; d3dviewport.MinDepth = 0.0f; d3dviewport.MaxDepth = 1.0f; - // SDL_Log("%s: D3D viewport = {%f,%f,%f,%f}\n", __FUNCTION__, d3dviewport.TopLeftX, d3dviewport.TopLeftY, d3dviewport.Width, d3dviewport.Height); + // SDL_Log("%s: D3D viewport = {%f,%f,%f,%f}", __FUNCTION__, d3dviewport.TopLeftX, d3dviewport.TopLeftY, d3dviewport.Width, d3dviewport.Height); ID3D12GraphicsCommandList_RSSetViewports(data->commandList, 1, &d3dviewport); data->viewportDirty = false; diff --git a/src/render/opengl/SDL_shaders_gl.c b/src/render/opengl/SDL_shaders_gl.c index c70bcdb19ef24..b09b12e725fad 100644 --- a/src/render/opengl/SDL_shaders_gl.c +++ b/src/render/opengl/SDL_shaders_gl.c @@ -350,7 +350,10 @@ static bool CompileShader(GL_ShaderContext *ctx, GLhandleARB shader, const char info = SDL_small_alloc(char, length + 1, &isstack); if (info) { ctx->glGetInfoLogARB(shader, length, NULL, info); - SDL_LogError(SDL_LOG_CATEGORY_RENDER, "Failed to compile shader:\n%s%s\n%s", defines, source, info); + SDL_LogError(SDL_LOG_CATEGORY_RENDER, "Failed to compile shader:"); + SDL_LogError(SDL_LOG_CATEGORY_RENDER, "%s", defines); + SDL_LogError(SDL_LOG_CATEGORY_RENDER, "%s", source); + SDL_LogError(SDL_LOG_CATEGORY_RENDER, "%s", info); SDL_small_free(info, isstack); } return false; diff --git a/src/render/opengles2/SDL_render_gles2.c b/src/render/opengles2/SDL_render_gles2.c index 1a013d570ca49..a4c5dec154c17 100644 --- a/src/render/opengles2/SDL_render_gles2.c +++ b/src/render/opengles2/SDL_render_gles2.c @@ -539,7 +539,7 @@ static GLuint GLES2_CacheShader(GLES2_RenderData *data, GLES2_ShaderType type, G SDL_asprintf(&message, "%s%s", last_message, shader_src_list[i]); SDL_free(last_message); } - SDL_Log("%s\n", message); + SDL_Log("%s", message); SDL_free(message); } #endif diff --git a/src/render/vitagxm/SDL_render_vita_gxm.c b/src/render/vitagxm/SDL_render_vita_gxm.c index 42477f34205fb..acf31c3db2620 100644 --- a/src/render/vitagxm/SDL_render_vita_gxm.c +++ b/src/render/vitagxm/SDL_render_vita_gxm.c @@ -324,11 +324,11 @@ static void VITA_GXM_SetYUVProfile(SDL_Renderer *renderer, SDL_Texture *texture) ret = sceGxmSetYuvProfile(data->gxm_context, 0, SCE_GXM_YUV_PROFILE_BT709_FULL_RANGE); } } else { - SDL_LogError(SDL_LOG_CATEGORY_RENDER, "Unsupported YUV colorspace\n"); + SDL_LogError(SDL_LOG_CATEGORY_RENDER, "Unsupported YUV colorspace"); } if (ret < 0) { - SDL_LogError(SDL_LOG_CATEGORY_RENDER, "Setting YUV profile failed: %x\n", ret); + SDL_LogError(SDL_LOG_CATEGORY_RENDER, "Setting YUV profile failed: %x", ret); } } diff --git a/src/render/vitagxm/SDL_render_vita_gxm_tools.c b/src/render/vitagxm/SDL_render_vita_gxm_tools.c index 38d7fd9f16c18..9140a62ca6063 100644 --- a/src/render/vitagxm/SDL_render_vita_gxm_tools.c +++ b/src/render/vitagxm/SDL_render_vita_gxm_tools.c @@ -87,7 +87,7 @@ void *pool_malloc(VITA_GXM_RenderData *data, unsigned int size) data->pool_index += size; return addr; } - SDL_LogError(SDL_LOG_CATEGORY_RENDER, "POOL OVERFLOW\n"); + SDL_LogError(SDL_LOG_CATEGORY_RENDER, "POOL OVERFLOW"); return NULL; } @@ -99,7 +99,7 @@ void *pool_memalign(VITA_GXM_RenderData *data, unsigned int size, unsigned int a data->pool_index = new_index + size; return addr; } - SDL_LogError(SDL_LOG_CATEGORY_RENDER, "POOL OVERFLOW\n"); + SDL_LogError(SDL_LOG_CATEGORY_RENDER, "POOL OVERFLOW"); return NULL; } @@ -173,7 +173,7 @@ static void make_fragment_programs(VITA_GXM_RenderData *data, fragment_programs &out->color); if (err != 0) { - SDL_LogError(SDL_LOG_CATEGORY_RENDER, "Patcher create fragment failed: %d\n", err); + SDL_LogError(SDL_LOG_CATEGORY_RENDER, "Patcher create fragment failed: %d", err); return; } @@ -187,7 +187,7 @@ static void make_fragment_programs(VITA_GXM_RenderData *data, fragment_programs &out->texture); if (err != 0) { - SDL_LogError(SDL_LOG_CATEGORY_RENDER, "Patcher create fragment failed: %d\n", err); + SDL_LogError(SDL_LOG_CATEGORY_RENDER, "Patcher create fragment failed: %d", err); return; } } @@ -387,7 +387,7 @@ int gxm_init(SDL_Renderer *renderer) err = sceGxmInitialize(&initializeParams); if (err != 0) { - SDL_LogError(SDL_LOG_CATEGORY_RENDER, "gxm init failed: %d\n", err); + SDL_LogError(SDL_LOG_CATEGORY_RENDER, "gxm init failed: %d", err); return err; } @@ -433,7 +433,7 @@ int gxm_init(SDL_Renderer *renderer) err = sceGxmCreateContext(&data->contextParams, &data->gxm_context); if (err != 0) { - SDL_LogError(SDL_LOG_CATEGORY_RENDER, "create context failed: %d\n", err); + SDL_LogError(SDL_LOG_CATEGORY_RENDER, "create context failed: %d", err); return err; } @@ -450,7 +450,7 @@ int gxm_init(SDL_Renderer *renderer) // create the render target err = sceGxmCreateRenderTarget(&renderTargetParams, &data->renderTarget); if (err != 0) { - SDL_LogError(SDL_LOG_CATEGORY_RENDER, "render target creation failed: %d\n", err); + SDL_LogError(SDL_LOG_CATEGORY_RENDER, "render target creation failed: %d", err); return err; } @@ -486,14 +486,14 @@ int gxm_init(SDL_Renderer *renderer) data->displayBufferData[i]); if (err != 0) { - SDL_LogError(SDL_LOG_CATEGORY_RENDER, "color surface init failed: %d\n", err); + SDL_LogError(SDL_LOG_CATEGORY_RENDER, "color surface init failed: %d", err); return err; } // create a sync object that we will associate with this buffer err = sceGxmSyncObjectCreate(&data->displayBufferSync[i]); if (err != 0) { - SDL_LogError(SDL_LOG_CATEGORY_RENDER, "sync object creation failed: %d\n", err); + SDL_LogError(SDL_LOG_CATEGORY_RENDER, "sync object creation failed: %d", err); return err; } } @@ -576,81 +576,81 @@ int gxm_init(SDL_Renderer *renderer) err = sceGxmShaderPatcherCreate(&patcherParams, &data->shaderPatcher); if (err != 0) { - SDL_LogError(SDL_LOG_CATEGORY_RENDER, "shader patcher creation failed: %d\n", err); + SDL_LogError(SDL_LOG_CATEGORY_RENDER, "shader patcher creation failed: %d", err); return err; } // check the shaders err = sceGxmProgramCheck(clearVertexProgramGxp); if (err != 0) { - SDL_LogError(SDL_LOG_CATEGORY_RENDER, "check program (clear vertex) failed: %d\n", err); + SDL_LogError(SDL_LOG_CATEGORY_RENDER, "check program (clear vertex) failed: %d", err); return err; } err = sceGxmProgramCheck(clearFragmentProgramGxp); if (err != 0) { - SDL_LogError(SDL_LOG_CATEGORY_RENDER, "check program (clear fragment) failed: %d\n", err); + SDL_LogError(SDL_LOG_CATEGORY_RENDER, "check program (clear fragment) failed: %d", err); return err; } err = sceGxmProgramCheck(colorVertexProgramGxp); if (err != 0) { - SDL_LogError(SDL_LOG_CATEGORY_RENDER, "check program (color vertex) failed: %d\n", err); + SDL_LogError(SDL_LOG_CATEGORY_RENDER, "check program (color vertex) failed: %d", err); return err; } err = sceGxmProgramCheck(colorFragmentProgramGxp); if (err != 0) { - SDL_LogError(SDL_LOG_CATEGORY_RENDER, "check program (color fragment) failed: %d\n", err); + SDL_LogError(SDL_LOG_CATEGORY_RENDER, "check program (color fragment) failed: %d", err); return err; } err = sceGxmProgramCheck(textureVertexProgramGxp); if (err != 0) { - SDL_LogError(SDL_LOG_CATEGORY_RENDER, "check program (texture vertex) failed: %d\n", err); + SDL_LogError(SDL_LOG_CATEGORY_RENDER, "check program (texture vertex) failed: %d", err); return err; } err = sceGxmProgramCheck(textureFragmentProgramGxp); if (err != 0) { - SDL_LogError(SDL_LOG_CATEGORY_RENDER, "check program (texture fragment) failed: %d\n", err); + SDL_LogError(SDL_LOG_CATEGORY_RENDER, "check program (texture fragment) failed: %d", err); return err; } // register programs with the patcher err = sceGxmShaderPatcherRegisterProgram(data->shaderPatcher, clearVertexProgramGxp, &data->clearVertexProgramId); if (err != 0) { - SDL_LogError(SDL_LOG_CATEGORY_RENDER, "register program (clear vertex) failed: %d\n", err); + SDL_LogError(SDL_LOG_CATEGORY_RENDER, "register program (clear vertex) failed: %d", err); return err; } err = sceGxmShaderPatcherRegisterProgram(data->shaderPatcher, clearFragmentProgramGxp, &data->clearFragmentProgramId); if (err != 0) { - SDL_LogError(SDL_LOG_CATEGORY_RENDER, "register program (clear fragment) failed: %d\n", err); + SDL_LogError(SDL_LOG_CATEGORY_RENDER, "register program (clear fragment) failed: %d", err); return err; } err = sceGxmShaderPatcherRegisterProgram(data->shaderPatcher, colorVertexProgramGxp, &data->colorVertexProgramId); if (err != 0) { - SDL_LogError(SDL_LOG_CATEGORY_RENDER, "register program (color vertex) failed: %d\n", err); + SDL_LogError(SDL_LOG_CATEGORY_RENDER, "register program (color vertex) failed: %d", err); return err; } err = sceGxmShaderPatcherRegisterProgram(data->shaderPatcher, colorFragmentProgramGxp, &data->colorFragmentProgramId); if (err != 0) { - SDL_LogError(SDL_LOG_CATEGORY_RENDER, "register program (color fragment) failed: %d\n", err); + SDL_LogError(SDL_LOG_CATEGORY_RENDER, "register program (color fragment) failed: %d", err); return err; } err = sceGxmShaderPatcherRegisterProgram(data->shaderPatcher, textureVertexProgramGxp, &data->textureVertexProgramId); if (err != 0) { - SDL_LogError(SDL_LOG_CATEGORY_RENDER, "register program (texture vertex) failed: %d\n", err); + SDL_LogError(SDL_LOG_CATEGORY_RENDER, "register program (texture vertex) failed: %d", err); return err; } err = sceGxmShaderPatcherRegisterProgram(data->shaderPatcher, textureFragmentProgramGxp, &data->textureFragmentProgramId); if (err != 0) { - SDL_LogError(SDL_LOG_CATEGORY_RENDER, "register program (texture fragment) failed: %d\n", err); + SDL_LogError(SDL_LOG_CATEGORY_RENDER, "register program (texture fragment) failed: %d", err); return err; } @@ -679,7 +679,7 @@ int gxm_init(SDL_Renderer *renderer) 1, &data->clearVertexProgram); if (err != 0) { - SDL_LogError(SDL_LOG_CATEGORY_RENDER, "create program (clear vertex) failed: %d\n", err); + SDL_LogError(SDL_LOG_CATEGORY_RENDER, "create program (clear vertex) failed: %d", err); return err; } @@ -692,7 +692,7 @@ int gxm_init(SDL_Renderer *renderer) clearVertexProgramGxp, &data->clearFragmentProgram); if (err != 0) { - SDL_LogError(SDL_LOG_CATEGORY_RENDER, "create program (clear fragment) failed: %d\n", err); + SDL_LogError(SDL_LOG_CATEGORY_RENDER, "create program (clear fragment) failed: %d", err); return err; } @@ -760,7 +760,7 @@ int gxm_init(SDL_Renderer *renderer) 1, &data->colorVertexProgram); if (err != 0) { - SDL_LogError(SDL_LOG_CATEGORY_RENDER, "create program (color vertex) failed: %d\n", err); + SDL_LogError(SDL_LOG_CATEGORY_RENDER, "create program (color vertex) failed: %d", err); return err; } } @@ -805,7 +805,7 @@ int gxm_init(SDL_Renderer *renderer) 1, &data->textureVertexProgram); if (err != 0) { - SDL_LogError(SDL_LOG_CATEGORY_RENDER, "create program (texture vertex) failed: %x\n", err); + SDL_LogError(SDL_LOG_CATEGORY_RENDER, "create program (texture vertex) failed: %x", err); return err; } } @@ -1016,7 +1016,7 @@ gxm_texture *create_gxm_texture(VITA_GXM_RenderData *data, unsigned int w, unsig // Try SCE_KERNEL_MEMBLOCK_TYPE_USER_RW_UNCACHE in case we're out of VRAM if (!texture_data) { - SDL_LogWarn(SDL_LOG_CATEGORY_RENDER, "CDRAM texture allocation failed\n"); + SDL_LogWarn(SDL_LOG_CATEGORY_RENDER, "CDRAM texture allocation failed"); texture_data = vita_mem_alloc( SCE_KERNEL_MEMBLOCK_TYPE_USER_RW_UNCACHE, tex_size, @@ -1040,7 +1040,7 @@ gxm_texture *create_gxm_texture(VITA_GXM_RenderData *data, unsigned int w, unsig ret = sceGxmTextureInitLinear(&texture->gxm_tex, texture_data, format, texture_w, h, 0); if (ret < 0) { free_gxm_texture(data, texture); - SDL_LogError(SDL_LOG_CATEGORY_RENDER, "texture init failed: %x\n", ret); + SDL_LogError(SDL_LOG_CATEGORY_RENDER, "texture init failed: %x", ret); return NULL; } @@ -1065,7 +1065,7 @@ gxm_texture *create_gxm_texture(VITA_GXM_RenderData *data, unsigned int w, unsig if (err < 0) { free_gxm_texture(data, texture); - SDL_LogError(SDL_LOG_CATEGORY_RENDER, "color surface init failed: %x\n", err); + SDL_LogError(SDL_LOG_CATEGORY_RENDER, "color surface init failed: %x", err); return NULL; } @@ -1088,7 +1088,7 @@ gxm_texture *create_gxm_texture(VITA_GXM_RenderData *data, unsigned int w, unsig if (err < 0) { free_gxm_texture(data, texture); - SDL_LogError(SDL_LOG_CATEGORY_RENDER, "depth stencil init failed: %x\n", err); + SDL_LogError(SDL_LOG_CATEGORY_RENDER, "depth stencil init failed: %x", err); return NULL; } @@ -1113,7 +1113,7 @@ gxm_texture *create_gxm_texture(VITA_GXM_RenderData *data, unsigned int w, unsig if (err < 0) { free_gxm_texture(data, texture); - SDL_LogError(SDL_LOG_CATEGORY_RENDER, "create render target failed: %x\n", err); + SDL_LogError(SDL_LOG_CATEGORY_RENDER, "create render target failed: %x", err); return NULL; } } diff --git a/src/render/vulkan/SDL_render_vulkan.c b/src/render/vulkan/SDL_render_vulkan.c index e61a88f58ba26..8cfc3a4ad7409 100644 --- a/src/render/vulkan/SDL_render_vulkan.c +++ b/src/render/vulkan/SDL_render_vulkan.c @@ -41,14 +41,14 @@ #define SET_ERROR_CODE(message, rc) \ if (SDL_GetHintBoolean(SDL_HINT_RENDER_VULKAN_DEBUG, false)) { \ - SDL_LogError(SDL_LOG_CATEGORY_RENDER, "%s: %s\n", message, SDL_Vulkan_GetResultString(rc)); \ + SDL_LogError(SDL_LOG_CATEGORY_RENDER, "%s: %s", message, SDL_Vulkan_GetResultString(rc)); \ SDL_TriggerBreakpoint(); \ } \ SDL_SetError("%s: %s", message, SDL_Vulkan_GetResultString(rc)) \ #define SET_ERROR_MESSAGE(message) \ if (SDL_GetHintBoolean(SDL_HINT_RENDER_VULKAN_DEBUG, false)) { \ - SDL_LogError(SDL_LOG_CATEGORY_RENDER, "%s\n", message); \ + SDL_LogError(SDL_LOG_CATEGORY_RENDER, "%s", message); \ SDL_TriggerBreakpoint(); \ } \ SDL_SetError("%s", message) \ @@ -2512,7 +2512,7 @@ static bool VULKAN_HandleDeviceLost(SDL_Renderer *renderer) VULKAN_CreateWindowSizeDependentResources(renderer) == VK_SUCCESS) { recovered = true; } else { - SDL_LogError(SDL_LOG_CATEGORY_RENDER, "Renderer couldn't recover from device lost: %s\n", SDL_GetError()); + SDL_LogError(SDL_LOG_CATEGORY_RENDER, "Renderer couldn't recover from device lost: %s", SDL_GetError()); VULKAN_DestroyAll(renderer); } @@ -3296,7 +3296,7 @@ static bool VULKAN_UpdateViewport(SDL_Renderer *renderer) * SDL_CreateRenderer is calling it, and will call it again later * with a non-empty viewport. */ - // SDL_Log("%s, no viewport was set!\n", __FUNCTION__); + // SDL_Log("%s, no viewport was set!", __FUNCTION__); return false; } diff --git a/src/sensor/windows/SDL_windowssensor.c b/src/sensor/windows/SDL_windowssensor.c index 77da14d01d2d1..059747eeb420e 100644 --- a/src/sensor/windows/SDL_windowssensor.c +++ b/src/sensor/windows/SDL_windowssensor.c @@ -132,7 +132,7 @@ static HRESULT STDMETHODCALLTYPE ISensorEventsVtbl_OnStateChanged(ISensorEvents SDL_LockSensors(); for (i = 0; i < SDL_num_sensors; ++i) { if (pSensor == SDL_sensors[i].sensor) { - SDL_Log("Sensor %s state changed to %d\n", SDL_sensors[i].name, state); + SDL_Log("Sensor %s state changed to %d", SDL_sensors[i].name, state); } } SDL_UnlockSensors(); @@ -156,7 +156,7 @@ static HRESULT STDMETHODCALLTYPE ISensorEventsVtbl_OnDataUpdated(ISensorEvents * Uint64 sensor_timestamp; #ifdef DEBUG_SENSORS - SDL_Log("Sensor %s data updated\n", SDL_sensors[i].name); + SDL_Log("Sensor %s data updated", SDL_sensors[i].name); #endif if (SUCCEEDED(ISensorDataReport_GetTimestamp(pNewData, &sensor_systemtime)) && SystemTimeToFileTime(&sensor_systemtime, &sensor_filetime)) { @@ -219,7 +219,7 @@ static HRESULT STDMETHODCALLTYPE ISensorEventsVtbl_OnEvent(ISensorEvents *This, SDL_LockSensors(); for (i = 0; i < SDL_num_sensors; ++i) { if (pSensor == SDL_sensors[i].sensor) { - SDL_Log("Sensor %s event occurred\n", SDL_sensors[i].name); + SDL_Log("Sensor %s event occurred", SDL_sensors[i].name); } } SDL_UnlockSensors(); @@ -235,7 +235,7 @@ static HRESULT STDMETHODCALLTYPE ISensorEventsVtbl_OnLeave(ISensorEvents *This, for (i = 0; i < SDL_num_sensors; ++i) { if (WIN_IsEqualIID(ID, &SDL_sensors[i].sensor_id)) { #ifdef DEBUG_SENSORS - SDL_Log("Sensor %s disconnected\n", SDL_sensors[i].name); + SDL_Log("Sensor %s disconnected", SDL_sensors[i].name); #endif DisconnectSensor(SDL_sensors[i].sensor); } diff --git a/src/test/SDL_test_common.c b/src/test/SDL_test_common.c index 8e0590ae9fa7d..3203ddea435a5 100644 --- a/src/test/SDL_test_common.c +++ b/src/test/SDL_test_common.c @@ -1092,12 +1092,12 @@ static void SDLTest_PrintRenderer(SDL_Renderer *renderer) name = SDL_GetRendererName(renderer); - SDL_Log(" Renderer %s:\n", name); + SDL_Log(" Renderer %s:", name); if (SDL_strcmp(name, "gpu") == 0) { SDL_GPUDevice *device = SDL_GetPointerProperty(SDL_GetRendererProperties(renderer), SDL_PROP_RENDERER_GPU_DEVICE_POINTER, NULL); - SDL_Log(" Driver: %s\n", SDL_GetGPUDeviceDriver(device)); + SDL_Log(" Driver: %s", SDL_GetGPUDeviceDriver(device)); } - SDL_Log(" VSync: %d\n", (int)SDL_GetNumberProperty(SDL_GetRendererProperties(renderer), SDL_PROP_RENDERER_VSYNC_NUMBER, 0)); + SDL_Log(" VSync: %d", (int)SDL_GetNumberProperty(SDL_GetRendererProperties(renderer), SDL_PROP_RENDERER_VSYNC_NUMBER, 0)); texture_formats = (const SDL_PixelFormat *)SDL_GetPointerProperty(SDL_GetRendererProperties(renderer), SDL_PROP_RENDERER_TEXTURE_FORMATS_POINTER, NULL); if (texture_formats) { @@ -1108,12 +1108,12 @@ static void SDLTest_PrintRenderer(SDL_Renderer *renderer) } SDLTest_PrintPixelFormat(text, sizeof(text), texture_formats[i]); } - SDL_Log("%s\n", text); + SDL_Log("%s", text); } max_texture_size = (int)SDL_GetNumberProperty(SDL_GetRendererProperties(renderer), SDL_PROP_RENDERER_MAX_TEXTURE_SIZE_NUMBER, 0); if (max_texture_size) { - SDL_Log(" Max Texture Size: %dx%d\n", max_texture_size, max_texture_size); + SDL_Log(" Max Texture Size: %dx%d", max_texture_size, max_texture_size); } } @@ -1124,7 +1124,7 @@ static SDL_Surface *SDLTest_LoadIcon(const char *file) /* Load the icon surface */ icon = SDL_LoadBMP(file); if (!icon) { - SDL_Log("Couldn't load %s: %s\n", file, SDL_GetError()); + SDL_Log("Couldn't load %s: %s", file, SDL_GetError()); return NULL; } @@ -1142,40 +1142,40 @@ static SDL_HitTestResult SDLCALL SDLTest_ExampleHitTestCallback(SDL_Window *win, const int RESIZE_BORDER = 8; const int DRAGGABLE_TITLE = 32; - /*SDL_Log("Hit test point %d,%d\n", area->x, area->y);*/ + /*SDL_Log("Hit test point %d,%d", area->x, area->y);*/ SDL_GetWindowSize(win, &w, &h); if (area->x < RESIZE_BORDER) { if (area->y < RESIZE_BORDER) { - SDL_Log("SDL_HITTEST_RESIZE_TOPLEFT\n"); + SDL_Log("SDL_HITTEST_RESIZE_TOPLEFT"); return SDL_HITTEST_RESIZE_TOPLEFT; } else if (area->y >= (h - RESIZE_BORDER)) { - SDL_Log("SDL_HITTEST_RESIZE_BOTTOMLEFT\n"); + SDL_Log("SDL_HITTEST_RESIZE_BOTTOMLEFT"); return SDL_HITTEST_RESIZE_BOTTOMLEFT; } else { - SDL_Log("SDL_HITTEST_RESIZE_LEFT\n"); + SDL_Log("SDL_HITTEST_RESIZE_LEFT"); return SDL_HITTEST_RESIZE_LEFT; } } else if (area->x >= (w - RESIZE_BORDER)) { if (area->y < RESIZE_BORDER) { - SDL_Log("SDL_HITTEST_RESIZE_TOPRIGHT\n"); + SDL_Log("SDL_HITTEST_RESIZE_TOPRIGHT"); return SDL_HITTEST_RESIZE_TOPRIGHT; } else if (area->y >= (h - RESIZE_BORDER)) { - SDL_Log("SDL_HITTEST_RESIZE_BOTTOMRIGHT\n"); + SDL_Log("SDL_HITTEST_RESIZE_BOTTOMRIGHT"); return SDL_HITTEST_RESIZE_BOTTOMRIGHT; } else { - SDL_Log("SDL_HITTEST_RESIZE_RIGHT\n"); + SDL_Log("SDL_HITTEST_RESIZE_RIGHT"); return SDL_HITTEST_RESIZE_RIGHT; } } else if (area->y >= (h - RESIZE_BORDER)) { - SDL_Log("SDL_HITTEST_RESIZE_BOTTOM\n"); + SDL_Log("SDL_HITTEST_RESIZE_BOTTOM"); return SDL_HITTEST_RESIZE_BOTTOM; } else if (area->y < RESIZE_BORDER) { - SDL_Log("SDL_HITTEST_RESIZE_TOP\n"); + SDL_Log("SDL_HITTEST_RESIZE_TOP"); return SDL_HITTEST_RESIZE_TOP; } else if (area->y < DRAGGABLE_TITLE) { - SDL_Log("SDL_HITTEST_DRAGGABLE\n"); + SDL_Log("SDL_HITTEST_DRAGGABLE"); return SDL_HITTEST_DRAGGABLE; } return SDL_HITTEST_NORMAL; @@ -1190,7 +1190,7 @@ bool SDLTest_CommonInit(SDLTest_CommonState *state) if (state->verbose & VERBOSE_VIDEO) { n = SDL_GetNumVideoDrivers(); if (n == 0) { - SDL_Log("No built-in video drivers\n"); + SDL_Log("No built-in video drivers"); } else { (void)SDL_snprintf(text, sizeof(text), "Built-in video drivers:"); for (i = 0; i < n; ++i) { @@ -1199,16 +1199,16 @@ bool SDLTest_CommonInit(SDLTest_CommonState *state) } SDL_snprintfcat(text, sizeof(text), " %s", SDL_GetVideoDriver(i)); } - SDL_Log("%s\n", text); + SDL_Log("%s", text); } } if (!SDL_InitSubSystem(SDL_INIT_VIDEO)) { - SDL_Log("Couldn't initialize video driver: %s\n", + SDL_Log("Couldn't initialize video driver: %s", SDL_GetError()); return false; } if (state->verbose & VERBOSE_VIDEO) { - SDL_Log("Video driver: %s\n", + SDL_Log("Video driver: %s", SDL_GetCurrentVideoDriver()); } @@ -1257,10 +1257,10 @@ bool SDLTest_CommonInit(SDLTest_CommonState *state) int outputIndex = 0; #endif displays = SDL_GetDisplays(&n); - SDL_Log("Number of displays: %d\n", n); + SDL_Log("Number of displays: %d", n); for (i = 0; i < n; ++i) { SDL_DisplayID displayID = displays[i]; - SDL_Log("Display %" SDL_PRIu32 ": %s\n", displayID, SDL_GetDisplayName(displayID)); + SDL_Log("Display %" SDL_PRIu32 ": %s", displayID, SDL_GetDisplayName(displayID)); SDL_zero(bounds); SDL_GetDisplayBounds(displayID, &bounds); @@ -1268,46 +1268,46 @@ bool SDLTest_CommonInit(SDLTest_CommonState *state) SDL_zero(usablebounds); SDL_GetDisplayUsableBounds(displayID, &usablebounds); - SDL_Log("Bounds: %dx%d at %d,%d\n", bounds.w, bounds.h, bounds.x, bounds.y); - SDL_Log("Usable bounds: %dx%d at %d,%d\n", usablebounds.w, usablebounds.h, usablebounds.x, usablebounds.y); + SDL_Log("Bounds: %dx%d at %d,%d", bounds.w, bounds.h, bounds.x, bounds.y); + SDL_Log("Usable bounds: %dx%d at %d,%d", usablebounds.w, usablebounds.h, usablebounds.x, usablebounds.y); mode = SDL_GetDesktopDisplayMode(displayID); SDL_GetMasksForPixelFormat(mode->format, &bpp, &Rmask, &Gmask, &Bmask, &Amask); - SDL_Log(" Desktop mode: %dx%d@%gx %gHz, %d bits-per-pixel (%s)\n", + SDL_Log(" Desktop mode: %dx%d@%gx %gHz, %d bits-per-pixel (%s)", mode->w, mode->h, mode->pixel_density, mode->refresh_rate, bpp, SDL_GetPixelFormatName(mode->format)); if (Rmask || Gmask || Bmask) { - SDL_Log(" Red Mask = 0x%.8" SDL_PRIx32 "\n", Rmask); - SDL_Log(" Green Mask = 0x%.8" SDL_PRIx32 "\n", Gmask); - SDL_Log(" Blue Mask = 0x%.8" SDL_PRIx32 "\n", Bmask); + SDL_Log(" Red Mask = 0x%.8" SDL_PRIx32, Rmask); + SDL_Log(" Green Mask = 0x%.8" SDL_PRIx32, Gmask); + SDL_Log(" Blue Mask = 0x%.8" SDL_PRIx32, Bmask); if (Amask) { - SDL_Log(" Alpha Mask = 0x%.8" SDL_PRIx32 "\n", Amask); + SDL_Log(" Alpha Mask = 0x%.8" SDL_PRIx32, Amask); } } /* Print available fullscreen video modes */ modes = SDL_GetFullscreenDisplayModes(displayID, &m); if (m == 0) { - SDL_Log("No available fullscreen video modes\n"); + SDL_Log("No available fullscreen video modes"); } else { - SDL_Log(" Fullscreen video modes:\n"); + SDL_Log(" Fullscreen video modes:"); for (j = 0; j < m; ++j) { mode = modes[j]; SDL_GetMasksForPixelFormat(mode->format, &bpp, &Rmask, &Gmask, &Bmask, &Amask); - SDL_Log(" Mode %d: %dx%d@%gx %gHz, %d bits-per-pixel (%s)\n", + SDL_Log(" Mode %d: %dx%d@%gx %gHz, %d bits-per-pixel (%s)", j, mode->w, mode->h, mode->pixel_density, mode->refresh_rate, bpp, SDL_GetPixelFormatName(mode->format)); if (Rmask || Gmask || Bmask) { - SDL_Log(" Red Mask = 0x%.8" SDL_PRIx32 "\n", + SDL_Log(" Red Mask = 0x%.8" SDL_PRIx32, Rmask); - SDL_Log(" Green Mask = 0x%.8" SDL_PRIx32 "\n", + SDL_Log(" Green Mask = 0x%.8" SDL_PRIx32, Gmask); - SDL_Log(" Blue Mask = 0x%.8" SDL_PRIx32 "\n", + SDL_Log(" Blue Mask = 0x%.8" SDL_PRIx32, Bmask); if (Amask) { - SDL_Log(" Alpha Mask = 0x%.8" SDL_PRIx32 "\n", Amask); + SDL_Log(" Alpha Mask = 0x%.8" SDL_PRIx32, Amask); } } } @@ -1330,11 +1330,11 @@ bool SDLTest_CommonInit(SDLTest_CommonState *state) if (state->verbose & VERBOSE_RENDER) { n = SDL_GetNumRenderDrivers(); if (n == 0) { - SDL_Log("No built-in render drivers\n"); + SDL_Log("No built-in render drivers"); } else { - SDL_Log("Built-in render drivers:\n"); + SDL_Log("Built-in render drivers:"); for (i = 0; i < n; ++i) { - SDL_Log(" %s\n", SDL_GetRenderDriver(i)); + SDL_Log(" %s", SDL_GetRenderDriver(i)); } } } @@ -1374,7 +1374,7 @@ bool SDLTest_CommonInit(SDLTest_CommonState *state) (SDL_Texture **)SDL_calloc(state->num_windows, sizeof(*state->targets)); if (!state->windows || !state->renderers) { - SDL_Log("Out of memory!\n"); + SDL_Log("Out of memory!"); return false; } for (i = 0; i < state->num_windows; ++i) { @@ -1412,7 +1412,7 @@ bool SDLTest_CommonInit(SDLTest_CommonState *state) state->windows[i] = SDL_CreateWindowWithProperties(props); SDL_DestroyProperties(props); if (!state->windows[i]) { - SDL_Log("Couldn't create window: %s\n", + SDL_Log("Couldn't create window: %s", SDL_GetError()); return false; } @@ -1427,7 +1427,7 @@ bool SDLTest_CommonInit(SDLTest_CommonState *state) } SDL_GetWindowSize(state->windows[i], &w, &h); if (!(state->window_flags & SDL_WINDOW_RESIZABLE) && (w != r.w || h != r.h)) { - SDL_Log("Window requested size %dx%d, got %dx%d\n", r.w, r.h, w, h); + SDL_Log("Window requested size %dx%d, got %dx%d", r.w, r.h, w, h); state->window_w = w; state->window_h = h; } @@ -1459,7 +1459,7 @@ bool SDLTest_CommonInit(SDLTest_CommonState *state) if (!state->skip_renderer && (state->renderdriver || !(state->window_flags & (SDL_WINDOW_OPENGL | SDL_WINDOW_VULKAN | SDL_WINDOW_METAL)))) { state->renderers[i] = SDL_CreateRenderer(state->windows[i], state->renderdriver); if (!state->renderers[i]) { - SDL_Log("Couldn't create renderer: %s\n", + SDL_Log("Couldn't create renderer: %s", SDL_GetError()); return false; } @@ -1471,14 +1471,14 @@ bool SDLTest_CommonInit(SDLTest_CommonState *state) SDL_SetRenderVSync(state->renderers[i], state->render_vsync); } if (!SDL_SetRenderLogicalPresentation(state->renderers[i], state->logical_w, state->logical_h, state->logical_presentation)) { - SDL_Log("Couldn't set logical presentation: %s\n", SDL_GetError()); + SDL_Log("Couldn't set logical presentation: %s", SDL_GetError()); return false; } if (state->scale != 0.0f) { SDL_SetRenderScale(state->renderers[i], state->scale, state->scale); } if (state->verbose & VERBOSE_RENDER) { - SDL_Log("Current renderer:\n"); + SDL_Log("Current renderer:"); SDLTest_PrintRenderer(state->renderers[i]); } } @@ -1494,7 +1494,7 @@ bool SDLTest_CommonInit(SDLTest_CommonState *state) if (state->verbose & VERBOSE_AUDIO) { n = SDL_GetNumAudioDrivers(); if (n == 0) { - SDL_Log("No built-in audio drivers\n"); + SDL_Log("No built-in audio drivers"); } else { (void)SDL_snprintf(text, sizeof(text), "Built-in audio drivers:"); for (i = 0; i < n; ++i) { @@ -1503,23 +1503,23 @@ bool SDLTest_CommonInit(SDLTest_CommonState *state) } SDL_snprintfcat(text, sizeof(text), " %s", SDL_GetAudioDriver(i)); } - SDL_Log("%s\n", text); + SDL_Log("%s", text); } } if (!SDL_InitSubSystem(SDL_INIT_AUDIO)) { - SDL_Log("Couldn't initialize audio driver: %s\n", + SDL_Log("Couldn't initialize audio driver: %s", SDL_GetError()); return false; } if (state->verbose & VERBOSE_AUDIO) { - SDL_Log("Audio driver: %s\n", + SDL_Log("Audio driver: %s", SDL_GetCurrentAudioDriver()); } const SDL_AudioSpec spec = { state->audio_format, state->audio_channels, state->audio_freq }; state->audio_id = SDL_OpenAudioDevice(SDL_AUDIO_DEVICE_DEFAULT_PLAYBACK, &spec); if (!state->audio_id) { - SDL_Log("Couldn't open audio: %s\n", SDL_GetError()); + SDL_Log("Couldn't open audio: %s", SDL_GetError()); return false; } } @@ -1676,7 +1676,7 @@ void SDLTest_PrintEvent(const SDL_Event *event) SDL_Rect rect; SDL_GetWindowSafeArea(SDL_GetWindowFromEvent(event), &rect); - SDL_Log("SDL EVENT: Window %" SDL_PRIu32 " changed safe area to: %d,%d %dx%d\n", + SDL_Log("SDL EVENT: Window %" SDL_PRIu32 " changed safe area to: %d,%d %dx%d", event->window.windowID, rect.x, rect.y, rect.w, rect.h); break; } @@ -2058,7 +2058,7 @@ static void SDLCALL SDLTest_ScreenShotClipboardCleanup(void *context) { SDLTest_ClipboardData *data = (SDLTest_ClipboardData *)context; - SDL_Log("Cleaning up screenshot image data\n"); + SDL_Log("Cleaning up screenshot image data"); if (data->image) { SDL_free(data->image); @@ -2071,14 +2071,14 @@ static const void * SDLCALL SDLTest_ScreenShotClipboardProvider(void *context, c SDLTest_ClipboardData *data = (SDLTest_ClipboardData *)context; if (SDL_strncmp(mime_type, "text", 4) == 0) { - SDL_Log("Providing screenshot title to clipboard!\n"); + SDL_Log("Providing screenshot title to clipboard!"); /* Return "Test screenshot" */ *size = 15; return "Test screenshot (but this isn't part of it)"; } - SDL_Log("Providing screenshot image to clipboard!\n"); + SDL_Log("Providing screenshot image to clipboard!"); if (!data->image) { SDL_IOStream *file; @@ -2089,7 +2089,7 @@ static const void * SDLCALL SDLTest_ScreenShotClipboardProvider(void *context, c void *image = SDL_malloc(length); if (image) { if (SDL_ReadIO(file, image, length) != length) { - SDL_Log("Couldn't read %s: %s\n", SCREENSHOT_FILE, SDL_GetError()); + SDL_Log("Couldn't read %s: %s", SCREENSHOT_FILE, SDL_GetError()); SDL_free(image); image = NULL; } @@ -2101,7 +2101,7 @@ static const void * SDLCALL SDLTest_ScreenShotClipboardProvider(void *context, c data->size = length; } } else { - SDL_Log("Couldn't load %s: %s\n", SCREENSHOT_FILE, SDL_GetError()); + SDL_Log("Couldn't load %s: %s", SCREENSHOT_FILE, SDL_GetError()); } } @@ -2124,12 +2124,12 @@ static void SDLTest_CopyScreenShot(SDL_Renderer *renderer) surface = SDL_RenderReadPixels(renderer, NULL); if (!surface) { - SDL_Log("Couldn't read screen: %s\n", SDL_GetError()); + SDL_Log("Couldn't read screen: %s", SDL_GetError()); return; } if (!SDL_SaveBMP(surface, SCREENSHOT_FILE)) { - SDL_Log("Couldn't save %s: %s\n", SCREENSHOT_FILE, SDL_GetError()); + SDL_Log("Couldn't save %s: %s", SCREENSHOT_FILE, SDL_GetError()); SDL_DestroySurface(surface); return; } @@ -2137,11 +2137,11 @@ static void SDLTest_CopyScreenShot(SDL_Renderer *renderer) clipboard_data = (SDLTest_ClipboardData *)SDL_calloc(1, sizeof(*clipboard_data)); if (!clipboard_data) { - SDL_Log("Couldn't allocate clipboard data\n"); + SDL_Log("Couldn't allocate clipboard data"); return; } SDL_SetClipboardData(SDLTest_ScreenShotClipboardProvider, SDLTest_ScreenShotClipboardCleanup, clipboard_data, image_formats, SDL_arraysize(image_formats)); - SDL_Log("Saved screenshot to %s and clipboard\n", SCREENSHOT_FILE); + SDL_Log("Saved screenshot to %s and clipboard", SCREENSHOT_FILE); } static void SDLTest_PasteScreenShot(void) @@ -2336,7 +2336,7 @@ SDL_AppResult SDLTest_CommonEventMainCallbacks(SDLTest_CommonState *state, const } else { dest = displays[(current_index + num_displays + 1) % num_displays]; } - SDL_Log("Centering on display (%" SDL_PRIu32 ")\n", dest); + SDL_Log("Centering on display (%" SDL_PRIu32 ")", dest); SDL_SetWindowPosition(window, SDL_WINDOWPOS_CENTERED_DISPLAY(dest), SDL_WINDOWPOS_CENTERED_DISPLAY(dest)); @@ -2365,7 +2365,7 @@ SDL_AppResult SDLTest_CommonEventMainCallbacks(SDLTest_CommonState *state, const x += delta; } - SDL_Log("Setting position to (%d, %d)\n", x, y); + SDL_Log("Setting position to (%d, %d)", x, y); SDL_SetWindowPosition(window, x, y); } } @@ -2399,7 +2399,7 @@ SDL_AppResult SDLTest_CommonEventMainCallbacks(SDLTest_CommonState *state, const if (withAlt) { /* Alt-C copy awesome text to the primary selection! */ SDL_SetPrimarySelectionText("SDL rocks!\nYou know it!"); - SDL_Log("Copied text to primary selection\n"); + SDL_Log("Copied text to primary selection"); } else if (withControl) { if (withShift) { @@ -2415,7 +2415,7 @@ SDL_AppResult SDLTest_CommonEventMainCallbacks(SDLTest_CommonState *state, const } else { /* Ctrl-C copy awesome text! */ SDL_SetClipboardText("SDL rocks!\nYou know it!"); - SDL_Log("Copied text to clipboard\n"); + SDL_Log("Copied text to clipboard"); } break; } @@ -2425,9 +2425,9 @@ SDL_AppResult SDLTest_CommonEventMainCallbacks(SDLTest_CommonState *state, const /* Alt-V paste awesome text from the primary selection! */ char *text = SDL_GetPrimarySelectionText(); if (*text) { - SDL_Log("Primary selection: %s\n", text); + SDL_Log("Primary selection: %s", text); } else { - SDL_Log("Primary selection is empty\n"); + SDL_Log("Primary selection is empty"); } SDL_free(text); @@ -2439,9 +2439,9 @@ SDL_AppResult SDLTest_CommonEventMainCallbacks(SDLTest_CommonState *state, const /* Ctrl-V paste awesome text! */ char *text = SDL_GetClipboardText(); if (*text) { - SDL_Log("Clipboard: %s\n", text); + SDL_Log("Clipboard: %s", text); } else { - SDL_Log("Clipboard is empty\n"); + SDL_Log("Clipboard is empty"); } SDL_free(text); } @@ -2498,7 +2498,7 @@ SDL_AppResult SDLTest_CommonEventMainCallbacks(SDLTest_CommonState *state, const if (window) { const bool shouldCapture = !(SDL_GetWindowFlags(window) & SDL_WINDOW_MOUSE_CAPTURE); const bool rc = SDL_CaptureMouse(shouldCapture); - SDL_Log("%sapturing mouse %s!\n", shouldCapture ? "C" : "Unc", rc ? "succeeded" : "failed"); + SDL_Log("%sapturing mouse %s!", shouldCapture ? "C" : "Unc", rc ? "succeeded" : "failed"); } } break; diff --git a/src/video/SDL_egl.c b/src/video/SDL_egl.c index edeb033fc2ebf..86502549b61e7 100644 --- a/src/video/SDL_egl.c +++ b/src/video/SDL_egl.c @@ -719,7 +719,7 @@ static void dumpconfig(SDL_VideoDevice *_this, EGLConfig config) for (attr = 0; attr < sizeof(all_attributes) / sizeof(Attribute); attr++) { EGLint value; _this->egl_data->eglGetConfigAttrib(_this->egl_data->egl_display, config, all_attributes[attr].attribute, &value); - SDL_Log("\t%-32s: %10d (0x%08x)\n", all_attributes[attr].name, value, value); + SDL_Log("\t%-32s: %10d (0x%08x)", all_attributes[attr].name, value, value); } } diff --git a/src/video/cocoa/SDL_cocoakeyboard.m b/src/video/cocoa/SDL_cocoakeyboard.m index 550f533f18d4a..df614e82d60dd 100644 --- a/src/video/cocoa/SDL_cocoakeyboard.m +++ b/src/video/cocoa/SDL_cocoakeyboard.m @@ -540,7 +540,7 @@ void Cocoa_HandleKeyEvent(SDL_VideoDevice *_this, NSEvent *event) #ifdef DEBUG_SCANCODES if (code == SDL_SCANCODE_UNKNOWN) { - SDL_Log("The key you just pressed is not recognized by SDL. To help get this fixed, report this to the SDL forums/mailing list or to Christian Walther . Mac virtual key code is %d.\n", scancode); + SDL_Log("The key you just pressed is not recognized by SDL. To help get this fixed, report this to the SDL forums/mailing list or to Christian Walther . Mac virtual key code is %d.", scancode); } #endif if (SDL_TextInputActive(SDL_GetKeyboardFocus())) { diff --git a/src/video/kmsdrm/SDL_kmsdrmdyn.c b/src/video/kmsdrm/SDL_kmsdrmdyn.c index 467fb27f9a4d6..a532ceaf15f1b 100644 --- a/src/video/kmsdrm/SDL_kmsdrmdyn.c +++ b/src/video/kmsdrm/SDL_kmsdrmdyn.c @@ -59,9 +59,9 @@ static void *KMSDRM_GetSym(const char *fnname, int *pHasModule, bool required) #if DEBUG_DYNAMIC_KMSDRM if (fn) - SDL_Log("KMSDRM: Found '%s' in %s (%p)\n", fnname, kmsdrmlibs[i].libname, fn); + SDL_Log("KMSDRM: Found '%s' in %s (%p)", fnname, kmsdrmlibs[i].libname, fn); else - SDL_Log("KMSDRM: Symbol '%s' NOT FOUND!\n", fnname); + SDL_Log("KMSDRM: Symbol '%s' NOT FOUND!", fnname); #endif if (!fn && required) { diff --git a/src/video/openvr/SDL_openvrvideo.c b/src/video/openvr/SDL_openvrvideo.c index 271ce93ca1b64..77ad96a7503ca 100644 --- a/src/video/openvr/SDL_openvrvideo.c +++ b/src/video/openvr/SDL_openvrvideo.c @@ -661,7 +661,7 @@ static bool OPENVR_SetupFrame(SDL_VideoDevice *_this, SDL_Window *window) { int error = ov_glGetError(); if (error) - SDL_Log("Found GL Error before beginning frame: %d / (Framebuffer:%d)\n", error, ov_glCheckNamedFramebufferStatus(videodata->fbo, GL_FRAMEBUFFER)); + SDL_Log("Found GL Error before beginning frame: %d / (Framebuffer:%d)", error, ov_glCheckNamedFramebufferStatus(videodata->fbo, GL_FRAMEBUFFER)); } #endif @@ -698,7 +698,7 @@ static bool OPENVR_ReleaseFrame(SDL_VideoDevice *_this) { int error = ov_glGetError(); if (error) { - SDL_Log("Found GL Error before release frame: %d / (Framebuffer:%d)\n", error, ov_glCheckNamedFramebufferStatus(videodata->fbo, GL_FRAMEBUFFER)); + SDL_Log("Found GL Error before release frame: %d / (Framebuffer:%d)", error, ov_glCheckNamedFramebufferStatus(videodata->fbo, GL_FRAMEBUFFER)); } } #endif @@ -895,7 +895,7 @@ static SDL_GLContext OPENVR_GL_CreateContext(SDL_VideoDevice *_this, SDL_Window const char *ccc = (const char *)ov_glGetStringi(GL_EXTENSIONS, i); if (SDL_strcmp(ccc, "GL_KHR_debug") == 0) { #ifdef DEBUG_OPENVR - SDL_Log("Found renderdoc debug extension.\n"); + SDL_Log("Found renderdoc debug extension."); #endif videodata->renderdoc_debugmarker_frame_end = true; } @@ -968,7 +968,7 @@ static bool SDL_EGL_InitInternal(SDL_VideoData * vd) vd->eglDpy = eglGetDisplay(EGL_DEFAULT_DISPLAY); #ifdef DEBUG_OPENVR - SDL_Log("EGL Display: %p\n", vd->eglDpy); + SDL_Log("EGL Display: %p", vd->eglDpy); #endif if (vd->eglDpy == 0) { @@ -1040,7 +1040,7 @@ static SDL_GLContext OVR_EGL_CreateContext(SDL_VideoDevice *_this, SDL_Window * const char * ccc = (const char*)ov_glGetStringi(GL_EXTENSIONS, i); if (SDL_strcmp(ccc, "GL_KHR_debug") == 0) { #ifdef DEBUG_OPENVR - SDL_Log("Found renderdoc debug extension.\n"); + SDL_Log("Found renderdoc debug extension."); #endif videodata->renderdoc_debugmarker_frame_end = true; } diff --git a/src/video/wayland/SDL_waylanddyn.c b/src/video/wayland/SDL_waylanddyn.c index dd0f3fc139666..7d6d42f3f56a9 100644 --- a/src/video/wayland/SDL_waylanddyn.c +++ b/src/video/wayland/SDL_waylanddyn.c @@ -66,9 +66,9 @@ static void *WAYLAND_GetSym(const char *fnname, int *pHasModule, bool required) #if DEBUG_DYNAMIC_WAYLAND if (fn) { - SDL_Log("WAYLAND: Found '%s' in %s (%p)\n", fnname, dynlib->libname, fn); + SDL_Log("WAYLAND: Found '%s' in %s (%p)", fnname, dynlib->libname, fn); } else { - SDL_Log("WAYLAND: Symbol '%s' NOT FOUND!\n", fnname); + SDL_Log("WAYLAND: Symbol '%s' NOT FOUND!", fnname); } #endif diff --git a/src/video/wayland/SDL_waylandvideo.c b/src/video/wayland/SDL_waylandvideo.c index 7ea5a582f5a1b..d1066b4d92a1e 100644 --- a/src/video/wayland/SDL_waylandvideo.c +++ b/src/video/wayland/SDL_waylandvideo.c @@ -1195,7 +1195,7 @@ static void libdecor_error(struct libdecor *context, enum libdecor_error error, const char *message) { - SDL_LogError(SDL_LOG_CATEGORY_VIDEO, "libdecor error (%d): %s\n", error, message); + SDL_LogError(SDL_LOG_CATEGORY_VIDEO, "libdecor error (%d): %s", error, message); } static struct libdecor_interface libdecor_interface = { diff --git a/src/video/windows/SDL_windowsevents.c b/src/video/windows/SDL_windowsevents.c index b65d81ac5ff13..c9bf2a4989654 100644 --- a/src/video/windows/SDL_windowsevents.c +++ b/src/video/windows/SDL_windowsevents.c @@ -157,17 +157,17 @@ static Uint64 WIN_GetEventTimestamp(void) timestamp += timestamp_offset; if (!timestamp_offset) { // Initializing timestamp offset - //SDL_Log("Initializing timestamp offset\n"); + //SDL_Log("Initializing timestamp offset"); timestamp_offset = (now - timestamp); timestamp = now; } else if ((Sint64)(now - timestamp - TIMESTAMP_WRAP_OFFSET) >= 0) { // The windows message tick wrapped - //SDL_Log("Adjusting timestamp offset for wrapping tick\n"); + //SDL_Log("Adjusting timestamp offset for wrapping tick"); timestamp_offset += TIMESTAMP_WRAP_OFFSET; timestamp += TIMESTAMP_WRAP_OFFSET; } else if (timestamp > now) { // We got a newer timestamp, but it can't be newer than now, so adjust our offset - //SDL_Log("Adjusting timestamp offset, %.2f ms newer\n", (double)(timestamp - now) / SDL_NS_PER_MS); + //SDL_Log("Adjusting timestamp offset, %.2f ms newer", (double)(timestamp - now) / SDL_NS_PER_MS); timestamp_offset -= (timestamp - now); timestamp = now; } @@ -2239,7 +2239,7 @@ LRESULT CALLBACK WIN_WindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lPara int w, h; #ifdef HIGHDPI_DEBUG - SDL_Log("WM_DPICHANGED: to %d\tsuggested rect: (%d, %d), (%dx%d)\n", newDPI, + SDL_Log("WM_DPICHANGED: to %d\tsuggested rect: (%d, %d), (%dx%d)", newDPI, suggestedRect->left, suggestedRect->top, suggestedRect->right - suggestedRect->left, suggestedRect->bottom - suggestedRect->top); #endif @@ -2270,7 +2270,7 @@ LRESULT CALLBACK WIN_WindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lPara } #ifdef HIGHDPI_DEBUG - SDL_Log("WM_DPICHANGED: current SDL window size: (%dx%d)\tcalling SetWindowPos: (%d, %d), (%dx%d)\n", + SDL_Log("WM_DPICHANGED: current SDL window size: (%dx%d)\tcalling SetWindowPos: (%d, %d), (%dx%d)", data->window->w, data->window->h, suggestedRect->left, suggestedRect->top, w, h); #endif diff --git a/src/video/windows/SDL_windowsgameinput.c b/src/video/windows/SDL_windowsgameinput.c index 6db142f167901..ddc116af3525a 100644 --- a/src/video/windows/SDL_windowsgameinput.c +++ b/src/video/windows/SDL_windowsgameinput.c @@ -391,7 +391,7 @@ static void DumpKeys(const char *prefix, GameInputKeyState *keys, uint32_t count for (uint32_t i = 0; i < count; ++i) { char str[5]; *SDL_UCS4ToUTF8(keys[i].codePoint, str) = '\0'; - SDL_Log(" Key 0x%.2x (%s)\n", keys[i].scanCode, str); + SDL_Log(" Key 0x%.2x (%s)", keys[i].scanCode, str); } } #endif // DEBUG_KEYS @@ -413,7 +413,7 @@ static void GAMEINPUT_HandleKeyboardDelta(WIN_GameInputData *data, SDL_Window *w uint32_t num_last = IGameInputReading_GetKeyState(last_reading, max_keys, last); uint32_t num_keys = IGameInputReading_GetKeyState(reading, max_keys, keys); #ifdef DEBUG_KEYS - SDL_Log("Timestamp: %llu\n", timestamp); + SDL_Log("Timestamp: %llu", timestamp); DumpKeys("Last keys:", last, num_last); DumpKeys("New keys:", keys, num_keys); #endif diff --git a/src/video/windows/SDL_windowsmodes.c b/src/video/windows/SDL_windowsmodes.c index bfb0baff29917..77ebab29a5765 100644 --- a/src/video/windows/SDL_windowsmodes.c +++ b/src/video/windows/SDL_windowsmodes.c @@ -561,7 +561,7 @@ static void WIN_AddDisplay(SDL_VideoDevice *_this, HMONITOR hMonitor, const MONI float content_scale = WIN_GetContentScale(_this, hMonitor); #ifdef DEBUG_MODES - SDL_Log("Display: %s\n", WIN_StringToUTF8W(info->szDevice)); + SDL_Log("Display: %s", WIN_StringToUTF8W(info->szDevice)); #endif dxgi_output = WIN_GetDXGIOutput(_this, info->szDevice); diff --git a/src/video/windows/SDL_windowsvideo.c b/src/video/windows/SDL_windowsvideo.c index 819cdee4f6c35..ff7c0c2a2d291 100644 --- a/src/video/windows/SDL_windowsvideo.c +++ b/src/video/windows/SDL_windowsvideo.c @@ -482,11 +482,11 @@ static bool WIN_VideoInit(SDL_VideoDevice *_this) if (SUCCEEDED(hr)) { data->oleinitialized = true; } else { - SDL_LogInfo(SDL_LOG_CATEGORY_VIDEO, "OleInitialize() failed: 0x%.8x, using fallback drag-n-drop functionality\n", (unsigned int)hr); + SDL_LogInfo(SDL_LOG_CATEGORY_VIDEO, "OleInitialize() failed: 0x%.8x, using fallback drag-n-drop functionality", (unsigned int)hr); } #endif // !(defined(SDL_PLATFORM_XBOXONE) || defined(SDL_PLATFORM_XBOXSERIES)) } else { - SDL_LogInfo(SDL_LOG_CATEGORY_VIDEO, "CoInitialize() failed: 0x%.8x, using fallback drag-n-drop functionality\n", (unsigned int)hr); + SDL_LogInfo(SDL_LOG_CATEGORY_VIDEO, "CoInitialize() failed: 0x%.8x, using fallback drag-n-drop functionality", (unsigned int)hr); } WIN_InitDPIAwareness(_this); diff --git a/src/video/x11/SDL_x11events.c b/src/video/x11/SDL_x11events.c index 90ce95c584ca0..0ced1b68d3074 100644 --- a/src/video/x11/SDL_x11events.c +++ b/src/video/x11/SDL_x11events.c @@ -430,7 +430,7 @@ void X11_ReconcileKeyboardState(SDL_VideoDevice *_this) static void X11_DispatchFocusIn(SDL_VideoDevice *_this, SDL_WindowData *data) { #ifdef DEBUG_XEVENTS - SDL_Log("window 0x%lx: Dispatching FocusIn\n", data->xwindow); + SDL_Log("window 0x%lx: Dispatching FocusIn", data->xwindow); #endif SDL_SetKeyboardFocus(data->window); X11_ReconcileKeyboardState(_this); @@ -447,7 +447,7 @@ static void X11_DispatchFocusIn(SDL_VideoDevice *_this, SDL_WindowData *data) static void X11_DispatchFocusOut(SDL_VideoDevice *_this, SDL_WindowData *data) { #ifdef DEBUG_XEVENTS - SDL_Log("window 0x%lx: Dispatching FocusOut\n", data->xwindow); + SDL_Log("window 0x%lx: Dispatching FocusOut", data->xwindow); #endif /* If another window has already processed a focus in, then don't try to * remove focus here. Doing so will incorrectly remove focus from that @@ -606,7 +606,7 @@ static void X11_UpdateUserTime(SDL_WindowData *data, const unsigned long latest) XA_CARDINAL, 32, PropModeReplace, (const unsigned char *)&latest, 1); #ifdef DEBUG_XEVENTS - SDL_Log("window 0x%lx: updating _NET_WM_USER_TIME to %lu\n", data->xwindow, latest); + SDL_Log("window 0x%lx: updating _NET_WM_USER_TIME to %lu", data->xwindow, latest); #endif data->user_time = latest; } @@ -636,7 +636,7 @@ static void X11_HandleClipboardEvent(SDL_VideoDevice *_this, const XEvent *xeven #ifdef DEBUG_XEVENTS char *atom_name; atom_name = X11_XGetAtomName(display, req->target); - SDL_Log("window CLIPBOARD: SelectionRequest (requestor = 0x%lx, target = 0x%lx, mime_type = %s)\n", + SDL_Log("window CLIPBOARD: SelectionRequest (requestor = 0x%lx, target = 0x%lx, mime_type = %s)", req->requestor, req->target, atom_name); if (atom_name) { X11_XFree(atom_name); @@ -709,7 +709,7 @@ static void X11_HandleClipboardEvent(SDL_VideoDevice *_this, const XEvent *xeven const char *propName = xsel->property ? X11_XGetAtomName(display, xsel->property) : "None"; const char *targetName = xsel->target ? X11_XGetAtomName(display, xsel->target) : "None"; - SDL_Log("window CLIPBOARD: SelectionNotify (requestor = 0x%lx, target = %s, property = %s)\n", + SDL_Log("window CLIPBOARD: SelectionNotify (requestor = 0x%lx, target = %s, property = %s)", xsel->requestor, targetName, propName); #endif if (xsel->target == videodata->atoms.TARGETS && xsel->property == videodata->atoms.SDL_FORMATS) { @@ -761,7 +761,7 @@ static void X11_HandleClipboardEvent(SDL_VideoDevice *_this, const XEvent *xeven SDLX11_ClipboardData *clipboard = NULL; #ifdef DEBUG_XEVENTS - SDL_Log("window CLIPBOARD: SelectionClear (requestor = 0x%lx, target = 0x%lx)\n", + SDL_Log("window CLIPBOARD: SelectionClear (requestor = 0x%lx, target = 0x%lx)", xevent->xselection.requestor, xevent->xselection.target); #endif @@ -892,14 +892,14 @@ void X11_HandleKeyEvent(SDL_VideoDevice *_this, SDL_WindowData *windowdata, SDL_ Uint64 timestamp = X11_GetEventTimestamp(xevent->xkey.time); #ifdef DEBUG_XEVENTS - SDL_Log("window 0x%lx %s (X11 keycode = 0x%X)\n", xevent->xany.window, (xevent->type == KeyPress ? "KeyPress" : "KeyRelease"), xevent->xkey.keycode); + SDL_Log("window 0x%lx %s (X11 keycode = 0x%X)", xevent->xany.window, (xevent->type == KeyPress ? "KeyPress" : "KeyRelease"), xevent->xkey.keycode); #endif #ifdef DEBUG_SCANCODES if (scancode == SDL_SCANCODE_UNKNOWN && keycode) { int min_keycode, max_keycode; X11_XDisplayKeycodes(display, &min_keycode, &max_keycode); keysym = X11_KeyCodeToSym(_this, keycode, xevent->xkey.state >> 13); - SDL_Log("The key you just pressed is not recognized by SDL. To help get this fixed, please report this to the SDL forums/mailing list X11 KeyCode %d (%d), X11 KeySym 0x%lX (%s).\n", + SDL_Log("The key you just pressed is not recognized by SDL. To help get this fixed, please report this to the SDL forums/mailing list X11 KeyCode %d (%d), X11 KeySym 0x%lX (%s).", keycode, keycode - min_keycode, keysym, X11_XKeysymToString(keysym)); } @@ -912,7 +912,7 @@ void X11_HandleKeyEvent(SDL_VideoDevice *_this, SDL_WindowData *windowdata, SDL_ // filter events catches XIM events and sends them to the correct handler if (X11_XFilterEvent(xevent, None)) { #ifdef DEBUG_XEVENTS - SDL_Log("Filtered event type = %d display = %p window = 0x%lx\n", + SDL_Log("Filtered event type = %d display = %p window = 0x%lx", xevent->type, xevent->xany.display, xevent->xany.window); #endif handled_by_ime = true; @@ -967,7 +967,7 @@ void X11_HandleButtonPress(SDL_VideoDevice *_this, SDL_WindowData *windowdata, S Uint64 timestamp = X11_GetEventTimestamp(time); #ifdef DEBUG_XEVENTS - SDL_Log("window 0x%lx: ButtonPress (X11 button = %d)\n", windowdata->xwindow, button); + SDL_Log("window 0x%lx: ButtonPress (X11 button = %d)", windowdata->xwindow, button); #endif SDL_Mouse *mouse = SDL_GetMouse(); @@ -1015,7 +1015,7 @@ void X11_HandleButtonRelease(SDL_VideoDevice *_this, SDL_WindowData *windowdata, Uint64 timestamp = X11_GetEventTimestamp(time); #ifdef DEBUG_XEVENTS - SDL_Log("window 0x%lx: ButtonRelease (X11 button = %d)\n", windowdata->xwindow, button); + SDL_Log("window 0x%lx: ButtonRelease (X11 button = %d)", windowdata->xwindow, button); #endif if (!X11_IsWheelEvent(display, button, &xticks, &yticks)) { if (button > 7) { @@ -1048,7 +1048,7 @@ void X11_GetBorderValues(SDL_WindowData *data) X11_XFree(property); #ifdef DEBUG_XEVENTS - SDL_Log("New _NET_FRAME_EXTENTS: left=%d right=%d, top=%d, bottom=%d\n", data->border_left, data->border_right, data->border_top, data->border_bottom); + SDL_Log("New _NET_FRAME_EXTENTS: left=%d right=%d, top=%d, bottom=%d", data->border_left, data->border_right, data->border_top, data->border_bottom); #endif } } else { @@ -1072,7 +1072,7 @@ static void X11_DispatchEvent(SDL_VideoDevice *_this, XEvent *xevent) if (xevent->type != KeyPress && xevent->type != KeyRelease) { if (X11_XFilterEvent(xevent, None)) { #ifdef DEBUG_XEVENTS - SDL_Log("Filtered event type = %d display = %p window = 0x%lx\n", + SDL_Log("Filtered event type = %d display = %p window = 0x%lx", xevent->type, xevent->xany.display, xevent->xany.window); #endif return; @@ -1100,7 +1100,7 @@ static void X11_DispatchEvent(SDL_VideoDevice *_this, XEvent *xevent) #endif #ifdef DEBUG_XEVENTS - SDL_Log("X11 event type = %d display = %p window = 0x%lx\n", + SDL_Log("X11 event type = %d display = %p window = 0x%lx", xevent->type, xevent->xany.display, xevent->xany.window); #endif @@ -1110,7 +1110,7 @@ static void X11_DispatchEvent(SDL_VideoDevice *_this, XEvent *xevent) XFixesSelectionNotifyEvent *ev = (XFixesSelectionNotifyEvent *)xevent; #ifdef DEBUG_XEVENTS - SDL_Log("window CLIPBOARD: XFixesSelectionNotify (selection = %s)\n", + SDL_Log("window CLIPBOARD: XFixesSelectionNotify (selection = %s)", X11_XGetAtomName(display, ev->selection)); #endif @@ -1154,7 +1154,7 @@ static void X11_DispatchEvent(SDL_VideoDevice *_this, XEvent *xevent) // The window for KeymapNotify, etc events is 0 if (xevent->type == KeymapNotify) { #ifdef DEBUG_XEVENTS - SDL_Log("window 0x%lx: KeymapNotify!\n", xevent->xany.window); + SDL_Log("window 0x%lx: KeymapNotify!", xevent->xany.window); #endif if (SDL_GetKeyboardFocus() != NULL) { #ifdef SDL_VIDEO_DRIVER_X11_HAS_XKBLOOKUPKEYSYM @@ -1176,7 +1176,7 @@ static void X11_DispatchEvent(SDL_VideoDevice *_this, XEvent *xevent) const int request = xevent->xmapping.request; #ifdef DEBUG_XEVENTS - SDL_Log("window 0x%lx: MappingNotify!\n", xevent->xany.window); + SDL_Log("window 0x%lx: MappingNotify!", xevent->xany.window); #endif if ((request == MappingKeyboard) || (request == MappingModifier)) { X11_XRefreshKeyboardMapping(&xevent->xmapping); @@ -1221,15 +1221,15 @@ static void X11_DispatchEvent(SDL_VideoDevice *_this, XEvent *xevent) { SDL_Mouse *mouse = SDL_GetMouse(); #ifdef DEBUG_XEVENTS - SDL_Log("window 0x%lx: EnterNotify! (%d,%d,%d)\n", xevent->xany.window, + SDL_Log("window 0x%lx: EnterNotify! (%d,%d,%d)", xevent->xany.window, xevent->xcrossing.x, xevent->xcrossing.y, xevent->xcrossing.mode); if (xevent->xcrossing.mode == NotifyGrab) { - SDL_Log("Mode: NotifyGrab\n"); + SDL_Log("Mode: NotifyGrab"); } if (xevent->xcrossing.mode == NotifyUngrab) { - SDL_Log("Mode: NotifyUngrab\n"); + SDL_Log("Mode: NotifyUngrab"); } #endif SDL_SetMouseFocus(data->window); @@ -1260,15 +1260,15 @@ static void X11_DispatchEvent(SDL_VideoDevice *_this, XEvent *xevent) case LeaveNotify: { #ifdef DEBUG_XEVENTS - SDL_Log("window 0x%lx: LeaveNotify! (%d,%d,%d)\n", xevent->xany.window, + SDL_Log("window 0x%lx: LeaveNotify! (%d,%d,%d)", xevent->xany.window, xevent->xcrossing.x, xevent->xcrossing.y, xevent->xcrossing.mode); if (xevent->xcrossing.mode == NotifyGrab) { - SDL_Log("Mode: NotifyGrab\n"); + SDL_Log("Mode: NotifyGrab"); } if (xevent->xcrossing.mode == NotifyUngrab) { - SDL_Log("Mode: NotifyUngrab\n"); + SDL_Log("Mode: NotifyUngrab"); } #endif if (!SDL_GetMouse()->relative_mode) { @@ -1295,19 +1295,19 @@ static void X11_DispatchEvent(SDL_VideoDevice *_this, XEvent *xevent) if (xevent->xfocus.mode == NotifyGrab || xevent->xfocus.mode == NotifyUngrab) { // Someone is handling a global hotkey, ignore it #ifdef DEBUG_XEVENTS - SDL_Log("window 0x%lx: FocusIn (NotifyGrab/NotifyUngrab, ignoring)\n", xevent->xany.window); + SDL_Log("window 0x%lx: FocusIn (NotifyGrab/NotifyUngrab, ignoring)", xevent->xany.window); #endif break; } if (xevent->xfocus.detail == NotifyInferior || xevent->xfocus.detail == NotifyPointer) { #ifdef DEBUG_XEVENTS - SDL_Log("window 0x%lx: FocusIn (NotifyInferior/NotifyPointer, ignoring)\n", xevent->xany.window); + SDL_Log("window 0x%lx: FocusIn (NotifyInferior/NotifyPointer, ignoring)", xevent->xany.window); #endif break; } #ifdef DEBUG_XEVENTS - SDL_Log("window 0x%lx: FocusIn!\n", xevent->xany.window); + SDL_Log("window 0x%lx: FocusIn!", xevent->xany.window); #endif if (!videodata->last_mode_change_deadline) /* no recent mode changes */ { data->pending_focus = PENDING_FOCUS_NONE; @@ -1326,7 +1326,7 @@ static void X11_DispatchEvent(SDL_VideoDevice *_this, XEvent *xevent) if (xevent->xfocus.mode == NotifyGrab || xevent->xfocus.mode == NotifyUngrab) { // Someone is handling a global hotkey, ignore it #ifdef DEBUG_XEVENTS - SDL_Log("window 0x%lx: FocusOut (NotifyGrab/NotifyUngrab, ignoring)\n", xevent->xany.window); + SDL_Log("window 0x%lx: FocusOut (NotifyGrab/NotifyUngrab, ignoring)", xevent->xany.window); #endif break; } @@ -1335,12 +1335,12 @@ static void X11_DispatchEvent(SDL_VideoDevice *_this, XEvent *xevent) care about the position of the pointer when the keyboard focus changed. */ #ifdef DEBUG_XEVENTS - SDL_Log("window 0x%lx: FocusOut (NotifyInferior/NotifyPointer, ignoring)\n", xevent->xany.window); + SDL_Log("window 0x%lx: FocusOut (NotifyInferior/NotifyPointer, ignoring)", xevent->xany.window); #endif break; } #ifdef DEBUG_XEVENTS - SDL_Log("window 0x%lx: FocusOut!\n", xevent->xany.window); + SDL_Log("window 0x%lx: FocusOut!", xevent->xany.window); #endif if (!videodata->last_mode_change_deadline) /* no recent mode changes */ { data->pending_focus = PENDING_FOCUS_NONE; @@ -1366,7 +1366,7 @@ static void X11_DispatchEvent(SDL_VideoDevice *_this, XEvent *xevent) XEvent ev; #ifdef DEBUG_XEVENTS - SDL_Log("window 0x%lx: UnmapNotify!\n", xevent->xany.window); + SDL_Log("window 0x%lx: UnmapNotify!", xevent->xany.window); #endif if (X11_XCheckIfEvent(display, &ev, &isReparentNotify, (XPointer)&xevent->xunmap)) { @@ -1387,7 +1387,7 @@ static void X11_DispatchEvent(SDL_VideoDevice *_this, XEvent *xevent) case MapNotify: { #ifdef DEBUG_XEVENTS - SDL_Log("window 0x%lx: MapNotify!\n", xevent->xany.window); + SDL_Log("window 0x%lx: MapNotify!", xevent->xany.window); #endif X11_DispatchMapNotify(data); @@ -1403,7 +1403,7 @@ static void X11_DispatchEvent(SDL_VideoDevice *_this, XEvent *xevent) case ConfigureNotify: { #ifdef DEBUG_XEVENTS - SDL_Log("window 0x%lx: ConfigureNotify! (position: %d,%d, size: %dx%d)\n", xevent->xany.window, + SDL_Log("window 0x%lx: ConfigureNotify! (position: %d,%d, size: %dx%d)", xevent->xany.window, xevent->xconfigure.x, xevent->xconfigure.y, xevent->xconfigure.width, xevent->xconfigure.height); #endif @@ -1470,9 +1470,9 @@ static void X11_DispatchEvent(SDL_VideoDevice *_this, XEvent *xevent) data->xdnd_source = xevent->xclient.data.l[0]; xdnd_version = (xevent->xclient.data.l[1] >> 24); #ifdef DEBUG_XEVENTS - SDL_Log("XID of source window : 0x%lx\n", data->xdnd_source); - SDL_Log("Protocol version to use : %d\n", xdnd_version); - SDL_Log("More then 3 data types : %d\n", (int)use_list); + SDL_Log("XID of source window : 0x%lx", data->xdnd_source); + SDL_Log("Protocol version to use : %d", xdnd_version); + SDL_Log("More then 3 data types : %d", (int)use_list); #endif if (use_list) { @@ -1488,7 +1488,7 @@ static void X11_DispatchEvent(SDL_VideoDevice *_this, XEvent *xevent) } } else if (xevent->xclient.message_type == videodata->atoms.XdndLeave) { #ifdef DEBUG_XEVENTS - SDL_Log("XID of source window : 0x%lx\n", xevent->xclient.data.l[0]); + SDL_Log("XID of source window : 0x%lx", xevent->xclient.data.l[0]); #endif SDL_SendDropComplete(data->window); } else if (xevent->xclient.message_type == videodata->atoms.XdndPosition) { @@ -1498,7 +1498,7 @@ static void X11_DispatchEvent(SDL_VideoDevice *_this, XEvent *xevent) if (xdnd_version >= 2) { act = xevent->xclient.data.l[4]; } - SDL_Log("Action requested by user is : %s\n", X11_XGetAtomName(display, act)); + SDL_Log("Action requested by user is : %s", X11_XGetAtomName(display, act)); #endif { // Drag and Drop position @@ -1555,7 +1555,7 @@ static void X11_DispatchEvent(SDL_VideoDevice *_this, XEvent *xevent) Window root = DefaultRootWindow(display); #ifdef DEBUG_XEVENTS - SDL_Log("window 0x%lx: _NET_WM_PING\n", xevent->xany.window); + SDL_Log("window 0x%lx: _NET_WM_PING", xevent->xany.window); #endif xevent->xclient.window = root; X11_XSendEvent(display, root, False, SubstructureRedirectMask | SubstructureNotifyMask, xevent); @@ -1567,7 +1567,7 @@ static void X11_DispatchEvent(SDL_VideoDevice *_this, XEvent *xevent) (xevent->xclient.data.l[0] == videodata->atoms.WM_DELETE_WINDOW)) { #ifdef DEBUG_XEVENTS - SDL_Log("window 0x%lx: WM_DELETE_WINDOW\n", xevent->xany.window); + SDL_Log("window 0x%lx: WM_DELETE_WINDOW", xevent->xany.window); #endif SDL_SendWindowEvent(data->window, SDL_EVENT_WINDOW_CLOSE_REQUESTED, 0, 0); break; @@ -1589,7 +1589,7 @@ static void X11_DispatchEvent(SDL_VideoDevice *_this, XEvent *xevent) case Expose: { #ifdef DEBUG_XEVENTS - SDL_Log("window 0x%lx: Expose (count = %d)\n", xevent->xany.window, xevent->xexpose.count); + SDL_Log("window 0x%lx: Expose (count = %d)", xevent->xany.window, xevent->xexpose.count); #endif SDL_SendWindowEvent(data->window, SDL_EVENT_WINDOW_EXPOSED, 0, 0); } break; @@ -1622,7 +1622,7 @@ static void X11_DispatchEvent(SDL_VideoDevice *_this, XEvent *xevent) SDL_Mouse *mouse = SDL_GetMouse(); if (!mouse->relative_mode) { #ifdef DEBUG_MOTION - SDL_Log("window 0x%lx: X11 motion: %d,%d\n", xevent->xany.window, xevent->xmotion.x, xevent->xmotion.y); + SDL_Log("window 0x%lx: X11 motion: %d,%d", xevent->xany.window, xevent->xmotion.x, xevent->xmotion.y); #endif X11_ProcessHitTest(_this, data, (float)xevent->xmotion.x, (float)xevent->xmotion.y, false); @@ -1661,7 +1661,7 @@ static void X11_DispatchEvent(SDL_VideoDevice *_this, XEvent *xevent) char *name = X11_XGetAtomName(display, xevent->xproperty.atom); if (name) { - SDL_Log("window 0x%lx: PropertyNotify: %s %s time=%lu\n", xevent->xany.window, name, (xevent->xproperty.state == PropertyDelete) ? "deleted" : "changed", xevent->xproperty.time); + SDL_Log("window 0x%lx: PropertyNotify: %s %s time=%lu", xevent->xany.window, name, (xevent->xproperty.state == PropertyDelete) ? "deleted" : "changed", xevent->xproperty.time); X11_XFree(name); } @@ -1674,7 +1674,7 @@ static void X11_DispatchEvent(SDL_VideoDevice *_this, XEvent *xevent) for (i = 0; i < items_read; i++) { SDL_Log(" %d", values[i]); } - SDL_Log(" }\n"); + SDL_Log(" }"); } else if (real_type == XA_CARDINAL) { if (real_format == 32) { Uint32 *values = (Uint32 *)propdata; @@ -1683,7 +1683,7 @@ static void X11_DispatchEvent(SDL_VideoDevice *_this, XEvent *xevent) for (i = 0; i < items_read; i++) { SDL_Log(" %d", values[i]); } - SDL_Log(" }\n"); + SDL_Log(" }"); } else if (real_format == 16) { Uint16 *values = (Uint16 *)propdata; @@ -1691,7 +1691,7 @@ static void X11_DispatchEvent(SDL_VideoDevice *_this, XEvent *xevent) for (i = 0; i < items_read; i++) { SDL_Log(" %d", values[i]); } - SDL_Log(" }\n"); + SDL_Log(" }"); } else if (real_format == 8) { Uint8 *values = (Uint8 *)propdata; @@ -1699,11 +1699,11 @@ static void X11_DispatchEvent(SDL_VideoDevice *_this, XEvent *xevent) for (i = 0; i < items_read; i++) { SDL_Log(" %d", values[i]); } - SDL_Log(" }\n"); + SDL_Log(" }"); } } else if (real_type == XA_STRING || real_type == videodata->atoms.UTF8_STRING) { - SDL_Log("{ \"%s\" }\n", propdata); + SDL_Log("{ \"%s\" }", propdata); } else if (real_type == XA_ATOM) { Atom *atoms = (Atom *)propdata; @@ -1715,10 +1715,10 @@ static void X11_DispatchEvent(SDL_VideoDevice *_this, XEvent *xevent) X11_XFree(atomname); } } - SDL_Log(" }\n"); + SDL_Log(" }"); } else { char *atomname = X11_XGetAtomName(display, real_type); - SDL_Log("Unknown type: 0x%lx (%s)\n", real_type, atomname ? atomname : "UNKNOWN"); + SDL_Log("Unknown type: 0x%lx (%s)", real_type, atomname ? atomname : "UNKNOWN"); if (atomname) { X11_XFree(atomname); } @@ -1918,7 +1918,7 @@ static void X11_DispatchEvent(SDL_VideoDevice *_this, XEvent *xevent) { Atom target = xevent->xselection.target; #ifdef DEBUG_XEVENTS - SDL_Log("window 0x%lx: SelectionNotify (requestor = 0x%lx, target = 0x%lx)\n", xevent->xany.window, + SDL_Log("window 0x%lx: SelectionNotify (requestor = 0x%lx, target = 0x%lx)", xevent->xany.window, xevent->xselection.requestor, xevent->xselection.target); #endif if (target == data->xdnd_req) { @@ -1969,7 +1969,7 @@ static void X11_DispatchEvent(SDL_VideoDevice *_this, XEvent *xevent) default: { #ifdef DEBUG_XEVENTS - SDL_Log("window 0x%lx: Unhandled event %d\n", xevent->xany.window, xevent->type); + SDL_Log("window 0x%lx: Unhandled event %d", xevent->xany.window, xevent->type); #endif } break; } diff --git a/src/video/x11/SDL_x11keyboard.c b/src/video/x11/SDL_x11keyboard.c index 336f906e2ebc7..f9ca027d1072e 100644 --- a/src/video/x11/SDL_x11keyboard.c +++ b/src/video/x11/SDL_x11keyboard.c @@ -239,7 +239,7 @@ bool X11_InitKeyboard(SDL_VideoDevice *_this) const SDL_Scancode *table = SDL_GetScancodeTable(scancode_set[best_index], &table_size); #ifdef DEBUG_KEYBOARD - SDL_Log("Using scancode set %d, min_keycode = %d, max_keycode = %d, table_size = %d\n", best_index, min_keycode, max_keycode, table_size); + SDL_Log("Using scancode set %d, min_keycode = %d, max_keycode = %d, table_size = %d", best_index, min_keycode, max_keycode, table_size); #endif // This should never happen, but just in case... if (table_size > (SDL_arraysize(data->key_layout) - min_keycode)) { @@ -267,14 +267,14 @@ bool X11_InitKeyboard(SDL_VideoDevice *_this) if ((SDL_GetKeymapKeycode(NULL, scancode, SDL_KMOD_NONE) & (SDLK_SCANCODE_MASK | SDLK_EXTENDED_MASK)) && X11_ScancodeIsRemappable(scancode)) { // Not a character key and the scancode is safe to remap #ifdef DEBUG_KEYBOARD - SDL_Log("Changing scancode, was %d (%s), now %d (%s)\n", data->key_layout[i], SDL_GetScancodeName(data->key_layout[i]), scancode, SDL_GetScancodeName(scancode)); + SDL_Log("Changing scancode, was %d (%s), now %d (%s)", data->key_layout[i], SDL_GetScancodeName(data->key_layout[i]), scancode, SDL_GetScancodeName(scancode)); #endif data->key_layout[i] = scancode; } } } else { #ifdef DEBUG_SCANCODES - SDL_Log("Keyboard layout unknown, please report the following to the SDL forums/mailing list (https://discourse.libsdl.org/):\n"); + SDL_Log("Keyboard layout unknown, please report the following to the SDL forums/mailing list (https://discourse.libsdl.org/):"); #endif // Determine key_layout - only works on US QWERTY layout @@ -288,9 +288,9 @@ bool X11_InitKeyboard(SDL_VideoDevice *_this) (unsigned int)sym, sym == NoSymbol ? "NoSymbol" : X11_XKeysymToString(sym)); } if (scancode == SDL_SCANCODE_UNKNOWN) { - SDL_Log("scancode not found\n"); + SDL_Log("scancode not found"); } else { - SDL_Log("scancode = %d (%s)\n", scancode, SDL_GetScancodeName(scancode)); + SDL_Log("scancode = %d (%s)", scancode, SDL_GetScancodeName(scancode)); } #endif data->key_layout[i] = scancode; @@ -592,12 +592,12 @@ static void preedit_draw_callback(XIC xic, XPointer client_data, XIMPreeditDrawC #ifdef DEBUG_XIM if (call_data->chg_length > 0) { - SDL_Log("Draw callback deleted %d characters at %d\n", call_data->chg_length, call_data->chg_first); + SDL_Log("Draw callback deleted %d characters at %d", call_data->chg_length, call_data->chg_first); } if (text) { - SDL_Log("Draw callback inserted %s at %d, caret: %d\n", text->string.multi_byte, call_data->chg_first, call_data->caret); + SDL_Log("Draw callback inserted %s at %d, caret: %d", text->string.multi_byte, call_data->chg_first, call_data->caret); } - SDL_Log("Pre-edit text: %s\n", data->preedit_text); + SDL_Log("Pre-edit text: %s", data->preedit_text); #endif X11_SendEditingEvent(data); diff --git a/src/video/x11/SDL_x11xinput2.c b/src/video/x11/SDL_x11xinput2.c index 32a62dd162095..caee30764d5de 100644 --- a/src/video/x11/SDL_x11xinput2.c +++ b/src/video/x11/SDL_x11xinput2.c @@ -584,7 +584,7 @@ bool X11_Xinput2SelectMouseAndKeyboard(SDL_VideoDevice *_this, SDL_Window *windo XISetMask(mask, XI_PropertyEvent); // E.g., when swapping tablet pens if (X11_XISelectEvents(data->display, windowdata->xwindow, &eventmask, 1) != Success) { - SDL_LogWarn(SDL_LOG_CATEGORY_INPUT, "Could not enable XInput2 event handling\n"); + SDL_LogWarn(SDL_LOG_CATEGORY_INPUT, "Could not enable XInput2 event handling"); windowdata->xinput2_keyboard_enabled = false; windowdata->xinput2_mouse_enabled = false; } diff --git a/test/checkkeys.c b/test/checkkeys.c index 67954923fc460..ab7df8eebcd97 100644 --- a/test/checkkeys.c +++ b/test/checkkeys.c @@ -185,7 +185,7 @@ static void PrintModifierState(void) left = sizeof(message); print_modifiers(&spot, &left, SDL_GetModState()); - SDL_Log("Initial state:%s\n", message); + SDL_Log("Initial state:%s", message); } static void PrintKey(SDL_KeyboardEvent *event) @@ -218,7 +218,7 @@ static void PrintKey(SDL_KeyboardEvent *event) if (event->repeat) { print_string(&spot, &left, " (repeat)"); } - SDL_Log("%s\n", message); + SDL_Log("%s", message); } static void PrintText(const char *eventtype, const char *text) @@ -231,7 +231,7 @@ static void PrintText(const char *eventtype, const char *text) size_t length = SDL_strlen(expanded); (void)SDL_snprintf(expanded + length, sizeof(expanded) - length, "\\x%.2x", (unsigned char)*spot); } - SDL_Log("%s Text (%s): \"%s%s\"\n", eventtype, expanded, *text == '"' ? "\\" : "", text); + SDL_Log("%s Text (%s): \"%s%s\"", eventtype, expanded, *text == '"' ? "\\" : "", text); } static void CountKeysDown(void) @@ -244,7 +244,7 @@ static void CountKeysDown(void) ++count; } } - SDL_Log("Keys down: %d\n", count); + SDL_Log("Keys down: %d", count); } static void DrawCursor(int i) @@ -373,10 +373,10 @@ static void loop(void) { SDL_Window *window = SDL_GetWindowFromEvent(&event); if (SDL_TextInputActive(window)) { - SDL_Log("Stopping text input for window %" SDL_PRIu32 "\n", event.tfinger.windowID); + SDL_Log("Stopping text input for window %" SDL_PRIu32, event.tfinger.windowID); SDL_StopTextInput(window); } else { - SDL_Log("Starting text input for window %" SDL_PRIu32 "\n", event.tfinger.windowID); + SDL_Log("Starting text input for window %" SDL_PRIu32, event.tfinger.windowID); SDL_StartTextInput(window); } break; @@ -385,16 +385,16 @@ static void loop(void) if (event.button.button == SDL_BUTTON_RIGHT) { SDL_Window *window = SDL_GetWindowFromEvent(&event); if (SDL_TextInputActive(window)) { - SDL_Log("Stopping text input for window %" SDL_PRIu32 "\n", event.button.windowID); + SDL_Log("Stopping text input for window %" SDL_PRIu32, event.button.windowID); SDL_StopTextInput(window); } else { - SDL_Log("Starting text input for window %" SDL_PRIu32 "\n", event.button.windowID); + SDL_Log("Starting text input for window %" SDL_PRIu32, event.button.windowID); SDL_StartTextInput(window); } } break; case SDL_EVENT_KEYMAP_CHANGED: - SDL_Log("Keymap changed!\n"); + SDL_Log("Keymap changed!"); break; case SDL_EVENT_QUIT: done = 1; @@ -466,13 +466,13 @@ int main(int argc, char *argv[]) /* Initialize SDL */ if (!SDLTest_CommonInit(state)) { - SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't initialize SDL: %s\n", SDL_GetError()); + SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't initialize SDL: %s", SDL_GetError()); return 1; } windowstates = (TextWindowState *)SDL_calloc(state->num_windows, sizeof(*windowstates)); if (!windowstates) { - SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't allocate text windows: %s\n", SDL_GetError()); + SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't allocate text windows: %s", SDL_GetError()); goto done; } diff --git a/test/childprocess.c b/test/childprocess.c index 333fc3c9732e2..772d86d760962 100644 --- a/test/childprocess.c +++ b/test/childprocess.c @@ -142,7 +142,7 @@ int main(int argc, char *argv[]) { #else SDL_strlcpy(error, strerror(errno), sizeof(error)); #endif - SDL_Log("Error reading from stdin: %s\n", error); + SDL_Log("Error reading from stdin: %s", error); } break; } diff --git a/test/loopwave.c b/test/loopwave.c index 901abaad98986..8a2d7a0ef5981 100644 --- a/test/loopwave.c +++ b/test/loopwave.c @@ -78,20 +78,20 @@ SDL_AppResult SDL_AppInit(void **appstate, int argc, char *argv[]) /* Load the SDL library */ if (!SDL_Init(SDL_INIT_AUDIO | SDL_INIT_EVENTS)) { - SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't initialize SDL: %s\n", SDL_GetError()); + SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't initialize SDL: %s", SDL_GetError()); return SDL_APP_FAILURE; } filename = GetResourceFilename(filename, "sample.wav"); if (!filename) { - SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "%s\n", SDL_GetError()); + SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "%s", SDL_GetError()); return SDL_APP_FAILURE; } /* Load the wave file into memory */ if (!SDL_LoadWAV(filename, &wave.spec, &wave.sound, &wave.soundlen)) { - SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't load %s: %s\n", filename, SDL_GetError()); + SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't load %s: %s", filename, SDL_GetError()); SDL_free(filename); return SDL_APP_FAILURE; } @@ -104,11 +104,11 @@ SDL_AppResult SDL_AppInit(void **appstate, int argc, char *argv[]) SDL_Log("%i: %s", i, SDL_GetAudioDriver(i)); } - SDL_Log("Using audio driver: %s\n", SDL_GetCurrentAudioDriver()); + SDL_Log("Using audio driver: %s", SDL_GetCurrentAudioDriver()); stream = SDL_OpenAudioDeviceStream(SDL_AUDIO_DEVICE_DEFAULT_PLAYBACK, &wave.spec, NULL, NULL); if (!stream) { - SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't create audio stream: %s\n", SDL_GetError()); + SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't create audio stream: %s", SDL_GetError()); return SDL_APP_FAILURE; } diff --git a/test/testatomic.c b/test/testatomic.c index 52d3fd9af0d91..37695349620a4 100644 --- a/test/testatomic.c +++ b/test/testatomic.c @@ -40,39 +40,43 @@ static void RunBasicTest(void) SDL_AtomicInt v; bool tfret = false; - SDL_Log("\nspin lock---------------------------------------\n\n"); + SDL_Log("%s", ""); + SDL_Log("spin lock---------------------------------------"); + SDL_Log("%s", ""); SDL_LockSpinlock(&lock); - SDL_Log("AtomicLock lock=%d\n", lock); + SDL_Log("AtomicLock lock=%d", lock); SDL_UnlockSpinlock(&lock); - SDL_Log("AtomicUnlock lock=%d\n", lock); + SDL_Log("AtomicUnlock lock=%d", lock); - SDL_Log("\natomic -----------------------------------------\n\n"); + SDL_Log("%s", ""); + SDL_Log("atomic -----------------------------------------"); + SDL_Log("%s", ""); SDL_SetAtomicInt(&v, 0); tfret = SDL_SetAtomicInt(&v, 10) == 0; - SDL_Log("AtomicSet(10) tfret=%s val=%d\n", tf(tfret), SDL_GetAtomicInt(&v)); + SDL_Log("AtomicSet(10) tfret=%s val=%d", tf(tfret), SDL_GetAtomicInt(&v)); tfret = SDL_AddAtomicInt(&v, 10) == 10; - SDL_Log("AtomicAdd(10) tfret=%s val=%d\n", tf(tfret), SDL_GetAtomicInt(&v)); + SDL_Log("AtomicAdd(10) tfret=%s val=%d", tf(tfret), SDL_GetAtomicInt(&v)); SDL_SetAtomicInt(&v, 0); SDL_AtomicIncRef(&v); tfret = (SDL_GetAtomicInt(&v) == 1); - SDL_Log("AtomicIncRef() tfret=%s val=%d\n", tf(tfret), SDL_GetAtomicInt(&v)); + SDL_Log("AtomicIncRef() tfret=%s val=%d", tf(tfret), SDL_GetAtomicInt(&v)); SDL_AtomicIncRef(&v); tfret = (SDL_GetAtomicInt(&v) == 2); - SDL_Log("AtomicIncRef() tfret=%s val=%d\n", tf(tfret), SDL_GetAtomicInt(&v)); + SDL_Log("AtomicIncRef() tfret=%s val=%d", tf(tfret), SDL_GetAtomicInt(&v)); tfret = (SDL_AtomicDecRef(&v) == false); - SDL_Log("AtomicDecRef() tfret=%s val=%d\n", tf(tfret), SDL_GetAtomicInt(&v)); + SDL_Log("AtomicDecRef() tfret=%s val=%d", tf(tfret), SDL_GetAtomicInt(&v)); tfret = (SDL_AtomicDecRef(&v) == true); - SDL_Log("AtomicDecRef() tfret=%s val=%d\n", tf(tfret), SDL_GetAtomicInt(&v)); + SDL_Log("AtomicDecRef() tfret=%s val=%d", tf(tfret), SDL_GetAtomicInt(&v)); SDL_SetAtomicInt(&v, 10); tfret = (SDL_CompareAndSwapAtomicInt(&v, 0, 20) == false); - SDL_Log("AtomicCAS() tfret=%s val=%d\n", tf(tfret), SDL_GetAtomicInt(&v)); + SDL_Log("AtomicCAS() tfret=%s val=%d", tf(tfret), SDL_GetAtomicInt(&v)); value = SDL_GetAtomicInt(&v); tfret = (SDL_CompareAndSwapAtomicInt(&v, value, 20) == true); - SDL_Log("AtomicCAS() tfret=%s val=%d\n", tf(tfret), SDL_GetAtomicInt(&v)); + SDL_Log("AtomicCAS() tfret=%s val=%d", tf(tfret), SDL_GetAtomicInt(&v)); } /**************************************************************************/ @@ -115,7 +119,7 @@ static SDL_Semaphore *threadDone; static int SDLCALL adder(void *junk) { unsigned long N = NInter; - SDL_Log("Thread subtracting %d %lu times\n", CountInc, N); + SDL_Log("Thread subtracting %d %lu times", CountInc, N); while (N--) { SDL_AddAtomicInt(&good, -CountInc); bad -= CountInc; @@ -153,7 +157,7 @@ static void runAdder(void) end = SDL_GetTicksNS(); - SDL_Log("Finished in %f sec\n", (end - start) / 1000000000.0); + SDL_Log("Finished in %f sec", (end - start) / 1000000000.0); } static void RunEpicTest(void) @@ -161,28 +165,30 @@ static void RunEpicTest(void) int b; atomicValue v; - SDL_Log("\nepic test---------------------------------------\n\n"); + SDL_Log("%s", ""); + SDL_Log("epic test---------------------------------------"); + SDL_Log("%s", ""); - SDL_Log("Size asserted to be >= 32-bit\n"); + SDL_Log("Size asserted to be >= 32-bit"); SDL_assert(sizeof(atomicValue) >= 4); - SDL_Log("Check static initializer\n"); + SDL_Log("Check static initializer"); v = SDL_GetAtomicInt(&good); SDL_assert(v == 42); SDL_assert(bad == 42); - SDL_Log("Test negative values\n"); + SDL_Log("Test negative values"); SDL_SetAtomicInt(&good, -5); v = SDL_GetAtomicInt(&good); SDL_assert(v == -5); - SDL_Log("Verify maximum value\n"); + SDL_Log("Verify maximum value"); SDL_SetAtomicInt(&good, CountTo); v = SDL_GetAtomicInt(&good); SDL_assert(v == CountTo); - SDL_Log("Test compare and exchange\n"); + SDL_Log("Test compare and exchange"); b = SDL_CompareAndSwapAtomicInt(&good, 500, 43); SDL_assert(!b); /* no swap since CountTo!=500 */ @@ -194,7 +200,7 @@ static void RunEpicTest(void) v = SDL_GetAtomicInt(&good); SDL_assert(v == 44); - SDL_Log("Test Add\n"); + SDL_Log("Test Add"); v = SDL_AddAtomicInt(&good, 1); SDL_assert(v == 44); @@ -206,7 +212,7 @@ static void RunEpicTest(void) v = SDL_GetAtomicInt(&good); SDL_assert(v == 55); - SDL_Log("Test Add (Negative values)\n"); + SDL_Log("Test Add (Negative values)"); v = SDL_AddAtomicInt(&good, -20); SDL_assert(v == 55); @@ -223,7 +229,7 @@ static void RunEpicTest(void) v = SDL_GetAtomicInt(&good); SDL_assert(v == 15); - SDL_Log("Reset before count down test\n"); + SDL_Log("Reset before count down test"); SDL_SetAtomicInt(&good, CountTo); v = SDL_GetAtomicInt(&good); SDL_assert(v == CountTo); @@ -231,11 +237,11 @@ static void RunEpicTest(void) bad = CountTo; SDL_assert(bad == CountTo); - SDL_Log("Counting down from %d, Expect %d remaining\n", CountTo, Expect); + SDL_Log("Counting down from %d, Expect %d remaining", CountTo, Expect); runAdder(); v = SDL_GetAtomicInt(&good); - SDL_Log("Atomic %d Non-Atomic %d\n", v, bad); + SDL_Log("Atomic %d Non-Atomic %d", v, bad); SDL_assert(v == Expect); /* We can't guarantee that bad != Expect, this would happen on a single core system, for example. */ /*SDL_assert(bad != Expect);*/ @@ -431,7 +437,7 @@ static bool EnqueueEvent_Mutex(SDL_EventQueue *queue, const SDL_Event *event) } else if (delta < 0) { /* We ran into an old queue entry, which means it still needs to be dequeued */ } else { - SDL_Log("ERROR: mutex failed!\n"); + SDL_Log("ERROR: mutex failed!"); } SDL_UnlockMutex(queue->mutex); @@ -464,7 +470,7 @@ static bool DequeueEvent_Mutex(SDL_EventQueue *queue, SDL_Event *event) } else if (delta < 0) { /* We ran into an old queue entry, which means we've hit empty */ } else { - SDL_Log("ERROR: mutex failed!\n"); + SDL_Log("ERROR: mutex failed!"); } SDL_UnlockMutex(queue->mutex); @@ -597,8 +603,10 @@ static void RunFIFOTest(bool lock_free) char textBuffer[1024]; size_t len; - SDL_Log("\nFIFO test---------------------------------------\n\n"); - SDL_Log("Mode: %s\n", lock_free ? "LockFree" : "Mutex"); + SDL_Log("%s", ""); + SDL_Log("FIFO test---------------------------------------"); + SDL_Log("%s", ""); + SDL_Log("Mode: %s", lock_free ? "LockFree" : "Mutex"); SDL_memset(&queue, 0xff, sizeof(queue)); @@ -617,7 +625,7 @@ static void RunFIFOTest(bool lock_free) #endif /* Start the readers first */ - SDL_Log("Starting %d readers\n", NUM_READERS); + SDL_Log("Starting %d readers", NUM_READERS); SDL_zeroa(readerData); for (i = 0; i < NUM_READERS; ++i) { char name[64]; @@ -628,7 +636,7 @@ static void RunFIFOTest(bool lock_free) } /* Start up the writers */ - SDL_Log("Starting %d writers\n", NUM_WRITERS); + SDL_Log("Starting %d writers", NUM_WRITERS); SDL_zeroa(writerData); for (i = 0; i < NUM_WRITERS; ++i) { char name[64]; @@ -663,16 +671,16 @@ static void RunFIFOTest(bool lock_free) SDL_DestroyMutex(queue.mutex); } - SDL_Log("Finished in %f sec\n", (end - start) / 1000000000.0); + SDL_Log("Finished in %f sec", (end - start) / 1000000000.0); - SDL_Log("\n"); + SDL_Log("%s", ""); for (i = 0; i < NUM_WRITERS; ++i) { - SDL_Log("Writer %d wrote %d events, had %d waits\n", i, EVENTS_PER_WRITER, writerData[i].waits); + SDL_Log("Writer %d wrote %d events, had %d waits", i, EVENTS_PER_WRITER, writerData[i].waits); } - SDL_Log("Writers wrote %d total events\n", NUM_WRITERS * EVENTS_PER_WRITER); + SDL_Log("Writers wrote %d total events", NUM_WRITERS * EVENTS_PER_WRITER); /* Print a breakdown of which readers read messages from which writer */ - SDL_Log("\n"); + SDL_Log("%s", ""); grand_total = 0; for (i = 0; i < NUM_READERS; ++i) { int total = 0; @@ -680,7 +688,7 @@ static void RunFIFOTest(bool lock_free) total += readerData[i].counters[j]; } grand_total += total; - SDL_Log("Reader %d read %d events, had %d waits\n", i, total, readerData[i].waits); + SDL_Log("Reader %d read %d events, had %d waits", i, total, readerData[i].waits); (void)SDL_snprintf(textBuffer, sizeof(textBuffer), " { "); for (j = 0; j < NUM_WRITERS; ++j) { if (j > 0) { @@ -694,7 +702,7 @@ static void RunFIFOTest(bool lock_free) (void)SDL_snprintf(textBuffer + len, sizeof(textBuffer) - len, " }\n"); SDL_Log("%s", textBuffer); } - SDL_Log("Readers read %d total events\n", grand_total); + SDL_Log("Readers read %d total events", grand_total); } /* End FIFO test */ diff --git a/test/testaudiohotplug.c b/test/testaudiohotplug.c index 9b77e8f8bb73c..9f2215829769e 100644 --- a/test/testaudiohotplug.c +++ b/test/testaudiohotplug.c @@ -84,7 +84,7 @@ static void iteration(void) if (!stream) { SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Failed to create/bind an audio stream to %u ('%s'): %s", (unsigned int) which, name, SDL_GetError()); } else { - SDL_Log("Opened '%s' as %u\n", name, (unsigned int) which); + SDL_Log("Opened '%s' as %u", name, (unsigned int) which); /* !!! FIXME: laziness, this used to loop the audio, but we'll just play it once for now on each connect. */ SDL_PutAudioStreamData(stream, sound, soundlen); SDL_FlushAudioStream(stream); @@ -94,7 +94,7 @@ static void iteration(void) } } else if (e.type == SDL_EVENT_AUDIO_DEVICE_REMOVED) { dev = (SDL_AudioDeviceID)e.adevice.which; - SDL_Log("%s device %u removed.\n", devtypestr(e.adevice.recording), (unsigned int)dev); + SDL_Log("%s device %u removed.", devtypestr(e.adevice.recording), (unsigned int)dev); /* !!! FIXME: we need to keep track of our streams and destroy them here. */ } } @@ -144,14 +144,14 @@ int main(int argc, char *argv[]) /* Load the SDL library */ if (!SDL_Init(SDL_INIT_VIDEO | SDL_INIT_AUDIO)) { - SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't initialize SDL: %s\n", SDL_GetError()); + SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't initialize SDL: %s", SDL_GetError()); return 1; } /* Some targets (Mac CoreAudio) need an event queue for audio hotplug, so make and immediately hide a window. */ window = SDL_CreateWindow("testaudiohotplug", 640, 480, 0); if (!window) { - SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "SDL_CreateWindow failed: %s\n", SDL_GetError()); + SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "SDL_CreateWindow failed: %s", SDL_GetError()); quit(1); } SDL_MinimizeWindow(window); @@ -159,13 +159,13 @@ int main(int argc, char *argv[]) filename = GetResourceFilename(filename, "sample.wav"); if (!filename) { - SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "%s\n", SDL_GetError()); + SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "%s", SDL_GetError()); quit(1); } /* Load the wave file into memory */ if (!SDL_LoadWAV(filename, &spec, &sound, &soundlen)) { - SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't load %s: %s\n", filename, SDL_GetError()); + SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't load %s: %s", filename, SDL_GetError()); quit(1); } @@ -187,8 +187,8 @@ int main(int argc, char *argv[]) SDL_Log("%i: %s", i, SDL_GetAudioDriver(i)); } - SDL_Log("Select a driver with the SDL_AUDIO_DRIVER environment variable.\n"); - SDL_Log("Using audio driver: %s\n", SDL_GetCurrentAudioDriver()); + SDL_Log("Select a driver with the SDL_AUDIO_DRIVER environment variable."); + SDL_Log("Using audio driver: %s", SDL_GetCurrentAudioDriver()); #ifdef SDL_PLATFORM_EMSCRIPTEN emscripten_set_main_loop(loop, 0, 1); diff --git a/test/testaudioinfo.c b/test/testaudioinfo.c index b561fb7fa5c89..a9139ec8d078a 100644 --- a/test/testaudioinfo.c +++ b/test/testaudioinfo.c @@ -23,28 +23,30 @@ print_devices(bool recording) SDL_AudioDeviceID *devices = recording ? SDL_GetAudioRecordingDevices(&n) : SDL_GetAudioPlaybackDevices(&n); if (!devices) { - SDL_Log(" Driver failed to report %s devices: %s\n\n", typestr, SDL_GetError()); + SDL_Log(" Driver failed to report %s devices: %s", typestr, SDL_GetError()); + SDL_Log("%s", ""); } else if (n == 0) { - SDL_Log(" No %s devices found.\n\n", typestr); + SDL_Log(" No %s devices found.", typestr); + SDL_Log("%s", ""); } else { int i; - SDL_Log("Found %d %s device%s:\n", n, typestr, n != 1 ? "s" : ""); + SDL_Log("Found %d %s device%s:", n, typestr, n != 1 ? "s" : ""); for (i = 0; i < n; i++) { const char *name = SDL_GetAudioDeviceName(devices[i]); if (name) { - SDL_Log(" %d: %s\n", i, name); + SDL_Log(" %d: %s", i, name); } else { - SDL_Log(" %d Error: %s\n", i, SDL_GetError()); + SDL_Log(" %d Error: %s", i, SDL_GetError()); } if (SDL_GetAudioDeviceFormat(devices[i], &spec, &frames)) { - SDL_Log(" Sample Rate: %d\n", spec.freq); - SDL_Log(" Channels: %d\n", spec.channels); - SDL_Log(" SDL_AudioFormat: %X\n", spec.format); - SDL_Log(" Buffer Size: %d frames\n", frames); + SDL_Log(" Sample Rate: %d", spec.freq); + SDL_Log(" Channels: %d", spec.channels); + SDL_Log(" SDL_AudioFormat: %X", spec.format); + SDL_Log(" Buffer Size: %d frames", frames); } } - SDL_Log("\n"); + SDL_Log("%s", ""); } SDL_free(devices); } @@ -70,45 +72,47 @@ int main(int argc, char **argv) /* Load the SDL library */ if (!SDL_Init(SDL_INIT_AUDIO)) { - SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't initialize SDL: %s\n", SDL_GetError()); + SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't initialize SDL: %s", SDL_GetError()); return 1; } /* Print available audio drivers */ n = SDL_GetNumAudioDrivers(); if (n == 0) { - SDL_Log("No built-in audio drivers\n\n"); + SDL_Log("No built-in audio drivers"); + SDL_Log("%s", ""); } else { - SDL_Log("Built-in audio drivers:\n"); + SDL_Log("Built-in audio drivers:"); for (i = 0; i < n; ++i) { - SDL_Log(" %d: %s\n", i, SDL_GetAudioDriver(i)); + SDL_Log(" %d: %s", i, SDL_GetAudioDriver(i)); } - SDL_Log("Select a driver with the SDL_AUDIO_DRIVER environment variable.\n"); + SDL_Log("Select a driver with the SDL_AUDIO_DRIVER environment variable."); } - SDL_Log("Using audio driver: %s\n\n", SDL_GetCurrentAudioDriver()); + SDL_Log("Using audio driver: %s", SDL_GetCurrentAudioDriver()); + SDL_Log("%s", ""); print_devices(false); print_devices(true); if (SDL_GetAudioDeviceFormat(SDL_AUDIO_DEVICE_DEFAULT_PLAYBACK, &spec, &frames)) { - SDL_Log("Default Playback Device:\n"); - SDL_Log("Sample Rate: %d\n", spec.freq); - SDL_Log("Channels: %d\n", spec.channels); - SDL_Log("SDL_AudioFormat: %X\n", spec.format); - SDL_Log("Buffer Size: %d frames\n", frames); + SDL_Log("Default Playback Device:"); + SDL_Log("Sample Rate: %d", spec.freq); + SDL_Log("Channels: %d", spec.channels); + SDL_Log("SDL_AudioFormat: %X", spec.format); + SDL_Log("Buffer Size: %d frames", frames); } else { - SDL_Log("Error when calling SDL_GetAudioDeviceFormat(default playback): %s\n", SDL_GetError()); + SDL_Log("Error when calling SDL_GetAudioDeviceFormat(default playback): %s", SDL_GetError()); } if (SDL_GetAudioDeviceFormat(SDL_AUDIO_DEVICE_DEFAULT_RECORDING, &spec, &frames)) { - SDL_Log("Default Recording Device:\n"); - SDL_Log("Sample Rate: %d\n", spec.freq); - SDL_Log("Channels: %d\n", spec.channels); - SDL_Log("SDL_AudioFormat: %X\n", spec.format); - SDL_Log("Buffer Size: %d frames\n", frames); + SDL_Log("Default Recording Device:"); + SDL_Log("Sample Rate: %d", spec.freq); + SDL_Log("Channels: %d", spec.channels); + SDL_Log("SDL_AudioFormat: %X", spec.format); + SDL_Log("Buffer Size: %d frames", frames); } else { - SDL_Log("Error when calling SDL_GetAudioDeviceFormat(default recording): %s\n", SDL_GetError()); + SDL_Log("Error when calling SDL_GetAudioDeviceFormat(default recording): %s", SDL_GetError()); } SDL_Quit(); diff --git a/test/testaudiorecording.c b/test/testaudiorecording.c index 88cbc73d54b5f..2e33da80f36cb 100644 --- a/test/testaudiorecording.c +++ b/test/testaudiorecording.c @@ -62,31 +62,31 @@ SDL_AppResult SDL_AppInit(void **appstate, int argc, char **argv) /* Load the SDL library */ if (!SDL_Init(SDL_INIT_VIDEO | SDL_INIT_AUDIO)) { - SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't initialize SDL: %s\n", SDL_GetError()); + SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't initialize SDL: %s", SDL_GetError()); return SDL_APP_SUCCESS; } if (!SDL_CreateWindowAndRenderer("testaudiorecording", 320, 240, 0, &window, &renderer)) { - SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't create SDL window and renderer: %s\n", SDL_GetError()); + SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't create SDL window and renderer: %s", SDL_GetError()); return SDL_APP_SUCCESS; } SDL_SetRenderDrawColor(renderer, 0, 0, 0, 255); SDL_RenderClear(renderer); SDL_RenderPresent(renderer); - SDL_Log("Using audio driver: %s\n", SDL_GetCurrentAudioDriver()); + SDL_Log("Using audio driver: %s", SDL_GetCurrentAudioDriver()); devices = SDL_GetAudioRecordingDevices(NULL); for (i = 0; devices[i] != 0; i++) { const char *name = SDL_GetAudioDeviceName(devices[i]); - SDL_Log(" Recording device #%d: '%s'\n", i, name); + SDL_Log(" Recording device #%d: '%s'", i, name); if (devname && (SDL_strcmp(devname, name) == 0)) { want_device = devices[i]; } } if (devname && (want_device == SDL_AUDIO_DEVICE_DEFAULT_RECORDING)) { - SDL_LogWarn(SDL_LOG_CATEGORY_APPLICATION, "Didn't see a recording device named '%s', using the system default instead.\n", devname); + SDL_LogWarn(SDL_LOG_CATEGORY_APPLICATION, "Didn't see a recording device named '%s', using the system default instead.", devname); devname = NULL; } @@ -96,10 +96,10 @@ SDL_AppResult SDL_AppInit(void **appstate, int argc, char **argv) open your recording devices second in case you land in those bizarre circumstances. */ - SDL_Log("Opening default playback device...\n"); + SDL_Log("Opening default playback device..."); device = SDL_OpenAudioDevice(SDL_AUDIO_DEVICE_DEFAULT_PLAYBACK, NULL); if (!device) { - SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't open an audio device for playback: %s!\n", SDL_GetError()); + SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't open an audio device for playback: %s!", SDL_GetError()); SDL_free(devices); return SDL_APP_FAILURE; } @@ -107,23 +107,23 @@ SDL_AppResult SDL_AppInit(void **appstate, int argc, char **argv) SDL_GetAudioDeviceFormat(device, &outspec, NULL); stream_out = SDL_CreateAudioStream(&outspec, &outspec); if (!stream_out) { - SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't create an audio stream for playback: %s!\n", SDL_GetError()); + SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't create an audio stream for playback: %s!", SDL_GetError()); SDL_free(devices); return SDL_APP_FAILURE; } else if (!SDL_BindAudioStream(device, stream_out)) { - SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't bind an audio stream for playback: %s!\n", SDL_GetError()); + SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't bind an audio stream for playback: %s!", SDL_GetError()); SDL_free(devices); return SDL_APP_FAILURE; } - SDL_Log("Opening recording device %s%s%s...\n", + SDL_Log("Opening recording device %s%s%s...", devname ? "'" : "", devname ? devname : "[[default]]", devname ? "'" : ""); device = SDL_OpenAudioDevice(want_device, NULL); if (!device) { - SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't open an audio device for recording: %s!\n", SDL_GetError()); + SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't open an audio device for recording: %s!", SDL_GetError()); SDL_free(devices); return SDL_APP_FAILURE; } @@ -132,16 +132,16 @@ SDL_AppResult SDL_AppInit(void **appstate, int argc, char **argv) SDL_GetAudioDeviceFormat(device, &inspec, NULL); stream_in = SDL_CreateAudioStream(&inspec, &inspec); if (!stream_in) { - SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't create an audio stream for recording: %s!\n", SDL_GetError()); + SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't create an audio stream for recording: %s!", SDL_GetError()); return SDL_APP_FAILURE; } else if (!SDL_BindAudioStream(device, stream_in)) { - SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't bind an audio stream for recording: %s!\n", SDL_GetError()); + SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't bind an audio stream for recording: %s!", SDL_GetError()); return SDL_APP_FAILURE; } SDL_SetAudioStreamFormat(stream_in, NULL, &outspec); /* make sure we output at the playback format. */ - SDL_Log("Ready! Hold down mouse or finger to record!\n"); + SDL_Log("Ready! Hold down mouse or finger to record!"); return SDL_APP_CONTINUE; } @@ -185,10 +185,10 @@ SDL_AppResult SDL_AppIterate(void *appstate) Uint8 buf[1024]; const int br = SDL_GetAudioStreamData(stream_in, buf, sizeof(buf)); if (br < 0) { - SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Failed to read from input audio stream: %s\n", SDL_GetError()); + SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Failed to read from input audio stream: %s", SDL_GetError()); return SDL_APP_FAILURE; } else if (!SDL_PutAudioStreamData(stream_out, buf, br)) { - SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Failed to write to output audio stream: %s\n", SDL_GetError()); + SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Failed to write to output audio stream: %s", SDL_GetError()); return SDL_APP_FAILURE; } } @@ -198,7 +198,7 @@ SDL_AppResult SDL_AppIterate(void *appstate) void SDL_AppQuit(void *appstate, SDL_AppResult result) { - SDL_Log("Shutting down.\n"); + SDL_Log("Shutting down."); const SDL_AudioDeviceID devid_in = SDL_GetAudioStreamDevice(stream_in); const SDL_AudioDeviceID devid_out = SDL_GetAudioStreamDevice(stream_out); SDL_CloseAudioDevice(devid_in); /* !!! FIXME: use SDL_OpenAudioDeviceStream instead so we can dump this. */ diff --git a/test/testaudiostreamdynamicresample.c b/test/testaudiostreamdynamicresample.c index 0dbde731d6179..9ee2c8413a926 100644 --- a/test/testaudiostreamdynamicresample.c +++ b/test/testaudiostreamdynamicresample.c @@ -396,7 +396,7 @@ int main(int argc, char *argv[]) /* Load the SDL library */ if (!SDLTest_CommonInit(state)) { - SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't initialize SDL: %s\n", SDL_GetError()); + SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't initialize SDL: %s", SDL_GetError()); return 1; } diff --git a/test/testcamera.c b/test/testcamera.c index f83347f27e55e..7d3e64cb43482 100644 --- a/test/testcamera.c +++ b/test/testcamera.c @@ -36,10 +36,10 @@ static void PrintCameraSpecs(SDL_CameraID camera_id) if (specs) { int i; - SDL_Log("Available formats:\n"); + SDL_Log("Available formats:"); for (i = 0; specs[i]; ++i) { const SDL_CameraSpec *s = specs[i]; - SDL_Log(" %dx%d %.2f FPS %s\n", s->width, s->height, (float)s->framerate_numerator / s->framerate_denominator, SDL_GetPixelFormatName(s->format)); + SDL_Log(" %dx%d %.2f FPS %s", s->width, s->height, (float)s->framerate_numerator / s->framerate_denominator, SDL_GetPixelFormatName(s->format)); } SDL_free(specs); } diff --git a/test/testclipboard.c b/test/testclipboard.c index 634f81c3b4dff..cb57bbf25d8ca 100644 --- a/test/testclipboard.c +++ b/test/testclipboard.c @@ -41,12 +41,12 @@ static const void *ClipboardDataCallback(void *userdata, const char *mime_type, SDL_AppResult SDL_AppInit(void **appstate, int argc, char *argv[]) { if (!SDL_Init(SDL_INIT_VIDEO)) { - SDL_Log("Couldn't initialize SDL: %s\n", SDL_GetError()); + SDL_Log("Couldn't initialize SDL: %s", SDL_GetError()); return SDL_APP_FAILURE; } if (!SDL_CreateWindowAndRenderer("testclipboard", 640, 480, 0, &window, &renderer)) { - SDL_Log("Couldn't create window and renderer: %s\n", SDL_GetError()); + SDL_Log("Couldn't create window and renderer: %s", SDL_GetError()); return SDL_APP_FAILURE; } return SDL_APP_CONTINUE; @@ -69,12 +69,12 @@ SDL_AppResult SDL_AppEvent(void *appstate, SDL_Event *event) case SDL_EVENT_CLIPBOARD_UPDATE: if (event->clipboard.num_mime_types > 0) { int i; - SDL_Log("Clipboard updated:\n"); + SDL_Log("Clipboard updated:"); for (i = 0; event->clipboard.mime_types[i]; ++i) { - SDL_Log(" %s\n", event->clipboard.mime_types[i]); + SDL_Log(" %s", event->clipboard.mime_types[i]); } } else { - SDL_Log("Clipboard cleared\n"); + SDL_Log("Clipboard cleared"); } break; diff --git a/test/testcolorspace.c b/test/testcolorspace.c index 14877cbec47ca..c3bcd3bf24cd4 100644 --- a/test/testcolorspace.c +++ b/test/testcolorspace.c @@ -64,12 +64,12 @@ static void UpdateHDRState(void) props = SDL_GetWindowProperties(window); HDR_enabled = SDL_GetBooleanProperty(props, SDL_PROP_WINDOW_HDR_ENABLED_BOOLEAN, false); - SDL_Log("HDR %s\n", HDR_enabled ? "enabled" : "disabled"); + SDL_Log("HDR %s", HDR_enabled ? "enabled" : "disabled"); if (HDR_enabled) { props = SDL_GetRendererProperties(renderer); if (SDL_GetNumberProperty(props, SDL_PROP_RENDERER_OUTPUT_COLORSPACE_NUMBER, SDL_COLORSPACE_SRGB) != SDL_COLORSPACE_SRGB_LINEAR) { - SDL_Log("Run with --colorspace linear to display HDR colors\n"); + SDL_Log("Run with --colorspace linear to display HDR colors"); } HDR_headroom = SDL_GetFloatProperty(props, SDL_PROP_RENDERER_HDR_HEADROOM_FLOAT, 1.0f); } @@ -86,12 +86,12 @@ static void CreateRenderer(void) renderer = SDL_CreateRendererWithProperties(props); SDL_DestroyProperties(props); if (!renderer) { - SDL_Log("Couldn't create renderer: %s\n", SDL_GetError()); + SDL_Log("Couldn't create renderer: %s", SDL_GetError()); return; } renderer_name = SDL_GetRendererName(renderer); - SDL_Log("Created renderer %s\n", renderer_name); + SDL_Log("Created renderer %s", renderer_name); UpdateHDRState(); } @@ -159,11 +159,11 @@ static bool ReadPixel(int x, int y, SDL_Color *c) if (SDL_ReadSurfacePixel(surface, 0, 0, &c->r, &c->g, &c->b, &c->a)) { result = true; } else { - SDL_Log("Couldn't read pixel: %s\n", SDL_GetError()); + SDL_Log("Couldn't read pixel: %s", SDL_GetError()); } SDL_DestroySurface(surface); } else { - SDL_Log("Couldn't read back pixels: %s\n", SDL_GetError()); + SDL_Log("Couldn't read back pixels: %s", SDL_GetError()); } return result; } @@ -662,7 +662,7 @@ static void loop(void) static void LogUsage(const char *argv0) { - SDL_Log("Usage: %s [--renderer renderer] [--colorspace colorspace]\n", argv0); + SDL_Log("Usage: %s [--renderer renderer] [--colorspace colorspace]", argv0); } int main(int argc, char *argv[]) @@ -691,7 +691,7 @@ int main(int argc, char *argv[]) colorspace = SDL_COLORSPACE_HDR10; */ } else { - SDL_Log("Unknown colorspace %s\n", argv[i + 1]); + SDL_Log("Unknown colorspace %s", argv[i + 1]); goto quit; } ++i; @@ -707,20 +707,20 @@ int main(int argc, char *argv[]) window = SDL_CreateWindow("SDL colorspace test", WINDOW_WIDTH, WINDOW_HEIGHT, 0); if (!window) { - SDL_Log("Couldn't create window: %s\n", SDL_GetError()); + SDL_Log("Couldn't create window: %s", SDL_GetError()); return_code = 2; goto quit; } renderer_count = SDL_GetNumRenderDrivers(); - SDL_Log("There are %d render drivers:\n", renderer_count); + SDL_Log("There are %d render drivers:", renderer_count); for (i = 0; i < renderer_count; ++i) { const char *name = SDL_GetRenderDriver(i); if (renderer_name && SDL_strcasecmp(renderer_name, name) == 0) { renderer_index = i; } - SDL_Log(" %s\n", name); + SDL_Log(" %s", name); } CreateRenderer(); diff --git a/test/testcontroller.c b/test/testcontroller.c index da87c72778301..6e9b662cceddb 100644 --- a/test/testcontroller.c +++ b/test/testcontroller.c @@ -923,9 +923,9 @@ static void AddController(SDL_JoystickID id, bool verbose) const char *name = SDL_GetJoystickName(joystick); const char *path = SDL_GetJoystickPath(joystick); char guid[33]; - SDL_Log("Opened joystick %s%s%s\n", name, path ? ", " : "", path ? path : ""); + SDL_Log("Opened joystick %s%s%s", name, path ? ", " : "", path ? path : ""); SDL_GUIDToString(SDL_GetJoystickGUID(joystick), guid, sizeof(guid)); - SDL_Log("No gamepad mapping for %s\n", guid); + SDL_Log("No gamepad mapping for %s", guid); } } else { SDL_Log("Couldn't open joystick: %s", SDL_GetError()); @@ -1021,7 +1021,7 @@ static void HandleGamepadAdded(SDL_JoystickID id, bool verbose) if (i < 0) { return; } - SDL_Log("Gamepad %" SDL_PRIu32 " added\n", id); + SDL_Log("Gamepad %" SDL_PRIu32 " added", id); SDL_assert(!controllers[i].gamepad); controllers[i].gamepad = SDL_OpenGamepad(id); @@ -1035,11 +1035,11 @@ static void HandleGamepadAdded(SDL_JoystickID id, bool verbose) SDL_GUID guid = SDL_GetGamepadGUIDForID(id); char guid_string[33]; SDL_GUIDToString(guid, guid_string, sizeof(guid_string)); - SDL_Log("Opened gamepad %s, guid %s%s%s\n", name, guid_string, path ? ", " : "", path ? path : ""); + SDL_Log("Opened gamepad %s, guid %s%s%s", name, guid_string, path ? ", " : "", path ? path : ""); firmware_version = SDL_GetGamepadFirmwareVersion(gamepad); if (firmware_version) { - SDL_Log("Firmware version: 0x%x (%d)\n", firmware_version, firmware_version); + SDL_Log("Firmware version: 0x%x (%d)", firmware_version, firmware_version); } if (SDL_GetBooleanProperty(props, SDL_PROP_GAMEPAD_CAP_PLAYER_LED_BOOLEAN, false)) { @@ -1055,7 +1055,7 @@ static void HandleGamepadAdded(SDL_JoystickID id, bool verbose) } if (SDL_GetGamepadPlayerIndex(gamepad) >= 0) { - SDL_Log("Player index: %d\n", SDL_GetGamepadPlayerIndex(gamepad)); + SDL_Log("Player index: %d", SDL_GetGamepadPlayerIndex(gamepad)); } } @@ -1064,7 +1064,7 @@ static void HandleGamepadAdded(SDL_JoystickID id, bool verbose) if (SDL_GamepadHasSensor(gamepad, sensor)) { if (verbose) { - SDL_Log("Enabling %s at %.2f Hz\n", GetSensorName(sensor), SDL_GetGamepadSensorDataRate(gamepad, sensor)); + SDL_Log("Enabling %s at %.2f Hz", GetSensorName(sensor), SDL_GetGamepadSensorDataRate(gamepad, sensor)); } SDL_SetGamepadSensorEnabled(gamepad, sensor, true); } @@ -1073,7 +1073,7 @@ static void HandleGamepadAdded(SDL_JoystickID id, bool verbose) if (verbose) { char *mapping = SDL_GetGamepadMapping(gamepad); if (mapping) { - SDL_Log("Mapping: %s\n", mapping); + SDL_Log("Mapping: %s", mapping); SDL_free(mapping); } } @@ -1093,7 +1093,7 @@ static void HandleGamepadRemoved(SDL_JoystickID id) if (i < 0) { return; } - SDL_Log("Gamepad %" SDL_PRIu32 " removed\n", id); + SDL_Log("Gamepad %" SDL_PRIu32 " removed", id); if (controllers[i].mapping) { SDL_free(controllers[i].mapping); @@ -1137,24 +1137,24 @@ static bool ShowingFront(void) static void SDLCALL VirtualGamepadSetPlayerIndex(void *userdata, int player_index) { - SDL_Log("Virtual Gamepad: player index set to %d\n", player_index); + SDL_Log("Virtual Gamepad: player index set to %d", player_index); } static bool SDLCALL VirtualGamepadRumble(void *userdata, Uint16 low_frequency_rumble, Uint16 high_frequency_rumble) { - SDL_Log("Virtual Gamepad: rumble set to %d/%d\n", low_frequency_rumble, high_frequency_rumble); + SDL_Log("Virtual Gamepad: rumble set to %d/%d", low_frequency_rumble, high_frequency_rumble); return true; } static bool SDLCALL VirtualGamepadRumbleTriggers(void *userdata, Uint16 left_rumble, Uint16 right_rumble) { - SDL_Log("Virtual Gamepad: trigger rumble set to %d/%d\n", left_rumble, right_rumble); + SDL_Log("Virtual Gamepad: trigger rumble set to %d/%d", left_rumble, right_rumble); return true; } static bool SDLCALL VirtualGamepadSetLED(void *userdata, Uint8 red, Uint8 green, Uint8 blue) { - SDL_Log("Virtual Gamepad: LED set to RGB %d,%d,%d\n", red, green, blue); + SDL_Log("Virtual Gamepad: LED set to RGB %d,%d,%d", red, green, blue); return true; } @@ -1184,11 +1184,11 @@ static void OpenVirtualGamepad(void) virtual_id = SDL_AttachVirtualJoystick(&desc); if (virtual_id == 0) { - SDL_Log("Couldn't attach virtual device: %s\n", SDL_GetError()); + SDL_Log("Couldn't attach virtual device: %s", SDL_GetError()); } else { virtual_joystick = SDL_OpenJoystick(virtual_id); if (!virtual_joystick) { - SDL_Log("Couldn't open virtual device: %s\n", SDL_GetError()); + SDL_Log("Couldn't open virtual device: %s", SDL_GetError()); } } } @@ -1620,7 +1620,7 @@ SDL_AppResult SDLCALL SDL_AppEvent(void *appstate, SDL_Event *event) } #ifdef DEBUG_AXIS_MAPPING - SDL_Log("AXIS %d nValue %d nCurrentDistance %d nFarthestDistance %d\n", event->jaxis.axis, nValue, nCurrentDistance, nFarthestDistance); + SDL_Log("AXIS %d nValue %d nCurrentDistance %d nFarthestDistance %d", event->jaxis.axis, nValue, nCurrentDistance, nFarthestDistance); #endif /* If we've gone out far enough and started to come back, let's bind this axis */ if (nFarthestDistance >= 16000 && nCurrentDistance <= 10000) { @@ -1642,7 +1642,7 @@ SDL_AppResult SDLCALL SDL_AppEvent(void *appstate, SDL_Event *event) } } #ifdef DEBUG_AXIS_MAPPING - SDL_Log("AXIS %d axis_min = %d, axis_max = %d, binding = %s\n", event->jaxis.axis, axis_min, axis_max, binding); + SDL_Log("AXIS %d axis_min = %d, axis_max = %d, binding = %s", event->jaxis.axis, axis_min, axis_max, binding); #endif CommitBindingElement(binding, false); } @@ -1698,7 +1698,7 @@ SDL_AppResult SDLCALL SDL_AppEvent(void *appstate, SDL_Event *event) case SDL_EVENT_GAMEPAD_TOUCHPAD_DOWN: case SDL_EVENT_GAMEPAD_TOUCHPAD_MOTION: case SDL_EVENT_GAMEPAD_TOUCHPAD_UP: - SDL_Log("Gamepad %" SDL_PRIu32 " touchpad %" SDL_PRIs32 " finger %" SDL_PRIs32 " %s %.2f, %.2f, %.2f\n", + SDL_Log("Gamepad %" SDL_PRIu32 " touchpad %" SDL_PRIs32 " finger %" SDL_PRIs32 " %s %.2f, %.2f, %.2f", event->gtouchpad.which, event->gtouchpad.touchpad, event->gtouchpad.finger, @@ -1711,7 +1711,7 @@ SDL_AppResult SDLCALL SDL_AppEvent(void *appstate, SDL_Event *event) #ifdef VERBOSE_SENSORS case SDL_EVENT_GAMEPAD_SENSOR_UPDATE: - SDL_Log("Gamepad %" SDL_PRIu32 " sensor %s: %.2f, %.2f, %.2f (%" SDL_PRIu64 ")\n", + SDL_Log("Gamepad %" SDL_PRIu32 " sensor %s: %.2f, %.2f, %.2f (%" SDL_PRIu64 ")", event->gsensor.which, GetSensorName((SDL_SensorType) event->gsensor.sensor), event->gsensor.data[0], @@ -1728,7 +1728,7 @@ SDL_AppResult SDLCALL SDL_AppEvent(void *appstate, SDL_Event *event) SetController(event->gaxis.which); } } - SDL_Log("Gamepad %" SDL_PRIu32 " axis %s changed to %d\n", + SDL_Log("Gamepad %" SDL_PRIu32 " axis %s changed to %d", event->gaxis.which, SDL_GetGamepadStringForAxis((SDL_GamepadAxis) event->gaxis.axis), event->gaxis.value); @@ -1743,7 +1743,7 @@ SDL_AppResult SDLCALL SDL_AppEvent(void *appstate, SDL_Event *event) } } #ifdef VERBOSE_BUTTONS - SDL_Log("Gamepad %" SDL_PRIu32 " button %s %s\n", + SDL_Log("Gamepad %" SDL_PRIu32 " button %s %s", event->gbutton.which, SDL_GetGamepadStringForButton((SDL_GamepadButton) event->gbutton.button), event->gbutton.state ? "pressed" : "released"); @@ -1784,8 +1784,8 @@ SDL_AppResult SDLCALL SDL_AppEvent(void *appstate, SDL_Event *event) } else if (display_mode == CONTROLLER_MODE_BINDING) { if (GamepadButtonContains(done_mapping_button, event->button.x, event->button.y)) { if (controller->mapping) { - SDL_Log("Mapping complete:\n"); - SDL_Log("%s\n", controller->mapping); + SDL_Log("Mapping complete:"); + SDL_Log("%s", controller->mapping); } SetDisplayMode(CONTROLLER_MODE_TESTING); } else if (GamepadButtonContains(cancel_button, event->button.x, event->button.y)) { @@ -2047,7 +2047,7 @@ SDL_AppResult SDLCALL SDL_AppInit(void **appstate, int argc, char *argv[]) /* Initialize SDL (Note: video is required to start event loop) */ if (!SDL_Init(SDL_INIT_VIDEO | SDL_INIT_JOYSTICK | SDL_INIT_GAMEPAD)) { - SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't initialize SDL: %s\n", SDL_GetError()); + SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't initialize SDL: %s", SDL_GetError()); return SDL_APP_FAILURE; } @@ -2057,11 +2057,11 @@ SDL_AppResult SDLCALL SDL_AppInit(void **appstate, int argc, char *argv[]) int count = 0; char **mappings = SDL_GetGamepadMappings(&count); int map_i; - SDL_Log("Supported mappings:\n"); + SDL_Log("Supported mappings:"); for (map_i = 0; map_i < count; ++map_i) { - SDL_Log("\t%s\n", mappings[map_i]); + SDL_Log("\t%s", mappings[map_i]); } - SDL_Log("\n"); + SDL_Log("%s", ""); SDL_free(mappings); } @@ -2074,13 +2074,13 @@ SDL_AppResult SDLCALL SDL_AppInit(void **appstate, int argc, char *argv[]) screen_height = (int)SDL_ceilf(SCREEN_HEIGHT * content_scale); window = SDL_CreateWindow("SDL Controller Test", screen_width, screen_height, 0); if (!window) { - SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't create window: %s\n", SDL_GetError()); + SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't create window: %s", SDL_GetError()); return SDL_APP_FAILURE; } screen = SDL_CreateRenderer(window, NULL); if (!screen) { - SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't create renderer: %s\n", SDL_GetError()); + SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't create renderer: %s", SDL_GetError()); SDL_DestroyWindow(window); return SDL_APP_FAILURE; } diff --git a/test/testdialog.c b/test/testdialog.c index 92f453bbcb03e..49a7310b72c51 100644 --- a/test/testdialog.c +++ b/test/testdialog.c @@ -33,14 +33,14 @@ static void SDLCALL callback(void* userdata, const char* const* files, int filte } } - SDL_Log("Filter used: '%s'\n", filter_name); + SDL_Log("Filter used: '%s'", filter_name); while (*files) { - SDL_Log("'%s'\n", *files); + SDL_Log("'%s'", *files); files++; } } else { - SDL_Log("Error: %s\n", SDL_GetError()); + SDL_Log("Error: %s", SDL_GetError()); } } @@ -82,7 +82,7 @@ int main(int argc, char *argv[]) return 1; } if (!SDL_CreateWindowAndRenderer("testdialog", 640, 480, 0, &w, &r)) { - SDL_Log("Failed to create window and/or renderer: %s\n", SDL_GetError()); + SDL_Log("Failed to create window and/or renderer: %s", SDL_GetError()); SDL_Quit(); return 1; } @@ -90,7 +90,7 @@ int main(int argc, char *argv[]) initial_path = SDL_GetUserFolder(SDL_FOLDER_HOME); if (!initial_path) { - SDL_Log("Will not use an initial path, couldn't get the home directory path: %s\n", SDL_GetError()); + SDL_Log("Will not use an initial path, couldn't get the home directory path: %s", SDL_GetError()); } while (1) { diff --git a/test/testdisplayinfo.c b/test/testdisplayinfo.c index 2c5063e9c72cc..af37dde1a4619 100644 --- a/test/testdisplayinfo.c +++ b/test/testdisplayinfo.c @@ -25,7 +25,7 @@ print_mode(const char *prefix, const SDL_DisplayMode *mode) return; } - SDL_Log("%s: %dx%d@%gx, %gHz, fmt=%s\n", + SDL_Log("%s: %dx%d@%gx, %gHz, fmt=%s", prefix, mode->w, mode->h, mode->pixel_density, mode->refresh_rate, SDL_GetPixelFormatName(mode->format)); @@ -52,14 +52,14 @@ int main(int argc, char *argv[]) /* Load the SDL library */ if (!SDL_Init(SDL_INIT_VIDEO)) { - SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't initialize SDL: %s\n", SDL_GetError()); + SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't initialize SDL: %s", SDL_GetError()); return 1; } - SDL_Log("Using video target '%s'.\n", SDL_GetCurrentVideoDriver()); + SDL_Log("Using video target '%s'.", SDL_GetCurrentVideoDriver()); displays = SDL_GetDisplays(&num_displays); - SDL_Log("See %d displays.\n", num_displays); + SDL_Log("See %d displays.", num_displays); for (i = 0; i < num_displays; i++) { SDL_DisplayID dpy = displays[i]; @@ -70,20 +70,20 @@ int main(int argc, char *argv[]) SDL_GetDisplayBounds(dpy, &rect); modes = SDL_GetFullscreenDisplayModes(dpy, &num_modes); - SDL_Log("%" SDL_PRIu32 ": \"%s\" (%dx%d at %d,%d), content scale %.2f, %d fullscreen modes, HDR capable: %s.\n", dpy, SDL_GetDisplayName(dpy), rect.w, rect.h, rect.x, rect.y, SDL_GetDisplayContentScale(dpy), num_modes, has_HDR ? "yes" : "no"); + SDL_Log("%" SDL_PRIu32 ": \"%s\" (%dx%d at %d,%d), content scale %.2f, %d fullscreen modes, HDR capable: %s.", dpy, SDL_GetDisplayName(dpy), rect.w, rect.h, rect.x, rect.y, SDL_GetDisplayContentScale(dpy), num_modes, has_HDR ? "yes" : "no"); mode = SDL_GetCurrentDisplayMode(dpy); if (mode) { print_mode("CURRENT", mode); } else { - SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, " CURRENT: failed to query (%s)\n", SDL_GetError()); + SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, " CURRENT: failed to query (%s)", SDL_GetError()); } mode = SDL_GetDesktopDisplayMode(dpy); if (mode) { print_mode("DESKTOP", mode); } else { - SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, " DESKTOP: failed to query (%s)\n", SDL_GetError()); + SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, " DESKTOP: failed to query (%s)", SDL_GetError()); } for (m = 0; m < num_modes; m++) { @@ -93,7 +93,7 @@ int main(int argc, char *argv[]) } SDL_free(modes); - SDL_Log("\n"); + SDL_Log("%s", ""); } SDL_free(displays); diff --git a/test/testdraw.c b/test/testdraw.c index 9f07f3a2df289..741706fe70649 100644 --- a/test/testdraw.c +++ b/test/testdraw.c @@ -208,7 +208,7 @@ static void loop(void) /* Print out some timing information */ const Uint64 then = next_fps_check - fps_check_delay; const double fps = ((double)frames * 1000) / (now - then); - SDL_Log("%2.2f frames per second\n", fps); + SDL_Log("%2.2f frames per second", fps); next_fps_check = now + fps_check_delay; frames = 0; } diff --git a/test/testdrawchessboard.c b/test/testdrawchessboard.c index 6c58482a712a6..0b6b1194e2c0c 100644 --- a/test/testdrawchessboard.c +++ b/test/testdrawchessboard.c @@ -132,14 +132,14 @@ int main(int argc, char *argv[]) /* Initialize SDL */ if (!SDL_Init(SDL_INIT_VIDEO)) { - SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "SDL_Init fail : %s\n", SDL_GetError()); + SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "SDL_Init fail : %s", SDL_GetError()); return 1; } /* Create window and renderer for given surface */ window = SDL_CreateWindow("Chess Board", 640, 480, SDL_WINDOW_RESIZABLE); if (!window) { - SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Window creation fail : %s\n", SDL_GetError()); + SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Window creation fail : %s", SDL_GetError()); return 1; } #ifdef USE_SOFTWARE_RENDERER @@ -149,7 +149,7 @@ int main(int argc, char *argv[]) renderer = SDL_CreateRenderer(window, NULL); #endif if (!renderer) { - SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Render creation for surface fail : %s\n", SDL_GetError()); + SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Render creation for surface fail : %s", SDL_GetError()); return 1; } diff --git a/test/testerror.c b/test/testerror.c index 07056ecbdc045..687cb4332b89c 100644 --- a/test/testerror.c +++ b/test/testerror.c @@ -38,10 +38,10 @@ ThreadFunc(void *data) SDL_SetError("Thread %s (%" SDL_PRIu64 ") had a problem: %s", (char *)data, SDL_GetCurrentThreadID(), "nevermind"); while (alive) { - SDL_Log("Thread '%s' is alive!\n", (char *)data); + SDL_Log("Thread '%s' is alive!", (char *)data); SDL_Delay(1 * 1000); } - SDL_Log("Child thread error string: %s\n", SDL_GetError()); + SDL_Log("Child thread error string: %s", SDL_GetError()); return 0; } @@ -83,7 +83,7 @@ int main(int argc, char *argv[]) /* Load the SDL library */ if (!SDL_Init(0)) { - SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't initialize SDL: %s\n", SDL_GetError()); + SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't initialize SDL: %s", SDL_GetError()); return 1; } @@ -100,16 +100,16 @@ int main(int argc, char *argv[]) alive = 1; thread = SDL_CreateThread(ThreadFunc, NULL, "#1"); if (!thread) { - SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't create thread: %s\n", SDL_GetError()); + SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't create thread: %s", SDL_GetError()); quit(1); } SDL_Delay(5 * 1000); - SDL_Log("Waiting for thread #1\n"); + SDL_Log("Waiting for thread #1"); alive = 0; SDL_WaitThread(thread, NULL); } - SDL_Log("Main thread error string: %s\n", SDL_GetError()); + SDL_Log("Main thread error string: %s", SDL_GetError()); SDL_Quit(); SDLTest_CommonDestroyState(state); diff --git a/test/testffmpeg.c b/test/testffmpeg.c index 5c072fcdd8675..63bc3cb59de30 100644 --- a/test/testffmpeg.c +++ b/test/testffmpeg.c @@ -171,7 +171,7 @@ static bool CreateWindowAndRenderer(SDL_WindowFlags window_flags, const char *dr return false; } - SDL_Log("Created renderer %s\n", SDL_GetRendererName(renderer)); + SDL_Log("Created renderer %s", SDL_GetRendererName(renderer)); #ifdef HAVE_EGL if (useEGL) { @@ -377,9 +377,9 @@ static enum AVPixelFormat GetSupportedPixelFormat(AVCodecContext *s, const enum } if (*p == AV_PIX_FMT_NONE) { - SDL_Log("Couldn't find a supported pixel format:\n"); + SDL_Log("Couldn't find a supported pixel format:"); for (p = pix_fmts; *p != AV_PIX_FMT_NONE; p++) { - SDL_Log(" %s\n", av_get_pix_fmt_name(*p)); + SDL_Log(" %s", av_get_pix_fmt_name(*p)); } } @@ -395,7 +395,7 @@ static AVCodecContext *OpenVideoStream(AVFormatContext *ic, int stream, const AV int i; int result; - SDL_Log("Video stream: %s %dx%d\n", avcodec_get_name(codec->id), codecpar->width, codecpar->height); + SDL_Log("Video stream: %s %dx%d", avcodec_get_name(codec->id), codecpar->width, codecpar->height); context = avcodec_alloc_context3(NULL); if (!context) { @@ -405,7 +405,7 @@ static AVCodecContext *OpenVideoStream(AVFormatContext *ic, int stream, const AV result = avcodec_parameters_to_context(context, ic->streams[stream]->codecpar); if (result < 0) { - SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "avcodec_parameters_to_context failed: %s\n", av_err2str(result)); + SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "avcodec_parameters_to_context failed: %s", av_err2str(result)); avcodec_free_context(&context); return NULL; } @@ -416,7 +416,7 @@ static AVCodecContext *OpenVideoStream(AVFormatContext *ic, int stream, const AV while (!context->hw_device_ctx && (config = avcodec_get_hw_config(codec, i++)) != NULL) { #if 0 - SDL_Log("Found %s hardware acceleration with pixel format %s\n", av_hwdevice_get_type_name(config->device_type), av_get_pix_fmt_name(config->pix_fmt)); + SDL_Log("Found %s hardware acceleration with pixel format %s", av_hwdevice_get_type_name(config->device_type), av_get_pix_fmt_name(config->pix_fmt)); #endif if (!(config->methods & AV_CODEC_HW_CONFIG_METHOD_HW_DEVICE_CTX) || @@ -440,7 +440,7 @@ static AVCodecContext *OpenVideoStream(AVFormatContext *ic, int stream, const AV if (result < 0) { SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't create %s hardware device context: %s", av_hwdevice_get_type_name(config->device_type), av_err2str(result)); } else { - SDL_Log("Using %s hardware acceleration with pixel format %s\n", av_hwdevice_get_type_name(config->device_type), av_get_pix_fmt_name(config->pix_fmt)); + SDL_Log("Using %s hardware acceleration with pixel format %s", av_hwdevice_get_type_name(config->device_type), av_get_pix_fmt_name(config->pix_fmt)); } } else #endif @@ -456,14 +456,14 @@ static AVCodecContext *OpenVideoStream(AVFormatContext *ic, int stream, const AV if (result < 0) { SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't create %s hardware device context: %s", av_hwdevice_get_type_name(config->device_type), av_err2str(result)); } else { - SDL_Log("Using %s hardware acceleration with pixel format %s\n", av_hwdevice_get_type_name(config->device_type), av_get_pix_fmt_name(config->pix_fmt)); + SDL_Log("Using %s hardware acceleration with pixel format %s", av_hwdevice_get_type_name(config->device_type), av_get_pix_fmt_name(config->pix_fmt)); } } else { result = av_hwdevice_ctx_create(&context->hw_device_ctx, config->device_type, NULL, NULL, 0); if (result < 0) { SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't create %s hardware device context: %s", av_hwdevice_get_type_name(config->device_type), av_err2str(result)); } else { - SDL_Log("Using %s hardware acceleration with pixel format %s\n", av_hwdevice_get_type_name(config->device_type), av_get_pix_fmt_name(config->pix_fmt)); + SDL_Log("Using %s hardware acceleration with pixel format %s", av_hwdevice_get_type_name(config->device_type), av_get_pix_fmt_name(config->pix_fmt)); } } } @@ -498,7 +498,7 @@ static SDL_Colorspace GetFrameColorspace(AVFrame *frame) if (frame && frame->colorspace != AVCOL_SPC_RGB) { #ifdef DEBUG_COLORSPACE - SDL_Log("Frame colorspace: range: %d, primaries: %d, trc: %d, colorspace: %d, chroma_location: %d\n", frame->color_range, frame->color_primaries, frame->color_trc, frame->colorspace, frame->chroma_location); + SDL_Log("Frame colorspace: range: %d, primaries: %d, trc: %d, colorspace: %d, chroma_location: %d", frame->color_range, frame->color_primaries, frame->color_trc, frame->colorspace, frame->chroma_location); #endif colorspace = SDL_DEFINE_COLORSPACE(SDL_COLOR_TYPE_YCBCR, frame->color_range, @@ -731,7 +731,7 @@ static bool GetNV12TextureForDRMFrame(AVFrame *frame, SDL_Texture **texture) EGLImage image = eglCreateImage(display, EGL_NO_CONTEXT, EGL_LINUX_DMA_BUF_EXT, NULL, attr); if (image == EGL_NO_IMAGE) { - SDL_Log("Couldn't create image: %d\n", glGetError()); + SDL_Log("Couldn't create image: %d", glGetError()); return false; } @@ -916,7 +916,7 @@ static bool GetOESTextureForDRMFrame(AVFrame *frame, SDL_Texture **texture) EGLImage image = eglCreateImage(display, EGL_NO_CONTEXT, EGL_LINUX_DMA_BUF_EXT, NULL, attr); if (image == EGL_NO_IMAGE) { - SDL_Log("Couldn't create image: %d\n", glGetError()); + SDL_Log("Couldn't create image: %d", glGetError()); return false; } @@ -1082,7 +1082,7 @@ static void DisplayVideoTexture(AVFrame *frame) { /* Update the video texture */ if (!GetTextureForFrame(frame, &video_texture)) { - SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't get texture for frame: %s\n", SDL_GetError()); + SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't get texture for frame: %s", SDL_GetError()); return; } @@ -1138,17 +1138,17 @@ static AVCodecContext *OpenAudioStream(AVFormatContext *ic, int stream, const AV AVCodecContext *context; int result; - SDL_Log("Audio stream: %s %d channels, %d Hz\n", avcodec_get_name(codec->id), codecpar->ch_layout.nb_channels, codecpar->sample_rate); + SDL_Log("Audio stream: %s %d channels, %d Hz", avcodec_get_name(codec->id), codecpar->ch_layout.nb_channels, codecpar->sample_rate); context = avcodec_alloc_context3(NULL); if (!context) { - SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "avcodec_alloc_context3 failed\n"); + SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "avcodec_alloc_context3 failed"); return NULL; } result = avcodec_parameters_to_context(context, ic->streams[stream]->codecpar); if (result < 0) { - SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "avcodec_parameters_to_context failed: %s\n", av_err2str(result)); + SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "avcodec_parameters_to_context failed: %s", av_err2str(result)); avcodec_free_context(&context); return NULL; } @@ -1471,7 +1471,7 @@ int main(int argc, char *argv[]) positions = (SDL_FRect *)SDL_malloc(num_sprites * sizeof(*positions)); velocities = (SDL_FRect *)SDL_malloc(num_sprites * sizeof(*velocities)); if (!positions || !velocities) { - SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Out of memory!\n"); + SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Out of memory!"); return_code = 3; goto quit; } @@ -1510,7 +1510,7 @@ int main(int argc, char *argv[]) if (!flushing) { result = av_read_frame(ic, pkt); if (result < 0) { - SDL_Log("End of stream, finishing decode\n"); + SDL_Log("End of stream, finishing decode"); if (audio_context) { avcodec_flush_buffers(audio_context); } diff --git a/test/testfile.c b/test/testfile.c index 352b57fbd2baa..f3d57aa10f93c 100644 --- a/test/testfile.c +++ b/test/testfile.c @@ -53,7 +53,7 @@ cleanup(void) static void iostrm_error_quit(unsigned line, SDL_IOStream *iostrm) { - SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "testfile.c(%d): failed\n", line); + SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "testfile.c(%d): failed", line); if (iostrm) { SDL_CloseIO(iostrm); } @@ -105,7 +105,7 @@ int main(int argc, char *argv[]) if (iostrm) { RWOP_ERR_QUIT(iostrm); } - SDL_Log("test1 OK\n"); + SDL_Log("test1 OK"); /* test 2 : check that inexistent file is not successfully opened/created when required */ /* modes : r, r+ imply that file MUST exist @@ -144,7 +144,7 @@ int main(int argc, char *argv[]) } SDL_CloseIO(iostrm); unlink(FBASENAME2); - SDL_Log("test2 OK\n"); + SDL_Log("test2 OK"); /* test 3 : creation, writing , reading, seeking, test : w mode, r mode, w+ mode @@ -257,7 +257,7 @@ int main(int argc, char *argv[]) RWOP_ERR_QUIT(iostrm); } SDL_CloseIO(iostrm); - SDL_Log("test3 OK\n"); + SDL_Log("test3 OK"); /* test 4: same in r+ mode */ iostrm = SDL_IOFromFile(FBASENAME1, "rb+"); /* write + read + file must exists, no truncation */ @@ -308,7 +308,7 @@ int main(int argc, char *argv[]) RWOP_ERR_QUIT(iostrm); } SDL_CloseIO(iostrm); - SDL_Log("test4 OK\n"); + SDL_Log("test4 OK"); /* test5 : append mode */ iostrm = SDL_IOFromFile(FBASENAME1, "ab+"); /* write + read + append */ @@ -365,7 +365,7 @@ int main(int argc, char *argv[]) RWOP_ERR_QUIT(iostrm); } SDL_CloseIO(iostrm); - SDL_Log("test5 OK\n"); + SDL_Log("test5 OK"); cleanup(); SDL_Quit(); SDLTest_CommonDestroyState(state); diff --git a/test/testfilesystem.c b/test/testfilesystem.c index bdd0bac59ff31..11235ebfbf5fa 100644 --- a/test/testfilesystem.c +++ b/test/testfilesystem.c @@ -106,42 +106,42 @@ int main(int argc, char *argv[]) } if (!SDL_Init(0)) { - SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "SDL_Init() failed: %s\n", SDL_GetError()); + SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "SDL_Init() failed: %s", SDL_GetError()); return 1; } base_path = SDL_GetBasePath(); if (!base_path) { - SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't find base path: %s\n", + SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't find base path: %s", SDL_GetError()); } else { - SDL_Log("base path: '%s'\n", base_path); + SDL_Log("base path: '%s'", base_path); } pref_path = SDL_GetPrefPath("libsdl", "test_filesystem"); if (!pref_path) { - SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't find pref path: %s\n", + SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't find pref path: %s", SDL_GetError()); } else { - SDL_Log("pref path: '%s'\n", pref_path); + SDL_Log("pref path: '%s'", pref_path); } SDL_free(pref_path); pref_path = SDL_GetPrefPath(NULL, "test_filesystem"); if (!pref_path) { - SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't find pref path without organization: %s\n", + SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't find pref path without organization: %s", SDL_GetError()); } else { - SDL_Log("pref path: '%s'\n", pref_path); + SDL_Log("pref path: '%s'", pref_path); } SDL_free(pref_path); curdir = SDL_GetCurrentDirectory(); if (!curdir) { - SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't find current directory: %s\n", + SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't find current directory: %s", SDL_GetError()); } else { - SDL_Log("current directory: '%s'\n", curdir); + SDL_Log("current directory: '%s'", curdir); } SDL_free(curdir); @@ -209,13 +209,13 @@ int main(int argc, char *argv[]) textA = (char *)SDL_LoadFile("testfilesystem-A", &sizeA); if (!textA || sizeA != SDL_strlen(text) || SDL_strcmp(textA, text) != 0) { - SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Contents of testfilesystem-A didn't match, expected %s, got %s\n", text, textA); + SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Contents of testfilesystem-A didn't match, expected %s, got %s", text, textA); } SDL_free(textA); textB = (char *)SDL_LoadFile("testfilesystem-B", &sizeB); if (!textB || sizeB != SDL_strlen(text) || SDL_strcmp(textB, text) != 0) { - SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Contents of testfilesystem-B didn't match, expected %s, got %s\n", text, textB); + SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Contents of testfilesystem-B didn't match, expected %s, got %s", text, textB); } SDL_free(textB); } diff --git a/test/testgeometry.c b/test/testgeometry.c index cd00b5b06c949..a510cfd410d85 100644 --- a/test/testgeometry.c +++ b/test/testgeometry.c @@ -57,7 +57,7 @@ static int LoadSprite(const char *file) return -1; } if (!SDL_SetTextureBlendMode(sprites[i], blendMode)) { - SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't set blend mode: %s\n", SDL_GetError()); + SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't set blend mode: %s", SDL_GetError()); SDL_DestroyTexture(sprites[i]); return -1; } @@ -239,7 +239,7 @@ int main(int argc, char *argv[]) sprites = (SDL_Texture **)SDL_malloc(state->num_windows * sizeof(*sprites)); if (!sprites) { - SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Out of memory!\n"); + SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Out of memory!"); quit(2); } /* Create the windows and initialize the renderers */ @@ -274,7 +274,7 @@ int main(int argc, char *argv[]) now = SDL_GetTicks(); if (now > then) { double fps = ((double)frames * 1000) / (now - then); - SDL_Log("%2.2f frames per second\n", fps); + SDL_Log("%2.2f frames per second", fps); } quit(0); diff --git a/test/testgl.c b/test/testgl.c index f109def341f3c..4a49b1e7cd0ee 100644 --- a/test/testgl.c +++ b/test/testgl.c @@ -203,9 +203,9 @@ static void LogSwapInterval(void) { int interval = 0; if (SDL_GL_GetSwapInterval(&interval)) { - SDL_Log("Swap Interval : %d\n", interval); + SDL_Log("Swap Interval : %d", interval); } else { - SDL_Log("Swap Interval : %d error: %s\n", interval, SDL_GetError()); + SDL_Log("Swap Interval : %d error: %s", interval, SDL_GetError()); } } @@ -282,13 +282,13 @@ int main(int argc, char *argv[]) /* Create OpenGL context */ context = SDL_GL_CreateContext(state->windows[0]); if (!context) { - SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "SDL_GL_CreateContext(): %s\n", SDL_GetError()); + SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "SDL_GL_CreateContext(): %s", SDL_GetError()); quit(2); } /* Important: call this *after* creating the context */ if (!LoadContext(&ctx)) { - SDL_Log("Could not load GL functions\n"); + SDL_Log("Could not load GL functions"); quit(2); return 0; } @@ -298,68 +298,68 @@ int main(int argc, char *argv[]) mode = SDL_GetCurrentDisplayMode(SDL_GetPrimaryDisplay()); if (mode) { - SDL_Log("Screen BPP : %d\n", SDL_BITSPERPIXEL(mode->format)); + SDL_Log("Screen BPP : %d", SDL_BITSPERPIXEL(mode->format)); } LogSwapInterval(); SDL_GetWindowSize(state->windows[0], &dw, &dh); - SDL_Log("Window Size : %d,%d\n", dw, dh); + SDL_Log("Window Size : %d,%d", dw, dh); SDL_GetWindowSizeInPixels(state->windows[0], &dw, &dh); - SDL_Log("Draw Size : %d,%d\n", dw, dh); - SDL_Log("\n"); - SDL_Log("Vendor : %s\n", ctx.glGetString(GL_VENDOR)); - SDL_Log("Renderer : %s\n", ctx.glGetString(GL_RENDERER)); - SDL_Log("Version : %s\n", ctx.glGetString(GL_VERSION)); - SDL_Log("Extensions : %s\n", ctx.glGetString(GL_EXTENSIONS)); - SDL_Log("\n"); + SDL_Log("Draw Size : %d,%d", dw, dh); + SDL_Log("%s", ""); + SDL_Log("Vendor : %s", ctx.glGetString(GL_VENDOR)); + SDL_Log("Renderer : %s", ctx.glGetString(GL_RENDERER)); + SDL_Log("Version : %s", ctx.glGetString(GL_VERSION)); + SDL_Log("Extensions : %s", ctx.glGetString(GL_EXTENSIONS)); + SDL_Log("%s", ""); if (SDL_GL_GetAttribute(SDL_GL_RED_SIZE, &value)) { - SDL_Log("SDL_GL_RED_SIZE: requested %d, got %d\n", 5, value); + SDL_Log("SDL_GL_RED_SIZE: requested %d, got %d", 5, value); } else { - SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Failed to get SDL_GL_RED_SIZE: %s\n", SDL_GetError()); + SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Failed to get SDL_GL_RED_SIZE: %s", SDL_GetError()); } if (SDL_GL_GetAttribute(SDL_GL_GREEN_SIZE, &value)) { - SDL_Log("SDL_GL_GREEN_SIZE: requested %d, got %d\n", 5, value); + SDL_Log("SDL_GL_GREEN_SIZE: requested %d, got %d", 5, value); } else { - SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Failed to get SDL_GL_GREEN_SIZE: %s\n", SDL_GetError()); + SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Failed to get SDL_GL_GREEN_SIZE: %s", SDL_GetError()); } if (SDL_GL_GetAttribute(SDL_GL_BLUE_SIZE, &value)) { - SDL_Log("SDL_GL_BLUE_SIZE: requested %d, got %d\n", 5, value); + SDL_Log("SDL_GL_BLUE_SIZE: requested %d, got %d", 5, value); } else { - SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Failed to get SDL_GL_BLUE_SIZE: %s\n", SDL_GetError()); + SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Failed to get SDL_GL_BLUE_SIZE: %s", SDL_GetError()); } if (SDL_GL_GetAttribute(SDL_GL_DEPTH_SIZE, &value)) { - SDL_Log("SDL_GL_DEPTH_SIZE: requested %d, got %d\n", 16, value); + SDL_Log("SDL_GL_DEPTH_SIZE: requested %d, got %d", 16, value); } else { - SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Failed to get SDL_GL_DEPTH_SIZE: %s\n", SDL_GetError()); + SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Failed to get SDL_GL_DEPTH_SIZE: %s", SDL_GetError()); } if (SDL_GL_GetAttribute(SDL_GL_CONTEXT_RELEASE_BEHAVIOR, &value)) { - SDL_Log("SDL_GL_CONTEXT_RELEASE_BEHAVIOR: requested %d, got %d\n", 0, value); + SDL_Log("SDL_GL_CONTEXT_RELEASE_BEHAVIOR: requested %d, got %d", 0, value); } else { - SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Failed to get SDL_GL_CONTEXT_RELEASE_BEHAVIOR: %s\n", SDL_GetError()); + SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Failed to get SDL_GL_CONTEXT_RELEASE_BEHAVIOR: %s", SDL_GetError()); } if (fsaa) { if (SDL_GL_GetAttribute(SDL_GL_MULTISAMPLEBUFFERS, &value)) { - SDL_Log("SDL_GL_MULTISAMPLEBUFFERS: requested 1, got %d\n", value); + SDL_Log("SDL_GL_MULTISAMPLEBUFFERS: requested 1, got %d", value); } else { - SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Failed to get SDL_GL_MULTISAMPLEBUFFERS: %s\n", + SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Failed to get SDL_GL_MULTISAMPLEBUFFERS: %s", SDL_GetError()); } if (SDL_GL_GetAttribute(SDL_GL_MULTISAMPLESAMPLES, &value)) { - SDL_Log("SDL_GL_MULTISAMPLESAMPLES: requested %d, got %d\n", fsaa, + SDL_Log("SDL_GL_MULTISAMPLESAMPLES: requested %d, got %d", fsaa, value); } else { - SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Failed to get SDL_GL_MULTISAMPLESAMPLES: %s\n", + SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Failed to get SDL_GL_MULTISAMPLESAMPLES: %s", SDL_GetError()); } } if (accel >= 0) { if (SDL_GL_GetAttribute(SDL_GL_ACCELERATED_VISUAL, &value)) { - SDL_Log("SDL_GL_ACCELERATED_VISUAL: requested %d, got %d\n", accel, + SDL_Log("SDL_GL_ACCELERATED_VISUAL: requested %d, got %d", accel, value); } else { - SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Failed to get SDL_GL_ACCELERATED_VISUAL: %s\n", + SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Failed to get SDL_GL_ACCELERATED_VISUAL: %s", SDL_GetError()); } } @@ -398,7 +398,7 @@ int main(int argc, char *argv[]) } if (update_swap_interval) { - SDL_Log("Swap interval to be set to %d\n", swap_interval); + SDL_Log("Swap interval to be set to %d", swap_interval); } for (i = 0; i < state->num_windows; ++i) { @@ -428,7 +428,7 @@ int main(int argc, char *argv[]) /* Print out some timing information */ now = SDL_GetTicks(); if (now > then) { - SDL_Log("%2.2f frames per second\n", + SDL_Log("%2.2f frames per second", ((double)frames * 1000) / (now - then)); } quit(0); @@ -439,7 +439,7 @@ int main(int argc, char *argv[]) int main(int argc, char *argv[]) { - SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "No OpenGL support on this system\n"); + SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "No OpenGL support on this system"); return 1; } diff --git a/test/testgles.c b/test/testgles.c index 09f426f6361d5..73097c71c46e7 100644 --- a/test/testgles.c +++ b/test/testgles.c @@ -173,7 +173,7 @@ int main(int argc, char *argv[]) context = (SDL_GLContext *)SDL_calloc(state->num_windows, sizeof(*context)); if (!context) { - SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Out of memory!\n"); + SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Out of memory!"); quit(2); } @@ -181,7 +181,7 @@ int main(int argc, char *argv[]) for (i = 0; i < state->num_windows; i++) { context[i] = SDL_GL_CreateContext(state->windows[i]); if (!context[i]) { - SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "SDL_GL_CreateContext(): %s\n", SDL_GetError()); + SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "SDL_GL_CreateContext(): %s", SDL_GetError()); quit(2); } } @@ -190,59 +190,59 @@ int main(int argc, char *argv[]) mode = SDL_GetCurrentDisplayMode(SDL_GetPrimaryDisplay()); if (mode) { - SDL_Log("Screen bpp: %d\n", SDL_BITSPERPIXEL(mode->format)); - SDL_Log("\n"); + SDL_Log("Screen bpp: %d", SDL_BITSPERPIXEL(mode->format)); + SDL_Log("%s", ""); } - SDL_Log("Vendor : %s\n", glGetString(GL_VENDOR)); - SDL_Log("Renderer : %s\n", glGetString(GL_RENDERER)); - SDL_Log("Version : %s\n", glGetString(GL_VERSION)); - SDL_Log("Extensions : %s\n", glGetString(GL_EXTENSIONS)); - SDL_Log("\n"); + SDL_Log("Vendor : %s", glGetString(GL_VENDOR)); + SDL_Log("Renderer : %s", glGetString(GL_RENDERER)); + SDL_Log("Version : %s", glGetString(GL_VERSION)); + SDL_Log("Extensions : %s", glGetString(GL_EXTENSIONS)); + SDL_Log("%s", ""); if (SDL_GL_GetAttribute(SDL_GL_RED_SIZE, &value)) { - SDL_Log("SDL_GL_RED_SIZE: requested %d, got %d\n", 5, value); + SDL_Log("SDL_GL_RED_SIZE: requested %d, got %d", 5, value); } else { - SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Failed to get SDL_GL_RED_SIZE: %s\n", + SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Failed to get SDL_GL_RED_SIZE: %s", SDL_GetError()); } if (SDL_GL_GetAttribute(SDL_GL_GREEN_SIZE, &value)) { - SDL_Log("SDL_GL_GREEN_SIZE: requested %d, got %d\n", 5, value); + SDL_Log("SDL_GL_GREEN_SIZE: requested %d, got %d", 5, value); } else { - SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Failed to get SDL_GL_GREEN_SIZE: %s\n", + SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Failed to get SDL_GL_GREEN_SIZE: %s", SDL_GetError()); } if (SDL_GL_GetAttribute(SDL_GL_BLUE_SIZE, &value)) { - SDL_Log("SDL_GL_BLUE_SIZE: requested %d, got %d\n", 5, value); + SDL_Log("SDL_GL_BLUE_SIZE: requested %d, got %d", 5, value); } else { - SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Failed to get SDL_GL_BLUE_SIZE: %s\n", + SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Failed to get SDL_GL_BLUE_SIZE: %s", SDL_GetError()); } if (SDL_GL_GetAttribute(SDL_GL_DEPTH_SIZE, &value)) { - SDL_Log("SDL_GL_DEPTH_SIZE: requested %d, got %d\n", depth, value); + SDL_Log("SDL_GL_DEPTH_SIZE: requested %d, got %d", depth, value); } else { - SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Failed to get SDL_GL_DEPTH_SIZE: %s\n", + SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Failed to get SDL_GL_DEPTH_SIZE: %s", SDL_GetError()); } if (fsaa) { if (SDL_GL_GetAttribute(SDL_GL_MULTISAMPLEBUFFERS, &value)) { - SDL_Log("SDL_GL_MULTISAMPLEBUFFERS: requested 1, got %d\n", value); + SDL_Log("SDL_GL_MULTISAMPLEBUFFERS: requested 1, got %d", value); } else { - SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Failed to get SDL_GL_MULTISAMPLEBUFFERS: %s\n", + SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Failed to get SDL_GL_MULTISAMPLEBUFFERS: %s", SDL_GetError()); } if (SDL_GL_GetAttribute(SDL_GL_MULTISAMPLESAMPLES, &value)) { - SDL_Log("SDL_GL_MULTISAMPLESAMPLES: requested %d, got %d\n", fsaa, + SDL_Log("SDL_GL_MULTISAMPLESAMPLES: requested %d, got %d", fsaa, value); } else { - SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Failed to get SDL_GL_MULTISAMPLESAMPLES: %s\n", + SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Failed to get SDL_GL_MULTISAMPLESAMPLES: %s", SDL_GetError()); } } if (accel) { if (SDL_GL_GetAttribute(SDL_GL_ACCELERATED_VISUAL, &value)) { - SDL_Log("SDL_GL_ACCELERATED_VISUAL: requested 1, got %d\n", value); + SDL_Log("SDL_GL_ACCELERATED_VISUAL: requested 1, got %d", value); } else { - SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Failed to get SDL_GL_ACCELERATED_VISUAL: %s\n", + SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Failed to get SDL_GL_ACCELERATED_VISUAL: %s", SDL_GetError()); } } @@ -252,7 +252,7 @@ int main(int argc, char *argv[]) float aspectAdjust; if (!SDL_GL_MakeCurrent(state->windows[i], context[i])) { - SDL_Log("SDL_GL_MakeCurrent(): %s\n", SDL_GetError()); + SDL_Log("SDL_GL_MakeCurrent(): %s", SDL_GetError()); /* Continue for next window */ continue; @@ -282,7 +282,7 @@ int main(int argc, char *argv[]) for (i = 0; i < state->num_windows; ++i) { if (event.window.windowID == SDL_GetWindowID(state->windows[i])) { if (!SDL_GL_MakeCurrent(state->windows[i], context[i])) { - SDL_Log("SDL_GL_MakeCurrent(): %s\n", SDL_GetError()); + SDL_Log("SDL_GL_MakeCurrent(): %s", SDL_GetError()); break; } /* Change view port to the new window dimensions */ @@ -301,7 +301,7 @@ int main(int argc, char *argv[]) continue; } if (!SDL_GL_MakeCurrent(state->windows[i], context[i])) { - SDL_Log("SDL_GL_MakeCurrent(): %s\n", SDL_GetError()); + SDL_Log("SDL_GL_MakeCurrent(): %s", SDL_GetError()); /* Continue for next window */ continue; @@ -314,7 +314,7 @@ int main(int argc, char *argv[]) /* Print out some timing information */ now = SDL_GetTicks(); if (now > then) { - SDL_Log("%2.2f frames per second\n", + SDL_Log("%2.2f frames per second", ((double)frames * 1000) / (now - then)); } #ifndef SDL_PLATFORM_ANDROID @@ -327,7 +327,7 @@ int main(int argc, char *argv[]) int main(int argc, char *argv[]) { - SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "No OpenGL ES support on this system\n"); + SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "No OpenGL ES support on this system"); return 1; } diff --git a/test/testgles2.c b/test/testgles2.c index 6183c2f7021ef..1184eab7cbf74 100644 --- a/test/testgles2.c +++ b/test/testgles2.c @@ -124,7 +124,7 @@ quit(int rc) { \ GLenum glError = ctx.glGetError(); \ if (glError != GL_NO_ERROR) { \ - SDL_Log("glGetError() = %i (0x%.8x) at line %i\n", glError, glError, __LINE__); \ + SDL_Log("glGetError() = %i (0x%.8x) at line %i", glError, glError, __LINE__); \ quit(1); \ } \ } @@ -551,7 +551,7 @@ render_window(int index) } if (!SDL_GL_MakeCurrent(state->windows[index], context[index])) { - SDL_Log("SDL_GL_MakeCurrent(): %s\n", SDL_GetError()); + SDL_Log("SDL_GL_MakeCurrent(): %s", SDL_GetError()); return; } @@ -750,7 +750,7 @@ int main(int argc, char *argv[]) context = (SDL_GLContext *)SDL_calloc(state->num_windows, sizeof(*context)); if (!context) { - SDL_Log("Out of memory!\n"); + SDL_Log("Out of memory!"); quit(2); } @@ -758,14 +758,14 @@ int main(int argc, char *argv[]) for (i = 0; i < state->num_windows; i++) { context[i] = SDL_GL_CreateContext(state->windows[i]); if (!context[i]) { - SDL_Log("SDL_GL_CreateContext(): %s\n", SDL_GetError()); + SDL_Log("SDL_GL_CreateContext(): %s", SDL_GetError()); quit(2); } } /* Important: call this *after* creating the context */ if (!LoadContext(&ctx)) { - SDL_Log("Could not load GLES2 functions\n"); + SDL_Log("Could not load GLES2 functions"); quit(2); return 0; } @@ -773,61 +773,61 @@ int main(int argc, char *argv[]) SDL_GL_SetSwapInterval(state->render_vsync); mode = SDL_GetCurrentDisplayMode(SDL_GetPrimaryDisplay()); - SDL_Log("Threaded : %s\n", threaded ? "yes" : "no"); + SDL_Log("Threaded : %s", threaded ? "yes" : "no"); if (mode) { - SDL_Log("Screen bpp: %d\n", SDL_BITSPERPIXEL(mode->format)); - SDL_Log("\n"); + SDL_Log("Screen bpp: %d", SDL_BITSPERPIXEL(mode->format)); + SDL_Log("%s", ""); } - SDL_Log("Vendor : %s\n", ctx.glGetString(GL_VENDOR)); - SDL_Log("Renderer : %s\n", ctx.glGetString(GL_RENDERER)); - SDL_Log("Version : %s\n", ctx.glGetString(GL_VERSION)); - SDL_Log("Extensions : %s\n", ctx.glGetString(GL_EXTENSIONS)); - SDL_Log("\n"); + SDL_Log("Vendor : %s", ctx.glGetString(GL_VENDOR)); + SDL_Log("Renderer : %s", ctx.glGetString(GL_RENDERER)); + SDL_Log("Version : %s", ctx.glGetString(GL_VERSION)); + SDL_Log("Extensions : %s", ctx.glGetString(GL_EXTENSIONS)); + SDL_Log("%s", ""); if (SDL_GL_GetAttribute(SDL_GL_RED_SIZE, &value)) { - SDL_Log("SDL_GL_RED_SIZE: requested %d, got %d\n", 5, value); + SDL_Log("SDL_GL_RED_SIZE: requested %d, got %d", 5, value); } else { - SDL_Log("Failed to get SDL_GL_RED_SIZE: %s\n", + SDL_Log("Failed to get SDL_GL_RED_SIZE: %s", SDL_GetError()); } if (SDL_GL_GetAttribute(SDL_GL_GREEN_SIZE, &value)) { - SDL_Log("SDL_GL_GREEN_SIZE: requested %d, got %d\n", 5, value); + SDL_Log("SDL_GL_GREEN_SIZE: requested %d, got %d", 5, value); } else { - SDL_Log("Failed to get SDL_GL_GREEN_SIZE: %s\n", + SDL_Log("Failed to get SDL_GL_GREEN_SIZE: %s", SDL_GetError()); } if (SDL_GL_GetAttribute(SDL_GL_BLUE_SIZE, &value)) { - SDL_Log("SDL_GL_BLUE_SIZE: requested %d, got %d\n", 5, value); + SDL_Log("SDL_GL_BLUE_SIZE: requested %d, got %d", 5, value); } else { - SDL_Log("Failed to get SDL_GL_BLUE_SIZE: %s\n", + SDL_Log("Failed to get SDL_GL_BLUE_SIZE: %s", SDL_GetError()); } if (SDL_GL_GetAttribute(SDL_GL_DEPTH_SIZE, &value)) { - SDL_Log("SDL_GL_DEPTH_SIZE: requested %d, got %d\n", depth, value); + SDL_Log("SDL_GL_DEPTH_SIZE: requested %d, got %d", depth, value); } else { - SDL_Log("Failed to get SDL_GL_DEPTH_SIZE: %s\n", + SDL_Log("Failed to get SDL_GL_DEPTH_SIZE: %s", SDL_GetError()); } if (fsaa) { if (SDL_GL_GetAttribute(SDL_GL_MULTISAMPLEBUFFERS, &value)) { - SDL_Log("SDL_GL_MULTISAMPLEBUFFERS: requested 1, got %d\n", value); + SDL_Log("SDL_GL_MULTISAMPLEBUFFERS: requested 1, got %d", value); } else { - SDL_Log("Failed to get SDL_GL_MULTISAMPLEBUFFERS: %s\n", + SDL_Log("Failed to get SDL_GL_MULTISAMPLEBUFFERS: %s", SDL_GetError()); } if (SDL_GL_GetAttribute(SDL_GL_MULTISAMPLESAMPLES, &value)) { - SDL_Log("SDL_GL_MULTISAMPLESAMPLES: requested %d, got %d\n", fsaa, + SDL_Log("SDL_GL_MULTISAMPLESAMPLES: requested %d, got %d", fsaa, value); } else { - SDL_Log("Failed to get SDL_GL_MULTISAMPLESAMPLES: %s\n", + SDL_Log("Failed to get SDL_GL_MULTISAMPLESAMPLES: %s", SDL_GetError()); } } if (accel) { if (SDL_GL_GetAttribute(SDL_GL_ACCELERATED_VISUAL, &value)) { - SDL_Log("SDL_GL_ACCELERATED_VISUAL: requested 1, got %d\n", value); + SDL_Log("SDL_GL_ACCELERATED_VISUAL: requested 1, got %d", value); } else { - SDL_Log("Failed to get SDL_GL_ACCELERATED_VISUAL: %s\n", + SDL_Log("Failed to get SDL_GL_ACCELERATED_VISUAL: %s", SDL_GetError()); } } @@ -839,7 +839,7 @@ int main(int argc, char *argv[]) int w, h; if (!SDL_GL_MakeCurrent(state->windows[i], context[i])) { - SDL_Log("SDL_GL_MakeCurrent(): %s\n", SDL_GetError()); + SDL_Log("SDL_GL_MakeCurrent(): %s", SDL_GetError()); /* Continue for next window */ continue; @@ -936,7 +936,7 @@ int main(int argc, char *argv[]) /* Print out some timing information */ now = SDL_GetTicks(); if (now > then) { - SDL_Log("%2.2f frames per second\n", + SDL_Log("%2.2f frames per second", ((double)frames * 1000) / (now - then)); } #ifndef SDL_PLATFORM_ANDROID @@ -949,7 +949,7 @@ int main(int argc, char *argv[]) int main(int argc, char *argv[]) { - SDL_Log("No OpenGL ES support on this system\n"); + SDL_Log("No OpenGL ES support on this system"); return 1; } diff --git a/test/testgles2_sdf.c b/test/testgles2_sdf.c index 3789068466872..d9acc64a56ce6 100644 --- a/test/testgles2_sdf.c +++ b/test/testgles2_sdf.c @@ -114,7 +114,7 @@ quit(int rc) { \ GLenum glError = ctx.glGetError(); \ if (glError != GL_NO_ERROR) { \ - SDL_Log("glGetError() = %i (0x%.8x) at line %i\n", glError, glError, __LINE__); \ + SDL_Log("glGetError() = %i (0x%.8x) at line %i", glError, glError, __LINE__); \ quit(1); \ } \ } @@ -363,7 +363,7 @@ static void loop(void) if (event.window.windowID == SDL_GetWindowID(state->windows[i])) { int w, h; if (!SDL_GL_MakeCurrent(state->windows[i], context[i])) { - SDL_Log("SDL_GL_MakeCurrent(): %s\n", SDL_GetError()); + SDL_Log("SDL_GL_MakeCurrent(): %s", SDL_GetError()); break; } /* Change view port to the new window dimensions */ @@ -414,7 +414,7 @@ static void loop(void) if (!done) { for (i = 0; i < state->num_windows; ++i) { if (!SDL_GL_MakeCurrent(state->windows[i], context[i])) { - SDL_Log("SDL_GL_MakeCurrent(): %s\n", SDL_GetError()); + SDL_Log("SDL_GL_MakeCurrent(): %s", SDL_GetError()); /* Continue for next window */ continue; @@ -509,7 +509,7 @@ int main(int argc, char *argv[]) context = (SDL_GLContext *)SDL_calloc(state->num_windows, sizeof(*context)); if (!context) { - SDL_Log("Out of memory!\n"); + SDL_Log("Out of memory!"); quit(2); } @@ -517,14 +517,14 @@ int main(int argc, char *argv[]) for (i = 0; i < state->num_windows; i++) { context[i] = SDL_GL_CreateContext(state->windows[i]); if (!context[i]) { - SDL_Log("SDL_GL_CreateContext(): %s\n", SDL_GetError()); + SDL_Log("SDL_GL_CreateContext(): %s", SDL_GetError()); quit(2); } } /* Important: call this *after* creating the context */ if (!LoadContext(&ctx)) { - SDL_Log("Could not load GLES2 functions\n"); + SDL_Log("Could not load GLES2 functions"); quit(2); return 0; } @@ -554,7 +554,7 @@ int main(int argc, char *argv[]) } if (!path) { - SDL_Log("out of memory\n"); + SDL_Log("out of memory"); exit(-1); } @@ -605,59 +605,59 @@ int main(int argc, char *argv[]) mode = SDL_GetCurrentDisplayMode(SDL_GetPrimaryDisplay()); if (mode) { - SDL_Log("Screen bpp: %d\n", SDL_BITSPERPIXEL(mode->format)); - SDL_Log("\n"); + SDL_Log("Screen bpp: %d", SDL_BITSPERPIXEL(mode->format)); + SDL_Log("%s", ""); } - SDL_Log("Vendor : %s\n", ctx.glGetString(GL_VENDOR)); - SDL_Log("Renderer : %s\n", ctx.glGetString(GL_RENDERER)); - SDL_Log("Version : %s\n", ctx.glGetString(GL_VERSION)); - SDL_Log("Extensions : %s\n", ctx.glGetString(GL_EXTENSIONS)); - SDL_Log("\n"); + SDL_Log("Vendor : %s", ctx.glGetString(GL_VENDOR)); + SDL_Log("Renderer : %s", ctx.glGetString(GL_RENDERER)); + SDL_Log("Version : %s", ctx.glGetString(GL_VERSION)); + SDL_Log("Extensions : %s", ctx.glGetString(GL_EXTENSIONS)); + SDL_Log("%s", ""); if (SDL_GL_GetAttribute(SDL_GL_RED_SIZE, &value)) { - SDL_Log("SDL_GL_RED_SIZE: requested %d, got %d\n", 5, value); + SDL_Log("SDL_GL_RED_SIZE: requested %d, got %d", 5, value); } else { - SDL_Log("Failed to get SDL_GL_RED_SIZE: %s\n", + SDL_Log("Failed to get SDL_GL_RED_SIZE: %s", SDL_GetError()); } if (SDL_GL_GetAttribute(SDL_GL_GREEN_SIZE, &value)) { - SDL_Log("SDL_GL_GREEN_SIZE: requested %d, got %d\n", 5, value); + SDL_Log("SDL_GL_GREEN_SIZE: requested %d, got %d", 5, value); } else { - SDL_Log("Failed to get SDL_GL_GREEN_SIZE: %s\n", + SDL_Log("Failed to get SDL_GL_GREEN_SIZE: %s", SDL_GetError()); } if (SDL_GL_GetAttribute(SDL_GL_BLUE_SIZE, &value)) { - SDL_Log("SDL_GL_BLUE_SIZE: requested %d, got %d\n", 5, value); + SDL_Log("SDL_GL_BLUE_SIZE: requested %d, got %d", 5, value); } else { - SDL_Log("Failed to get SDL_GL_BLUE_SIZE: %s\n", + SDL_Log("Failed to get SDL_GL_BLUE_SIZE: %s", SDL_GetError()); } if (SDL_GL_GetAttribute(SDL_GL_DEPTH_SIZE, &value)) { - SDL_Log("SDL_GL_DEPTH_SIZE: requested %d, got %d\n", depth, value); + SDL_Log("SDL_GL_DEPTH_SIZE: requested %d, got %d", depth, value); } else { - SDL_Log("Failed to get SDL_GL_DEPTH_SIZE: %s\n", + SDL_Log("Failed to get SDL_GL_DEPTH_SIZE: %s", SDL_GetError()); } if (fsaa) { if (SDL_GL_GetAttribute(SDL_GL_MULTISAMPLEBUFFERS, &value)) { - SDL_Log("SDL_GL_MULTISAMPLEBUFFERS: requested 1, got %d\n", value); + SDL_Log("SDL_GL_MULTISAMPLEBUFFERS: requested 1, got %d", value); } else { - SDL_Log("Failed to get SDL_GL_MULTISAMPLEBUFFERS: %s\n", + SDL_Log("Failed to get SDL_GL_MULTISAMPLEBUFFERS: %s", SDL_GetError()); } if (SDL_GL_GetAttribute(SDL_GL_MULTISAMPLESAMPLES, &value)) { - SDL_Log("SDL_GL_MULTISAMPLESAMPLES: requested %d, got %d\n", fsaa, + SDL_Log("SDL_GL_MULTISAMPLESAMPLES: requested %d, got %d", fsaa, value); } else { - SDL_Log("Failed to get SDL_GL_MULTISAMPLESAMPLES: %s\n", + SDL_Log("Failed to get SDL_GL_MULTISAMPLESAMPLES: %s", SDL_GetError()); } } if (accel) { if (SDL_GL_GetAttribute(SDL_GL_ACCELERATED_VISUAL, &value)) { - SDL_Log("SDL_GL_ACCELERATED_VISUAL: requested 1, got %d\n", value); + SDL_Log("SDL_GL_ACCELERATED_VISUAL: requested 1, got %d", value); } else { - SDL_Log("Failed to get SDL_GL_ACCELERATED_VISUAL: %s\n", + SDL_Log("Failed to get SDL_GL_ACCELERATED_VISUAL: %s", SDL_GetError()); } } @@ -669,7 +669,7 @@ int main(int argc, char *argv[]) int w, h; if (!SDL_GL_MakeCurrent(state->windows[i], context[i])) { - SDL_Log("SDL_GL_MakeCurrent(): %s\n", SDL_GetError()); + SDL_Log("SDL_GL_MakeCurrent(): %s", SDL_GetError()); /* Continue for next window */ continue; @@ -765,7 +765,7 @@ int main(int argc, char *argv[]) /* Print out some timing information */ now = SDL_GetTicks(); if (now > then) { - SDL_Log("%2.2f frames per second\n", + SDL_Log("%2.2f frames per second", ((double)frames * 1000) / (now - then)); } #ifndef SDL_PLATFORM_ANDROID @@ -778,7 +778,7 @@ int main(int argc, char *argv[]) int main(int argc, char *argv[]) { - SDL_Log("No OpenGL ES support on this system\n"); + SDL_Log("No OpenGL ES support on this system"); return 1; } diff --git a/test/testgpu_simple_clear.c b/test/testgpu_simple_clear.c index 5c48607eb3268..41016ee8c6749 100644 --- a/test/testgpu_simple_clear.c +++ b/test/testgpu_simple_clear.c @@ -54,13 +54,13 @@ SDL_AppResult SDL_AppInit(void **appstate, int argc, char *argv[]) mode = SDL_GetCurrentDisplayMode(SDL_GetPrimaryDisplay()); if (mode) { - SDL_Log("Screen BPP : %d\n", SDL_BITSPERPIXEL(mode->format)); + SDL_Log("Screen BPP : %d", SDL_BITSPERPIXEL(mode->format)); } SDL_GetWindowSize(state->windows[0], &dw, &dh); - SDL_Log("Window Size : %d,%d\n", dw, dh); + SDL_Log("Window Size : %d,%d", dw, dh); SDL_GetWindowSizeInPixels(state->windows[0], &dw, &dh); - SDL_Log("Draw Size : %d,%d\n", dw, dh); - SDL_Log("\n"); + SDL_Log("Draw Size : %d,%d", dw, dh); + SDL_Log("%s", ""); then = SDL_GetTicks(); @@ -119,7 +119,7 @@ void SDL_AppQuit(void *appstate, SDL_AppResult result) /* Print out some timing information */ const Uint64 now = SDL_GetTicks(); if (now > then) { - SDL_Log("%2.2f frames per second\n", ((double)frames * 1000) / (now - then)); + SDL_Log("%2.2f frames per second", ((double)frames * 1000) / (now - then)); } SDL_ReleaseWindowFromGPUDevice(gpu_device, state->windows[0]); diff --git a/test/testgpu_spinning_cube.c b/test/testgpu_spinning_cube.c index ff9ece8138ca3..b2f7aefff1da4 100644 --- a/test/testgpu_spinning_cube.c +++ b/test/testgpu_spinning_cube.c @@ -27,7 +27,7 @@ #define TESTGPU_SUPPORTED_FORMATS (SDL_GPU_SHADERFORMAT_SPIRV | SDL_GPU_SHADERFORMAT_DXBC | SDL_GPU_SHADERFORMAT_DXIL | SDL_GPU_SHADERFORMAT_METALLIB) -#define CHECK_CREATE(var, thing) { if (!(var)) { SDL_Log("Failed to create %s: %s\n", thing, SDL_GetError()); quit(2); } } +#define CHECK_CREATE(var, thing) { if (!(var)) { SDL_Log("Failed to create %s: %s", thing, SDL_GetError()); quit(2); } } static Uint32 frames = 0; @@ -641,7 +641,7 @@ init_render_state(int msaa) window_states = (WindowState *) SDL_calloc(state->num_windows, sizeof (WindowState)); if (!window_states) { - SDL_Log("Out of memory!\n"); + SDL_Log("Out of memory!"); quit(2); } @@ -729,7 +729,7 @@ main(int argc, char *argv[]) } mode = SDL_GetCurrentDisplayMode(SDL_GetDisplayForWindow(state->windows[0])); - SDL_Log("Screen bpp: %d\n", SDL_BITSPERPIXEL(mode->format)); + SDL_Log("Screen bpp: %d", SDL_BITSPERPIXEL(mode->format)); init_render_state(msaa); @@ -749,7 +749,7 @@ main(int argc, char *argv[]) /* Print out some timing information */ now = SDL_GetTicks(); if (now > then) { - SDL_Log("%2.2f frames per second\n", + SDL_Log("%2.2f frames per second", ((double) frames * 1000) / (now - then)); } #if !defined(__ANDROID__) diff --git a/test/testhaptic.c b/test/testhaptic.c index f458b469dfb35..a31d2786499ae 100644 --- a/test/testhaptic.c +++ b/test/testhaptic.c @@ -69,9 +69,9 @@ int main(int argc, char **argv) if (consumed <= 0) { static const char *options[] = { "[device]", NULL }; SDLTest_CommonLogUsage(state, argv[0], options); - SDL_Log("\n"); - SDL_Log("If device is a two-digit number it'll use it as an index, otherwise\n" - "it'll use it as if it were part of the device's name.\n"); + SDL_Log("%s", ""); + SDL_Log("If device is a two-digit number it'll use it as an index, otherwise"); + SDL_Log("it'll use it as if it were part of the device's name."); return 1; } @@ -81,12 +81,12 @@ int main(int argc, char **argv) /* Initialize the force feedbackness */ SDL_Init(SDL_INIT_VIDEO | SDL_INIT_JOYSTICK | SDL_INIT_HAPTIC); haptics = SDL_GetHaptics(&num_haptics); - SDL_Log("%d Haptic devices detected.\n", num_haptics); + SDL_Log("%d Haptic devices detected.", num_haptics); for (i = 0; i < num_haptics; ++i) { - SDL_Log(" %s\n", SDL_GetHapticNameForID(haptics[i])); + SDL_Log(" %s", SDL_GetHapticNameForID(haptics[i])); } if (num_haptics == 0) { - SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "No Haptic devices found!\n"); + SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "No Haptic devices found!"); SDL_free(haptics); return 1; } @@ -96,7 +96,7 @@ int main(int argc, char **argv) i = (index != -1) ? index : 0; if (i >= num_haptics) { - SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Index out of range, aborting.\n"); + SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Index out of range, aborting."); SDL_free(haptics); return 1; } @@ -110,7 +110,7 @@ int main(int argc, char **argv) } if (i >= num_haptics) { - SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Unable to find device matching '%s', aborting.\n", name); + SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Unable to find device matching '%s', aborting.", name); SDL_free(haptics); return 1; } @@ -118,11 +118,11 @@ int main(int argc, char **argv) haptic = SDL_OpenHaptic(haptics[i]); if (!haptic) { - SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Unable to create the haptic device: %s\n", SDL_GetError()); + SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Unable to create the haptic device: %s", SDL_GetError()); SDL_free(haptics); return 1; } - SDL_Log("Device: %s\n", SDL_GetHapticName(haptic)); + SDL_Log("Device: %s", SDL_GetHapticName(haptic)); HapticPrintSupported(haptic); SDL_free(haptics); @@ -134,10 +134,11 @@ int main(int argc, char **argv) nefx = 0; supported = SDL_GetHapticFeatures(haptic); - SDL_Log("\nUploading effects\n"); + SDL_Log("%s", ""); + SDL_Log("Uploading effects"); /* First we'll try a SINE effect. */ if (supported & SDL_HAPTIC_SINE) { - SDL_Log(" effect %d: Sine Wave\n", nefx); + SDL_Log(" effect %d: Sine Wave", nefx); efx[nefx].type = SDL_HAPTIC_SINE; efx[nefx].periodic.period = 1000; efx[nefx].periodic.magnitude = -0x2000; /* Negative magnitude and ... */ @@ -147,14 +148,14 @@ int main(int argc, char **argv) efx[nefx].periodic.fade_length = 1000; id[nefx] = SDL_CreateHapticEffect(haptic, &efx[nefx]); if (id[nefx] < 0) { - SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "UPLOADING EFFECT ERROR: %s\n", SDL_GetError()); + SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "UPLOADING EFFECT ERROR: %s", SDL_GetError()); abort_execution(); } nefx++; } /* Now we'll try a SAWTOOTHUP */ if (supported & SDL_HAPTIC_SAWTOOTHUP) { - SDL_Log(" effect %d: Sawtooth Up\n", nefx); + SDL_Log(" effect %d: Sawtooth Up", nefx); efx[nefx].type = SDL_HAPTIC_SAWTOOTHUP; efx[nefx].periodic.period = 500; efx[nefx].periodic.magnitude = 0x5000; @@ -163,7 +164,7 @@ int main(int argc, char **argv) efx[nefx].periodic.fade_length = 1000; id[nefx] = SDL_CreateHapticEffect(haptic, &efx[nefx]); if (id[nefx] < 0) { - SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "UPLOADING EFFECT ERROR: %s\n", SDL_GetError()); + SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "UPLOADING EFFECT ERROR: %s", SDL_GetError()); abort_execution(); } nefx++; @@ -171,7 +172,7 @@ int main(int argc, char **argv) /* Now the classical constant effect. */ if (supported & SDL_HAPTIC_CONSTANT) { - SDL_Log(" effect %d: Constant Force\n", nefx); + SDL_Log(" effect %d: Constant Force", nefx); efx[nefx].type = SDL_HAPTIC_CONSTANT; efx[nefx].constant.direction.type = SDL_HAPTIC_POLAR; efx[nefx].constant.direction.dir[0] = 20000; /* Force comes from the south-west. */ @@ -181,7 +182,7 @@ int main(int argc, char **argv) efx[nefx].constant.fade_length = 1000; id[nefx] = SDL_CreateHapticEffect(haptic, &efx[nefx]); if (id[nefx] < 0) { - SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "UPLOADING EFFECT ERROR: %s\n", SDL_GetError()); + SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "UPLOADING EFFECT ERROR: %s", SDL_GetError()); abort_execution(); } nefx++; @@ -189,7 +190,7 @@ int main(int argc, char **argv) /* The cute spring effect. */ if (supported & SDL_HAPTIC_SPRING) { - SDL_Log(" effect %d: Condition Spring\n", nefx); + SDL_Log(" effect %d: Condition Spring", nefx); efx[nefx].type = SDL_HAPTIC_SPRING; efx[nefx].condition.length = 5000; for (i = 0; i < SDL_GetNumHapticAxes(haptic); i++) { @@ -201,14 +202,14 @@ int main(int argc, char **argv) } id[nefx] = SDL_CreateHapticEffect(haptic, &efx[nefx]); if (id[nefx] < 0) { - SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "UPLOADING EFFECT ERROR: %s\n", SDL_GetError()); + SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "UPLOADING EFFECT ERROR: %s", SDL_GetError()); abort_execution(); } nefx++; } /* The interesting damper effect. */ if (supported & SDL_HAPTIC_DAMPER) { - SDL_Log(" effect %d: Condition Damper\n", nefx); + SDL_Log(" effect %d: Condition Damper", nefx); efx[nefx].type = SDL_HAPTIC_DAMPER; efx[nefx].condition.length = 5000; for (i = 0; i < SDL_GetNumHapticAxes(haptic); i++) { @@ -219,14 +220,14 @@ int main(int argc, char **argv) } id[nefx] = SDL_CreateHapticEffect(haptic, &efx[nefx]); if (id[nefx] < 0) { - SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "UPLOADING EFFECT ERROR: %s\n", SDL_GetError()); + SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "UPLOADING EFFECT ERROR: %s", SDL_GetError()); abort_execution(); } nefx++; } /* The pretty awesome inertia effect. */ if (supported & SDL_HAPTIC_INERTIA) { - SDL_Log(" effect %d: Condition Inertia\n", nefx); + SDL_Log(" effect %d: Condition Inertia", nefx); efx[nefx].type = SDL_HAPTIC_INERTIA; efx[nefx].condition.length = 5000; for (i = 0; i < SDL_GetNumHapticAxes(haptic); i++) { @@ -238,14 +239,14 @@ int main(int argc, char **argv) } id[nefx] = SDL_CreateHapticEffect(haptic, &efx[nefx]); if (id[nefx] < 0) { - SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "UPLOADING EFFECT ERROR: %s\n", SDL_GetError()); + SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "UPLOADING EFFECT ERROR: %s", SDL_GetError()); abort_execution(); } nefx++; } /* The hot friction effect. */ if (supported & SDL_HAPTIC_FRICTION) { - SDL_Log(" effect %d: Condition Friction\n", nefx); + SDL_Log(" effect %d: Condition Friction", nefx); efx[nefx].type = SDL_HAPTIC_FRICTION; efx[nefx].condition.length = 5000; for (i = 0; i < SDL_GetNumHapticAxes(haptic); i++) { @@ -256,7 +257,7 @@ int main(int argc, char **argv) } id[nefx] = SDL_CreateHapticEffect(haptic, &efx[nefx]); if (id[nefx] < 0) { - SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "UPLOADING EFFECT ERROR: %s\n", SDL_GetError()); + SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "UPLOADING EFFECT ERROR: %s", SDL_GetError()); abort_execution(); } nefx++; @@ -264,7 +265,7 @@ int main(int argc, char **argv) /* Now we'll try a ramp effect */ if (supported & SDL_HAPTIC_RAMP) { - SDL_Log(" effect %d: Ramp\n", nefx); + SDL_Log(" effect %d: Ramp", nefx); efx[nefx].type = SDL_HAPTIC_RAMP; efx[nefx].ramp.direction.type = SDL_HAPTIC_CARTESIAN; efx[nefx].ramp.direction.dir[0] = 1; /* Force comes from */ @@ -276,7 +277,7 @@ int main(int argc, char **argv) efx[nefx].ramp.fade_length = 1000; id[nefx] = SDL_CreateHapticEffect(haptic, &efx[nefx]); if (id[nefx] < 0) { - SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "UPLOADING EFFECT ERROR: %s\n", SDL_GetError()); + SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "UPLOADING EFFECT ERROR: %s", SDL_GetError()); abort_execution(); } nefx++; @@ -284,22 +285,23 @@ int main(int argc, char **argv) /* Finally we'll try a left/right effect. */ if (supported & SDL_HAPTIC_LEFTRIGHT) { - SDL_Log(" effect %d: Left/Right\n", nefx); + SDL_Log(" effect %d: Left/Right", nefx); efx[nefx].type = SDL_HAPTIC_LEFTRIGHT; efx[nefx].leftright.length = 5000; efx[nefx].leftright.large_magnitude = 0x3000; efx[nefx].leftright.small_magnitude = 0xFFFF; id[nefx] = SDL_CreateHapticEffect(haptic, &efx[nefx]); if (id[nefx] < 0) { - SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "UPLOADING EFFECT ERROR: %s\n", SDL_GetError()); + SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "UPLOADING EFFECT ERROR: %s", SDL_GetError()); abort_execution(); } nefx++; } - SDL_Log("\nNow playing effects for 5 seconds each with 1 second delay between\n"); + SDL_Log("%s", ""); + SDL_Log("Now playing effects for 5 seconds each with 1 second delay between"); for (i = 0; i < nefx; i++) { - SDL_Log(" Playing effect %d\n", i); + SDL_Log(" Playing effect %d", i); SDL_RunHapticEffect(haptic, id[i], 1); SDL_Delay(6000); /* Effects only have length 5000 */ } @@ -320,7 +322,8 @@ int main(int argc, char **argv) static void abort_execution(void) { - SDL_Log("\nAborting program execution.\n"); + SDL_Log("%s", ""); + SDL_Log("Aborting program execution."); SDL_CloseHaptic(haptic); SDL_Quit(); @@ -338,54 +341,54 @@ HapticPrintSupported(SDL_Haptic *ptr) unsigned int supported; supported = SDL_GetHapticFeatures(ptr); - SDL_Log(" Supported effects [%d effects, %d playing]:\n", + SDL_Log(" Supported effects [%d effects, %d playing]:", SDL_GetMaxHapticEffects(ptr), SDL_GetMaxHapticEffectsPlaying(ptr)); if (supported & SDL_HAPTIC_CONSTANT) { - SDL_Log(" constant\n"); + SDL_Log(" constant"); } if (supported & SDL_HAPTIC_SINE) { - SDL_Log(" sine\n"); + SDL_Log(" sine"); } if (supported & SDL_HAPTIC_SQUARE) - SDL_Log(" square\n"); + SDL_Log(" square"); if (supported & SDL_HAPTIC_TRIANGLE) { - SDL_Log(" triangle\n"); + SDL_Log(" triangle"); } if (supported & SDL_HAPTIC_SAWTOOTHUP) { - SDL_Log(" sawtoothup\n"); + SDL_Log(" sawtoothup"); } if (supported & SDL_HAPTIC_SAWTOOTHDOWN) { - SDL_Log(" sawtoothdown\n"); + SDL_Log(" sawtoothdown"); } if (supported & SDL_HAPTIC_RAMP) { - SDL_Log(" ramp\n"); + SDL_Log(" ramp"); } if (supported & SDL_HAPTIC_FRICTION) { - SDL_Log(" friction\n"); + SDL_Log(" friction"); } if (supported & SDL_HAPTIC_SPRING) { - SDL_Log(" spring\n"); + SDL_Log(" spring"); } if (supported & SDL_HAPTIC_DAMPER) { - SDL_Log(" damper\n"); + SDL_Log(" damper"); } if (supported & SDL_HAPTIC_INERTIA) { - SDL_Log(" inertia\n"); + SDL_Log(" inertia"); } if (supported & SDL_HAPTIC_CUSTOM) { - SDL_Log(" custom\n"); + SDL_Log(" custom"); } if (supported & SDL_HAPTIC_LEFTRIGHT) { - SDL_Log(" left/right\n"); + SDL_Log(" left/right"); } - SDL_Log(" Supported capabilities:\n"); + SDL_Log(" Supported capabilities:"); if (supported & SDL_HAPTIC_GAIN) { - SDL_Log(" gain\n"); + SDL_Log(" gain"); } if (supported & SDL_HAPTIC_AUTOCENTER) { - SDL_Log(" autocenter\n"); + SDL_Log(" autocenter"); } if (supported & SDL_HAPTIC_STATUS) { - SDL_Log(" status\n"); + SDL_Log(" status"); } } diff --git a/test/testhittesting.c b/test/testhittesting.c index 24ff250ddaddb..c276d42da08bf 100644 --- a/test/testhittesting.c +++ b/test/testhittesting.c @@ -47,14 +47,14 @@ hitTest(SDL_Window *window, const SDL_Point *pt, void *data) for (i = 0; i < numareas; i++) { if (SDL_PointInRect(&adj_pt, &areas[i])) { - SDL_Log("HIT-TEST: DRAGGABLE\n"); + SDL_Log("HIT-TEST: DRAGGABLE"); return SDL_HITTEST_DRAGGABLE; } } #define REPORT_RESIZE_HIT(name) \ { \ - SDL_Log("HIT-TEST: RESIZE_" #name "\n"); \ + SDL_Log("HIT-TEST: RESIZE_" #name ""); \ return SDL_HITTEST_RESIZE_##name; \ } @@ -76,7 +76,7 @@ hitTest(SDL_Window *window, const SDL_Point *pt, void *data) REPORT_RESIZE_HIT(LEFT); } - SDL_Log("HIT-TEST: NORMAL\n"); + SDL_Log("HIT-TEST: NORMAL"); return SDL_HITTEST_NORMAL; } @@ -130,15 +130,15 @@ int main(int argc, char **argv) switch (e.type) { case SDL_EVENT_MOUSE_BUTTON_DOWN: - SDL_Log("button down!\n"); + SDL_Log("button down!"); break; case SDL_EVENT_MOUSE_BUTTON_UP: - SDL_Log("button up!\n"); + SDL_Log("button up!"); break; case SDL_EVENT_WINDOW_MOVED: - SDL_Log("Window event moved to (%d, %d)!\n", (int)e.window.data1, (int)e.window.data2); + SDL_Log("Window event moved to (%d, %d)!", (int)e.window.data1, (int)e.window.data2); break; case SDL_EVENT_KEY_DOWN: diff --git a/test/testhotplug.c b/test/testhotplug.c index 6a7df424dd0e1..f050adea51911 100644 --- a/test/testhotplug.c +++ b/test/testhotplug.c @@ -66,7 +66,7 @@ int main(int argc, char *argv[]) /* Initialize SDL (Note: video is required to start event loop) */ if (!SDL_Init(init_subsystems)) { - SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't initialize SDL: %s\n", SDL_GetError()); + SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't initialize SDL: %s", SDL_GetError()); exit(1); } @@ -75,18 +75,18 @@ int main(int argc, char *argv[]) */ SDL_free(SDL_GetKeyboards(&num_keyboards)); - SDL_Log("There are %d keyboards at startup\n", num_keyboards); + SDL_Log("There are %d keyboards at startup", num_keyboards); SDL_free(SDL_GetMice(&num_mice)); - SDL_Log("There are %d mice at startup\n", num_mice); + SDL_Log("There are %d mice at startup", num_mice); SDL_free(SDL_GetJoysticks(&num_joysticks)); - SDL_Log("There are %d joysticks at startup\n", num_joysticks); + SDL_Log("There are %d joysticks at startup", num_joysticks); if (enable_haptic) { int num_haptics; SDL_free(SDL_GetHaptics(&num_haptics)); - SDL_Log("There are %d haptic devices at startup\n", num_haptics); + SDL_Log("There are %d haptic devices at startup", num_haptics); } while (keepGoing) { @@ -97,46 +97,46 @@ int main(int argc, char *argv[]) keepGoing = false; break; case SDL_EVENT_KEYBOARD_ADDED: - SDL_Log("Keyboard '%s' added : %" SDL_PRIu32 "\n", SDL_GetKeyboardNameForID(event.kdevice.which), event.kdevice.which); + SDL_Log("Keyboard '%s' added : %" SDL_PRIu32, SDL_GetKeyboardNameForID(event.kdevice.which), event.kdevice.which); break; case SDL_EVENT_KEYBOARD_REMOVED: - SDL_Log("Keyboard removed: %" SDL_PRIu32 "\n", event.kdevice.which); + SDL_Log("Keyboard removed: %" SDL_PRIu32, event.kdevice.which); break; case SDL_EVENT_MOUSE_ADDED: - SDL_Log("Mouse '%s' added : %" SDL_PRIu32 "\n", SDL_GetMouseNameForID(event.mdevice.which), event.mdevice.which); + SDL_Log("Mouse '%s' added : %" SDL_PRIu32, SDL_GetMouseNameForID(event.mdevice.which), event.mdevice.which); break; case SDL_EVENT_MOUSE_REMOVED: - SDL_Log("Mouse removed: %" SDL_PRIu32 "\n", event.mdevice.which); + SDL_Log("Mouse removed: %" SDL_PRIu32, event.mdevice.which); break; case SDL_EVENT_JOYSTICK_ADDED: if (joystick) { - SDL_Log("Only one joystick supported by this test\n"); + SDL_Log("Only one joystick supported by this test"); } else { joystick = SDL_OpenJoystick(event.jdevice.which); instance = event.jdevice.which; - SDL_Log("Joy Added : %" SDL_PRIu32 " : %s\n", event.jdevice.which, SDL_GetJoystickName(joystick)); + SDL_Log("Joy Added : %" SDL_PRIu32 " : %s", event.jdevice.which, SDL_GetJoystickName(joystick)); if (enable_haptic) { if (SDL_IsJoystickHaptic(joystick)) { haptic = SDL_OpenHapticFromJoystick(joystick); if (haptic) { - SDL_Log("Joy Haptic Opened\n"); + SDL_Log("Joy Haptic Opened"); if (!SDL_InitHapticRumble(haptic)) { - SDL_Log("Could not init Rumble!: %s\n", SDL_GetError()); + SDL_Log("Could not init Rumble!: %s", SDL_GetError()); SDL_CloseHaptic(haptic); haptic = NULL; } } else { - SDL_Log("Joy haptic open FAILED!: %s\n", SDL_GetError()); + SDL_Log("Joy haptic open FAILED!: %s", SDL_GetError()); } } else { - SDL_Log("No haptic found\n"); + SDL_Log("No haptic found"); } } } break; case SDL_EVENT_JOYSTICK_REMOVED: if (instance == event.jdevice.which) { - SDL_Log("Joy Removed: %" SDL_PRIs32 "\n", event.jdevice.which); + SDL_Log("Joy Removed: %" SDL_PRIs32, event.jdevice.which); instance = 0; if (enable_haptic && haptic) { SDL_CloseHaptic(haptic); @@ -145,29 +145,29 @@ int main(int argc, char *argv[]) SDL_CloseJoystick(joystick); joystick = NULL; } else { - SDL_Log("Unknown joystick disconnected\n"); + SDL_Log("Unknown joystick disconnected"); } break; case SDL_EVENT_JOYSTICK_AXIS_MOTION: /* - // SDL_Log("Axis Move: %d\n", event.jaxis.axis); + // SDL_Log("Axis Move: %d", event.jaxis.axis); */ if (enable_haptic) { SDL_PlayHapticRumble(haptic, 0.25, 250); } break; case SDL_EVENT_JOYSTICK_BUTTON_DOWN: - SDL_Log("Button Press: %d\n", event.jbutton.button); + SDL_Log("Button Press: %d", event.jbutton.button); if (enable_haptic && haptic) { SDL_PlayHapticRumble(haptic, 0.25, 250); } if (event.jbutton.button == 0) { - SDL_Log("Exiting due to button press of button 0\n"); + SDL_Log("Exiting due to button press of button 0"); keepGoing = false; } break; case SDL_EVENT_JOYSTICK_BUTTON_UP: - SDL_Log("Button Release: %d\n", event.jbutton.button); + SDL_Log("Button Release: %d", event.jbutton.button); break; default: break; diff --git a/test/testiconv.c b/test/testiconv.c index e339e5fa8aca6..189c02f43577b 100644 --- a/test/testiconv.c +++ b/test/testiconv.c @@ -111,7 +111,7 @@ int main(int argc, char *argv[]) fname = GetResourceFilename(fname, "utf8.txt"); fdata = (Uint8 *) (fname ? SDL_LoadFile(fname, &fdatalen) : NULL); if (!fdata) { - SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Unable to load %s\n", fname); + SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Unable to load %s", fname); return 1; } @@ -126,7 +126,7 @@ int main(int argc, char *argv[]) test[0] = SDL_iconv_string(formats[i], "UCS-4", ucs4, len); test[1] = SDL_iconv_string("UCS-4", formats[i], test[0], len); if (!test[1] || SDL_memcmp(test[1], ucs4, len) != 0) { - SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "FAIL: %s\n", formats[i]); + SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "FAIL: %s", formats[i]); ++errors; } SDL_free(test[0]); @@ -140,7 +140,7 @@ int main(int argc, char *argv[]) SDL_free(fdata); SDL_free(fname); - SDL_LogInfo(SDL_LOG_CATEGORY_APPLICATION, "Total errors: %d\n", errors); + SDL_LogInfo(SDL_LOG_CATEGORY_APPLICATION, "Total errors: %d", errors); SDL_Quit(); SDLTest_CommonDestroyState(state); return errors ? errors + 1 : 0; diff --git a/test/testime.c b/test/testime.c index bcc1f3cd86d20..ea56d3c8070cd 100644 --- a/test/testime.c +++ b/test/testime.c @@ -163,7 +163,7 @@ static int unifont_init(const char *fontname) /* Allocate memory for the glyph data so the file can be closed after initialization. */ unifontGlyph = (struct UnifontGlyph *)SDL_malloc(unifontGlyphSize); if (!unifontGlyph) { - SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "unifont: Failed to allocate %d KiB for glyph data.\n", (int)(unifontGlyphSize + 1023) / 1024); + SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "unifont: Failed to allocate %d KiB for glyph data.", (int)(unifontGlyphSize + 1023) / 1024); return -1; } SDL_memset(unifontGlyph, 0, unifontGlyphSize); @@ -171,20 +171,20 @@ static int unifont_init(const char *fontname) /* Allocate memory for texture pointers for all renderers. */ unifontTexture = (SDL_Texture **)SDL_malloc(unifontTextureSize); if (!unifontTexture) { - SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "unifont: Failed to allocate %d KiB for texture pointer data.\n", (int)(unifontTextureSize + 1023) / 1024); + SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "unifont: Failed to allocate %d KiB for texture pointer data.", (int)(unifontTextureSize + 1023) / 1024); return -1; } SDL_memset(unifontTexture, 0, unifontTextureSize); filename = GetResourceFilename(NULL, fontname); if (!filename) { - SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Out of memory\n"); + SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Out of memory"); return -1; } hexFile = SDL_IOFromFile(filename, "rb"); SDL_free(filename); if (!hexFile) { - SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "unifont: Failed to open font file: %s\n", fontname); + SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "unifont: Failed to open font file: %s", fontname); return -1; } @@ -200,7 +200,7 @@ static int unifont_init(const char *fontname) break; /* EOF */ } if ((numGlyphs == 0 && bytesRead == 0) || (numGlyphs > 0 && bytesRead < 9)) { - SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "unifont: Unexpected end of hex file.\n"); + SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "unifont: Unexpected end of hex file."); return -1; } @@ -214,16 +214,16 @@ static int unifont_init(const char *fontname) } else if (hexBuffer[8] == ':') { codepointHexSize = 8; } else { - SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "unifont: Could not find codepoint and glyph data separator symbol in hex file on line %d.\n", lineNumber); + SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "unifont: Could not find codepoint and glyph data separator symbol in hex file on line %d.", lineNumber); return -1; } if (!validate_hex((const char *)hexBuffer, codepointHexSize, &codepoint)) { - SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "unifont: Malformed hexadecimal number in hex file on line %d.\n", lineNumber); + SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "unifont: Malformed hexadecimal number in hex file on line %d.", lineNumber); return -1; } if (codepoint > UNIFONT_MAX_CODEPOINT) { - SDL_LogWarn(SDL_LOG_CATEGORY_APPLICATION, "unifont: Codepoint on line %d exceeded limit of 0x%x.\n", lineNumber, UNIFONT_MAX_CODEPOINT); + SDL_LogWarn(SDL_LOG_CATEGORY_APPLICATION, "unifont: Codepoint on line %d exceeded limit of 0x%x.", lineNumber, UNIFONT_MAX_CODEPOINT); } /* If there was glyph data read in the last file read, move it to the front of the buffer. */ @@ -234,7 +234,7 @@ static int unifont_init(const char *fontname) bytesRead = SDL_ReadIO(hexFile, hexBuffer + bytesOverread, 33 - bytesOverread); if (bytesRead < (33 - bytesOverread)) { - SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "unifont: Unexpected end of hex file.\n"); + SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "unifont: Unexpected end of hex file."); return -1; } if (hexBuffer[32] == '\n') { @@ -243,19 +243,19 @@ static int unifont_init(const char *fontname) glyphWidth = 16; bytesRead = SDL_ReadIO(hexFile, hexBuffer + 33, 32); if (bytesRead < 32) { - SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "unifont: Unexpected end of hex file.\n"); + SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "unifont: Unexpected end of hex file."); return -1; } } if (!validate_hex((const char *)hexBuffer, glyphWidth * 4, NULL)) { - SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "unifont: Malformed hexadecimal glyph data in hex file on line %d.\n", lineNumber); + SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "unifont: Malformed hexadecimal glyph data in hex file on line %d.", lineNumber); return -1; } if (codepoint <= UNIFONT_MAX_CODEPOINT) { if (unifontGlyph[codepoint].width > 0) { - SDL_LogWarn(SDL_LOG_CATEGORY_APPLICATION, "unifont: Ignoring duplicate codepoint 0x%08" SDL_PRIx32 " in hex file on line %d.\n", codepoint, lineNumber); + SDL_LogWarn(SDL_LOG_CATEGORY_APPLICATION, "unifont: Ignoring duplicate codepoint 0x%08" SDL_PRIx32 " in hex file on line %d.", codepoint, lineNumber); } else { unifontGlyph[codepoint].width = glyphWidth; /* Pack the hex data into a more compact form. */ @@ -270,7 +270,7 @@ static int unifont_init(const char *fontname) } while (bytesRead > 0); SDL_CloseIO(hexFile); - SDL_Log("unifont: Loaded %" SDL_PRIu32 " glyphs.\n", numGlyphs); + SDL_Log("unifont: Loaded %" SDL_PRIu32 " glyphs.", numGlyphs); return 0; } @@ -310,13 +310,13 @@ static int unifont_load_texture(Uint32 textureID) Uint8 *textureRGBA; if (textureID >= UNIFONT_NUM_TEXTURES) { - SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "unifont: Tried to load out of range texture %" SDL_PRIu32 "\n", textureID); + SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "unifont: Tried to load out of range texture %" SDL_PRIu32, textureID); return -1; } textureRGBA = (Uint8 *)SDL_malloc(UNIFONT_TEXTURE_SIZE); if (!textureRGBA) { - SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "unifont: Failed to allocate %d MiB for a texture.\n", UNIFONT_TEXTURE_SIZE / 1024 / 1024); + SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "unifont: Failed to allocate %d MiB for a texture.", UNIFONT_TEXTURE_SIZE / 1024 / 1024); return -1; } SDL_memset(textureRGBA, 0, UNIFONT_TEXTURE_SIZE); @@ -340,13 +340,13 @@ static int unifont_load_texture(Uint32 textureID) } tex = SDL_CreateTexture(renderer, SDL_PIXELFORMAT_ARGB8888, SDL_TEXTUREACCESS_STATIC, UNIFONT_TEXTURE_WIDTH, UNIFONT_TEXTURE_WIDTH); if (tex == NULL) { - SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "unifont: Failed to create texture %" SDL_PRIu32 " for renderer %d.\n", textureID, i); + SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "unifont: Failed to create texture %" SDL_PRIu32 " for renderer %d.", textureID, i); return -1; } unifontTexture[UNIFONT_NUM_TEXTURES * i + textureID] = tex; SDL_SetTextureBlendMode(tex, SDL_BLENDMODE_BLEND); if (!SDL_UpdateTexture(tex, NULL, textureRGBA, UNIFONT_TEXTURE_PITCH)) { - SDL_Log("unifont error: Failed to update texture %" SDL_PRIu32 " data for renderer %d.\n", textureID, i); + SDL_Log("unifont error: Failed to update texture %" SDL_PRIu32 " data for renderer %d.", textureID, i); } } @@ -970,7 +970,7 @@ int main(int argc, char *argv[]) windowstate = (WindowState *)SDL_calloc(state->num_windows, sizeof(*windowstate)); if (!windowstate) { - SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't allocate window state: %s\n", SDL_GetError()); + SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't allocate window state: %s", SDL_GetError()); return -1; } @@ -980,7 +980,7 @@ int main(int argc, char *argv[]) return -1; } - SDL_Log("Using font: %s\n", fontname); + SDL_Log("Using font: %s", fontname); /* Initialize window state */ for (i = 0; i < state->num_windows; ++i) { @@ -1082,7 +1082,7 @@ int main(int argc, char *argv[]) break; } - SDL_Log("Keyboard: scancode 0x%08X = %s, keycode 0x%08" SDL_PRIX32 " = %s\n", + SDL_Log("Keyboard: scancode 0x%08X = %s, keycode 0x%08" SDL_PRIX32 " = %s", event.key.scancode, SDL_GetScancodeName(event.key.scancode), SDL_static_cast(Uint32, event.key.key), @@ -1099,13 +1099,13 @@ int main(int argc, char *argv[]) break; } - SDL_Log("Keyboard: text input \"%s\"\n", event.text.text); + SDL_Log("Keyboard: text input \"%s\"", event.text.text); if (SDL_strlen(ctx->text) + SDL_strlen(event.text.text) < sizeof(ctx->text)) { SDL_strlcat(ctx->text, event.text.text, sizeof(ctx->text)); } - SDL_Log("text inputted: %s\n", ctx->text); + SDL_Log("text inputted: %s", ctx->text); /* After text inputted, we can clear up markedText because it */ /* is committed */ @@ -1118,7 +1118,7 @@ int main(int argc, char *argv[]) break; } - SDL_Log("text editing \"%s\", selected range (%" SDL_PRIs32 ", %" SDL_PRIs32 ")\n", + SDL_Log("text editing \"%s\", selected range (%" SDL_PRIs32 ", %" SDL_PRIs32 ")", event.edit.text, event.edit.start, event.edit.length); SDL_strlcpy(ctx->markedText, event.edit.text, sizeof(ctx->markedText)); @@ -1132,9 +1132,9 @@ int main(int argc, char *argv[]) break; } - SDL_Log("text candidates:\n"); + SDL_Log("text candidates:"); for (i = 0; i < event.edit_candidates.num_candidates; ++i) { - SDL_Log("%c%s\n", i == event.edit_candidates.selected_candidate ? '>' : ' ', event.edit_candidates.candidates[i]); + SDL_Log("%c%s", i == event.edit_candidates.selected_candidate ? '>' : ' ', event.edit_candidates.candidates[i]); } ClearCandidates(ctx); diff --git a/test/testintersections.c b/test/testintersections.c index d3e42182f516b..cc58511f9e991 100644 --- a/test/testintersections.c +++ b/test/testintersections.c @@ -92,7 +92,7 @@ static int add_line(float x1, float y1, float x2, float y2) return 0; } - SDL_Log("adding line (%g, %g), (%g, %g)\n", x1, y1, x2, y2); + SDL_Log("adding line (%g, %g), (%g, %g)", x1, y1, x2, y2); lines[num_lines].x = x1; lines[num_lines].y = y1; lines[num_lines].w = x2; @@ -142,7 +142,7 @@ static int add_rect(float x1, float y1, float x2, float y2) SWAP(float, y1, y2); } - SDL_Log("adding rect (%g, %g), (%g, %g) [%gx%g]\n", x1, y1, x2, y2, + SDL_Log("adding rect (%g, %g), (%g, %g) [%gx%g]", x1, y1, x2, y2, x2 - x1, y2 - y1); rects[num_rects].x = x1; @@ -385,7 +385,7 @@ int main(int argc, char *argv[]) if (now > then) { double fps = ((double)frames * 1000) / (now - then); - SDL_Log("%2.2f frames per second\n", fps); + SDL_Log("%2.2f frames per second", fps); } return 0; } diff --git a/test/testkeys.c b/test/testkeys.c index 166b4a19ac4f5..c77338474f829 100644 --- a/test/testkeys.c +++ b/test/testkeys.c @@ -35,11 +35,11 @@ int main(int argc, char *argv[]) } if (!SDL_Init(SDL_INIT_VIDEO)) { - SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't initialize SDL: %s\n", SDL_GetError()); + SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't initialize SDL: %s", SDL_GetError()); exit(1); } for (scancode = 0; scancode < SDL_SCANCODE_COUNT; ++scancode) { - SDL_Log("Scancode #%d, \"%s\"\n", scancode, + SDL_Log("Scancode #%d, \"%s\"", scancode, SDL_GetScancodeName(scancode)); } SDL_Quit(); diff --git a/test/testloadso.c b/test/testloadso.c index 0a8d1659ec463..106fbc71004dc 100644 --- a/test/testloadso.c +++ b/test/testloadso.c @@ -24,8 +24,8 @@ typedef int (*fntype)(const char *); static void log_usage(char *progname, SDLTest_CommonState *state) { static const char *options[] = { "library", "functionname|--hello", NULL }; SDLTest_CommonLogUsage(state, progname, options); - SDL_Log("USAGE: %s \n", progname); - SDL_Log(" %s --hello\n", progname); + SDL_Log("USAGE: %s ", progname); + SDL_Log(" %s --hello", progname); } int main(int argc, char *argv[]) @@ -80,28 +80,28 @@ int main(int argc, char *argv[]) /* Initialize SDL */ if (!SDL_Init(0)) { - SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't initialize SDL: %s\n", SDL_GetError()); + SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't initialize SDL: %s", SDL_GetError()); return 2; } lib = SDL_LoadObject(libname); if (!lib) { - SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "SDL_LoadObject('%s') failed: %s\n", + SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "SDL_LoadObject('%s') failed: %s", libname, SDL_GetError()); result = 3; } else { fn = (fntype)SDL_LoadFunction(lib, symname); if (!fn) { - SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "SDL_LoadFunction('%s') failed: %s\n", + SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "SDL_LoadFunction('%s') failed: %s", symname, SDL_GetError()); result = 4; } else { - SDL_Log("Found %s in %s at %p\n", symname, libname, fn); + SDL_Log("Found %s in %s at %p", symname, libname, fn); if (hello) { - SDL_Log("Calling function...\n"); + SDL_Log("Calling function..."); fn(" HELLO, WORLD!\n"); - SDL_Log("...apparently, we survived. :)\n"); - SDL_Log("Unloading library...\n"); + SDL_Log("...apparently, we survived. :)"); + SDL_Log("Unloading library..."); } } SDL_UnloadObject(lib); diff --git a/test/testlock.c b/test/testlock.c index 60aab55d3f0c4..971b30327777c 100644 --- a/test/testlock.c +++ b/test/testlock.c @@ -42,7 +42,7 @@ SDL_Quit_Wrapper(void) static void printid(void) { - SDL_Log("Thread %" SDL_PRIu64 ": exiting\n", SDL_GetCurrentThreadID()); + SDL_Log("Thread %" SDL_PRIu64 ": exiting", SDL_GetCurrentThreadID()); } static void terminate(int sig) @@ -55,7 +55,7 @@ static void closemutex(int sig) { SDL_ThreadID id = SDL_GetCurrentThreadID(); int i; - SDL_Log("Thread %" SDL_PRIu64 ": Cleaning up...\n", id == mainthread ? 0 : id); + SDL_Log("Thread %" SDL_PRIu64 ": Cleaning up...", id == mainthread ? 0 : id); SDL_SetAtomicInt(&doterminate, 1); if (threads) { for (i = 0; i < nb_threads; ++i) { @@ -81,21 +81,21 @@ Run(void *data) } SDL_Log("Thread %" SDL_PRIu64 ": starting up", current_thread); while (!SDL_GetAtomicInt(&doterminate)) { - SDL_Log("Thread %" SDL_PRIu64 ": ready to work\n", current_thread); + SDL_Log("Thread %" SDL_PRIu64 ": ready to work", current_thread); SDL_LockMutex(mutex); - SDL_Log("Thread %" SDL_PRIu64 ": start work!\n", current_thread); + SDL_Log("Thread %" SDL_PRIu64 ": start work!", current_thread); SDL_Delay(1 * worktime); - SDL_Log("Thread %" SDL_PRIu64 ": work done!\n", current_thread); + SDL_Log("Thread %" SDL_PRIu64 ": work done!", current_thread); SDL_UnlockMutex(mutex); /* If this sleep isn't done, then threads may starve */ SDL_Delay(10); } if (current_thread == mainthread && SDL_GetAtomicInt(&doterminate)) { - SDL_Log("Thread %" SDL_PRIu64 ": raising SIGTERM\n", current_thread); + SDL_Log("Thread %" SDL_PRIu64 ": raising SIGTERM", current_thread); (void)raise(SIGTERM); } - SDL_Log("Thread %" SDL_PRIu64 ": exiting!\n", current_thread); + SDL_Log("Thread %" SDL_PRIu64 ": exiting!", current_thread); return 0; } @@ -174,7 +174,7 @@ int main(int argc, char *argv[]) /* Load the SDL library */ if (!SDL_Init(0)) { - SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "%s\n", SDL_GetError()); + SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "%s", SDL_GetError()); exit(1); } (void)atexit(SDL_Quit_Wrapper); @@ -183,19 +183,19 @@ int main(int argc, char *argv[]) mutex = SDL_CreateMutex(); if (!mutex) { - SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't create mutex: %s\n", SDL_GetError()); + SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't create mutex: %s", SDL_GetError()); exit(1); } mainthread = SDL_GetCurrentThreadID(); - SDL_Log("Main thread: %" SDL_PRIu64 "\n", mainthread); + SDL_Log("Main thread: %" SDL_PRIu64, mainthread); (void)atexit(printid); for (i = 0; i < nb_threads; ++i) { char name[64]; (void)SDL_snprintf(name, sizeof(name), "Worker%d", i); threads[i] = SDL_CreateThread(Run, name, NULL); if (threads[i] == NULL) { - SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't create thread!\n"); + SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't create thread!"); } } diff --git a/test/testmessage.c b/test/testmessage.c index 30c7005436513..1e5dbc9ab8499 100644 --- a/test/testmessage.c +++ b/test/testmessage.c @@ -64,7 +64,7 @@ button_messagebox(void *eventNumber) success = SDL_ShowMessageBox(&data, &button); if (success == -1) { - SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Error Presenting MessageBox: %s\n", SDL_GetError()); + SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Error Presenting MessageBox: %s", SDL_GetError()); if (eventNumber) { SDL_Event event; event.type = (Uint32)(intptr_t)eventNumber; @@ -74,7 +74,7 @@ button_messagebox(void *eventNumber) quit(2); } } - SDL_Log("Pressed button: %d, %s\n", button, button == -1 ? "[closed]" : button == 1 ? "Cancel" + SDL_Log("Pressed button: %d, %s", button, button == -1 ? "[closed]" : button == 1 ? "Cancel" : "OK"); if (eventNumber) { @@ -107,7 +107,7 @@ int main(int argc, char *argv[]) "This is a simple error MessageBox", NULL); if (!success) { - SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Error Presenting MessageBox: %s\n", SDL_GetError()); + SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Error Presenting MessageBox: %s", SDL_GetError()); quit(1); } @@ -116,7 +116,7 @@ int main(int argc, char *argv[]) "This is a simple MessageBox with a newline:\r\nHello world!", NULL); if (!success) { - SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Error Presenting MessageBox: %s\n", SDL_GetError()); + SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Error Presenting MessageBox: %s", SDL_GetError()); quit(1); } @@ -125,7 +125,7 @@ int main(int argc, char *argv[]) "NULL Title", NULL); if (!success) { - SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Error Presenting MessageBox: %s\n", SDL_GetError()); + SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Error Presenting MessageBox: %s", SDL_GetError()); quit(1); } @@ -134,7 +134,7 @@ int main(int argc, char *argv[]) NULL, NULL); if (!success) { - SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Error Presenting MessageBox: %s\n", SDL_GetError()); + SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Error Presenting MessageBox: %s", SDL_GetError()); quit(1); } @@ -144,7 +144,7 @@ int main(int argc, char *argv[]) "Unicode text: '牛肉西蘭花' ...", NULL); if (!success) { - SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Error Presenting MessageBox: %s\n", SDL_GetError()); + SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Error Presenting MessageBox: %s", SDL_GetError()); quit(1); } @@ -154,7 +154,7 @@ int main(int argc, char *argv[]) "Unicode text and newline:\r\n'牛肉西蘭花'\n'牛肉西蘭花'", NULL); if (!success) { - SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Error Presenting MessageBox: %s\n", SDL_GetError()); + SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Error Presenting MessageBox: %s", SDL_GetError()); quit(1); } @@ -164,7 +164,7 @@ int main(int argc, char *argv[]) "Unicode text in the title.", NULL); if (!success) { - SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Error Presenting MessageBox: %s\n", SDL_GetError()); + SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Error Presenting MessageBox: %s", SDL_GetError()); quit(1); } @@ -177,7 +177,7 @@ int main(int argc, char *argv[]) subsystem on the main thread. */ if (!SDL_Init(SDL_INIT_VIDEO)) { - SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't initialize SDL video subsystem: %s\n", SDL_GetError()); + SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't initialize SDL video subsystem: %s", SDL_GetError()); return 1; } { @@ -194,7 +194,7 @@ int main(int argc, char *argv[]) SDL_WaitThread(thread, &status); - SDL_Log("Message box thread return %i\n", status); + SDL_Log("Message box thread return %i", status); } /* Test showing a message box with a parent window */ @@ -213,7 +213,7 @@ int main(int argc, char *argv[]) "This is a simple error MessageBox with a parent window. Press a key or close the window after dismissing this messagebox.", window); if (!success) { - SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Error Presenting MessageBox: %s\n", SDL_GetError()); + SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Error Presenting MessageBox: %s", SDL_GetError()); quit(1); } diff --git a/test/testmodal.c b/test/testmodal.c index 156d61e21bb71..9e5ea63e409a3 100644 --- a/test/testmodal.c +++ b/test/testmodal.c @@ -52,13 +52,13 @@ int main(int argc, char *argv[]) } if (!SDL_CreateWindowAndRenderer("Parent Window", 640, 480, 0, &w1, &r1)) { - SDL_Log("Failed to create parent window and/or renderer: %s\n", SDL_GetError()); + SDL_Log("Failed to create parent window and/or renderer: %s", SDL_GetError()); exit_code = 1; goto sdl_quit; } if (!SDL_CreateWindowAndRenderer("Non-Modal Window", 320, 200, 0, &w2, &r2)) { - SDL_Log("Failed to create parent window and/or renderer: %s\n", SDL_GetError()); + SDL_Log("Failed to create parent window and/or renderer: %s", SDL_GetError()); exit_code = 1; goto sdl_quit; } @@ -91,7 +91,7 @@ int main(int argc, char *argv[]) } else if (e.type == SDL_EVENT_KEY_DOWN) { if ((e.key.key == SDLK_M || e.key.key == SDLK_N) && !w2) { if (!SDL_CreateWindowAndRenderer("Non-Modal Window", 320, 200, SDL_WINDOW_HIDDEN, &w2, &r2)) { - SDL_Log("Failed to create modal window and/or renderer: %s\n", SDL_GetError()); + SDL_Log("Failed to create modal window and/or renderer: %s", SDL_GetError()); exit_code = 1; goto sdl_quit; } diff --git a/test/testmouse.c b/test/testmouse.c index 7d4758644fd07..bc839c09a9d01 100644 --- a/test/testmouse.c +++ b/test/testmouse.c @@ -295,7 +295,7 @@ int main(int argc, char *argv[]) /* Initialize SDL (Note: video is required to start event loop) */ if (!SDL_Init(SDL_INIT_VIDEO)) { - SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't initialize SDL: %s\n", SDL_GetError()); + SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't initialize SDL: %s", SDL_GetError()); exit(1); } @@ -313,7 +313,7 @@ int main(int argc, char *argv[]) window = SDL_CreateWindow("Mouse Test", SCREEN_WIDTH, SCREEN_HEIGHT, 0); #endif if (!window) { - SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't create window: %s\n", SDL_GetError()); + SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't create window: %s", SDL_GetError()); return 0; } @@ -321,7 +321,7 @@ int main(int argc, char *argv[]) loop_data.renderer = SDL_CreateRenderer(window, NULL); if (!loop_data.renderer) { - SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't create renderer: %s\n", SDL_GetError()); + SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't create renderer: %s", SDL_GetError()); SDL_DestroyWindow(window); return 0; } diff --git a/test/testmultiaudio.c b/test/testmultiaudio.c index 1e8f020bb49d8..7e1b8dc73dba4 100644 --- a/test/testmultiaudio.c +++ b/test/testmultiaudio.c @@ -86,7 +86,7 @@ test_multi_audio(const SDL_AudioDeviceID *devices, int devcount) } /* note that Emscripten currently doesn't run this part (but maybe only has a single audio device anyhow?) */ - SDL_Log("Playing on all devices...\n"); + SDL_Log("Playing on all devices..."); streams = (SDL_AudioStream **) SDL_calloc(devcount, sizeof (SDL_AudioStream *)); if (!streams) { SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Out of memory!"); @@ -130,7 +130,7 @@ test_multi_audio(const SDL_AudioDeviceID *devices, int devcount) SDL_free(streams); } - SDL_Log("All done!\n"); + SDL_Log("All done!"); } int main(int argc, char **argv) @@ -169,11 +169,11 @@ int main(int argc, char **argv) /* Load the SDL library */ if (!SDLTest_CommonInit(state)) { - SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't initialize SDL: %s\n", SDL_GetError()); + SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't initialize SDL: %s", SDL_GetError()); return 1; } - SDL_Log("Using audio driver: %s\n", SDL_GetCurrentAudioDriver()); + SDL_Log("Using audio driver: %s", SDL_GetCurrentAudioDriver()); filename = GetResourceFilename(filename, "sample.wav"); @@ -186,7 +186,7 @@ int main(int argc, char **argv) test_multi_audio(devices, devcount); SDL_free(sound); } else { - SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't load %s: %s\n", filename, + SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't load %s: %s", filename, SDL_GetError()); } SDL_free(devices); diff --git a/test/testnative.c b/test/testnative.c index cf91250ae92ba..a4b58fa421e27 100644 --- a/test/testnative.c +++ b/test/testnative.c @@ -120,7 +120,7 @@ int main(int argc, char *argv[]) } if (!SDL_Init(SDL_INIT_VIDEO)) { - SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't initialize SDL video: %s\n", + SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't initialize SDL video: %s", SDL_GetError()); exit(1); } @@ -134,14 +134,14 @@ int main(int argc, char *argv[]) } } if (!factory) { - SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't find native window code for %s driver\n", + SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't find native window code for %s driver", driver); quit(2); } - SDL_Log("Creating native window for %s driver\n", driver); + SDL_Log("Creating native window for %s driver", driver); native_window = factory->CreateNativeWindow(WINDOW_W, WINDOW_H); if (!native_window) { - SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't create native window\n"); + SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't create native window"); quit(3); } props = SDL_CreateProperties(); @@ -152,7 +152,7 @@ int main(int argc, char *argv[]) window = SDL_CreateWindowWithProperties(props); SDL_DestroyProperties(props); if (!window) { - SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't create SDL window: %s\n", SDL_GetError()); + SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't create SDL window: %s", SDL_GetError()); quit(4); } SDL_SetWindowTitle(window, "SDL Native Window Test"); @@ -160,7 +160,7 @@ int main(int argc, char *argv[]) /* Create the renderer */ renderer = SDL_CreateRenderer(window, NULL); if (!renderer) { - SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't create renderer: %s\n", SDL_GetError()); + SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't create renderer: %s", SDL_GetError()); quit(5); } @@ -178,7 +178,7 @@ int main(int argc, char *argv[]) positions = (SDL_FRect *)SDL_malloc(NUM_SPRITES * sizeof(*positions)); velocities = (SDL_FRect *)SDL_malloc(NUM_SPRITES * sizeof(*velocities)); if (!positions || !velocities) { - SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Out of memory!\n"); + SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Out of memory!"); quit(2); } for (i = 0; i < NUM_SPRITES; ++i) { diff --git a/test/testoffscreen.c b/test/testoffscreen.c index 249c87b9e30b6..8100bee4baccd 100644 --- a/test/testoffscreen.c +++ b/test/testoffscreen.c @@ -108,7 +108,7 @@ int main(int argc, char *argv[]) /* Force the offscreen renderer, if it cannot be created then fail out */ SDL_SetHint(SDL_HINT_VIDEO_DRIVER, "offscreen"); if (!SDL_InitSubSystem(SDL_INIT_VIDEO)) { - SDL_Log("Couldn't initialize the offscreen video driver: %s\n", + SDL_Log("Couldn't initialize the offscreen video driver: %s", SDL_GetError()); return 1; } @@ -117,14 +117,14 @@ int main(int argc, char *argv[]) window = SDL_CreateWindow("Offscreen Test", width, height, 0); if (!window) { - SDL_Log("Couldn't create window: %s\n", SDL_GetError()); + SDL_Log("Couldn't create window: %s", SDL_GetError()); return 1; } renderer = SDL_CreateRenderer(window, NULL); if (!renderer) { - SDL_Log("Couldn't create renderer: %s\n", + SDL_Log("Couldn't create renderer: %s", SDL_GetError()); return 1; } @@ -138,7 +138,7 @@ int main(int argc, char *argv[]) done = 0; #endif - SDL_Log("Rendering %u frames offscreen\n", max_frames); + SDL_Log("Rendering %u frames offscreen", max_frames); #ifdef SDL_PLATFORM_EMSCRIPTEN emscripten_set_main_loop(loop, 0, 1); @@ -152,7 +152,7 @@ int main(int argc, char *argv[]) now = SDL_GetTicks(); if (now > then) { double fps = ((double)frames * 1000) / (now - then); - SDL_Log("Frames remaining: %" SDL_PRIu32 " rendering at %2.2f frames per second\n", max_frames - frames, fps); + SDL_Log("Frames remaining: %" SDL_PRIu32 " rendering at %2.2f frames per second", max_frames - frames, fps); } } } diff --git a/test/testoverlay.c b/test/testoverlay.c index 7e9f97c5aae11..ac568eee489f6 100644 --- a/test/testoverlay.c +++ b/test/testoverlay.c @@ -311,7 +311,7 @@ static void loop(void) /* Print out some timing information */ const Uint64 then = next_fps_check - fps_check_delay; const double fps = ((double)frames * 1000) / (now - then); - SDL_Log("%2.2f frames per second\n", fps); + SDL_Log("%2.2f frames per second", fps); next_fps_check = now + fps_check_delay; frames = 0; } @@ -347,15 +347,15 @@ int main(int argc, char **argv) consumed = 2; fps = SDL_atoi(argv[i + 1]); if (fps == 0) { - SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "The --fps option requires an argument [from 1 to 1000], default is 12.\n"); + SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "The --fps option requires an argument [from 1 to 1000], default is 12."); quit(10); } if ((fps < 0) || (fps > 1000)) { - SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "The --fps option must be in range from 1 to 1000, default is 12.\n"); + SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "The --fps option must be in range from 1 to 1000, default is 12."); quit(10); } } else { - SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "The --fps option requires an argument [from 1 to 1000], default is 12.\n"); + SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "The --fps option requires an argument [from 1 to 1000], default is 12."); quit(10); } } else if (SDL_strcmp(argv[i], "--nodelay") == 0) { @@ -369,15 +369,15 @@ int main(int argc, char **argv) if (argv[i + 1]) { scale = SDL_atoi(argv[i + 1]); if (scale == 0) { - SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "The --scale option requires an argument [from 1 to 50], default is 5.\n"); + SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "The --scale option requires an argument [from 1 to 50], default is 5."); quit(10); } if ((scale < 0) || (scale > 50)) { - SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "The --scale option must be in range from 1 to 50, default is 5.\n"); + SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "The --scale option must be in range from 1 to 50, default is 5."); quit(10); } } else { - SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "The --fps option requires an argument [from 1 to 1000], default is 12.\n"); + SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "The --fps option requires an argument [from 1 to 1000], default is 12."); quit(10); } } else if (SDL_strcmp(argv[i], "--yuvformat") == 0) { @@ -400,11 +400,11 @@ int main(int argc, char **argv) } else if (SDL_strcmp(fmt, "NV21") == 0) { yuv_format = SDL_PIXELFORMAT_NV21; } else { - SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "The --yuvformat option requires one of the: YV12 (default), IYUV, YUY2, UYVY, YVYU, NV12, NV21)\n"); + SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "The --yuvformat option requires one of the: YV12 (default), IYUV, YUY2, UYVY, YVYU, NV12, NV21)"); quit(10); } } else { - SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "The --yuvformat option requires one of the: YV12 (default), IYUV, YUY2, UYVY, YVYU, NV12, NV21)\n"); + SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "The --yuvformat option requires one of the: YV12 (default), IYUV, YUY2, UYVY, YVYU, NV12, NV21)"); quit(10); } } @@ -435,20 +435,20 @@ int main(int argc, char **argv) RawMooseData = (Uint8 *)SDL_malloc(MOOSEFRAME_SIZE * MOOSEFRAMES_COUNT); if (!RawMooseData) { - SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Can't allocate memory for movie !\n"); + SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Can't allocate memory for movie !"); quit(1); } /* load the trojan moose images */ filename = GetResourceFilename(NULL, "moose.dat"); if (!filename) { - SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Out of memory\n"); + SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Out of memory"); quit(2); } handle = SDL_IOFromFile(filename, "rb"); SDL_free(filename); if (!handle) { - SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Can't find the file moose.dat !\n"); + SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Can't find the file moose.dat !"); quit(2); } @@ -461,7 +461,7 @@ int main(int argc, char **argv) window_h = MOOSEPIC_H * scale; if (state->num_windows != 1) { - SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Only one window allowed\n"); + SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Only one window allowed"); quit(1); } @@ -471,7 +471,7 @@ int main(int argc, char **argv) if (streaming) { MooseTexture = SDL_CreateTexture(renderer, yuv_format, SDL_TEXTUREACCESS_STREAMING, MOOSEPIC_W, MOOSEPIC_H); if (!MooseTexture) { - SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't set create texture: %s\n", SDL_GetError()); + SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't set create texture: %s", SDL_GetError()); quit(5); } } diff --git a/test/testplatform.c b/test/testplatform.c index e48dc08cfe254..c1eb6aa62f30b 100644 --- a/test/testplatform.c +++ b/test/testplatform.c @@ -50,36 +50,36 @@ static int TestTypes(bool verbose) if (badsize(sizeof(bool), 1)) { if (verbose) { - SDL_Log("sizeof(bool) != 1, instead = %u\n", (unsigned int)sizeof(bool)); + SDL_Log("sizeof(bool) != 1, instead = %u", (unsigned int)sizeof(bool)); } ++error; } if (badsize(sizeof(Uint8), 1)) { if (verbose) { - SDL_Log("sizeof(Uint8) != 1, instead = %u\n", (unsigned int)sizeof(Uint8)); + SDL_Log("sizeof(Uint8) != 1, instead = %u", (unsigned int)sizeof(Uint8)); } ++error; } if (badsize(sizeof(Uint16), 2)) { if (verbose) { - SDL_Log("sizeof(Uint16) != 2, instead = %u\n", (unsigned int)sizeof(Uint16)); + SDL_Log("sizeof(Uint16) != 2, instead = %u", (unsigned int)sizeof(Uint16)); } ++error; } if (badsize(sizeof(Uint32), 4)) { if (verbose) { - SDL_Log("sizeof(Uint32) != 4, instead = %u\n", (unsigned int)sizeof(Uint32)); + SDL_Log("sizeof(Uint32) != 4, instead = %u", (unsigned int)sizeof(Uint32)); } ++error; } if (badsize(sizeof(Uint64), 8)) { if (verbose) { - SDL_Log("sizeof(Uint64) != 8, instead = %u\n", (unsigned int)sizeof(Uint64)); + SDL_Log("sizeof(Uint64) != 8, instead = %u", (unsigned int)sizeof(Uint64)); } ++error; } if (verbose && !error) { - SDL_Log("All data types are the expected size.\n"); + SDL_Log("All data types are the expected size."); } return error ? 1 : 0; @@ -112,7 +112,7 @@ static int TestEndian(bool verbose) value_double.d = 3.141593; if (verbose) { - SDL_Log("Detected a %s endian machine.\n", + SDL_Log("Detected a %s endian machine.", (SDL_BYTEORDER == SDL_LIL_ENDIAN) ? "little" : "big"); } if ((*((char *)&value) >> 4) == 0x1) { @@ -122,13 +122,13 @@ static int TestEndian(bool verbose) } if (real_byteorder != SDL_BYTEORDER) { if (verbose) { - SDL_Log("Actually a %s endian machine!\n", + SDL_Log("Actually a %s endian machine!", (real_byteorder == SDL_LIL_ENDIAN) ? "little" : "big"); } ++error; } if (verbose) { - SDL_Log("Detected a %s endian float word order machine.\n", + SDL_Log("Detected a %s endian float word order machine.", (SDL_FLOATWORDORDER == SDL_LIL_ENDIAN) ? "little" : "big"); } if (value_double.ui32[0] == 0x82c2bd7f && value_double.ui32[1] == 0x400921fb) { @@ -138,40 +138,40 @@ static int TestEndian(bool verbose) } if (real_floatwordorder != SDL_FLOATWORDORDER) { if (verbose) { - SDL_Log("Actually a %s endian float word order machine!\n", + SDL_Log("Actually a %s endian float word order machine!", (real_floatwordorder == SDL_LIL_ENDIAN) ? "little" : (real_floatwordorder == SDL_BIG_ENDIAN) ? "big" : "unknown"); } ++error; } if (verbose) { - SDL_Log("Value 16 = 0x%X, swapped = 0x%X\n", value16, + SDL_Log("Value 16 = 0x%X, swapped = 0x%X", value16, SDL_Swap16(value16)); } if (SDL_Swap16(value16) != swapped16) { if (verbose) { - SDL_Log("16 bit value swapped incorrectly!\n"); + SDL_Log("16 bit value swapped incorrectly!"); } ++error; } if (verbose) { - SDL_Log("Value 32 = 0x%" SDL_PRIX32 ", swapped = 0x%" SDL_PRIX32 "\n", + SDL_Log("Value 32 = 0x%" SDL_PRIX32 ", swapped = 0x%" SDL_PRIX32, value32, SDL_Swap32(value32)); } if (SDL_Swap32(value32) != swapped32) { if (verbose) { - SDL_Log("32 bit value swapped incorrectly!\n"); + SDL_Log("32 bit value swapped incorrectly!"); } ++error; } if (verbose) { - SDL_Log("Value 64 = 0x%" SDL_PRIX64 ", swapped = 0x%" SDL_PRIX64 "\n", value64, + SDL_Log("Value 64 = 0x%" SDL_PRIX64 ", swapped = 0x%" SDL_PRIX64, value64, SDL_Swap64(value64)); } if (SDL_Swap64(value64) != swapped64) { if (verbose) { - SDL_Log("64 bit value swapped incorrectly!\n"); + SDL_Log("64 bit value swapped incorrectly!"); } ++error; } @@ -380,14 +380,14 @@ static int Test64Bit(bool verbose) if (!t->routine(&t->a, &t->b, t->arg, &result, &t->expected_result)) { if (verbose) { - SDL_Log("%s(0x%08X%08X, 0x%08X%08X, %3d, produced: 0x%08X%08X, expected: 0x%08X%08X\n", t->operation, al[1], al[0], bl[1], bl[0], + SDL_Log("%s(0x%08X%08X, 0x%08X%08X, %3d, produced: 0x%08X%08X, expected: 0x%08X%08X", t->operation, al[1], al[0], bl[1], bl[0], t->arg, rl[1], rl[0], el[1], el[0]); } ++failed; } } if (verbose && (failed == 0)) { - SDL_Log("All 64bit intrinsic tests passed\n"); + SDL_Log("All 64bit intrinsic tests passed"); } return failed ? 1 : 0; } @@ -395,23 +395,23 @@ static int Test64Bit(bool verbose) static int TestCPUInfo(bool verbose) { if (verbose) { - SDL_Log("Number of logical CPU cores: %d\n", SDL_GetNumLogicalCPUCores()); - SDL_Log("CPU cache line size: %d\n", SDL_GetCPUCacheLineSize()); - SDL_Log("AltiVec %s\n", SDL_HasAltiVec() ? "detected" : "not detected"); - SDL_Log("MMX %s\n", SDL_HasMMX() ? "detected" : "not detected"); - SDL_Log("SSE %s\n", SDL_HasSSE() ? "detected" : "not detected"); - SDL_Log("SSE2 %s\n", SDL_HasSSE2() ? "detected" : "not detected"); - SDL_Log("SSE3 %s\n", SDL_HasSSE3() ? "detected" : "not detected"); - SDL_Log("SSE4.1 %s\n", SDL_HasSSE41() ? "detected" : "not detected"); - SDL_Log("SSE4.2 %s\n", SDL_HasSSE42() ? "detected" : "not detected"); - SDL_Log("AVX %s\n", SDL_HasAVX() ? "detected" : "not detected"); - SDL_Log("AVX2 %s\n", SDL_HasAVX2() ? "detected" : "not detected"); - SDL_Log("AVX-512F %s\n", SDL_HasAVX512F() ? "detected" : "not detected"); - SDL_Log("ARM SIMD %s\n", SDL_HasARMSIMD() ? "detected" : "not detected"); - SDL_Log("NEON %s\n", SDL_HasNEON() ? "detected" : "not detected"); - SDL_Log("LSX %s\n", SDL_HasLSX() ? "detected" : "not detected"); - SDL_Log("LASX %s\n", SDL_HasLASX() ? "detected" : "not detected"); - SDL_Log("System RAM %d MB\n", SDL_GetSystemRAM()); + SDL_Log("Number of logical CPU cores: %d", SDL_GetNumLogicalCPUCores()); + SDL_Log("CPU cache line size: %d", SDL_GetCPUCacheLineSize()); + SDL_Log("AltiVec %s", SDL_HasAltiVec() ? "detected" : "not detected"); + SDL_Log("MMX %s", SDL_HasMMX() ? "detected" : "not detected"); + SDL_Log("SSE %s", SDL_HasSSE() ? "detected" : "not detected"); + SDL_Log("SSE2 %s", SDL_HasSSE2() ? "detected" : "not detected"); + SDL_Log("SSE3 %s", SDL_HasSSE3() ? "detected" : "not detected"); + SDL_Log("SSE4.1 %s", SDL_HasSSE41() ? "detected" : "not detected"); + SDL_Log("SSE4.2 %s", SDL_HasSSE42() ? "detected" : "not detected"); + SDL_Log("AVX %s", SDL_HasAVX() ? "detected" : "not detected"); + SDL_Log("AVX2 %s", SDL_HasAVX2() ? "detected" : "not detected"); + SDL_Log("AVX-512F %s", SDL_HasAVX512F() ? "detected" : "not detected"); + SDL_Log("ARM SIMD %s", SDL_HasARMSIMD() ? "detected" : "not detected"); + SDL_Log("NEON %s", SDL_HasNEON() ? "detected" : "not detected"); + SDL_Log("LSX %s", SDL_HasLSX() ? "detected" : "not detected"); + SDL_Log("LASX %s", SDL_HasLASX() ? "detected" : "not detected"); + SDL_Log("System RAM %d MB", SDL_GetSystemRAM()); } return 0; } @@ -434,7 +434,7 @@ static int TestAssertions(bool verbose) { const SDL_AssertData *item = SDL_GetAssertionReport(); while (item) { - SDL_Log("'%s', %s (%s:%d), triggered %u times, always ignore: %s.\n", + SDL_Log("'%s', %s (%s:%d), triggered %u times, always ignore: %s.", item->condition, item->function, item->filename, item->linenum, item->trigger_count, item->always_ignore ? "yes" : "no"); @@ -478,7 +478,7 @@ int main(int argc, char *argv[]) } if (verbose) { - SDL_Log("This system is running %s\n", SDL_GetPlatform()); + SDL_Log("This system is running %s", SDL_GetPlatform()); } status += TestTypes(verbose); diff --git a/test/testpower.c b/test/testpower.c index 3bd056d8699e5..912ee67be356b 100644 --- a/test/testpower.c +++ b/test/testpower.c @@ -22,7 +22,7 @@ report_power(void) const SDL_PowerState state = SDL_GetPowerInfo(&seconds, &percent); const char *statestr = NULL; - SDL_Log("SDL-reported power info...\n"); + SDL_Log("SDL-reported power info..."); switch (state) { case SDL_POWERSTATE_UNKNOWN: statestr = "Unknown"; @@ -44,18 +44,18 @@ report_power(void) break; } - SDL_Log("State: %s\n", statestr); + SDL_Log("State: %s", statestr); if (percent == -1) { - SDL_Log("Percent left: unknown\n"); + SDL_Log("Percent left: unknown"); } else { - SDL_Log("Percent left: %d%%\n", percent); + SDL_Log("Percent left: %d%%", percent); } if (seconds == -1) { - SDL_Log("Time left: unknown\n"); + SDL_Log("Time left: unknown"); } else { - SDL_Log("Time left: %d minutes, %d seconds\n", seconds / 60, seconds % 60); + SDL_Log("Time left: %d minutes, %d seconds", seconds / 60, seconds % 60); } } @@ -75,7 +75,7 @@ int main(int argc, char *argv[]) } if (!SDL_Init(0)) { - SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "SDL_Init() failed: %s\n", SDL_GetError()); + SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "SDL_Init() failed: %s", SDL_GetError()); return 1; } diff --git a/test/testqsort.c b/test/testqsort.c index 38d147010902f..6230e74657952 100644 --- a/test/testqsort.c +++ b/test/testqsort.c @@ -91,7 +91,7 @@ int main(int argc, char *argv[]) seed_seen = 1; consumed = 1; } else { - SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Invalid seed. Use a decimal or hexadecimal number.\n"); + SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Invalid seed. Use a decimal or hexadecimal number."); return 1; } } @@ -108,7 +108,7 @@ int main(int argc, char *argv[]) if (!seed_seen) { seed = SDL_GetPerformanceCounter(); } - SDL_Log("Using random seed 0x%" SDL_PRIx64 "\n", seed); + SDL_Log("Using random seed 0x%" SDL_PRIx64, seed); for (iteration = 0; iteration < SDL_arraysize(itervals); iteration++) { const int arraylen = itervals[iteration]; diff --git a/test/testrendercopyex.c b/test/testrendercopyex.c index 0b3b3073d7f6a..b3b998bde851a 100644 --- a/test/testrendercopyex.c +++ b/test/testrendercopyex.c @@ -161,7 +161,7 @@ int main(int argc, char *argv[]) now = SDL_GetTicks(); if (now > then) { double fps = ((double)frames * 1000) / (now - then); - SDL_Log("%2.2f frames per second\n", fps); + SDL_Log("%2.2f frames per second", fps); } SDL_stack_free(drawstates); diff --git a/test/testrendertarget.c b/test/testrendertarget.c index 4e33210af6c88..e5ef96294a29e 100644 --- a/test/testrendertarget.c +++ b/test/testrendertarget.c @@ -79,7 +79,7 @@ DrawComposite(DrawState *s) if (surface) { Uint8 r, g, b, a; if (SDL_ReadSurfacePixel(surface, 0, 0, &r, &g, &b, &a)) { - SDL_Log("Blended pixel: 0x%.2x%.2x%.2x%.2x\n", r, g, b, a); + SDL_Log("Blended pixel: 0x%.2x%.2x%.2x%.2x", r, g, b, a); } SDL_DestroySurface(surface); } @@ -148,7 +148,7 @@ Draw(DrawState *s) target = SDL_CreateTexture(s->renderer, SDL_PIXELFORMAT_ARGB8888, SDL_TEXTUREACCESS_TARGET, viewport.w, viewport.h); if (!target) { - SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't create render target texture: %s\n", SDL_GetError()); + SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't create render target texture: %s", SDL_GetError()); return false; } SDL_SetRenderTarget(s->renderer, target); @@ -283,7 +283,7 @@ int main(int argc, char *argv[]) now = SDL_GetTicks(); if (now > then) { double fps = ((double)frames * 1000) / (now - then); - SDL_Log("%2.2f frames per second\n", fps); + SDL_Log("%2.2f frames per second", fps); } SDL_stack_free(drawstates); diff --git a/test/testresample.c b/test/testresample.c index 0ca95c4965b56..55db2f3ff6d04 100644 --- a/test/testresample.c +++ b/test/testresample.c @@ -93,20 +93,20 @@ int main(int argc, char **argv) } if (!SDL_Init(SDL_INIT_AUDIO)) { - SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "SDL_Init() failed: %s\n", SDL_GetError()); + SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "SDL_Init() failed: %s", SDL_GetError()); ret = 2; goto end; } if (!SDL_LoadWAV(file_in, &spec, &data, &len)) { - SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "failed to load %s: %s\n", file_in, SDL_GetError()); + SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "failed to load %s: %s", file_in, SDL_GetError()); ret = 3; goto end; } cvtspec.format = spec.format; if (!SDL_ConvertAudioSamples(&spec, data, len, &cvtspec, &dst_buf, &dst_len)) { - SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "failed to convert samples: %s\n", SDL_GetError()); + SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "failed to convert samples: %s", SDL_GetError()); ret = 4; goto end; } @@ -114,7 +114,7 @@ int main(int argc, char **argv) /* write out a WAV header... */ io = SDL_IOFromFile(file_out, "wb"); if (!io) { - SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "opening '%s' failed: %s\n", file_out, SDL_GetError()); + SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "opening '%s' failed: %s", file_out, SDL_GetError()); ret = 5; goto end; } @@ -139,7 +139,7 @@ int main(int argc, char **argv) SDL_WriteIO(io, dst_buf, dst_len); if (!SDL_CloseIO(io)) { - SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "closing '%s' failed: %s\n", file_out, SDL_GetError()); + SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "closing '%s' failed: %s", file_out, SDL_GetError()); ret = 6; goto end; } diff --git a/test/testrumble.c b/test/testrumble.c index 0dc06cd94f0db..b53cb18eddcda 100644 --- a/test/testrumble.c +++ b/test/testrumble.c @@ -72,7 +72,7 @@ int main(int argc, char **argv) if (consumed <= 0) { static const char *options[] = { "[device]", NULL }; SDLTest_CommonLogUsage(state, argv[0], options); - SDL_Log("\n"); + SDL_Log("%s", ""); SDL_Log("If device is a two-digit number it'll use it as an index, otherwise\n" "it'll use it as if it were part of the device's name.\n"); return 1; @@ -84,9 +84,9 @@ int main(int argc, char **argv) /* Initialize the force feedbackness */ SDL_Init(SDL_INIT_VIDEO | SDL_INIT_JOYSTICK | SDL_INIT_HAPTIC); haptics = SDL_GetHaptics(&num_haptics); - SDL_Log("%d Haptic devices detected.\n", num_haptics); + SDL_Log("%d Haptic devices detected.", num_haptics); if (num_haptics == 0) { - SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "No Haptic devices found!\n"); + SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "No Haptic devices found!"); SDL_free(haptics); return 1; } @@ -96,7 +96,7 @@ int main(int argc, char **argv) i = (index != -1) ? index : 0; if (i >= num_haptics) { - SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Index out of range, aborting.\n"); + SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Index out of range, aborting."); SDL_free(haptics); return 1; } @@ -110,7 +110,7 @@ int main(int argc, char **argv) } if (i >= num_haptics) { - SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Unable to find device matching '%s', aborting.\n", name); + SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Unable to find device matching '%s', aborting.", name); SDL_free(haptics); return 1; } @@ -118,36 +118,36 @@ int main(int argc, char **argv) haptic = SDL_OpenHaptic(haptics[i]); if (!haptic) { - SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Unable to create the haptic device: %s\n", SDL_GetError()); + SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Unable to create the haptic device: %s", SDL_GetError()); SDL_free(haptics); return 1; } - SDL_Log("Device: %s\n", SDL_GetHapticName(haptic)); + SDL_Log("Device: %s", SDL_GetHapticName(haptic)); SDL_free(haptics); /* We only want force feedback errors. */ SDL_ClearError(); if (!SDL_HapticRumbleSupported(haptic)) { - SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Rumble not supported!\n"); + SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Rumble not supported!"); return 1; } if (!SDL_InitHapticRumble(haptic)) { - SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Failed to initialize rumble: %s\n", SDL_GetError()); + SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Failed to initialize rumble: %s", SDL_GetError()); return 1; } - SDL_Log("Playing 2 second rumble at 0.5 magnitude.\n"); + SDL_Log("Playing 2 second rumble at 0.5 magnitude."); if (!SDL_PlayHapticRumble(haptic, 0.5, 5000)) { - SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Failed to play rumble: %s\n", SDL_GetError()); + SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Failed to play rumble: %s", SDL_GetError()); return 1; } SDL_Delay(2000); - SDL_Log("Stopping rumble.\n"); + SDL_Log("Stopping rumble."); SDL_StopHapticRumble(haptic); SDL_Delay(2000); - SDL_Log("Playing 2 second rumble at 0.3 magnitude.\n"); + SDL_Log("Playing 2 second rumble at 0.3 magnitude."); if (!SDL_PlayHapticRumble(haptic, 0.3f, 5000)) { - SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Failed to play rumble: %s\n", SDL_GetError()); + SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Failed to play rumble: %s", SDL_GetError()); return 1; } SDL_Delay(2000); diff --git a/test/testrwlock.c b/test/testrwlock.c index d39b74fb218b5..a80873c92467a 100644 --- a/test/testrwlock.c +++ b/test/testrwlock.c @@ -34,16 +34,16 @@ static void DoWork(const int workticks) /* "Work" */ const bool is_reader = tid != mainthread; const char *typestr = is_reader ? "Reader" : "Writer"; - SDL_Log("%s Thread %" SDL_PRIu64 ": ready to work\n", typestr, tid); + SDL_Log("%s Thread %" SDL_PRIu64 ": ready to work", typestr, tid); if (is_reader) { SDL_LockRWLockForReading(rwlock); } else { SDL_LockRWLockForWriting(rwlock); } - SDL_Log("%s Thread %" SDL_PRIu64 ": start work!\n", typestr, tid); + SDL_Log("%s Thread %" SDL_PRIu64 ": start work!", typestr, tid); SDL_Delay(workticks); - SDL_Log("%s Thread %" SDL_PRIu64 ": work done!\n", typestr, tid); + SDL_Log("%s Thread %" SDL_PRIu64 ": work done!", typestr, tid); SDL_UnlockRWLock(rwlock); /* If this sleep isn't done, then threads may starve */ @@ -57,7 +57,7 @@ ReaderRun(void *data) while (!SDL_GetAtomicInt(&doterminate)) { DoWork(worktime); } - SDL_Log("Reader Thread %" SDL_PRIu64 ": exiting!\n", SDL_GetCurrentThreadID()); + SDL_Log("Reader Thread %" SDL_PRIu64 ": exiting!", SDL_GetCurrentThreadID()); return 0; } @@ -132,7 +132,7 @@ int main(int argc, char *argv[]) /* Load the SDL library */ if (!SDL_Init(0)) { - SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "%s\n", SDL_GetError()); + SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "%s", SDL_GetError()); return 1; } @@ -140,20 +140,20 @@ int main(int argc, char *argv[]) rwlock = SDL_CreateRWLock(); if (!rwlock) { - SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't create rwlock: %s\n", SDL_GetError()); + SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't create rwlock: %s", SDL_GetError()); SDL_Quit(); SDLTest_CommonDestroyState(state); return 1; } mainthread = SDL_GetCurrentThreadID(); - SDL_Log("Writer thread: %" SDL_PRIu64 "\n", mainthread); + SDL_Log("Writer thread: %" SDL_PRIu64, mainthread); for (i = 0; i < nb_threads; ++i) { char name[64]; (void)SDL_snprintf(name, sizeof(name), "Reader%d", i); threads[i] = SDL_CreateThread(ReaderRun, name, NULL); if (threads[i] == NULL) { - SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't create reader thread! %s\n", SDL_GetError()); + SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't create reader thread! %s", SDL_GetError()); } } diff --git a/test/testscale.c b/test/testscale.c index 4082a455e829a..571817fac4953 100644 --- a/test/testscale.c +++ b/test/testscale.c @@ -153,7 +153,7 @@ int main(int argc, char *argv[]) now = SDL_GetTicks(); if (now > then) { double fps = ((double)frames * 1000) / (now - then); - SDL_Log("%2.2f frames per second\n", fps); + SDL_Log("%2.2f frames per second", fps); } SDL_stack_free(drawstates); diff --git a/test/testsem.c b/test/testsem.c index a8390c4e3f0a5..78de533029594 100644 --- a/test/testsem.c +++ b/test/testsem.c @@ -53,16 +53,16 @@ ThreadFuncRealWorld(void *data) Thread_State *state = (Thread_State *)data; while (alive) { SDL_WaitSemaphore(sem); - SDL_Log("Thread number %d has got the semaphore (value = %" SDL_PRIu32 ")!\n", + SDL_Log("Thread number %d has got the semaphore (value = %" SDL_PRIu32 ")!", state->number, SDL_GetSemaphoreValue(sem)); SDL_Delay(200); SDL_SignalSemaphore(sem); - SDL_Log("Thread number %d has released the semaphore (value = %" SDL_PRIu32 ")!\n", + SDL_Log("Thread number %d has released the semaphore (value = %" SDL_PRIu32 ")!", state->number, SDL_GetSemaphoreValue(sem)); ++state->loop_count; SDL_Delay(1); /* For the scheduler */ } - SDL_Log("Thread number %d exiting.\n", state->number); + SDL_Log("Thread number %d exiting.", state->number); return 0; } @@ -75,7 +75,7 @@ TestRealWorld(int init_sem) sem = SDL_CreateSemaphore(init_sem); - SDL_Log("Running %d threads, semaphore value = %d\n", NUM_THREADS, + SDL_Log("Running %d threads, semaphore value = %d", NUM_THREADS, init_sem); alive = 1; /* Create all the threads */ @@ -90,14 +90,15 @@ TestRealWorld(int init_sem) SDL_Delay(10 * 1000); /* Wait for all threads to finish */ - SDL_Log("Waiting for threads to finish\n"); + SDL_Log("Waiting for threads to finish"); alive = 0; loop_count = 0; for (i = 0; i < NUM_THREADS; ++i) { SDL_WaitThread(thread_states[i].thread, NULL); loop_count += thread_states[i].loop_count; } - SDL_Log("Finished waiting for threads, ran %d loops in total\n\n", loop_count); + SDL_Log("Finished waiting for threads, ran %d loops in total", loop_count); + SDL_Log("%s", ""); SDL_DestroySemaphore(sem); } @@ -111,7 +112,7 @@ TestWaitTimeout(void) bool result; sem = SDL_CreateSemaphore(0); - SDL_Log("Waiting 2 seconds on semaphore\n"); + SDL_Log("Waiting 2 seconds on semaphore"); start_ticks = SDL_GetTicks(); result = SDL_WaitSemaphoreTimeout(sem, 2000); @@ -120,12 +121,14 @@ TestWaitTimeout(void) duration = end_ticks - start_ticks; /* Accept a little offset in the effective wait */ - SDL_Log("Wait took %" SDL_PRIu64 " milliseconds\n\n", duration); + SDL_Log("Wait took %" SDL_PRIu64 " milliseconds", duration); + SDL_Log("%s", ""); SDL_assert(duration > 1900 && duration < 2050); /* Check to make sure the return value indicates timed out */ if (result) { - SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "SDL_WaitSemaphoreTimeout returned: %d; expected: false\n\n", result); + SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "SDL_WaitSemaphoreTimeout returned: %d; expected: false", result); + SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "%s", ""); } SDL_DestroySemaphore(sem); @@ -140,7 +143,7 @@ TestOverheadUncontended(void) int i, j; sem = SDL_CreateSemaphore(0); - SDL_Log("Doing %d uncontended Post/Wait operations on semaphore\n", NUM_OVERHEAD_OPS * NUM_OVERHEAD_OPS_MULT); + SDL_Log("Doing %d uncontended Post/Wait operations on semaphore", NUM_OVERHEAD_OPS * NUM_OVERHEAD_OPS_MULT); start_ticks = SDL_GetTicks(); for (i = 0; i < NUM_OVERHEAD_OPS_MULT; i++) { @@ -154,7 +157,8 @@ TestOverheadUncontended(void) end_ticks = SDL_GetTicks(); duration = end_ticks - start_ticks; - SDL_Log("Took %" SDL_PRIu64 " milliseconds\n\n", duration); + SDL_Log("Took %" SDL_PRIu64 " milliseconds", duration); + SDL_Log("%s", ""); SDL_DestroySemaphore(sem); } @@ -197,7 +201,7 @@ TestOverheadContended(bool try_wait) size_t len; sem = SDL_CreateSemaphore(0); - SDL_Log("Doing %d contended %s operations on semaphore using %d threads\n", + SDL_Log("Doing %d contended %s operations on semaphore using %d threads", NUM_OVERHEAD_OPS * NUM_OVERHEAD_OPS_MULT, try_wait ? "Post/TryWait" : "Post/WaitTimeout", NUM_THREADS); alive = 1; /* Create multiple threads to starve the semaphore and cause contention */ @@ -232,7 +236,7 @@ TestOverheadContended(bool try_wait) SDL_assert_release((loop_count - content_count) == NUM_OVERHEAD_OPS * NUM_OVERHEAD_OPS_MULT); duration = end_ticks - start_ticks; - SDL_Log("Took %" SDL_PRIu64 " milliseconds, threads %s %d out of %d times in total (%.2f%%)\n", + SDL_Log("Took %" SDL_PRIu64 " milliseconds, threads %s %d out of %d times in total (%.2f%%)", duration, try_wait ? "where contended" : "timed out", content_count, loop_count, ((float)content_count * 100) / loop_count); /* Print how many semaphores where consumed per thread */ @@ -246,8 +250,8 @@ TestOverheadContended(bool try_wait) (void)SDL_snprintf(textBuffer + len, sizeof(textBuffer) - len, "%d", thread_states[i].loop_count - thread_states[i].content_count); } len = SDL_strlen(textBuffer); - (void)SDL_snprintf(textBuffer + len, sizeof(textBuffer) - len, " }\n"); - SDL_Log("%s\n", textBuffer); + (void)SDL_snprintf(textBuffer + len, sizeof(textBuffer) - len, " }"); + SDL_Log("%s", textBuffer); SDL_DestroySemaphore(sem); } @@ -300,7 +304,7 @@ int main(int argc, char **argv) /* Load the SDL library */ if (!SDL_Init(0)) { - SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't initialize SDL: %s\n", SDL_GetError()); + SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't initialize SDL: %s", SDL_GetError()); return 1; } (void)signal(SIGTERM, killed); diff --git a/test/testsensor.c b/test/testsensor.c index 2574b4e73f8e4..42d1fa6883469 100644 --- a/test/testsensor.c +++ b/test/testsensor.c @@ -39,19 +39,19 @@ static void HandleSensorEvent(SDL_SensorEvent *event) { SDL_Sensor *sensor = SDL_GetSensorFromID(event->which); if (!sensor) { - SDL_Log("Couldn't get sensor for sensor event\n"); + SDL_Log("Couldn't get sensor for sensor event"); return; } switch (SDL_GetSensorType(sensor)) { case SDL_SENSOR_ACCEL: - SDL_Log("Accelerometer update: %.2f, %.2f, %.2f\n", event->data[0], event->data[1], event->data[2]); + SDL_Log("Accelerometer update: %.2f, %.2f, %.2f", event->data[0], event->data[1], event->data[2]); break; case SDL_SENSOR_GYRO: - SDL_Log("Gyro update: %.2f, %.2f, %.2f\n", event->data[0], event->data[1], event->data[2]); + SDL_Log("Gyro update: %.2f, %.2f, %.2f", event->data[0], event->data[1], event->data[2]); break; default: - SDL_Log("Sensor update for sensor type %s\n", GetSensorTypeString(SDL_GetSensorType(sensor))); + SDL_Log("Sensor update for sensor type %s", GetSensorTypeString(SDL_GetSensorType(sensor))); break; } } @@ -76,7 +76,7 @@ int main(int argc, char **argv) /* Load the SDL library */ if (!SDL_Init(SDL_INIT_SENSOR)) { - SDL_Log("Couldn't initialize SDL: %s\n", SDL_GetError()); + SDL_Log("Couldn't initialize SDL: %s", SDL_GetError()); SDL_Quit(); SDLTest_CommonDestroyState(state); return 1; @@ -85,10 +85,10 @@ int main(int argc, char **argv) sensors = SDL_GetSensors(&num_sensors); num_opened = 0; - SDL_Log("There are %d sensors available\n", num_sensors); + SDL_Log("There are %d sensors available", num_sensors); if (sensors) { for (i = 0; i < num_sensors; ++i) { - SDL_Log("Sensor %" SDL_PRIu32 ": %s, type %s, platform type %d\n", + SDL_Log("Sensor %" SDL_PRIu32 ": %s, type %s, platform type %d", sensors[i], SDL_GetSensorNameForID(sensors[i]), GetSensorTypeString(SDL_GetSensorTypeForID(sensors[i])), @@ -97,7 +97,7 @@ int main(int argc, char **argv) if (SDL_GetSensorTypeForID(sensors[i]) != SDL_SENSOR_UNKNOWN) { SDL_Sensor *sensor = SDL_OpenSensor(sensors[i]); if (!sensor) { - SDL_Log("Couldn't open sensor %" SDL_PRIu32 ": %s\n", sensors[i], SDL_GetError()); + SDL_Log("Couldn't open sensor %" SDL_PRIu32 ": %s", sensors[i], SDL_GetError()); } else { ++num_opened; } @@ -105,7 +105,7 @@ int main(int argc, char **argv) } SDL_free(sensors); } - SDL_Log("Opened %d sensors\n", num_opened); + SDL_Log("Opened %d sensors", num_opened); if (num_opened > 0) { bool done = false; diff --git a/test/testshader.c b/test/testshader.c index ca9b0c37cf70c..9b13890bd32cc 100644 --- a/test/testshader.c +++ b/test/testshader.c @@ -145,7 +145,9 @@ static bool CompileShader(GLhandleARB shader, const char *source) SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Out of memory!"); } else { pglGetInfoLogARB(shader, length, NULL, info); - SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Failed to compile shader:\n%s\n%s", source, info); + SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Failed to compile shader:"); + SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "%s", source); + SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "%s", info); SDL_free(info); } return false; @@ -173,7 +175,8 @@ static bool LinkProgram(ShaderData *data) SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Out of memory!"); } else { pglGetInfoLogARB(data->program, length, NULL, info); - SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Failed to link program:\n%s", info); + SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Failed to link program:"); + SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "%s", info); SDL_free(info); } return false; @@ -279,7 +282,7 @@ static bool InitShaders(void) /* Compile all the shaders */ for (i = 0; i < NUM_SHADERS; ++i) { if (!CompileShaderProgram(&shaders[i])) { - SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Unable to compile shader!\n"); + SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Unable to compile shader!"); return false; } } @@ -480,20 +483,20 @@ int main(int argc, char **argv) /* Initialize SDL for video output */ if (!SDL_Init(SDL_INIT_VIDEO)) { - SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Unable to initialize SDL: %s\n", SDL_GetError()); + SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Unable to initialize SDL: %s", SDL_GetError()); exit(1); } /* Create a 640x480 OpenGL screen */ window = SDL_CreateWindow("Shader Demo", 640, 480, SDL_WINDOW_OPENGL); if (!window) { - SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Unable to create OpenGL window: %s\n", SDL_GetError()); + SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Unable to create OpenGL window: %s", SDL_GetError()); SDL_Quit(); exit(2); } if (!SDL_GL_CreateContext(window)) { - SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Unable to create OpenGL context: %s\n", SDL_GetError()); + SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Unable to create OpenGL context: %s", SDL_GetError()); SDL_Quit(); exit(2); } @@ -503,7 +506,7 @@ int main(int argc, char **argv) SDL_free(filename); if (!surface) { - SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Unable to load icon.bmp: %s\n", SDL_GetError()); + SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Unable to load icon.bmp: %s", SDL_GetError()); SDL_Quit(); exit(3); } @@ -513,9 +516,9 @@ int main(int argc, char **argv) /* Loop, drawing and checking events */ InitGL(640, 480); if (InitShaders()) { - SDL_Log("Shaders supported, press SPACE to cycle them.\n"); + SDL_Log("Shaders supported, press SPACE to cycle them."); } else { - SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Shaders not supported!\n"); + SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Shaders not supported!"); } done = 0; while (!done) { @@ -549,7 +552,7 @@ int main(int argc, char **argv) int main(int argc, char *argv[]) { - SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "No OpenGL support on this system\n"); + SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "No OpenGL support on this system"); return 1; } diff --git a/test/testshape.c b/test/testshape.c index dd85b36c725a2..9a884e6aa7a6f 100644 --- a/test/testshape.c +++ b/test/testshape.c @@ -48,7 +48,7 @@ int main(int argc, char *argv[]) } else if (!image_file) { image_file = argv[i]; } else { - SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Usage: %s [--resizable] [shape.bmp]\n", argv[0]); + SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Usage: %s [--resizable] [shape.bmp]", argv[0]); goto quit; } } @@ -56,18 +56,18 @@ int main(int argc, char *argv[]) if (image_file) { shape = SDL_LoadBMP(image_file); if (!shape) { - SDL_Log("Couldn't load %s: %s\n", image_file, SDL_GetError()); + SDL_Log("Couldn't load %s: %s", image_file, SDL_GetError()); goto quit; } } else { SDL_IOStream *stream = SDL_IOFromConstMem(glass_bmp, sizeof(glass_bmp)); if (!stream) { - SDL_Log("Couldn't create iostream for glass.bmp: %s\n", SDL_GetError()); + SDL_Log("Couldn't create iostream for glass.bmp: %s", SDL_GetError()); goto quit; } shape = SDL_LoadBMP_IO(stream, true); if (!shape) { - SDL_Log("Couldn't load glass.bmp: %s\n", SDL_GetError()); + SDL_Log("Couldn't load glass.bmp: %s", SDL_GetError()); goto quit; } } @@ -81,13 +81,13 @@ int main(int argc, char *argv[]) } window = SDL_CreateWindow("SDL Shape Test", shape->w, shape->h, flags); if (!window) { - SDL_Log("Couldn't create transparent window: %s\n", SDL_GetError()); + SDL_Log("Couldn't create transparent window: %s", SDL_GetError()); goto quit; } renderer = SDL_CreateRenderer(window, NULL); if (!renderer) { - SDL_Log("Couldn't create renderer: %s\n", SDL_GetError()); + SDL_Log("Couldn't create renderer: %s", SDL_GetError()); goto quit; } @@ -102,7 +102,7 @@ int main(int argc, char *argv[]) if (!resizable) { /* Set the hit test callback so we can drag the window */ if (!SDL_SetWindowHitTest(window, ShapeHitTest, shape)) { - SDL_Log("Couldn't set hit test callback: %s\n", SDL_GetError()); + SDL_Log("Couldn't set hit test callback: %s", SDL_GetError()); goto quit; } } diff --git a/test/testsprite.c b/test/testsprite.c index e8d8a7dcb4435..2f202d6da9ea2 100644 --- a/test/testsprite.c +++ b/test/testsprite.c @@ -67,7 +67,7 @@ static int LoadSprite(const char *file) return -1; } if (!SDL_SetTextureBlendMode(sprites[i], blendMode)) { - SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't set blend mode: %s\n", SDL_GetError()); + SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't set blend mode: %s", SDL_GetError()); SDL_DestroyTexture(sprites[i]); return -1; } @@ -502,7 +502,7 @@ SDL_AppResult SDL_AppInit(void **appstate, int argc, char *argv[]) sprites = (SDL_Texture **)SDL_malloc(state->num_windows * sizeof(*sprites)); if (!sprites) { - SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Out of memory!\n"); + SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Out of memory!"); return SDL_APP_FAILURE; } for (i = 0; i < state->num_windows; ++i) { @@ -518,7 +518,7 @@ SDL_AppResult SDL_AppInit(void **appstate, int argc, char *argv[]) positions = (SDL_FRect *)SDL_malloc(num_sprites * sizeof(*positions)); velocities = (SDL_FRect *)SDL_malloc(num_sprites * sizeof(*velocities)); if (!positions || !velocities) { - SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Out of memory!\n"); + SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Out of memory!"); return SDL_APP_FAILURE; } @@ -588,7 +588,7 @@ SDL_AppResult SDL_AppIterate(void *appstate) /* Print out some timing information */ const Uint64 then = next_fps_check - fps_check_delay; const double fps = ((double)frames * 1000) / (now - then); - SDL_Log("%2.2f frames per second\n", fps); + SDL_Log("%2.2f frames per second", fps); next_fps_check = now + fps_check_delay; frames = 0; } diff --git a/test/testspriteminimal.c b/test/testspriteminimal.c index 19bb200d230d3..bf2a834d4c294 100644 --- a/test/testspriteminimal.c +++ b/test/testspriteminimal.c @@ -113,7 +113,7 @@ int main(int argc, char *argv[]) int i; if (argc > 1) { - SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "USAGE: %s\n", argv[0]); + SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "USAGE: %s", argv[0]); return_code = 1; goto quit; } diff --git a/test/testspritesurface.c b/test/testspritesurface.c index 80d61a3964e40..68b926d01def6 100644 --- a/test/testspritesurface.c +++ b/test/testspritesurface.c @@ -106,7 +106,7 @@ int main(int argc, char *argv[]) int i; if (argc > 1) { - SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "USAGE: %s\n", argv[0]); + SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "USAGE: %s", argv[0]); return_code = 1; goto quit; } diff --git a/test/teststreaming.c b/test/teststreaming.c index 2ed8c46207899..ea61b0e0b9bf7 100644 --- a/test/teststreaming.c +++ b/test/teststreaming.c @@ -86,7 +86,7 @@ static void UpdateTexture(SDL_Texture *texture) int pitch; if (!SDL_LockTexture(texture, NULL, &pixels, &pitch)) { - SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't lock texture: %s\n", SDL_GetError()); + SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't lock texture: %s", SDL_GetError()); quit(5); } src = MooseFrames[frame]; @@ -152,20 +152,20 @@ int main(int argc, char **argv) } if (!SDL_Init(SDL_INIT_VIDEO)) { - SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't initialize SDL: %s\n", SDL_GetError()); + SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't initialize SDL: %s", SDL_GetError()); return 1; } /* load the moose images */ filename = GetResourceFilename(NULL, "moose.dat"); if (!filename) { - SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Out of memory\n"); + SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Out of memory"); return -1; } handle = SDL_IOFromFile(filename, "rb"); SDL_free(filename); if (!handle) { - SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Can't find the file moose.dat !\n"); + SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Can't find the file moose.dat !"); quit(2); } SDL_ReadIO(handle, MooseFrames, MOOSEFRAME_SIZE * MOOSEFRAMES_COUNT); @@ -174,19 +174,19 @@ int main(int argc, char **argv) /* Create the window and renderer */ window = SDL_CreateWindow("Happy Moose", MOOSEPIC_W * 4, MOOSEPIC_H * 4, SDL_WINDOW_RESIZABLE); if (!window) { - SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't set create window: %s\n", SDL_GetError()); + SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't set create window: %s", SDL_GetError()); quit(3); } renderer = SDL_CreateRenderer(window, NULL); if (!renderer) { - SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't set create renderer: %s\n", SDL_GetError()); + SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't set create renderer: %s", SDL_GetError()); quit(4); } MooseTexture = SDL_CreateTexture(renderer, SDL_PIXELFORMAT_ARGB8888, SDL_TEXTUREACCESS_STREAMING, MOOSEPIC_W, MOOSEPIC_H); if (!MooseTexture) { - SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't set create texture: %s\n", SDL_GetError()); + SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't set create texture: %s", SDL_GetError()); quit(5); } diff --git a/test/testsurround.c b/test/testsurround.c index 0c66163d02cd2..36b33f4c5eb12 100644 --- a/test/testsurround.c +++ b/test/testsurround.c @@ -209,7 +209,7 @@ int main(int argc, char *argv[]) } if (!SDL_Init(SDL_INIT_AUDIO)) { - SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't initialize SDL: %s\n", SDL_GetError()); + SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't initialize SDL: %s", SDL_GetError()); return 1; } @@ -219,11 +219,11 @@ int main(int argc, char *argv[]) SDL_Log("%i: %s", i, SDL_GetAudioDriver(i)); } - SDL_Log("Using audio driver: %s\n", SDL_GetCurrentAudioDriver()); + SDL_Log("Using audio driver: %s", SDL_GetCurrentAudioDriver()); devices = SDL_GetAudioPlaybackDevices(&devcount); if (!devices) { - SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "SDL_GetAudioPlaybackDevices() failed: %s\n", SDL_GetError()); + SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "SDL_GetAudioPlaybackDevices() failed: %s", SDL_GetError()); } SDL_Log("Available audio devices:"); @@ -237,14 +237,14 @@ int main(int argc, char *argv[]) int j; SDL_AudioSpec spec; - SDL_Log("Testing audio device: %s\n", devname); + SDL_Log("Testing audio device: %s", devname); if (!SDL_GetAudioDeviceFormat(devices[i], &spec, NULL)) { - SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "SDL_GetAudioDeviceFormat() failed: %s\n", SDL_GetError()); + SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "SDL_GetAudioDeviceFormat() failed: %s", SDL_GetError()); continue; } - SDL_Log(" (%d channels)\n", spec.channels); + SDL_Log(" (%d channels)", spec.channels); spec.freq = SAMPLE_RATE_HZ; spec.format = SDL_AUDIO_S16; @@ -255,7 +255,7 @@ int main(int argc, char *argv[]) stream = SDL_OpenAudioDeviceStream(devices[i], &spec, fill_buffer, NULL); if (!stream) { - SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "SDL_OpenAudioDeviceStream() failed: %s\n", SDL_GetError()); + SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "SDL_OpenAudioDeviceStream() failed: %s", SDL_GetError()); continue; } SDL_ResumeAudioStreamDevice(stream); @@ -263,7 +263,7 @@ int main(int argc, char *argv[]) for (j = 0; j < total_channels; j++) { const int sine_freq = is_lfe_channel(j, total_channels) ? LFE_SINE_FREQ_HZ : SINE_FREQ_HZ; - SDL_Log("Playing %d Hz test tone on channel: %s\n", sine_freq, get_channel_name(j, total_channels)); + SDL_Log("Playing %d Hz test tone on channel: %s", sine_freq, get_channel_name(j, total_channels)); /* fill_buffer() will increment the active channel */ if (SDL_GetEnvironmentVariable(SDL_GetEnvironment(), "SDL_TESTS_QUICK") != NULL) { diff --git a/test/testthread.c b/test/testthread.c index 5a4c47814a10f..70710eacbcfb0 100644 --- a/test/testthread.c +++ b/test/testthread.c @@ -60,13 +60,13 @@ ThreadFunc(void *data) SDL_ThreadPriority prio = SDL_THREAD_PRIORITY_NORMAL; SDL_SetTLS(&tls, "baby thread", NULL); - SDL_Log("Started thread %s: My thread id is %" SDL_PRIu64 ", thread data = %s\n", + SDL_Log("Started thread %s: My thread id is %" SDL_PRIu64 ", thread data = %s", (char *)data, SDL_GetCurrentThreadID(), (const char *)SDL_GetTLS(&tls)); while (SDL_GetAtomicInt(&alive)) { - SDL_Log("Thread '%s' is alive!\n", (char *)data); + SDL_Log("Thread '%s' is alive!", (char *)data); if (testprio) { - SDL_Log("SDL_SetCurrentThreadPriority(%s):%d\n", getprioritystr(prio), SDL_SetCurrentThreadPriority(prio)); + SDL_Log("SDL_SetCurrentThreadPriority(%s):%d", getprioritystr(prio), SDL_SetCurrentThreadPriority(prio)); if (++prio > SDL_THREAD_PRIORITY_TIME_CRITICAL) { prio = SDL_THREAD_PRIORITY_LOW; } @@ -74,14 +74,14 @@ ThreadFunc(void *data) SDL_Delay(1 * 1000); } - SDL_Log("Thread '%s' exiting!\n", (char *)data); + SDL_Log("Thread '%s' exiting!", (char *)data); return 0; } static void killed(int sig) { - SDL_Log("Killed with SIGTERM, waiting 5 seconds to exit\n"); + SDL_Log("Killed with SIGTERM, waiting 5 seconds to exit"); SDL_Delay(5 * 1000); SDL_SetAtomicInt(&alive, 0); SDL_WaitThread(thread, NULL); @@ -120,7 +120,7 @@ int main(int argc, char *argv[]) /* Load the SDL library */ if (!SDL_Init(0)) { - SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't initialize SDL: %s\n", SDL_GetError()); + SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't initialize SDL: %s", SDL_GetError()); return 1; } @@ -131,26 +131,26 @@ int main(int argc, char *argv[]) } SDL_SetTLS(&tls, "main thread", NULL); - SDL_Log("Main thread data initially: %s\n", (const char *)SDL_GetTLS(&tls)); + SDL_Log("Main thread data initially: %s", (const char *)SDL_GetTLS(&tls)); SDL_SetAtomicInt(&alive, 1); thread = SDL_CreateThread(ThreadFunc, "One", "#1"); if (!thread) { - SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't create thread: %s\n", SDL_GetError()); + SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't create thread: %s", SDL_GetError()); quit(1); } SDL_Delay(5 * 1000); - SDL_Log("Waiting for thread #1\n"); + SDL_Log("Waiting for thread #1"); SDL_SetAtomicInt(&alive, 0); SDL_WaitThread(thread, NULL); - SDL_Log("Main thread data finally: %s\n", (const char *)SDL_GetTLS(&tls)); + SDL_Log("Main thread data finally: %s", (const char *)SDL_GetTLS(&tls)); SDL_SetAtomicInt(&alive, 1); (void)signal(SIGTERM, killed); thread = SDL_CreateThread(ThreadFunc, "Two", "#2"); if (!thread) { - SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't create thread: %s\n", SDL_GetError()); + SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't create thread: %s", SDL_GetError()); quit(1); } (void)raise(SIGTERM); diff --git a/test/testtimer.c b/test/testtimer.c index f099a8f485f93..0f12dce721d12 100644 --- a/test/testtimer.c +++ b/test/testtimer.c @@ -68,7 +68,7 @@ callback(void *param, SDL_TimerID timerID, Uint32 interval) { int value = (int)(uintptr_t)param; SDL_assert( value == 1 || value == 2 || value == 3 ); - SDL_Log("Timer %" SDL_PRIu32 " : param = %d\n", interval, value); + SDL_Log("Timer %" SDL_PRIu32 " : param = %d", interval, value); return interval; } @@ -123,13 +123,13 @@ int main(int argc, char *argv[]) } /* Verify SDL_GetTicks* acts monotonically increasing, and not erratic. */ - SDL_Log("Sanity-checking GetTicks\n"); + SDL_Log("Sanity-checking GetTicks"); for (i = 0; i < 1000; ++i) { start = SDL_GetTicks(); SDL_Delay(1); now = SDL_GetTicks() - start; if (now > 100) { - SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "testtimer.c: Delta time erratic at iter %d. Delay 1ms = %d ms in ticks\n", i, (int)now); + SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "testtimer.c: Delta time erratic at iter %d. Delay 1ms = %d ms in ticks", i, (int)now); SDL_Quit(); return 1; } @@ -143,7 +143,7 @@ int main(int argc, char *argv[]) t1 = SDL_AddTimer(desired, ticktock, NULL); /* Wait 1 seconds */ - SDL_Log("Waiting 1 seconds for millisecond timer\n"); + SDL_Log("Waiting 1 seconds for millisecond timer"); SDL_Delay(1 * 1000); /* Stop the timer */ @@ -151,7 +151,7 @@ int main(int argc, char *argv[]) /* Print the results */ if (ticks) { - SDL_Log("Millisecond timer resolution: desired = %d ms, actual = %f ms\n", + SDL_Log("Millisecond timer resolution: desired = %d ms, actual = %f ms", desired, (double)(10 * 1000) / ticks); } @@ -163,7 +163,7 @@ int main(int argc, char *argv[]) t1 = SDL_AddTimerNS(desired, ticktockNS, NULL); /* Wait 1 seconds */ - SDL_Log("Waiting 1 seconds for nanosecond timer\n"); + SDL_Log("Waiting 1 seconds for nanosecond timer"); SDL_Delay(1 * 1000); /* Stop the timer */ @@ -171,7 +171,7 @@ int main(int argc, char *argv[]) /* Print the results */ if (ticks) { - SDL_Log("Nanosecond timer resolution: desired = %d ns, actual = %f ns\n", + SDL_Log("Nanosecond timer resolution: desired = %d ns, actual = %f ns", desired, (double)(10 * 1000000) / ticks); } @@ -188,9 +188,9 @@ int main(int argc, char *argv[]) SDL_DelayNS(1); now = SDL_GetTicksNS(); actual_delay = (now - start); - SDL_Log("Minimum nanosecond delay: %" SDL_PRIu64 " ns\n", actual_delay); + SDL_Log("Minimum nanosecond delay: %" SDL_PRIu64 " ns", actual_delay); - SDL_Log("Timing 100 frames at 60 FPS\n"); + SDL_Log("Timing 100 frames at 60 FPS"); for (i = 0; i < 100; ++i) { start = SDL_GetTicksNS(); SDL_DelayNS(desired_delay); @@ -200,7 +200,7 @@ int main(int argc, char *argv[]) total_overslept += (actual_delay - desired_delay); } } - SDL_Log("Overslept %.2f ms\n", (double)total_overslept / SDL_NS_PER_MS); + SDL_Log("Overslept %.2f ms", (double)total_overslept / SDL_NS_PER_MS); } /* Wait for the results to be seen */ @@ -216,9 +216,9 @@ int main(int argc, char *argv[]) SDL_DelayPrecise(1); now = SDL_GetTicksNS(); actual_delay = (now - start); - SDL_Log("Minimum precise delay: %" SDL_PRIu64 " ns\n", actual_delay); + SDL_Log("Minimum precise delay: %" SDL_PRIu64 " ns", actual_delay); - SDL_Log("Timing 100 frames at 60 FPS\n"); + SDL_Log("Timing 100 frames at 60 FPS"); for (i = 0; i < 100; ++i) { start = SDL_GetTicksNS(); SDL_DelayPrecise(desired_delay); @@ -228,32 +228,32 @@ int main(int argc, char *argv[]) total_overslept += (actual_delay - desired_delay); } } - SDL_Log("Overslept %.2f ms\n", (double)total_overslept / SDL_NS_PER_MS); + SDL_Log("Overslept %.2f ms", (double)total_overslept / SDL_NS_PER_MS); } /* Wait for the results to be seen */ SDL_Delay(1 * 1000); /* Test multiple timers */ - SDL_Log("Testing multiple timers...\n"); + SDL_Log("Testing multiple timers..."); t1 = SDL_AddTimer(100, callback, (void *)1); if (!t1) { - SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Could not create timer 1: %s\n", SDL_GetError()); + SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Could not create timer 1: %s", SDL_GetError()); } t2 = SDL_AddTimer(50, callback, (void *)2); if (!t2) { - SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Could not create timer 2: %s\n", SDL_GetError()); + SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Could not create timer 2: %s", SDL_GetError()); } t3 = SDL_AddTimer(233, callback, (void *)3); if (!t3) { - SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Could not create timer 3: %s\n", SDL_GetError()); + SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Could not create timer 3: %s", SDL_GetError()); } /* Wait 3 seconds */ - SDL_Log("Waiting 3 seconds\n"); + SDL_Log("Waiting 3 seconds"); SDL_Delay(3 * 1000); - SDL_Log("Removing timer 1 and waiting 3 more seconds\n"); + SDL_Log("Removing timer 1 and waiting 3 more seconds"); SDL_RemoveTimer(t1); SDL_Delay(3 * 1000); @@ -267,15 +267,15 @@ int main(int argc, char *argv[]) ticktock(NULL, 0, 0); } now_perf = SDL_GetPerformanceCounter(); - SDL_Log("1 million iterations of ticktock took %f ms\n", (double)((now_perf - start_perf) * 1000) / SDL_GetPerformanceFrequency()); + SDL_Log("1 million iterations of ticktock took %f ms", (double)((now_perf - start_perf) * 1000) / SDL_GetPerformanceFrequency()); - SDL_Log("Performance counter frequency: %" SDL_PRIu64 "\n", SDL_GetPerformanceFrequency()); + SDL_Log("Performance counter frequency: %" SDL_PRIu64, SDL_GetPerformanceFrequency()); start = SDL_GetTicks(); start_perf = SDL_GetPerformanceCounter(); SDL_Delay(1000); now_perf = SDL_GetPerformanceCounter(); now = SDL_GetTicks(); - SDL_Log("Delay 1 second = %d ms in ticks, %f ms according to performance counter\n", (int)(now - start), (double)((now_perf - start_perf) * 1000) / SDL_GetPerformanceFrequency()); + SDL_Log("Delay 1 second = %d ms in ticks, %f ms according to performance counter", (int)(now - start), (double)((now_perf - start_perf) * 1000) / SDL_GetPerformanceFrequency()); if (run_interactive_tests) { return_code = test_sdl_delay_within_bounds(); diff --git a/test/testtray.c b/test/testtray.c index f3cf8ba406402..fdb12daf28d72 100644 --- a/test/testtray.c +++ b/test/testtray.c @@ -52,7 +52,7 @@ static void SDLCALL change_icon(void *ptr, SDL_TrayEntry *entry) static void SDLCALL print_entry(void *ptr, SDL_TrayEntry *entry) { - SDL_Log("Clicked on button '%s'\n", SDL_GetTrayEntryLabel(entry)); + SDL_Log("Clicked on button '%s'", SDL_GetTrayEntryLabel(entry)); } static void SDLCALL set_entry_enabled(void *ptr, SDL_TrayEntry *entry) @@ -88,7 +88,7 @@ static void SDLCALL remove_entry(void *ptr, SDL_TrayEntry *entry) SDL_TrayEntry *ctrl_entry = SDL_GetTrayMenuParentEntry(ctrl_submenu); if (!ctrl_entry) { - SDL_Log("Attempt to remove a menu that isn't a submenu. This shouldn't happen.\n"); + SDL_Log("Attempt to remove a menu that isn't a submenu. This shouldn't happen."); return; } @@ -108,7 +108,7 @@ static void SDLCALL append_button_to(void *ptr, SDL_TrayEntry *entry) new_ctrl = SDL_InsertTrayEntryAt(SDL_GetTrayEntryParent(entry), -1, "New button", SDL_TRAYENTRY_SUBMENU); if (!new_ctrl) { - SDL_Log("Couldn't insert entry in control tray: %s\n", SDL_GetError()); + SDL_Log("Couldn't insert entry in control tray: %s", SDL_GetError()); return; } @@ -117,7 +117,7 @@ static void SDLCALL append_button_to(void *ptr, SDL_TrayEntry *entry) submenu = SDL_CreateTraySubmenu(new_ctrl); if (!new_ctrl) { - SDL_Log("Couldn't create control tray entry submenu: %s\n", SDL_GetError()); + SDL_Log("Couldn't create control tray entry submenu: %s", SDL_GetError()); SDL_RemoveTrayEntry(new_ctrl); return; } @@ -127,7 +127,7 @@ static void SDLCALL append_button_to(void *ptr, SDL_TrayEntry *entry) new_example = SDL_InsertTrayEntryAt(menu, -1, "New button", SDL_TRAYENTRY_BUTTON); if (new_example == NULL) { - SDL_Log("Couldn't insert entry in example tray: %s\n", SDL_GetError()); + SDL_Log("Couldn't insert entry in example tray: %s", SDL_GetError()); SDL_RemoveTrayEntry(new_ctrl); return; } @@ -139,7 +139,7 @@ static void SDLCALL append_button_to(void *ptr, SDL_TrayEntry *entry) new_ctrl_remove = SDL_InsertTrayEntryAt(submenu, -1, "Remove", SDL_TRAYENTRY_BUTTON); if (new_ctrl_remove == NULL) { - SDL_Log("Couldn't insert new_ctrl_remove: %s\n", SDL_GetError()); + SDL_Log("Couldn't insert new_ctrl_remove: %s", SDL_GetError()); SDL_RemoveTrayEntry(new_ctrl); SDL_RemoveTrayEntry(new_example); return; @@ -152,7 +152,7 @@ static void SDLCALL append_button_to(void *ptr, SDL_TrayEntry *entry) new_ctrl_enabled = SDL_InsertTrayEntryAt(submenu, -1, "Enable", SDL_TRAYENTRY_BUTTON); if (new_ctrl_enabled == NULL) { - SDL_Log("Couldn't insert new_ctrl_enabled: %s\n", SDL_GetError()); + SDL_Log("Couldn't insert new_ctrl_enabled: %s", SDL_GetError()); SDL_RemoveTrayEntry(new_ctrl); SDL_RemoveTrayEntry(new_example); return; @@ -165,7 +165,7 @@ static void SDLCALL append_button_to(void *ptr, SDL_TrayEntry *entry) new_ctrl_disabled = SDL_InsertTrayEntryAt(submenu, -1, "Disable", SDL_TRAYENTRY_BUTTON); if (new_ctrl_disabled == NULL) { - SDL_Log("Couldn't insert new_ctrl_disabled: %s\n", SDL_GetError()); + SDL_Log("Couldn't insert new_ctrl_disabled: %s", SDL_GetError()); SDL_RemoveTrayEntry(new_ctrl); SDL_RemoveTrayEntry(new_example); return; @@ -189,7 +189,7 @@ static void SDLCALL append_checkbox_to(void *ptr, SDL_TrayEntry *entry) new_ctrl = SDL_InsertTrayEntryAt(SDL_GetTrayEntryParent(entry), -1, "New checkbox", SDL_TRAYENTRY_SUBMENU); if (!new_ctrl) { - SDL_Log("Couldn't insert entry in control tray: %s\n", SDL_GetError()); + SDL_Log("Couldn't insert entry in control tray: %s", SDL_GetError()); return; } @@ -198,7 +198,7 @@ static void SDLCALL append_checkbox_to(void *ptr, SDL_TrayEntry *entry) submenu = SDL_CreateTraySubmenu(new_ctrl); if (!new_ctrl) { - SDL_Log("Couldn't create control tray entry submenu: %s\n", SDL_GetError()); + SDL_Log("Couldn't create control tray entry submenu: %s", SDL_GetError()); SDL_RemoveTrayEntry(new_ctrl); return; } @@ -208,7 +208,7 @@ static void SDLCALL append_checkbox_to(void *ptr, SDL_TrayEntry *entry) new_example = SDL_InsertTrayEntryAt(menu, -1, "New checkbox", SDL_TRAYENTRY_CHECKBOX); if (new_example == NULL) { - SDL_Log("Couldn't insert entry in example tray: %s\n", SDL_GetError()); + SDL_Log("Couldn't insert entry in example tray: %s", SDL_GetError()); SDL_RemoveTrayEntry(new_ctrl); return; } @@ -220,7 +220,7 @@ static void SDLCALL append_checkbox_to(void *ptr, SDL_TrayEntry *entry) new_ctrl_remove = SDL_InsertTrayEntryAt(submenu, -1, "Remove", SDL_TRAYENTRY_BUTTON); if (new_ctrl_remove == NULL) { - SDL_Log("Couldn't insert new_ctrl_remove: %s\n", SDL_GetError()); + SDL_Log("Couldn't insert new_ctrl_remove: %s", SDL_GetError()); SDL_RemoveTrayEntry(new_ctrl); SDL_RemoveTrayEntry(new_example); return; @@ -233,7 +233,7 @@ static void SDLCALL append_checkbox_to(void *ptr, SDL_TrayEntry *entry) new_ctrl_enabled = SDL_InsertTrayEntryAt(submenu, -1, "Enable", SDL_TRAYENTRY_BUTTON); if (new_ctrl_enabled == NULL) { - SDL_Log("Couldn't insert new_ctrl_enabled: %s\n", SDL_GetError()); + SDL_Log("Couldn't insert new_ctrl_enabled: %s", SDL_GetError()); SDL_RemoveTrayEntry(new_ctrl); SDL_RemoveTrayEntry(new_example); return; @@ -246,7 +246,7 @@ static void SDLCALL append_checkbox_to(void *ptr, SDL_TrayEntry *entry) new_ctrl_disabled = SDL_InsertTrayEntryAt(submenu, -1, "Disable", SDL_TRAYENTRY_BUTTON); if (new_ctrl_disabled == NULL) { - SDL_Log("Couldn't insert new_ctrl_disabled: %s\n", SDL_GetError()); + SDL_Log("Couldn't insert new_ctrl_disabled: %s", SDL_GetError()); SDL_RemoveTrayEntry(new_ctrl); SDL_RemoveTrayEntry(new_example); return; @@ -259,7 +259,7 @@ static void SDLCALL append_checkbox_to(void *ptr, SDL_TrayEntry *entry) new_ctrl_checked = SDL_InsertTrayEntryAt(submenu, -1, "Check", SDL_TRAYENTRY_BUTTON); if (new_ctrl_checked == NULL) { - SDL_Log("Couldn't insert new_ctrl_checked: %s\n", SDL_GetError()); + SDL_Log("Couldn't insert new_ctrl_checked: %s", SDL_GetError()); SDL_RemoveTrayEntry(new_ctrl); SDL_RemoveTrayEntry(new_example); return; @@ -272,7 +272,7 @@ static void SDLCALL append_checkbox_to(void *ptr, SDL_TrayEntry *entry) new_ctrl_unchecked = SDL_InsertTrayEntryAt(submenu, -1, "Uncheck", SDL_TRAYENTRY_BUTTON); if (new_ctrl_unchecked == NULL) { - SDL_Log("Couldn't insert new_ctrl_unchecked: %s\n", SDL_GetError()); + SDL_Log("Couldn't insert new_ctrl_unchecked: %s", SDL_GetError()); SDL_RemoveTrayEntry(new_ctrl); SDL_RemoveTrayEntry(new_example); return; @@ -292,7 +292,7 @@ static void SDLCALL append_separator_to(void *ptr, SDL_TrayEntry *entry) new_ctrl = SDL_InsertTrayEntryAt(SDL_GetTrayEntryParent(entry), -1, "[Separator]", SDL_TRAYENTRY_SUBMENU); if (!new_ctrl) { - SDL_Log("Couldn't insert entry in control tray: %s\n", SDL_GetError()); + SDL_Log("Couldn't insert entry in control tray: %s", SDL_GetError()); return; } @@ -301,7 +301,7 @@ static void SDLCALL append_separator_to(void *ptr, SDL_TrayEntry *entry) submenu = SDL_CreateTraySubmenu(new_ctrl); if (!new_ctrl) { - SDL_Log("Couldn't create control tray entry submenu: %s\n", SDL_GetError()); + SDL_Log("Couldn't create control tray entry submenu: %s", SDL_GetError()); SDL_RemoveTrayEntry(new_ctrl); return; } @@ -311,7 +311,7 @@ static void SDLCALL append_separator_to(void *ptr, SDL_TrayEntry *entry) new_example = SDL_InsertTrayEntryAt(menu, -1, NULL, SDL_TRAYENTRY_BUTTON); if (new_example == NULL) { - SDL_Log("Couldn't insert separator in example tray: %s\n", SDL_GetError()); + SDL_Log("Couldn't insert separator in example tray: %s", SDL_GetError()); SDL_RemoveTrayEntry(new_ctrl); return; } @@ -321,7 +321,7 @@ static void SDLCALL append_separator_to(void *ptr, SDL_TrayEntry *entry) new_ctrl_remove = SDL_InsertTrayEntryAt(submenu, -1, "Remove", SDL_TRAYENTRY_BUTTON); if (new_ctrl_remove == NULL) { - SDL_Log("Couldn't insert new_ctrl_remove: %s\n", SDL_GetError()); + SDL_Log("Couldn't insert new_ctrl_remove: %s", SDL_GetError()); SDL_RemoveTrayEntry(new_ctrl); SDL_RemoveTrayEntry(new_example); return; @@ -344,7 +344,7 @@ static void SDLCALL append_submenu_to(void *ptr, SDL_TrayEntry *entry) new_ctrl = SDL_InsertTrayEntryAt(SDL_GetTrayEntryParent(entry), -1, "New submenu", SDL_TRAYENTRY_SUBMENU); if (!new_ctrl) { - SDL_Log("Couldn't insert entry in control tray: %s\n", SDL_GetError()); + SDL_Log("Couldn't insert entry in control tray: %s", SDL_GetError()); return; } @@ -353,7 +353,7 @@ static void SDLCALL append_submenu_to(void *ptr, SDL_TrayEntry *entry) submenu = SDL_CreateTraySubmenu(new_ctrl); if (!new_ctrl) { - SDL_Log("Couldn't create control tray entry submenu: %s\n", SDL_GetError()); + SDL_Log("Couldn't create control tray entry submenu: %s", SDL_GetError()); SDL_RemoveTrayEntry(new_ctrl); return; } @@ -363,7 +363,7 @@ static void SDLCALL append_submenu_to(void *ptr, SDL_TrayEntry *entry) new_example = SDL_InsertTrayEntryAt(menu, -1, "New submenu", SDL_TRAYENTRY_SUBMENU); if (new_example == NULL) { - SDL_Log("Couldn't insert entry in example tray: %s\n", SDL_GetError()); + SDL_Log("Couldn't insert entry in example tray: %s", SDL_GetError()); SDL_RemoveTrayEntry(new_ctrl); return; } @@ -375,7 +375,7 @@ static void SDLCALL append_submenu_to(void *ptr, SDL_TrayEntry *entry) entry_submenu = SDL_CreateTraySubmenu(new_example); if (entry_submenu == NULL) { - SDL_Log("Couldn't create new entry submenu: %s\n", SDL_GetError()); + SDL_Log("Couldn't create new entry submenu: %s", SDL_GetError()); SDL_RemoveTrayEntry(new_ctrl); SDL_RemoveTrayEntry(new_example); return; @@ -386,7 +386,7 @@ static void SDLCALL append_submenu_to(void *ptr, SDL_TrayEntry *entry) new_ctrl_remove = SDL_InsertTrayEntryAt(submenu, -1, "Remove", SDL_TRAYENTRY_BUTTON); if (new_ctrl_remove == NULL) { - SDL_Log("Couldn't insert new_ctrl_remove: %s\n", SDL_GetError()); + SDL_Log("Couldn't insert new_ctrl_remove: %s", SDL_GetError()); SDL_RemoveTrayEntry(new_ctrl); SDL_RemoveTrayEntry(new_example); return; @@ -399,7 +399,7 @@ static void SDLCALL append_submenu_to(void *ptr, SDL_TrayEntry *entry) new_ctrl_enabled = SDL_InsertTrayEntryAt(submenu, -1, "Enable", SDL_TRAYENTRY_BUTTON); if (new_ctrl_enabled == NULL) { - SDL_Log("Couldn't insert new_ctrl_enabled: %s\n", SDL_GetError()); + SDL_Log("Couldn't insert new_ctrl_enabled: %s", SDL_GetError()); SDL_RemoveTrayEntry(new_ctrl); SDL_RemoveTrayEntry(new_example); return; @@ -412,7 +412,7 @@ static void SDLCALL append_submenu_to(void *ptr, SDL_TrayEntry *entry) new_ctrl_disabled = SDL_InsertTrayEntryAt(submenu, -1, "Disable", SDL_TRAYENTRY_BUTTON); if (new_ctrl_disabled == NULL) { - SDL_Log("Couldn't insert new_ctrl_disabled: %s\n", SDL_GetError()); + SDL_Log("Couldn't insert new_ctrl_disabled: %s", SDL_GetError()); SDL_RemoveTrayEntry(new_ctrl); SDL_RemoveTrayEntry(new_example); return; @@ -429,7 +429,7 @@ static void SDLCALL append_submenu_to(void *ptr, SDL_TrayEntry *entry) SDL_TrayEntry *entry_newbtn = SDL_InsertTrayEntryAt(submenu, -1, "Create button", SDL_TRAYENTRY_BUTTON); if (entry_newbtn == NULL) { - SDL_Log("Couldn't insert entry_newbtn: %s\n", SDL_GetError()); + SDL_Log("Couldn't insert entry_newbtn: %s", SDL_GetError()); SDL_RemoveTrayEntry(new_ctrl); SDL_RemoveTrayEntry(new_example); return; @@ -442,7 +442,7 @@ static void SDLCALL append_submenu_to(void *ptr, SDL_TrayEntry *entry) SDL_TrayEntry *entry_newchk = SDL_InsertTrayEntryAt(submenu, -1, "Create checkbox", SDL_TRAYENTRY_BUTTON); if (entry_newchk == NULL) { - SDL_Log("Couldn't insert entry_newchk: %s\n", SDL_GetError()); + SDL_Log("Couldn't insert entry_newchk: %s", SDL_GetError()); SDL_RemoveTrayEntry(new_ctrl); SDL_RemoveTrayEntry(new_example); return; @@ -455,7 +455,7 @@ static void SDLCALL append_submenu_to(void *ptr, SDL_TrayEntry *entry) SDL_TrayEntry *entry_newsub = SDL_InsertTrayEntryAt(submenu, -1, "Create submenu", SDL_TRAYENTRY_BUTTON); if (entry_newsub == NULL) { - SDL_Log("Couldn't insert entry_newsub: %s\n", SDL_GetError()); + SDL_Log("Couldn't insert entry_newsub: %s", SDL_GetError()); SDL_RemoveTrayEntry(new_ctrl); SDL_RemoveTrayEntry(new_example); return; @@ -468,7 +468,7 @@ static void SDLCALL append_submenu_to(void *ptr, SDL_TrayEntry *entry) SDL_TrayEntry *entry_newsep = SDL_InsertTrayEntryAt(submenu, -1, "Create separator", SDL_TRAYENTRY_BUTTON); if (entry_newsep == NULL) { - SDL_Log("Couldn't insert entry_newsep: %s\n", SDL_GetError()); + SDL_Log("Couldn't insert entry_newsep: %s", SDL_GetError()); SDL_RemoveTrayEntry(new_ctrl); SDL_RemoveTrayEntry(new_example); return; diff --git a/test/testurl.c b/test/testurl.c index 3f4b2231fc063..cc2cb61c41f52 100644 --- a/test/testurl.c +++ b/test/testurl.c @@ -26,7 +26,7 @@ int main(int argc, char **argv) { int i; if (!SDL_Init(SDL_INIT_VIDEO)) { - SDL_Log("SDL_Init failed: %s\n", SDL_GetError()); + SDL_Log("SDL_Init failed: %s", SDL_GetError()); return 1; } diff --git a/test/testutils.c b/test/testutils.c index 6ca778dc928f6..ab044bf21c2c4 100644 --- a/test/testutils.c +++ b/test/testutils.c @@ -127,7 +127,7 @@ SDL_Texture *LoadTexture(SDL_Renderer *renderer, const char *file, bool transpar texture = SDL_CreateTextureFromSurface(renderer, temp); if (!texture) { - SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't create texture: %s\n", SDL_GetError()); + SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't create texture: %s", SDL_GetError()); } } SDL_DestroySurface(temp); diff --git a/test/testver.c b/test/testver.c index bed2a6a6d3728..b8730384432c9 100644 --- a/test/testver.c +++ b/test/testver.c @@ -25,15 +25,15 @@ int main(int argc, char *argv[]) } #if SDL_VERSION_ATLEAST(3, 0, 0) - SDL_Log("Compiled with SDL 3.0 or newer\n"); + SDL_Log("Compiled with SDL 3.0 or newer"); #else - SDL_Log("Compiled with SDL older than 3.0\n"); + SDL_Log("Compiled with SDL older than 3.0"); #endif - SDL_Log("Compiled version: %d.%d.%d (%s)\n", + SDL_Log("Compiled version: %d.%d.%d (%s)", SDL_MAJOR_VERSION, SDL_MINOR_VERSION, SDL_MICRO_VERSION, SDL_REVISION); int version = SDL_GetVersion(); - SDL_Log("Runtime version: %d.%d.%d (%s)\n", + SDL_Log("Runtime version: %d.%d.%d (%s)", SDL_VERSIONNUM_MAJOR(version), SDL_VERSIONNUM_MINOR(version), SDL_VERSIONNUM_MICRO(version), SDL_GetRevision()); SDL_Quit(); diff --git a/test/testviewport.c b/test/testviewport.c index 904cc9018e99b..7554100a1e36e 100644 --- a/test/testviewport.c +++ b/test/testviewport.c @@ -227,7 +227,7 @@ int main(int argc, char *argv[]) now = SDL_GetTicks(); if (now > then) { double fps = ((double)frames * 1000) / (now - then); - SDL_Log("%2.2f frames per second\n", fps); + SDL_Log("%2.2f frames per second", fps); } quit(0); return 0; diff --git a/test/testvulkan.c b/test/testvulkan.c index 9d9d80a041be7..e4437e50abc67 100644 --- a/test/testvulkan.c +++ b/test/testvulkan.c @@ -18,7 +18,7 @@ int main(int argc, char *argv[]) { - SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "No Vulkan support on this system\n"); + SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "No Vulkan support on this system"); return 1; } @@ -264,7 +264,7 @@ static void createSurface(void) { if (!SDL_Vulkan_CreateSurface(vulkanContext->window, vulkanContext->instance, NULL, &vulkanContext->surface)) { vulkanContext->surface = VK_NULL_HANDLE; - SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "SDL_Vulkan_CreateSurface(): %s\n", SDL_GetError()); + SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "SDL_Vulkan_CreateSurface(): %s", SDL_GetError()); quit(2); } } @@ -478,7 +478,7 @@ static void createDevice(void) result = vkCreateDevice(vulkanContext->physicalDevice, &deviceCreateInfo, NULL, &vulkanContext->device); if (result != VK_SUCCESS) { vulkanContext->device = VK_NULL_HANDLE; - SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "vkCreateDevice(): %s\n", getVulkanResultString(result)); + SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "vkCreateDevice(): %s", getVulkanResultString(result)); quit(2); } } @@ -1040,12 +1040,12 @@ static bool render(void) } rc = vkWaitForFences(vulkanContext->device, 1, &vulkanContext->fences[frameIndex], VK_FALSE, UINT64_MAX); if (rc != VK_SUCCESS) { - SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "vkWaitForFences(): %s\n", getVulkanResultString(rc)); + SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "vkWaitForFences(): %s", getVulkanResultString(rc)); quit(2); } rc = vkResetFences(vulkanContext->device, 1, &vulkanContext->fences[frameIndex]); if (rc != VK_SUCCESS) { - SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "vkResetFences(): %s\n", getVulkanResultString(rc)); + SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "vkResetFences(): %s", getVulkanResultString(rc)); quit(2); } currentTime = (double)SDL_GetPerformanceCounter() / SDL_GetPerformanceFrequency(); @@ -1065,7 +1065,7 @@ static bool render(void) rc = vkQueueSubmit(vulkanContext->graphicsQueue, 1, &submitInfo, vulkanContext->fences[frameIndex]); if (rc != VK_SUCCESS) { - SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "vkQueueSubmit(): %s\n", getVulkanResultString(rc)); + SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "vkQueueSubmit(): %s", getVulkanResultString(rc)); quit(2); } presentInfo.sType = VK_STRUCTURE_TYPE_PRESENT_INFO_KHR; @@ -1118,13 +1118,13 @@ int main(int argc, char **argv) mode = SDL_GetCurrentDisplayMode(SDL_GetPrimaryDisplay()); if (mode) { - SDL_Log("Screen BPP : %d\n", SDL_BITSPERPIXEL(mode->format)); + SDL_Log("Screen BPP : %d", SDL_BITSPERPIXEL(mode->format)); } SDL_GetWindowSize(state->windows[0], &dw, &dh); - SDL_Log("Window Size : %d,%d\n", dw, dh); + SDL_Log("Window Size : %d,%d", dw, dh); SDL_GetWindowSizeInPixels(state->windows[0], &dw, &dh); - SDL_Log("Draw Size : %d,%d\n", dw, dh); - SDL_Log("\n"); + SDL_Log("Draw Size : %d,%d", dw, dh); + SDL_Log("%s", ""); initVulkan(); @@ -1159,7 +1159,7 @@ int main(int argc, char **argv) /* Print out some timing information */ now = SDL_GetTicks(); if (now > then) { - SDL_Log("%2.2f frames per second\n", ((double)frames * 1000) / (now - then)); + SDL_Log("%2.2f frames per second", ((double)frames * 1000) / (now - then)); } shutdownVulkan(true); diff --git a/test/testwm.c b/test/testwm.c index 0d25c0fdfa986..b46ee435c96dc 100644 --- a/test/testwm.c +++ b/test/testwm.c @@ -157,10 +157,10 @@ static void loop(void) /* Wait up to 20 ms for input, as a test */ Uint64 then = SDL_GetTicks(); if (SDL_WaitEventTimeout(NULL, 20)) { - SDL_Log("Got an event!\n"); + SDL_Log("Got an event!"); } Uint64 now = SDL_GetTicks(); - SDL_Log("Waited %d ms for events\n", (int)(now - then)); + SDL_Log("Waited %d ms for events", (int)(now - then)); #endif while (SDL_PollEvent(&event)) { @@ -170,7 +170,7 @@ static void loop(void) if (event.type == SDL_EVENT_WINDOW_RESIZED) { SDL_Window *window = SDL_GetWindowFromEvent(&event); if (window) { - SDL_Log("Window %" SDL_PRIu32 " resized to %" SDL_PRIs32 "x%" SDL_PRIs32 "\n", + SDL_Log("Window %" SDL_PRIu32 " resized to %" SDL_PRIs32 "x%" SDL_PRIs32, event.window.windowID, event.window.data1, event.window.data2); @@ -179,7 +179,7 @@ static void loop(void) if (event.type == SDL_EVENT_WINDOW_MOVED) { SDL_Window *window = SDL_GetWindowFromEvent(&event); if (window) { - SDL_Log("Window %" SDL_PRIu32 " moved to %" SDL_PRIs32 ",%" SDL_PRIs32 " (display %s)\n", + SDL_Log("Window %" SDL_PRIu32 " moved to %" SDL_PRIs32 ",%" SDL_PRIs32 " (display %s)", event.window.windowID, event.window.data1, event.window.data2, diff --git a/test/testyuv.c b/test/testyuv.c index 0cd2823801bef..8dda4c5ec360c 100644 --- a/test/testyuv.c +++ b/test/testyuv.c @@ -89,7 +89,7 @@ static bool verify_yuv_data(Uint32 format, SDL_Colorspace colorspace, const Uint int deltaB = (int)actual[2] - expected[2]; int distance = (deltaR * deltaR + deltaG * deltaG + deltaB * deltaB); if (distance > tolerance) { - SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Pixel at %d,%d was 0x%.2x,0x%.2x,0x%.2x, expected 0x%.2x,0x%.2x,0x%.2x, distance = %d\n", x, y, actual[0], actual[1], actual[2], expected[0], expected[1], expected[2], distance); + SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Pixel at %d,%d was 0x%.2x,0x%.2x,0x%.2x, expected 0x%.2x,0x%.2x,0x%.2x, distance = %d", x, y, actual[0], actual[1], actual[2], expected[0], expected[1], expected[2], distance); result = false; } actual += 3; @@ -97,7 +97,7 @@ static bool verify_yuv_data(Uint32 format, SDL_Colorspace colorspace, const Uint } } } else { - SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't convert %s to %s: %s\n", SDL_GetPixelFormatName(format), SDL_GetPixelFormatName(surface->format), SDL_GetError()); + SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't convert %s to %s: %s", SDL_GetPixelFormatName(format), SDL_GetPixelFormatName(surface->format), SDL_GetError()); } SDL_free(rgb); @@ -138,12 +138,12 @@ static bool run_automated_tests(int pattern_size, int extra_pitch) /* Verify conversion from YUV formats */ for (i = 0; i < SDL_arraysize(formats); ++i) { if (!ConvertRGBtoYUV(formats[i], pattern->pixels, pattern->pitch, yuv1, pattern->w, pattern->h, mode, 0, 100)) { - SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "ConvertRGBtoYUV() doesn't support converting to %s\n", SDL_GetPixelFormatName(formats[i])); + SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "ConvertRGBtoYUV() doesn't support converting to %s", SDL_GetPixelFormatName(formats[i])); goto done; } yuv1_pitch = CalculateYUVPitch(formats[i], pattern->w); if (!verify_yuv_data(formats[i], colorspace, yuv1, yuv1_pitch, pattern, tight_tolerance)) { - SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Failed conversion from %s to RGB\n", SDL_GetPixelFormatName(formats[i])); + SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Failed conversion from %s to RGB", SDL_GetPixelFormatName(formats[i])); goto done; } } @@ -152,11 +152,11 @@ static bool run_automated_tests(int pattern_size, int extra_pitch) for (i = 0; i < SDL_arraysize(formats); ++i) { yuv1_pitch = CalculateYUVPitch(formats[i], pattern->w) + extra_pitch; if (!SDL_ConvertPixelsAndColorspace(pattern->w, pattern->h, pattern->format, SDL_COLORSPACE_SRGB, 0, pattern->pixels, pattern->pitch, formats[i], colorspace, 0, yuv1, yuv1_pitch)) { - SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't convert %s to %s: %s\n", SDL_GetPixelFormatName(pattern->format), SDL_GetPixelFormatName(formats[i]), SDL_GetError()); + SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't convert %s to %s: %s", SDL_GetPixelFormatName(pattern->format), SDL_GetPixelFormatName(formats[i]), SDL_GetError()); goto done; } if (!verify_yuv_data(formats[i], colorspace, yuv1, yuv1_pitch, pattern, tight_tolerance)) { - SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Failed conversion from RGB to %s\n", SDL_GetPixelFormatName(formats[i])); + SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Failed conversion from RGB to %s", SDL_GetPixelFormatName(formats[i])); goto done; } } @@ -167,15 +167,15 @@ static bool run_automated_tests(int pattern_size, int extra_pitch) yuv1_pitch = CalculateYUVPitch(formats[i], pattern->w) + extra_pitch; yuv2_pitch = CalculateYUVPitch(formats[j], pattern->w) + extra_pitch; if (!SDL_ConvertPixelsAndColorspace(pattern->w, pattern->h, pattern->format, SDL_COLORSPACE_SRGB, 0, pattern->pixels, pattern->pitch, formats[i], colorspace, 0, yuv1, yuv1_pitch)) { - SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't convert %s to %s: %s\n", SDL_GetPixelFormatName(pattern->format), SDL_GetPixelFormatName(formats[i]), SDL_GetError()); + SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't convert %s to %s: %s", SDL_GetPixelFormatName(pattern->format), SDL_GetPixelFormatName(formats[i]), SDL_GetError()); goto done; } if (!SDL_ConvertPixelsAndColorspace(pattern->w, pattern->h, formats[i], colorspace, 0, yuv1, yuv1_pitch, formats[j], colorspace, 0, yuv2, yuv2_pitch)) { - SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't convert %s to %s: %s\n", SDL_GetPixelFormatName(formats[i]), SDL_GetPixelFormatName(formats[j]), SDL_GetError()); + SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't convert %s to %s: %s", SDL_GetPixelFormatName(formats[i]), SDL_GetPixelFormatName(formats[j]), SDL_GetError()); goto done; } if (!verify_yuv_data(formats[j], colorspace, yuv2, yuv2_pitch, pattern, tight_tolerance)) { - SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Failed conversion from %s to %s\n", SDL_GetPixelFormatName(formats[i]), SDL_GetPixelFormatName(formats[j])); + SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Failed conversion from %s to %s", SDL_GetPixelFormatName(formats[i]), SDL_GetPixelFormatName(formats[j])); goto done; } } @@ -192,15 +192,15 @@ static bool run_automated_tests(int pattern_size, int extra_pitch) yuv1_pitch = CalculateYUVPitch(formats[i], pattern->w) + extra_pitch; yuv2_pitch = CalculateYUVPitch(formats[j], pattern->w) + extra_pitch; if (!SDL_ConvertPixelsAndColorspace(pattern->w, pattern->h, pattern->format, SDL_COLORSPACE_SRGB, 0, pattern->pixels, pattern->pitch, formats[i], colorspace, 0, yuv1, yuv1_pitch)) { - SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't convert %s to %s: %s\n", SDL_GetPixelFormatName(pattern->format), SDL_GetPixelFormatName(formats[i]), SDL_GetError()); + SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't convert %s to %s: %s", SDL_GetPixelFormatName(pattern->format), SDL_GetPixelFormatName(formats[i]), SDL_GetError()); goto done; } if (!SDL_ConvertPixelsAndColorspace(pattern->w, pattern->h, formats[i], colorspace, 0, yuv1, yuv1_pitch, formats[j], colorspace, 0, yuv1, yuv2_pitch)) { - SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't convert %s to %s: %s\n", SDL_GetPixelFormatName(formats[i]), SDL_GetPixelFormatName(formats[j]), SDL_GetError()); + SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't convert %s to %s: %s", SDL_GetPixelFormatName(formats[i]), SDL_GetPixelFormatName(formats[j]), SDL_GetError()); goto done; } if (!verify_yuv_data(formats[j], colorspace, yuv1, yuv2_pitch, pattern, tight_tolerance)) { - SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Failed conversion from %s to %s\n", SDL_GetPixelFormatName(formats[i]), SDL_GetPixelFormatName(formats[j])); + SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Failed conversion from %s to %s", SDL_GetPixelFormatName(formats[i]), SDL_GetPixelFormatName(formats[j])); goto done; } } @@ -209,24 +209,24 @@ static bool run_automated_tests(int pattern_size, int extra_pitch) /* Verify round trip through BT.2020 */ colorspace = SDL_COLORSPACE_BT2020_FULL; if (!ConvertRGBtoYUV(SDL_PIXELFORMAT_P010, pattern->pixels, pattern->pitch, yuv1, pattern->w, pattern->h, YUV_CONVERSION_BT2020, 0, 100)) { - SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "ConvertRGBtoYUV() doesn't support converting to %s\n", SDL_GetPixelFormatName(SDL_PIXELFORMAT_P010)); + SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "ConvertRGBtoYUV() doesn't support converting to %s", SDL_GetPixelFormatName(SDL_PIXELFORMAT_P010)); goto done; } yuv1_pitch = CalculateYUVPitch(SDL_PIXELFORMAT_P010, pattern->w); if (!verify_yuv_data(SDL_PIXELFORMAT_P010, colorspace, yuv1, yuv1_pitch, pattern, tight_tolerance)) { - SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Failed conversion from %s to RGB\n", SDL_GetPixelFormatName(SDL_PIXELFORMAT_P010)); + SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Failed conversion from %s to RGB", SDL_GetPixelFormatName(SDL_PIXELFORMAT_P010)); goto done; } /* The pitch needs to be Uint16 aligned for P010 pixels */ yuv1_pitch = CalculateYUVPitch(SDL_PIXELFORMAT_P010, pattern->w) + ((extra_pitch + 1) & ~1); if (!SDL_ConvertPixelsAndColorspace(pattern->w, pattern->h, pattern->format, SDL_COLORSPACE_SRGB, 0, pattern->pixels, pattern->pitch, SDL_PIXELFORMAT_P010, colorspace, 0, yuv1, yuv1_pitch)) { - SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't convert %s to %s: %s\n", SDL_GetPixelFormatName(pattern->format), SDL_GetPixelFormatName(SDL_PIXELFORMAT_P010), SDL_GetError()); + SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't convert %s to %s: %s", SDL_GetPixelFormatName(pattern->format), SDL_GetPixelFormatName(SDL_PIXELFORMAT_P010), SDL_GetError()); goto done; } /* Going through XRGB2101010 format during P010 conversion is slightly lossy, so use looser tolerance here */ if (!verify_yuv_data(SDL_PIXELFORMAT_P010, colorspace, yuv1, yuv1_pitch, pattern, loose_tolerance)) { - SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Failed conversion from RGB to %s\n", SDL_GetPixelFormatName(SDL_PIXELFORMAT_P010)); + SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Failed conversion from RGB to %s", SDL_GetPixelFormatName(SDL_PIXELFORMAT_P010)); goto done; } @@ -265,13 +265,13 @@ static bool run_colorspace_test(void) int i; if (!SDL_CreateWindowAndRenderer("testyuv", 320, 240, 0, &window, &renderer)) { - SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't create window and renderer: %s\n", SDL_GetError()); + SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't create window and renderer: %s", SDL_GetError()); goto done; } rgb = SDL_CreateSurface(32, 32, SDL_PIXELFORMAT_XRGB8888); if (!rgb) { - SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't create RGB surface: %s\n", SDL_GetError()); + SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't create RGB surface: %s", SDL_GetError()); goto done; } SDL_FillSurfaceRect(rgb, NULL, SDL_MapSurfaceRGB(rgb, 255, 0, 0)); @@ -280,28 +280,28 @@ static bool run_colorspace_test(void) bool next = false; Uint8 r, g, b, a; - SDL_Log("Checking colorspace %s\n", colorspaces[i].name); + SDL_Log("Checking colorspace %s", colorspaces[i].name); yuv = SDL_ConvertSurfaceAndColorspace(rgb, SDL_PIXELFORMAT_NV12, NULL, colorspaces[i].colorspace, 0); if (!yuv) { - SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't create YUV surface: %s\n", SDL_GetError()); + SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't create YUV surface: %s", SDL_GetError()); goto done; } if (!SDL_ReadSurfacePixel(yuv, 0, 0, &r, &g, &b, &a)) { - SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't read YUV surface: %s\n", SDL_GetError()); + SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't read YUV surface: %s", SDL_GetError()); goto done; } if (SDL_abs((int)r - 255) > allowed_error || SDL_abs((int)g - 0) > allowed_error || SDL_abs((int)b - 0) > allowed_error) { - SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Failed color conversion, expected 255,0,0, got %d,%d,%d\n", r, g, b); + SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Failed color conversion, expected 255,0,0, got %d,%d,%d", r, g, b); } texture = SDL_CreateTextureFromSurface(renderer, yuv); if (!texture) { - SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't create YUV texture: %s\n", SDL_GetError()); + SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't create YUV texture: %s", SDL_GetError()); goto done; } @@ -312,14 +312,14 @@ static bool run_colorspace_test(void) yuv = SDL_RenderReadPixels(renderer, NULL); if (!SDL_ReadSurfacePixel(yuv, 0, 0, &r, &g, &b, &a)) { - SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't read YUV surface: %s\n", SDL_GetError()); + SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't read YUV surface: %s", SDL_GetError()); goto done; } if (SDL_abs((int)r - 255) > allowed_error || SDL_abs((int)g - 0) > allowed_error || SDL_abs((int)b - 0) > allowed_error) { - SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Failed renderer color conversion, expected 255,0,0, got %d,%d,%d\n", r, g, b); + SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Failed renderer color conversion, expected 255,0,0, got %d,%d,%d", r, g, b); } while (!next) { @@ -530,7 +530,7 @@ int main(int argc, char **argv) /* Run automated tests */ if (should_run_automated_tests) { for (i = 0; i < (int)SDL_arraysize(automated_test_params); ++i) { - SDL_LogInfo(SDL_LOG_CATEGORY_APPLICATION, "Running automated test, pattern size %d, extra pitch %d, intrinsics %s\n", + SDL_LogInfo(SDL_LOG_CATEGORY_APPLICATION, "Running automated test, pattern size %d, extra pitch %d, intrinsics %s", automated_test_params[i].pattern_size, automated_test_params[i].extra_pitch, automated_test_params[i].enable_intrinsics ? "enabled" : "disabled"); @@ -553,7 +553,7 @@ int main(int argc, char **argv) original = SDL_ConvertSurface(bmp, SDL_PIXELFORMAT_RGB24); SDL_DestroySurface(bmp); if (!original) { - SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't load %s: %s\n", filename, SDL_GetError()); + SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't load %s: %s", filename, SDL_GetError()); return 3; } @@ -586,7 +586,7 @@ int main(int argc, char **argv) converted = SDL_CreateSurface(original->w, original->h, rgb_format); if (!converted) { - SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't create converted surface: %s\n", SDL_GetError()); + SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't create converted surface: %s", SDL_GetError()); return 3; } @@ -595,17 +595,17 @@ int main(int argc, char **argv) SDL_ConvertPixelsAndColorspace(original->w, original->h, yuv_format, yuv_colorspace, 0, raw_yuv, pitch, rgb_format, rgb_colorspace, 0, converted->pixels, converted->pitch); } now = SDL_GetTicks(); - SDL_LogInfo(SDL_LOG_CATEGORY_APPLICATION, "%d iterations in %" SDL_PRIu64 " ms, %.2fms each\n", iterations, (now - then), (float)(now - then) / iterations); + SDL_LogInfo(SDL_LOG_CATEGORY_APPLICATION, "%d iterations in %" SDL_PRIu64 " ms, %.2fms each", iterations, (now - then), (float)(now - then) / iterations); window = SDL_CreateWindow("YUV test", original->w, original->h, 0); if (!window) { - SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't create window: %s\n", SDL_GetError()); + SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't create window: %s", SDL_GetError()); return 4; } renderer = SDL_CreateRenderer(window, NULL); if (!renderer) { - SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't create renderer: %s\n", SDL_GetError()); + SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't create renderer: %s", SDL_GetError()); return 4; } @@ -620,7 +620,7 @@ int main(int argc, char **argv) output[2] = SDL_CreateTextureWithProperties(renderer, props); SDL_DestroyProperties(props); if (!output[0] || !output[1] || !output[2]) { - SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't set create texture: %s\n", SDL_GetError()); + SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't set create texture: %s", SDL_GetError()); return 5; } SDL_UpdateTexture(output[2], NULL, raw_yuv, pitch); diff --git a/test/torturethread.c b/test/torturethread.c index cbc254dc09e2f..a572fe9f3a6ef 100644 --- a/test/torturethread.c +++ b/test/torturethread.c @@ -52,7 +52,7 @@ ThreadFunc(void *data) int i; int tid = (int)(uintptr_t)data; - SDL_Log("Creating Thread %d\n", tid); + SDL_Log("Creating Thread %d", tid); for (i = 0; i < NUMTHREADS; i++) { char name[64]; @@ -61,18 +61,18 @@ ThreadFunc(void *data) sub_threads[i] = SDL_CreateThread(SubThreadFunc, name, &flags[i]); } - SDL_Log("Thread '%d' waiting for signal\n", tid); + SDL_Log("Thread '%d' waiting for signal", tid); while (SDL_GetAtomicInt(&time_for_threads_to_die[tid]) != 1) { ; /* do nothing */ } - SDL_Log("Thread '%d' sending signals to subthreads\n", tid); + SDL_Log("Thread '%d' sending signals to subthreads", tid); for (i = 0; i < NUMTHREADS; i++) { SDL_SetAtomicInt(&flags[i], 1); SDL_WaitThread(sub_threads[i], NULL); } - SDL_Log("Thread '%d' exiting!\n", tid); + SDL_Log("Thread '%d' exiting!", tid); return 0; } @@ -103,7 +103,7 @@ int main(int argc, char *argv[]) threads[i] = SDL_CreateThread(ThreadFunc, name, (void *)(uintptr_t)i); if (threads[i] == NULL) { - SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't create thread: %s\n", SDL_GetError()); + SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't create thread: %s", SDL_GetError()); quit(1); } } From 983cfe8b1cdfced8ae2d9a5ff3078a4615e2ab35 Mon Sep 17 00:00:00 2001 From: Petar Popovic Date: Thu, 23 Jan 2025 18:06:29 +0100 Subject: [PATCH 233/340] Remove even more newlines from log messages --- src/audio/aaudio/SDL_aaudio.c | 8 +- src/audio/alsa/SDL_alsa_audio.c | 6 +- src/joystick/hidapi/SDL_hidapijoystick.c | 2 +- src/video/kmsdrm/SDL_kmsdrmvideo.c | 2 +- src/video/wayland/SDL_waylanddatamanager.c | 4 +- src/video/wayland/SDL_waylandevents.c | 38 +++++----- src/video/windows/SDL_windowskeyboard.c | 38 +++++----- src/video/windows/SDL_windowswindow.c | 72 +++++++++--------- test/testrumble.c | 2 +- test/testvulkan.c | 86 +++++++++++----------- 10 files changed, 129 insertions(+), 129 deletions(-) diff --git a/src/audio/aaudio/SDL_aaudio.c b/src/audio/aaudio/SDL_aaudio.c index 8b1681b4e1086..0339a6158b375 100644 --- a/src/audio/aaudio/SDL_aaudio.c +++ b/src/audio/aaudio/SDL_aaudio.c @@ -102,7 +102,7 @@ static aaudio_data_callback_result_t AAUDIO_dataCallback(AAudioStream *stream, v size_t end = (offset + size) % hidden->mixbuf_bytes; SDL_assert(size <= hidden->mixbuf_bytes); -//LOGI("Recorded %zu frames, %zu available, %zu max (%zu written, %zu read)\n", callback_bytes / framesize, available_bytes / framesize, hidden->mixbuf_bytes / framesize, hidden->callback_bytes / framesize, hidden->processed_bytes / framesize); +//LOGI("Recorded %zu frames, %zu available, %zu max (%zu written, %zu read)", callback_bytes / framesize, available_bytes / framesize, hidden->mixbuf_bytes / framesize, hidden->callback_bytes / framesize, hidden->processed_bytes / framesize); if (offset <= end) { SDL_memcpy(&hidden->mixbuf[offset], input, size); @@ -116,7 +116,7 @@ static aaudio_data_callback_result_t AAUDIO_dataCallback(AAudioStream *stream, v hidden->callback_bytes += size; if (size < callback_bytes) { - LOGI("Audio recording overflow, dropped %zu frames\n", (callback_bytes - size) / framesize); + LOGI("Audio recording overflow, dropped %zu frames", (callback_bytes - size) / framesize); } } else { Uint8 *output = (Uint8 *)audioData; @@ -126,7 +126,7 @@ static aaudio_data_callback_result_t AAUDIO_dataCallback(AAudioStream *stream, v size_t end = (offset + size) % hidden->mixbuf_bytes; SDL_assert(size <= hidden->mixbuf_bytes); -//LOGI("Playing %zu frames, %zu available, %zu max (%zu written, %zu read)\n", callback_bytes / framesize, available_bytes / framesize, hidden->mixbuf_bytes / framesize, hidden->processed_bytes / framesize, hidden->callback_bytes / framesize); +//LOGI("Playing %zu frames, %zu available, %zu max (%zu written, %zu read)", callback_bytes / framesize, available_bytes / framesize, hidden->mixbuf_bytes / framesize, hidden->processed_bytes / framesize, hidden->callback_bytes / framesize); SDL_MemoryBarrierAcquire(); if (offset <= end) { @@ -139,7 +139,7 @@ static aaudio_data_callback_result_t AAUDIO_dataCallback(AAudioStream *stream, v hidden->callback_bytes += size; if (size < callback_bytes) { - LOGI("Audio playback underflow, missed %zu frames\n", (callback_bytes - size) / framesize); + LOGI("Audio playback underflow, missed %zu frames", (callback_bytes - size) / framesize); SDL_memset(&output[size], device->silence_value, (callback_bytes - size)); } } diff --git a/src/audio/alsa/SDL_alsa_audio.c b/src/audio/alsa/SDL_alsa_audio.c index 652a1a5cfa417..633e36440adbb 100644 --- a/src/audio/alsa/SDL_alsa_audio.c +++ b/src/audio/alsa/SDL_alsa_audio.c @@ -923,7 +923,7 @@ static int ALSA_pcm_cfg_hw_chans_n_scan(struct ALSA_pcm_cfg_ctx *ctx, unsigned i return CHANS_N_NOT_CONFIGURED; } - LOGDEBUG("target chans_n is %u\n", target_chans_n); + LOGDEBUG("target chans_n is %u", target_chans_n); int status = ALSA_snd_pcm_hw_params_any(ctx->device->hidden->pcm, ctx->hwparams); if (status < 0) { @@ -1050,7 +1050,7 @@ static int ALSA_pcm_cfg_hw_chans_n_scan(struct ALSA_pcm_cfg_ctx *ctx, unsigned i static bool ALSA_pcm_cfg_hw(struct ALSA_pcm_cfg_ctx *ctx) { - LOGDEBUG("target chans_n, equal or above requested chans_n mode\n"); + LOGDEBUG("target chans_n, equal or above requested chans_n mode"); int status = ALSA_pcm_cfg_hw_chans_n_scan(ctx, CHANS_N_SCAN_MODE__EQUAL_OR_ABOVE_REQUESTED_CHANS_N); if (status < 0) { // something went too wrong return false; @@ -1059,7 +1059,7 @@ static bool ALSA_pcm_cfg_hw(struct ALSA_pcm_cfg_ctx *ctx) } // Here, status == CHANS_N_NOT_CONFIGURED - LOGDEBUG("target chans_n, below requested chans_n mode\n"); + LOGDEBUG("target chans_n, below requested chans_n mode"); status = ALSA_pcm_cfg_hw_chans_n_scan(ctx, CHANS_N_SCAN_MODE__BELOW_REQUESTED_CHANS_N); if (status < 0) { // something went too wrong return false; diff --git a/src/joystick/hidapi/SDL_hidapijoystick.c b/src/joystick/hidapi/SDL_hidapijoystick.c index d1f34eef6a729..30bae026fd325 100644 --- a/src/joystick/hidapi/SDL_hidapijoystick.c +++ b/src/joystick/hidapi/SDL_hidapijoystick.c @@ -458,7 +458,7 @@ static void HIDAPI_SetupDeviceDriver(SDL_HIDAPI_Device *device, bool *removed) S if (dev == NULL) { SDL_LogDebug(SDL_LOG_CATEGORY_INPUT, - "HIDAPI_SetupDeviceDriver() couldn't open %s: %s\n", + "HIDAPI_SetupDeviceDriver() couldn't open %s: %s", device->path, SDL_GetError()); return; } diff --git a/src/video/kmsdrm/SDL_kmsdrmvideo.c b/src/video/kmsdrm/SDL_kmsdrmvideo.c index 1d25b8d0f0742..a6f3730a6a212 100644 --- a/src/video/kmsdrm/SDL_kmsdrmvideo.c +++ b/src/video/kmsdrm/SDL_kmsdrmvideo.c @@ -163,7 +163,7 @@ static int get_driindex(void) close(drm_fd); } else { SDL_LogDebug(SDL_LOG_CATEGORY_VIDEO, - "Failed to open KMSDRM device %s, errno: %d\n", device, errno); + "Failed to open KMSDRM device %s, errno: %d", device, errno); } } } diff --git a/src/video/wayland/SDL_waylanddatamanager.c b/src/video/wayland/SDL_waylanddatamanager.c index 8c75e3d06d41a..d9b1b91e6c55c 100644 --- a/src/video/wayland/SDL_waylanddatamanager.c +++ b/src/video/wayland/SDL_waylanddatamanager.c @@ -382,7 +382,7 @@ void *Wayland_data_offer_receive(SDL_WaylandDataOffer *offer, close(pipefd[0]); } SDL_LogTrace(SDL_LOG_CATEGORY_INPUT, - ". In Wayland_data_offer_receive for '%s', buffer (%ld) at %p\n", + ". In Wayland_data_offer_receive for '%s', buffer (%ld) at %p", mime_type, *length, buffer); return buffer; } @@ -418,7 +418,7 @@ void *Wayland_primary_selection_offer_receive(SDL_WaylandPrimarySelectionOffer * close(pipefd[0]); } SDL_LogTrace(SDL_LOG_CATEGORY_INPUT, - ". In Wayland_primary_selection_offer_receive for '%s', buffer (%ld) at %p\n", + ". In Wayland_primary_selection_offer_receive for '%s', buffer (%ld) at %p", mime_type, *length, buffer); return buffer; } diff --git a/src/video/wayland/SDL_waylandevents.c b/src/video/wayland/SDL_waylandevents.c index c6260b863bfb9..c63721ec3d92a 100644 --- a/src/video/wayland/SDL_waylandevents.c +++ b/src/video/wayland/SDL_waylandevents.c @@ -2179,7 +2179,7 @@ static void data_offer_handle_offer(void *data, struct wl_data_offer *wl_data_of SDL_WaylandDataOffer *offer = data; Wayland_data_offer_add_mime(offer, mime_type); SDL_LogTrace(SDL_LOG_CATEGORY_INPUT, - ". In wl_data_offer_listener . data_offer_handle_offer on data_offer 0x%08x for MIME '%s'\n", + ". In wl_data_offer_listener . data_offer_handle_offer on data_offer 0x%08x for MIME '%s'", (wl_data_offer ? WAYLAND_wl_proxy_get_id((struct wl_proxy *)wl_data_offer) : -1), mime_type); } @@ -2188,7 +2188,7 @@ static void data_offer_handle_source_actions(void *data, struct wl_data_offer *w uint32_t source_actions) { SDL_LogTrace(SDL_LOG_CATEGORY_INPUT, - ". In wl_data_offer_listener . data_offer_handle_source_actions on data_offer 0x%08x for Source Actions '%d'\n", + ". In wl_data_offer_listener . data_offer_handle_source_actions on data_offer 0x%08x for Source Actions '%d'", (wl_data_offer ? WAYLAND_wl_proxy_get_id((struct wl_proxy *)wl_data_offer) : -1), source_actions); } @@ -2197,7 +2197,7 @@ static void data_offer_handle_actions(void *data, struct wl_data_offer *wl_data_ uint32_t dnd_action) { SDL_LogTrace(SDL_LOG_CATEGORY_INPUT, - ". In wl_data_offer_listener . data_offer_handle_actions on data_offer 0x%08x for DND Actions '%d'\n", + ". In wl_data_offer_listener . data_offer_handle_actions on data_offer 0x%08x for DND Actions '%d'", (wl_data_offer ? WAYLAND_wl_proxy_get_id((struct wl_proxy *)wl_data_offer) : -1), dnd_action); } @@ -2214,7 +2214,7 @@ static void primary_selection_offer_handle_offer(void *data, struct zwp_primary_ SDL_WaylandPrimarySelectionOffer *offer = data; Wayland_primary_selection_offer_add_mime(offer, mime_type); SDL_LogTrace(SDL_LOG_CATEGORY_INPUT, - ". In zwp_primary_selection_offer_v1_listener . primary_selection_offer_handle_offer on primary_selection_offer 0x%08x for MIME '%s'\n", + ". In zwp_primary_selection_offer_v1_listener . primary_selection_offer_handle_offer on primary_selection_offer 0x%08x for MIME '%s'", (zwp_primary_selection_offer_v1 ? WAYLAND_wl_proxy_get_id((struct wl_proxy *)zwp_primary_selection_offer_v1) : -1), mime_type); } @@ -2234,7 +2234,7 @@ static void data_device_handle_data_offer(void *data, struct wl_data_device *wl_ wl_data_offer_set_user_data(id, data_offer); wl_data_offer_add_listener(id, &data_offer_listener, data_offer); SDL_LogTrace(SDL_LOG_CATEGORY_INPUT, - ". In wl_data_device_listener . data_device_handle_data_offer on data_offer 0x%08x\n", + ". In wl_data_device_listener . data_device_handle_data_offer on data_offer 0x%08x", (id ? WAYLAND_wl_proxy_get_id((struct wl_proxy *)id) : -1)); } } @@ -2292,25 +2292,25 @@ static void data_device_handle_enter(void *data, struct wl_data_device *wl_data_ const float dy = (float)wl_fixed_to_double(y); SDL_SendDropPosition(data_device->dnd_window, dx, dy); SDL_LogTrace(SDL_LOG_CATEGORY_INPUT, - ". In wl_data_device_listener . data_device_handle_enter on data_offer 0x%08x at %d x %d into window %d for serial %d\n", + ". In wl_data_device_listener . data_device_handle_enter on data_offer 0x%08x at %d x %d into window %d for serial %d", WAYLAND_wl_proxy_get_id((struct wl_proxy *)id), wl_fixed_to_int(x), wl_fixed_to_int(y), SDL_GetWindowID(data_device->dnd_window), serial); } else { data_device->dnd_window = NULL; SDL_LogTrace(SDL_LOG_CATEGORY_INPUT, - ". In wl_data_device_listener . data_device_handle_enter on data_offer 0x%08x at %d x %d for serial %d\n", + ". In wl_data_device_listener . data_device_handle_enter on data_offer 0x%08x at %d x %d for serial %d", WAYLAND_wl_proxy_get_id((struct wl_proxy *)id), wl_fixed_to_int(x), wl_fixed_to_int(y), serial); } } else { SDL_LogTrace(SDL_LOG_CATEGORY_INPUT, - ". In wl_data_device_listener . data_device_handle_enter on data_offer 0x%08x at %d x %d for serial %d\n", + ". In wl_data_device_listener . data_device_handle_enter on data_offer 0x%08x at %d x %d for serial %d", WAYLAND_wl_proxy_get_id((struct wl_proxy *)id), wl_fixed_to_int(x), wl_fixed_to_int(y), serial); } } else { SDL_LogTrace(SDL_LOG_CATEGORY_INPUT, - ". In wl_data_device_listener . data_device_handle_enter on data_offer 0x%08x at %d x %d for serial %d\n", + ". In wl_data_device_listener . data_device_handle_enter on data_offer 0x%08x at %d x %d for serial %d", -1, wl_fixed_to_int(x), wl_fixed_to_int(y), serial); } } @@ -2323,12 +2323,12 @@ static void data_device_handle_leave(void *data, struct wl_data_device *wl_data_ if (data_device->dnd_window) { SDL_SendDropComplete(data_device->dnd_window); SDL_LogTrace(SDL_LOG_CATEGORY_INPUT, - ". In wl_data_device_listener . data_device_handle_leave on data_offer 0x%08x from window %d for serial %d\n", + ". In wl_data_device_listener . data_device_handle_leave on data_offer 0x%08x from window %d for serial %d", WAYLAND_wl_proxy_get_id((struct wl_proxy *)data_device->drag_offer->offer), SDL_GetWindowID(data_device->dnd_window), data_device->drag_serial); } else { SDL_LogTrace(SDL_LOG_CATEGORY_INPUT, - ". In wl_data_device_listener . data_device_handle_leave on data_offer 0x%08x for serial %d\n", + ". In wl_data_device_listener . data_device_handle_leave on data_offer 0x%08x for serial %d", WAYLAND_wl_proxy_get_id((struct wl_proxy *)data_device->drag_offer->offer), data_device->drag_serial); } @@ -2336,7 +2336,7 @@ static void data_device_handle_leave(void *data, struct wl_data_device *wl_data_ data_device->drag_offer = NULL; } else { SDL_LogTrace(SDL_LOG_CATEGORY_INPUT, - ". In wl_data_device_listener . data_device_handle_leave on data_offer 0x%08x for serial %d\n", + ". In wl_data_device_listener . data_device_handle_leave on data_offer 0x%08x for serial %d", -1, -1); } data_device->has_mime_file = false; @@ -2358,13 +2358,13 @@ static void data_device_handle_motion(void *data, struct wl_data_device *wl_data */ SDL_SendDropPosition(data_device->dnd_window, dx, dy); SDL_LogTrace(SDL_LOG_CATEGORY_INPUT, - ". In wl_data_device_listener . data_device_handle_motion on data_offer 0x%08x at %d x %d in window %d serial %d\n", + ". In wl_data_device_listener . data_device_handle_motion on data_offer 0x%08x at %d x %d in window %d serial %d", WAYLAND_wl_proxy_get_id((struct wl_proxy *)data_device->drag_offer->offer), wl_fixed_to_int(x), wl_fixed_to_int(y), SDL_GetWindowID(data_device->dnd_window), data_device->drag_serial); } else { SDL_LogTrace(SDL_LOG_CATEGORY_INPUT, - ". In wl_data_device_listener . data_device_handle_motion on data_offer 0x%08x at %d x %d serial %d\n", + ". In wl_data_device_listener . data_device_handle_motion on data_offer 0x%08x at %d x %d serial %d", -1, wl_fixed_to_int(x), wl_fixed_to_int(y), -1); } } @@ -2375,7 +2375,7 @@ static void data_device_handle_drop(void *data, struct wl_data_device *wl_data_d if (data_device->drag_offer && data_device->dnd_window && (data_device->has_mime_file || data_device->has_mime_text)) { SDL_LogTrace(SDL_LOG_CATEGORY_INPUT, - ". In wl_data_device_listener . data_device_handle_drop on data_offer 0x%08x in window %d serial %d\n", + ". In wl_data_device_listener . data_device_handle_drop on data_offer 0x%08x in window %d serial %d", WAYLAND_wl_proxy_get_id((struct wl_proxy *)data_device->drag_offer->offer), SDL_GetWindowID(data_device->dnd_window), data_device->drag_serial); // TODO: SDL Support more mime types @@ -2457,7 +2457,7 @@ static void data_device_handle_drop(void *data, struct wl_data_device *wl_data_d } } else { SDL_LogTrace(SDL_LOG_CATEGORY_INPUT, - ". In wl_data_device_listener . data_device_handle_drop on data_offer 0x%08x serial %d\n", + ". In wl_data_device_listener . data_device_handle_drop on data_offer 0x%08x serial %d", -1, -1); } @@ -2511,7 +2511,7 @@ static void data_device_handle_selection(void *data, struct wl_data_device *wl_d } SDL_LogTrace(SDL_LOG_CATEGORY_INPUT, - ". In data_device_listener . data_device_handle_selection on data_offer 0x%08x\n", + ". In data_device_listener . data_device_handle_selection on data_offer 0x%08x", (id ? WAYLAND_wl_proxy_get_id((struct wl_proxy *)id) : -1)); if (data_device->selection_offer != offer) { Wayland_data_offer_destroy(data_device->selection_offer); @@ -2542,7 +2542,7 @@ static void primary_selection_device_handle_offer(void *data, struct zwp_primary zwp_primary_selection_offer_v1_add_listener(id, &primary_selection_offer_listener, primary_selection_offer); } SDL_LogTrace(SDL_LOG_CATEGORY_INPUT, - ". In zwp_primary_selection_device_v1_listener . primary_selection_device_handle_offer on primary_selection_offer 0x%08x\n", + ". In zwp_primary_selection_device_v1_listener . primary_selection_device_handle_offer on primary_selection_offer 0x%08x", (id ? WAYLAND_wl_proxy_get_id((struct wl_proxy *)id) : -1)); } @@ -2561,7 +2561,7 @@ static void primary_selection_device_handle_selection(void *data, struct zwp_pri primary_selection_device->selection_offer = offer; } SDL_LogTrace(SDL_LOG_CATEGORY_INPUT, - ". In zwp_primary_selection_device_v1_listener . primary_selection_device_handle_selection on primary_selection_offer 0x%08x\n", + ". In zwp_primary_selection_device_v1_listener . primary_selection_device_handle_selection on primary_selection_offer 0x%08x", (id ? WAYLAND_wl_proxy_get_id((struct wl_proxy *)id) : -1)); notifyFromMimes(offer ? &offer->mimes : NULL); diff --git a/src/video/windows/SDL_windowskeyboard.c b/src/video/windows/SDL_windowskeyboard.c index 5f934e021ee0c..75e8ad4a2895b 100644 --- a/src/video/windows/SDL_windowskeyboard.c +++ b/src/video/windows/SDL_windowskeyboard.c @@ -741,7 +741,7 @@ static void IME_GetCompositionString(SDL_VideoData *videodata, HIMC himc, DWORD videodata->ime_cursor = LOWORD(ImmGetCompositionStringW(himc, GCS_CURSORPOS, 0, 0)); videodata->ime_selected_start = 0; videodata->ime_selected_length = 0; - SDL_DebugIMELog("Cursor = %d\n", videodata->ime_cursor); + SDL_DebugIMELog("Cursor = %d", videodata->ime_cursor); length = ImmGetCompositionStringW(himc, string, NULL, 0); if (length > 0 && videodata->ime_composition_length < length) { @@ -786,7 +786,7 @@ static void IME_GetCompositionString(SDL_VideoData *videodata, HIMC himc, DWORD } for (LONG i = 0; i < length; ++i) { - SDL_DebugIMELog("attrib[%d] = %d\n", i, attributes[i]); + SDL_DebugIMELog("attrib[%d] = %d", i, attributes[i]); } for (start = 0; start < length; ++start) { @@ -987,7 +987,7 @@ bool WIN_HandleIMEMessage(HWND hwnd, UINT msg, WPARAM wParam, LPARAM *lParam, SD HIMC himc = 0; if (msg == WM_IME_SETCONTEXT) { - SDL_DebugIMELog("WM_IME_SETCONTEXT\n"); + SDL_DebugIMELog("WM_IME_SETCONTEXT"); LPARAM element_mask; if (videodata->ime_internal_composition && videodata->ime_internal_candidates) { @@ -1013,35 +1013,35 @@ bool WIN_HandleIMEMessage(HWND hwnd, UINT msg, WPARAM wParam, LPARAM *lParam, SD switch (msg) { case WM_KEYDOWN: if (wParam == VK_PROCESSKEY) { - SDL_DebugIMELog("WM_KEYDOWN VK_PROCESSKEY\n"); + SDL_DebugIMELog("WM_KEYDOWN VK_PROCESSKEY"); trap = true; } else { - SDL_DebugIMELog("WM_KEYDOWN normal\n"); + SDL_DebugIMELog("WM_KEYDOWN normal"); } break; case WM_INPUTLANGCHANGE: - SDL_DebugIMELog("WM_INPUTLANGCHANGE\n"); + SDL_DebugIMELog("WM_INPUTLANGCHANGE"); IME_InputLangChanged(videodata); break; case WM_IME_STARTCOMPOSITION: - SDL_DebugIMELog("WM_IME_STARTCOMPOSITION\n"); + SDL_DebugIMELog("WM_IME_STARTCOMPOSITION"); if (videodata->ime_internal_composition) { trap = true; } break; case WM_IME_COMPOSITION: - SDL_DebugIMELog("WM_IME_COMPOSITION %x\n", lParam); + SDL_DebugIMELog("WM_IME_COMPOSITION %x", lParam); if (videodata->ime_internal_composition) { trap = true; himc = ImmGetContext(hwnd); if (*lParam & GCS_RESULTSTR) { - SDL_DebugIMELog("GCS_RESULTSTR\n"); + SDL_DebugIMELog("GCS_RESULTSTR"); IME_GetCompositionString(videodata, himc, GCS_RESULTSTR); IME_SendClearComposition(videodata); IME_SendInputEvent(videodata); } if (*lParam & GCS_COMPSTR) { - SDL_DebugIMELog("GCS_COMPSTR\n"); + SDL_DebugIMELog("GCS_COMPSTR"); videodata->ime_readingstring[0] = 0; IME_GetCompositionString(videodata, himc, GCS_COMPSTR); IME_SendEditingEvent(videodata); @@ -1050,7 +1050,7 @@ bool WIN_HandleIMEMessage(HWND hwnd, UINT msg, WPARAM wParam, LPARAM *lParam, SD } break; case WM_IME_ENDCOMPOSITION: - SDL_DebugIMELog("WM_IME_ENDCOMPOSITION\n"); + SDL_DebugIMELog("WM_IME_ENDCOMPOSITION"); if (videodata->ime_internal_composition) { trap = true; videodata->ime_composition[0] = 0; @@ -1062,32 +1062,32 @@ bool WIN_HandleIMEMessage(HWND hwnd, UINT msg, WPARAM wParam, LPARAM *lParam, SD } break; case WM_IME_NOTIFY: - SDL_DebugIMELog("WM_IME_NOTIFY %x\n", wParam); + SDL_DebugIMELog("WM_IME_NOTIFY %x", wParam); switch (wParam) { case IMN_SETCOMPOSITIONWINDOW: - SDL_DebugIMELog("IMN_SETCOMPOSITIONWINDOW\n"); + SDL_DebugIMELog("IMN_SETCOMPOSITIONWINDOW"); break; case IMN_SETCOMPOSITIONFONT: - SDL_DebugIMELog("IMN_SETCOMPOSITIONFONT\n"); + SDL_DebugIMELog("IMN_SETCOMPOSITIONFONT"); break; case IMN_SETCANDIDATEPOS: - SDL_DebugIMELog("IMN_SETCANDIDATEPOS\n"); + SDL_DebugIMELog("IMN_SETCANDIDATEPOS"); break; case IMN_SETCONVERSIONMODE: case IMN_SETOPENSTATUS: - SDL_DebugIMELog("%s\n", wParam == IMN_SETCONVERSIONMODE ? "IMN_SETCONVERSIONMODE" : "IMN_SETOPENSTATUS"); + SDL_DebugIMELog("%s", wParam == IMN_SETCONVERSIONMODE ? "IMN_SETCONVERSIONMODE" : "IMN_SETOPENSTATUS"); IME_UpdateInputLocale(videodata); break; case IMN_OPENCANDIDATE: case IMN_CHANGECANDIDATE: - SDL_DebugIMELog("%s\n", wParam == IMN_OPENCANDIDATE ? "IMN_OPENCANDIDATE" : "IMN_CHANGECANDIDATE"); + SDL_DebugIMELog("%s", wParam == IMN_OPENCANDIDATE ? "IMN_OPENCANDIDATE" : "IMN_CHANGECANDIDATE"); if (videodata->ime_internal_candidates) { trap = true; videodata->ime_update_candidates = true; } break; case IMN_CLOSECANDIDATE: - SDL_DebugIMELog("IMN_CLOSECANDIDATE\n"); + SDL_DebugIMELog("IMN_CLOSECANDIDATE"); if (videodata->ime_internal_candidates) { trap = true; videodata->ime_update_candidates = false; @@ -1097,7 +1097,7 @@ bool WIN_HandleIMEMessage(HWND hwnd, UINT msg, WPARAM wParam, LPARAM *lParam, SD case IMN_PRIVATE: { DWORD dwId = IME_GetId(videodata, 0); - SDL_DebugIMELog("IMN_PRIVATE %u\n", dwId); + SDL_DebugIMELog("IMN_PRIVATE %u", dwId); IME_GetReadingString(videodata, hwnd); switch (dwId) { case IMEID_CHT_VER42: diff --git a/src/video/windows/SDL_windowswindow.c b/src/video/windows/SDL_windowswindow.c index 1711fc0a597c0..bb3f3cf6907ab 100644 --- a/src/video/windows/SDL_windowswindow.c +++ b/src/video/windows/SDL_windowswindow.c @@ -1862,16 +1862,16 @@ static STDMETHODIMP SDLDropTarget_DragEnter(SDLDropTarget *target, POINTL pt, DWORD *pdwEffect) { SDL_LogTrace(SDL_LOG_CATEGORY_INPUT, - ". In DragEnter at %ld, %ld\n", pt.x, pt.y); + ". In DragEnter at %ld, %ld", pt.x, pt.y); *pdwEffect = DROPEFFECT_COPY; POINT pnt = { pt.x, pt.y }; if (ScreenToClient(target->hwnd, &pnt)) { SDL_LogTrace(SDL_LOG_CATEGORY_INPUT, - ". In DragEnter at %ld, %ld => window %u at %ld, %ld\n", pt.x, pt.y, target->window->id, pnt.x, pnt.y); + ". In DragEnter at %ld, %ld => window %u at %ld, %ld", pt.x, pt.y, target->window->id, pnt.x, pnt.y); SDL_SendDropPosition(target->window, pnt.x, pnt.y); } else { SDL_LogTrace(SDL_LOG_CATEGORY_INPUT, - ". In DragEnter at %ld, %ld => nil, nil\n", pt.x, pt.y); + ". In DragEnter at %ld, %ld => nil, nil", pt.x, pt.y); } return S_OK; } @@ -1881,16 +1881,16 @@ static STDMETHODIMP SDLDropTarget_DragOver(SDLDropTarget *target, POINTL pt, DWORD *pdwEffect) { SDL_LogTrace(SDL_LOG_CATEGORY_INPUT, - ". In DragOver at %ld, %ld\n", pt.x, pt.y); + ". In DragOver at %ld, %ld", pt.x, pt.y); *pdwEffect = DROPEFFECT_COPY; POINT pnt = { pt.x, pt.y }; if (ScreenToClient(target->hwnd, &pnt)) { SDL_LogTrace(SDL_LOG_CATEGORY_INPUT, - ". In DragOver at %ld, %ld => window %u at %ld, %ld\n", pt.x, pt.y, target->window->id, pnt.x, pnt.y); + ". In DragOver at %ld, %ld => window %u at %ld, %ld", pt.x, pt.y, target->window->id, pnt.x, pnt.y); SDL_SendDropPosition(target->window, pnt.x, pnt.y); } else { SDL_LogTrace(SDL_LOG_CATEGORY_INPUT, - ". In DragOver at %ld, %ld => nil, nil\n", pt.x, pt.y); + ". In DragOver at %ld, %ld => nil, nil", pt.x, pt.y); } return S_OK; } @@ -1898,7 +1898,7 @@ static STDMETHODIMP SDLDropTarget_DragOver(SDLDropTarget *target, static STDMETHODIMP SDLDropTarget_DragLeave(SDLDropTarget *target) { SDL_LogTrace(SDL_LOG_CATEGORY_INPUT, - ". In DragLeave\n"); + ". In DragLeave"); SDL_SendDropComplete(target->window); return S_OK; } @@ -1911,11 +1911,11 @@ static STDMETHODIMP SDLDropTarget_Drop(SDLDropTarget *target, POINT pnt = { pt.x, pt.y }; if (ScreenToClient(target->hwnd, &pnt)) { SDL_LogTrace(SDL_LOG_CATEGORY_INPUT, - ". In Drop at %ld, %ld => window %u at %ld, %ld\n", pt.x, pt.y, target->window->id, pnt.x, pnt.y); + ". In Drop at %ld, %ld => window %u at %ld, %ld", pt.x, pt.y, target->window->id, pnt.x, pnt.y); SDL_SendDropPosition(target->window, pnt.x, pnt.y); } else { SDL_LogTrace(SDL_LOG_CATEGORY_INPUT, - ". In Drop at %ld, %ld => nil, nil\n", pt.x, pt.y); + ". In Drop at %ld, %ld => nil, nil", pt.x, pt.y); } { @@ -1923,7 +1923,7 @@ static STDMETHODIMP SDLDropTarget_Drop(SDLDropTarget *target, HRESULT hres; hres = pDataObject->lpVtbl->EnumFormatEtc(pDataObject, DATADIR_GET, &pEnumFormatEtc); SDL_LogTrace(SDL_LOG_CATEGORY_INPUT, - ". In Drop for EnumFormatEtc, HRESULT is %08lx\n", hres); + ". In Drop for EnumFormatEtc, HRESULT is %08lx", hres); if (hres == S_OK) { FORMATETC fetc; while (pEnumFormatEtc->lpVtbl->Next(pEnumFormatEtc, 1, &fetc, NULL) == S_OK) { @@ -1931,10 +1931,10 @@ static STDMETHODIMP SDLDropTarget_Drop(SDLDropTarget *target, const char *cfnm = SDLGetClipboardFormatName(fetc.cfFormat, name, 256); if (cfnm) { SDL_LogTrace(SDL_LOG_CATEGORY_INPUT, - ". In Drop, Supported format is %08x, '%s'\n", fetc.cfFormat, cfnm); + ". In Drop, Supported format is %08x, '%s'", fetc.cfFormat, cfnm); } else { SDL_LogTrace(SDL_LOG_CATEGORY_INPUT, - ". In Drop, Supported format is %08x, Predefined\n", fetc.cfFormat); + ". In Drop, Supported format is %08x, Predefined", fetc.cfFormat); } } } @@ -1950,18 +1950,18 @@ static STDMETHODIMP SDLDropTarget_Drop(SDLDropTarget *target, const char *format_mime = "text/uri-list"; if (SUCCEEDED(pDataObject->lpVtbl->QueryGetData(pDataObject, &fetc))) { SDL_LogTrace(SDL_LOG_CATEGORY_INPUT, - ". In Drop File for QueryGetData, format %08x '%s', success\n", + ". In Drop File for QueryGetData, format %08x '%s', success", fetc.cfFormat, format_mime); STGMEDIUM med; HRESULT hres = pDataObject->lpVtbl->GetData(pDataObject, &fetc, &med); SDL_LogTrace(SDL_LOG_CATEGORY_INPUT, - ". In Drop File for GetData, format %08x '%s', HRESULT is %08lx\n", + ". In Drop File for GetData, format %08x '%s', HRESULT is %08lx", fetc.cfFormat, format_mime, hres); if (SUCCEEDED(hres)) { const size_t bsize = GlobalSize(med.hGlobal); const void *buffer = (void *)GlobalLock(med.hGlobal); SDL_LogTrace(SDL_LOG_CATEGORY_INPUT, - ". In Drop File for GlobalLock, format %08x '%s', memory (%lu) %p\n", + ". In Drop File for GlobalLock, format %08x '%s', memory (%lu) %p", fetc.cfFormat, format_mime, (unsigned long)bsize, buffer); if (buffer) { char *text = (char *)SDL_malloc(bsize + sizeof(Uint32)); @@ -1972,7 +1972,7 @@ static STDMETHODIMP SDLDropTarget_Drop(SDLDropTarget *target, while (token != NULL) { if (SDL_URIToLocal(token, token) >= 0) { SDL_LogTrace(SDL_LOG_CATEGORY_INPUT, - ". In Drop File, file (%lu of %lu) '%s'\n", + ". In Drop File, file (%lu of %lu) '%s'", (unsigned long)SDL_strlen(token), (unsigned long)bsize, token); SDL_SendDropFile(target->window, NULL, token); } @@ -1998,18 +1998,18 @@ static STDMETHODIMP SDLDropTarget_Drop(SDLDropTarget *target, const char *format_mime = "text/plain;charset=utf-8"; if (SUCCEEDED(pDataObject->lpVtbl->QueryGetData(pDataObject, &fetc))) { SDL_LogTrace(SDL_LOG_CATEGORY_INPUT, - ". In Drop Text for QueryGetData, format %08x '%s', success\n", + ". In Drop Text for QueryGetData, format %08x '%s', success", fetc.cfFormat, format_mime); STGMEDIUM med; HRESULT hres = pDataObject->lpVtbl->GetData(pDataObject, &fetc, &med); SDL_LogTrace(SDL_LOG_CATEGORY_INPUT, - ". In Drop Text for GetData, format %08x '%s', HRESULT is %08lx\n", + ". In Drop Text for GetData, format %08x '%s', HRESULT is %08lx", fetc.cfFormat, format_mime, hres); if (SUCCEEDED(hres)) { const size_t bsize = GlobalSize(med.hGlobal); const void *buffer = (void *)GlobalLock(med.hGlobal); SDL_LogTrace(SDL_LOG_CATEGORY_INPUT, - ". In Drop Text for GlobalLock, format %08x '%s', memory (%lu) %p\n", + ". In Drop Text for GlobalLock, format %08x '%s', memory (%lu) %p", fetc.cfFormat, format_mime, (unsigned long)bsize, buffer); if (buffer) { char *text = (char *)SDL_malloc(bsize + sizeof(Uint32)); @@ -2019,7 +2019,7 @@ static STDMETHODIMP SDLDropTarget_Drop(SDLDropTarget *target, char *token = SDL_strtok_r(text, "\r\n", &saveptr); while (token != NULL) { SDL_LogTrace(SDL_LOG_CATEGORY_INPUT, - ". In Drop Text, text (%lu of %lu) '%s'\n", + ". In Drop Text, text (%lu of %lu) '%s'", (unsigned long)SDL_strlen(token), (unsigned long)bsize, token); SDL_SendDropText(target->window, (char *)token); token = SDL_strtok_r(NULL, "\r\n", &saveptr); @@ -2044,25 +2044,25 @@ static STDMETHODIMP SDLDropTarget_Drop(SDLDropTarget *target, const char *format_mime = "CF_UNICODETEXT"; if (SUCCEEDED(pDataObject->lpVtbl->QueryGetData(pDataObject, &fetc))) { SDL_LogTrace(SDL_LOG_CATEGORY_INPUT, - ". In Drop Text for QueryGetData, format %08x '%s', success\n", + ". In Drop Text for QueryGetData, format %08x '%s', success", fetc.cfFormat, format_mime); STGMEDIUM med; HRESULT hres = pDataObject->lpVtbl->GetData(pDataObject, &fetc, &med); SDL_LogTrace(SDL_LOG_CATEGORY_INPUT, - ". In Drop Text for GetData, format %08x '%s', HRESULT is %08lx\n", + ". In Drop Text for GetData, format %08x '%s', HRESULT is %08lx", fetc.cfFormat, format_mime, hres); if (SUCCEEDED(hres)) { const size_t bsize = GlobalSize(med.hGlobal); const void *buffer = (void *)GlobalLock(med.hGlobal); SDL_LogTrace(SDL_LOG_CATEGORY_INPUT, - ". In Drop Text for GlobalLock, format %08x '%s', memory (%lu) %p\n", + ". In Drop Text for GlobalLock, format %08x '%s', memory (%lu) %p", fetc.cfFormat, format_mime, (unsigned long)bsize, buffer); if (buffer) { buffer = WIN_StringToUTF8((const wchar_t *)buffer); if (buffer) { const size_t lbuffer = SDL_strlen((const char *)buffer); SDL_LogTrace(SDL_LOG_CATEGORY_INPUT, - ". In Drop Text for StringToUTF8, format %08x '%s', memory (%lu) %p\n", + ". In Drop Text for StringToUTF8, format %08x '%s', memory (%lu) %p", fetc.cfFormat, format_mime, (unsigned long)lbuffer, buffer); char *text = (char *)SDL_malloc(lbuffer + sizeof(Uint32)); SDL_memcpy((Uint8 *)text, buffer, lbuffer); @@ -2071,7 +2071,7 @@ static STDMETHODIMP SDLDropTarget_Drop(SDLDropTarget *target, char *token = SDL_strtok_r(text, "\r\n", &saveptr); while (token != NULL) { SDL_LogTrace(SDL_LOG_CATEGORY_INPUT, - ". In Drop Text, text (%lu of %lu) '%s'\n", + ". In Drop Text, text (%lu of %lu) '%s'", (unsigned long)SDL_strlen(token), (unsigned long)lbuffer, token); SDL_SendDropText(target->window, (char *)token); token = SDL_strtok_r(NULL, "\r\n", &saveptr); @@ -2098,18 +2098,18 @@ static STDMETHODIMP SDLDropTarget_Drop(SDLDropTarget *target, const char *format_mime = "CF_TEXT"; if (SUCCEEDED(pDataObject->lpVtbl->QueryGetData(pDataObject, &fetc))) { SDL_LogTrace(SDL_LOG_CATEGORY_INPUT, - ". In Drop Text for QueryGetData, format %08x '%s', success\n", + ". In Drop Text for QueryGetData, format %08x '%s', success", fetc.cfFormat, format_mime); STGMEDIUM med; HRESULT hres = pDataObject->lpVtbl->GetData(pDataObject, &fetc, &med); SDL_LogTrace(SDL_LOG_CATEGORY_INPUT, - ". In Drop Text for GetData, format %08x '%s', HRESULT is %08lx\n", + ". In Drop Text for GetData, format %08x '%s', HRESULT is %08lx", fetc.cfFormat, format_mime, hres); if (SUCCEEDED(hres)) { const size_t bsize = GlobalSize(med.hGlobal); const void *buffer = (void *)GlobalLock(med.hGlobal); SDL_LogTrace(SDL_LOG_CATEGORY_INPUT, - ". In Drop Text for GlobalLock, format %08x '%s', memory (%lu) %p\n", + ". In Drop Text for GlobalLock, format %08x '%s', memory (%lu) %p", fetc.cfFormat, format_mime, (unsigned long)bsize, buffer); if (buffer) { char *text = (char *)SDL_malloc(bsize + sizeof(Uint32)); @@ -2119,7 +2119,7 @@ static STDMETHODIMP SDLDropTarget_Drop(SDLDropTarget *target, char *token = SDL_strtok_r(text, "\r\n", &saveptr); while (token != NULL) { SDL_LogTrace(SDL_LOG_CATEGORY_INPUT, - ". In Drop Text, text (%lu of %lu) '%s'\n", + ". In Drop Text, text (%lu of %lu) '%s'", (unsigned long)SDL_strlen(token), (unsigned long)bsize, token); SDL_SendDropText(target->window, (char *)token); token = SDL_strtok_r(NULL, "\r\n", &saveptr); @@ -2144,18 +2144,18 @@ static STDMETHODIMP SDLDropTarget_Drop(SDLDropTarget *target, const char *format_mime = "CF_HDROP"; if (SUCCEEDED(pDataObject->lpVtbl->QueryGetData(pDataObject, &fetc))) { SDL_LogTrace(SDL_LOG_CATEGORY_INPUT, - ". In Drop File for QueryGetData, format %08x '%s', success\n", + ". In Drop File for QueryGetData, format %08x '%s', success", fetc.cfFormat, format_mime); STGMEDIUM med; HRESULT hres = pDataObject->lpVtbl->GetData(pDataObject, &fetc, &med); SDL_LogTrace(SDL_LOG_CATEGORY_INPUT, - ". In Drop File for GetData, format %08x '%s', HRESULT is %08lx\n", + ". In Drop File for GetData, format %08x '%s', HRESULT is %08lx", fetc.cfFormat, format_mime, hres); if (SUCCEEDED(hres)) { const size_t bsize = GlobalSize(med.hGlobal); HDROP drop = (HDROP)GlobalLock(med.hGlobal); SDL_LogTrace(SDL_LOG_CATEGORY_INPUT, - ". In Drop File for GlobalLock, format %08x '%s', memory (%lu) %p\n", + ". In Drop File for GlobalLock, format %08x '%s', memory (%lu) %p", fetc.cfFormat, format_mime, (unsigned long)bsize, drop); UINT count = DragQueryFile(drop, 0xFFFFFFFF, NULL, 0); for (UINT i = 0; i < count; ++i) { @@ -2165,7 +2165,7 @@ static STDMETHODIMP SDLDropTarget_Drop(SDLDropTarget *target, if (DragQueryFile(drop, i, buffer, size)) { char *file = WIN_StringToUTF8(buffer); SDL_LogTrace(SDL_LOG_CATEGORY_INPUT, - ". In Drop File, file (%lu of %lu) '%s'\n", + ". In Drop File, file (%lu of %lu) '%s'", (unsigned long)SDL_strlen(file), (unsigned long)bsize, file); SDL_SendDropFile(target->window, NULL, file); SDL_free(file); @@ -2211,7 +2211,7 @@ void WIN_AcceptDragAndDrop(SDL_Window *window, bool accept) SDLDropTarget_AddRef(drop_target); RegisterDragDrop(data->hwnd, (LPDROPTARGET)drop_target); SDL_LogTrace(SDL_LOG_CATEGORY_INPUT, - ". In Accept Drag and Drop, window %u, enabled Full OLE IDropTarget\n", + ". In Accept Drag and Drop, window %u, enabled Full OLE IDropTarget", window->id); } } else if (!accept && data->drop_target) { @@ -2219,13 +2219,13 @@ void WIN_AcceptDragAndDrop(SDL_Window *window, bool accept) SDLDropTarget_Release(data->drop_target); data->drop_target = NULL; SDL_LogTrace(SDL_LOG_CATEGORY_INPUT, - ". In Accept Drag and Drop, window %u, disabled Full OLE IDropTarget\n", + ". In Accept Drag and Drop, window %u, disabled Full OLE IDropTarget", window->id); } } else { DragAcceptFiles(data->hwnd, accept ? TRUE : FALSE); SDL_LogTrace(SDL_LOG_CATEGORY_INPUT, - ". In Accept Drag and Drop, window %u, %s Fallback WM_DROPFILES\n", + ". In Accept Drag and Drop, window %u, %s Fallback WM_DROPFILES", window->id, (accept ? "enabled" : "disabled")); } } diff --git a/test/testrumble.c b/test/testrumble.c index b53cb18eddcda..df35e0bb575ae 100644 --- a/test/testrumble.c +++ b/test/testrumble.c @@ -74,7 +74,7 @@ int main(int argc, char **argv) SDLTest_CommonLogUsage(state, argv[0], options); SDL_Log("%s", ""); SDL_Log("If device is a two-digit number it'll use it as an index, otherwise\n" - "it'll use it as if it were part of the device's name.\n"); + "it'll use it as if it were part of the device's name."); return 1; } diff --git a/test/testvulkan.c b/test/testvulkan.c index e4437e50abc67..a728b79e53343 100644 --- a/test/testvulkan.c +++ b/test/testvulkan.c @@ -198,18 +198,18 @@ static void loadGlobalFunctions(void) vkGetInstanceProcAddr = (PFN_vkGetInstanceProcAddr)SDL_Vulkan_GetVkGetInstanceProcAddr(); if (!vkGetInstanceProcAddr) { SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, - "SDL_Vulkan_GetVkGetInstanceProcAddr(): %s\n", + "SDL_Vulkan_GetVkGetInstanceProcAddr(): %s", SDL_GetError()); quit(2); } #define VULKAN_DEVICE_FUNCTION(name) -#define VULKAN_GLOBAL_FUNCTION(name) \ - name = (PFN_##name)vkGetInstanceProcAddr(VK_NULL_HANDLE, #name); \ - if (!name) { \ - SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, \ - "vkGetInstanceProcAddr(VK_NULL_HANDLE, \"" #name "\") failed\n"); \ - quit(2); \ +#define VULKAN_GLOBAL_FUNCTION(name) \ + name = (PFN_##name)vkGetInstanceProcAddr(VK_NULL_HANDLE, #name); \ + if (!name) { \ + SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, \ + "vkGetInstanceProcAddr(VK_NULL_HANDLE, \"" #name "\") failed"); \ + quit(2); \ } #define VULKAN_INSTANCE_FUNCTION(name) VULKAN_FUNCTIONS() @@ -237,7 +237,7 @@ static void createInstance(void) if (result != VK_SUCCESS) { vulkanContext->instance = VK_NULL_HANDLE; SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, - "vkCreateInstance(): %s\n", + "vkCreateInstance(): %s", getVulkanResultString(result)); quit(2); } @@ -247,12 +247,12 @@ static void loadInstanceFunctions(void) { #define VULKAN_DEVICE_FUNCTION(name) #define VULKAN_GLOBAL_FUNCTION(name) -#define VULKAN_INSTANCE_FUNCTION(name) \ - name = (PFN_##name)vkGetInstanceProcAddr(vulkanContext->instance, #name); \ - if (!name) { \ - SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, \ - "vkGetInstanceProcAddr(instance, \"" #name "\") failed\n"); \ - quit(2); \ +#define VULKAN_INSTANCE_FUNCTION(name) \ + name = (PFN_##name)vkGetInstanceProcAddr(vulkanContext->instance, #name); \ + if (!name) { \ + SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, \ + "vkGetInstanceProcAddr(instance, \"" #name "\") failed"); \ + quit(2); \ } VULKAN_FUNCTIONS() #undef VULKAN_DEVICE_FUNCTION @@ -283,13 +283,13 @@ static void findPhysicalDevice(void) result = vkEnumeratePhysicalDevices(vulkanContext->instance, &physicalDeviceCount, NULL); if (result != VK_SUCCESS) { SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, - "vkEnumeratePhysicalDevices(): %s\n", + "vkEnumeratePhysicalDevices(): %s", getVulkanResultString(result)); quit(2); } if (physicalDeviceCount == 0) { SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, - "vkEnumeratePhysicalDevices(): no physical devices\n"); + "vkEnumeratePhysicalDevices(): no physical devices"); quit(2); } physicalDevices = (VkPhysicalDevice *)SDL_malloc(sizeof(VkPhysicalDevice) * physicalDeviceCount); @@ -300,7 +300,7 @@ static void findPhysicalDevice(void) if (result != VK_SUCCESS) { SDL_free(physicalDevices); SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, - "vkEnumeratePhysicalDevices(): %s\n", + "vkEnumeratePhysicalDevices(): %s", getVulkanResultString(result)); quit(2); } @@ -353,7 +353,7 @@ static void findPhysicalDevice(void) SDL_free(queueFamiliesProperties); SDL_free(deviceExtensions); SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, - "vkGetPhysicalDeviceSurfaceSupportKHR(): %s\n", + "vkGetPhysicalDeviceSurfaceSupportKHR(): %s", getVulkanResultString(result)); quit(2); } @@ -369,7 +369,7 @@ static void findPhysicalDevice(void) SDL_free(queueFamiliesProperties); SDL_free(deviceExtensions); SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, - "SDL_Vulkan_GetPresentationSupport(): %s\n", + "SDL_Vulkan_GetPresentationSupport(): %s", SDL_GetError()); quit(2); } @@ -393,7 +393,7 @@ static void findPhysicalDevice(void) SDL_free(queueFamiliesProperties); SDL_free(deviceExtensions); SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, - "vkEnumerateDeviceExtensionProperties(): %s\n", + "vkEnumerateDeviceExtensionProperties(): %s", getVulkanResultString(result)); quit(2); } @@ -416,7 +416,7 @@ static void findPhysicalDevice(void) SDL_free(queueFamiliesProperties); SDL_free(deviceExtensions); SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, - "vkEnumerateDeviceExtensionProperties(): %s\n", + "vkEnumerateDeviceExtensionProperties(): %s", getVulkanResultString(result)); quit(2); } @@ -485,12 +485,12 @@ static void createDevice(void) static void loadDeviceFunctions(void) { -#define VULKAN_DEVICE_FUNCTION(name) \ - name = (PFN_##name)vkGetDeviceProcAddr(vulkanContext->device, #name); \ - if (!name) { \ - SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, \ - "vkGetDeviceProcAddr(device, \"" #name "\") failed\n"); \ - quit(2); \ +#define VULKAN_DEVICE_FUNCTION(name) \ + name = (PFN_##name)vkGetDeviceProcAddr(vulkanContext->device, #name); \ + if (!name) { \ + SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, \ + "vkGetDeviceProcAddr(device, \"" #name "\") failed"); \ + quit(2); \ } #define VULKAN_GLOBAL_FUNCTION(name) #define VULKAN_INSTANCE_FUNCTION(name) @@ -528,7 +528,7 @@ static void createSemaphore(VkSemaphore *semaphore) if (result != VK_SUCCESS) { *semaphore = VK_NULL_HANDLE; SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, - "vkCreateSemaphore(): %s\n", + "vkCreateSemaphore(): %s", getVulkanResultString(result)); quit(2); } @@ -545,7 +545,7 @@ static void getSurfaceCaps(void) VkResult result = vkGetPhysicalDeviceSurfaceCapabilitiesKHR(vulkanContext->physicalDevice, vulkanContext->surface, &vulkanContext->surfaceCapabilities); if (result != VK_SUCCESS) { SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, - "vkGetPhysicalDeviceSurfaceCapabilitiesKHR(): %s\n", + "vkGetPhysicalDeviceSurfaceCapabilitiesKHR(): %s", getVulkanResultString(result)); quit(2); } @@ -553,7 +553,7 @@ static void getSurfaceCaps(void) // check surface usage if (!(vulkanContext->surfaceCapabilities.supportedUsageFlags & VK_IMAGE_USAGE_TRANSFER_DST_BIT)) { SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, - "Vulkan surface doesn't support VK_IMAGE_USAGE_TRANSFER_DST_BIT\n"); + "Vulkan surface doesn't support VK_IMAGE_USAGE_TRANSFER_DST_BIT"); quit(2); } } @@ -567,7 +567,7 @@ static void getSurfaceFormats(void) if (result != VK_SUCCESS) { vulkanContext->surfaceFormatsCount = 0; SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, - "vkGetPhysicalDeviceSurfaceFormatsKHR(): %s\n", + "vkGetPhysicalDeviceSurfaceFormatsKHR(): %s", getVulkanResultString(result)); quit(2); } @@ -587,7 +587,7 @@ static void getSurfaceFormats(void) if (result != VK_SUCCESS) { vulkanContext->surfaceFormatsCount = 0; SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, - "vkGetPhysicalDeviceSurfaceFormatsKHR(): %s\n", + "vkGetPhysicalDeviceSurfaceFormatsKHR(): %s", getVulkanResultString(result)); quit(2); } @@ -603,7 +603,7 @@ static void getSwapchainImages(void) if (result != VK_SUCCESS) { vulkanContext->swapchainImageCount = 0; SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, - "vkGetSwapchainImagesKHR(): %s\n", + "vkGetSwapchainImagesKHR(): %s", getVulkanResultString(result)); quit(2); } @@ -620,7 +620,7 @@ static void getSwapchainImages(void) vulkanContext->swapchainImages = NULL; vulkanContext->swapchainImageCount = 0; SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, - "vkGetSwapchainImagesKHR(): %s\n", + "vkGetSwapchainImagesKHR(): %s", getVulkanResultString(result)); quit(2); } @@ -706,7 +706,7 @@ static bool createSwapchain(void) if (result != VK_SUCCESS) { vulkanContext->swapchain = VK_NULL_HANDLE; SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, - "vkCreateSwapchainKHR(): %s\n", + "vkCreateSwapchainKHR(): %s", getVulkanResultString(result)); quit(2); } @@ -756,7 +756,7 @@ static void createCommandPool(void) if (result != VK_SUCCESS) { vulkanContext->commandPool = VK_NULL_HANDLE; SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, - "vkCreateCommandPool(): %s\n", + "vkCreateCommandPool(): %s", getVulkanResultString(result)); quit(2); } @@ -776,7 +776,7 @@ static void createCommandBuffers(void) SDL_free(vulkanContext->commandBuffers); vulkanContext->commandBuffers = NULL; SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, - "vkAllocateCommandBuffers(): %s\n", + "vkAllocateCommandBuffers(): %s", getVulkanResultString(result)); quit(2); } @@ -803,7 +803,7 @@ static void createFences(void) SDL_free(vulkanContext->fences); vulkanContext->fences = NULL; SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, - "vkCreateFence(): %s\n", + "vkCreateFence(): %s", getVulkanResultString(result)); quit(2); } @@ -868,7 +868,7 @@ static void rerecordCommandBuffer(uint32_t frameIndex, const VkClearColorValue * VkResult result = vkResetCommandBuffer(commandBuffer, 0); if (result != VK_SUCCESS) { SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, - "vkResetCommandBuffer(): %s\n", + "vkResetCommandBuffer(): %s", getVulkanResultString(result)); quit(2); } @@ -877,7 +877,7 @@ static void rerecordCommandBuffer(uint32_t frameIndex, const VkClearColorValue * result = vkBeginCommandBuffer(commandBuffer, &beginInfo); if (result != VK_SUCCESS) { SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, - "vkBeginCommandBuffer(): %s\n", + "vkBeginCommandBuffer(): %s", getVulkanResultString(result)); quit(2); } @@ -902,7 +902,7 @@ static void rerecordCommandBuffer(uint32_t frameIndex, const VkClearColorValue * result = vkEndCommandBuffer(commandBuffer); if (result != VK_SUCCESS) { SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, - "vkEndCommandBuffer(): %s\n", + "vkEndCommandBuffer(): %s", getVulkanResultString(result)); quit(2); } @@ -1034,7 +1034,7 @@ static bool render(void) if ((rc != VK_SUBOPTIMAL_KHR) && (rc != VK_SUCCESS)) { SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, - "vkAcquireNextImageKHR(): %s\n", + "vkAcquireNextImageKHR(): %s", getVulkanResultString(rc)); quit(2); } @@ -1081,7 +1081,7 @@ static bool render(void) if (rc != VK_SUCCESS) { SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, - "vkQueuePresentKHR(): %s\n", + "vkQueuePresentKHR(): %s", getVulkanResultString(rc)); quit(2); } From 72a3eae0da06babf5daa22ead75b107961a64a56 Mon Sep 17 00:00:00 2001 From: hspir404 Date: Thu, 23 Jan 2025 02:32:00 -0800 Subject: [PATCH 234/340] Fix buffer overrun in ConvertAudio with different src/dst channel count - Source or destination format also has to not be F32 to trigger bug --- src/audio/SDL_audiocvt.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/audio/SDL_audiocvt.c b/src/audio/SDL_audiocvt.c index daf44da02b80e..f128f8b5ae5f8 100644 --- a/src/audio/SDL_audiocvt.c +++ b/src/audio/SDL_audiocvt.c @@ -325,7 +325,7 @@ void ConvertAudio(int num_frames, // Gain adjustment if (gain != 1.0f) { - float *buf = (float *)(dstconvert ? scratch : dst); + float *buf = (float *)((channelconvert || dstconvert) ? scratch : dst); const int total_samples = num_frames * src_channels; if (src == buf) { for (int i = 0; i < total_samples; i++) { From d0ae0936811a49289d7ac0be49058ff9e897156b Mon Sep 17 00:00:00 2001 From: Frank Praznik Date: Wed, 22 Jan 2025 19:18:56 -0500 Subject: [PATCH 235/340] x11: Don't force position windows with an undefined position An undefined position means that the window manager can handle placement, so SDL shouldn't override that by forcing a position when showing a window. Allows for removing a fair bit of now-unnecessary code as well. --- src/video/x11/SDL_x11events.c | 46 +++++++++-------------------------- src/video/x11/SDL_x11window.c | 30 +++++++---------------- src/video/x11/SDL_x11window.h | 7 +++++- 3 files changed, 26 insertions(+), 57 deletions(-) diff --git a/src/video/x11/SDL_x11events.c b/src/video/x11/SDL_x11events.c index 0ced1b68d3074..aebed3ef0710c 100644 --- a/src/video/x11/SDL_x11events.c +++ b/src/video/x11/SDL_x11events.c @@ -1424,7 +1424,7 @@ static void X11_DispatchEvent(SDL_VideoDevice *_this, XEvent *xevent) if (xevent->xconfigure.x != data->last_xconfigure.x || xevent->xconfigure.y != data->last_xconfigure.y) { - if (!data->disable_size_position_events) { + if (!data->size_move_event_flags) { SDL_Window *w; int x = xevent->xconfigure.x; int y = xevent->xconfigure.y; @@ -1448,7 +1448,7 @@ static void X11_DispatchEvent(SDL_VideoDevice *_this, XEvent *xevent) if (xevent->xconfigure.width != data->last_xconfigure.width || xevent->xconfigure.height != data->last_xconfigure.height) { - if (!data->disable_size_position_events) { + if (!data->size_move_event_flags) { data->pending_operation &= ~X11_PENDING_OP_RESIZE; SDL_SendWindowEvent(data->window, SDL_EVENT_WINDOW_RESIZED, xevent->xconfigure.width, @@ -1799,7 +1799,7 @@ static void X11_DispatchEvent(SDL_VideoDevice *_this, XEvent *xevent) * shut off to avoid bogus window sizes and positions, and * note that the old borders were non-zero for restoration. */ - data->disable_size_position_events = true; + data->size_move_event_flags |= X11_SIZE_MOVE_EVENTS_WAIT_FOR_BORDERS; data->previous_borders_nonzero = true; } else if (!(flags & SDL_WINDOW_FULLSCREEN) && data->previous_borders_nonzero && @@ -1809,10 +1809,10 @@ static void X11_DispatchEvent(SDL_VideoDevice *_this, XEvent *xevent) * off size events until the borders come back to avoid bogus * window sizes and positions. */ - data->disable_size_position_events = true; + data->size_move_event_flags |= X11_SIZE_MOVE_EVENTS_WAIT_FOR_BORDERS; data->previous_borders_nonzero = false; } else { - data->disable_size_position_events = false; + data->size_move_event_flags = 0; data->previous_borders_nonzero = false; if (!(data->window->flags & SDL_WINDOW_FULLSCREEN) && data->toggle_borders) { @@ -1845,7 +1845,7 @@ static void X11_DispatchEvent(SDL_VideoDevice *_this, XEvent *xevent) data->pending_operation |= X11_PENDING_OP_MOVE; data->expected.x = data->window->pending.x - data->border_left; data->expected.y = data->window->pending.y - data->border_top; - X11_XMoveWindow(display, data->xwindow, data->window->pending.x - data->border_left, data->window->pending.y - data->border_top); + X11_XMoveWindow(display, data->xwindow, data->expected.x, data->expected.y); } if (data->pending_size) { data->pending_size = false; @@ -1875,37 +1875,13 @@ static void X11_DispatchEvent(SDL_VideoDevice *_this, XEvent *xevent) right approach, but it seems to work. */ X11_UpdateKeymap(_this, true); } else if (xevent->xproperty.atom == videodata->atoms._NET_FRAME_EXTENTS) { - if (data->disable_size_position_events) { - /* Re-enable size events if they were turned off waiting for the borders to come back - * when leaving fullscreen. - */ - data->disable_size_position_events = false; + /* Events are disabled when leaving fullscreen until the borders appear to avoid + * incorrect size/position events. + */ + if (data->size_move_event_flags) { + data->size_move_event_flags &= ~X11_SIZE_MOVE_EVENTS_WAIT_FOR_BORDERS; X11_GetBorderValues(data); - if (data->border_top != 0 || data->border_left != 0 || data->border_right != 0 || data->border_bottom != 0) { - // Adjust if the window size/position changed to accommodate the borders. - data->pending_operation |= X11_PENDING_OP_MOVE | X11_PENDING_OP_RESIZE; - - if (data->pending_position) { - data->pending_position = false; - data->expected.x = data->window->pending.x - data->border_left; - data->expected.y = data->window->pending.y - data->border_top; - - } else { - data->expected.x = data->window->windowed.x - data->border_left; - data->expected.y = data->window->windowed.y - data->border_top; - } - if (data->pending_size) { - data->pending_size = false; - data->expected.w = data->window->pending.w; - data->expected.h = data->window->pending.h; - } else { - data->expected.w = data->window->windowed.w; - data->expected.h = data->window->windowed.h; - } - X11_XMoveWindow(display, data->xwindow, data->expected.x, data->expected.y - data->border_top); - X11_XResizeWindow(display, data->xwindow, data->expected.w, data->expected.h); - } } if (!(data->window->flags & SDL_WINDOW_FULLSCREEN) && data->toggle_borders) { data->toggle_borders = false; diff --git a/src/video/x11/SDL_x11window.c b/src/video/x11/SDL_x11window.c index 0ecabec6752dc..c3c125eafeb20 100644 --- a/src/video/x11/SDL_x11window.c +++ b/src/video/x11/SDL_x11window.c @@ -1440,9 +1440,6 @@ void X11_ShowWindow(SDL_VideoDevice *_this, SDL_Window *window) X11_UpdateWindowPosition(window, false); } - const int target_x = window->last_position_pending ? window->pending.x : window->x; - const int target_y = window->last_position_pending ? window->pending.y : window->y; - /* Whether XMapRaised focuses the window is based on the window type and it is * wm specific. There isn't much we can do here */ (void)bActivate; @@ -1475,33 +1472,24 @@ void X11_ShowWindow(SDL_VideoDevice *_this, SDL_Window *window) X11_GetBorderValues(data); } - /* Some window managers can send garbage coordinates while mapping the window, and need the position sent again - * after mapping or the window may not be positioned properly. - * - * Don't emit size and position events during the initial configure events, they will be sent afterwards, when the - * final coordinates are available to avoid sending garbage values. + // Apply the pending position, if any, after the window is mapped. + data->pending_position = window->last_position_pending; + + /* Some window managers can send garbage coordinates while mapping the window, so don't emit size and position + * events during the initial configure events. */ - data->disable_size_position_events = true; + data->size_move_event_flags = X11_SIZE_MOVE_EVENTS_DISABLE; X11_XSync(display, False); X11_PumpEvents(_this); + data->size_move_event_flags = 0; // If a configure event was received (type is non-zero), send the final window size and coordinates. if (data->last_xconfigure.type) { - int x = data->last_xconfigure.x; - int y = data->last_xconfigure.y; - SDL_GlobalToRelativeForWindow(data->window, x, y, &x, &y); - - // If the borders appeared, this happened automatically in the event system, otherwise, set the position now. - if (data->disable_size_position_events && (target_x != x || target_y != y)) { - data->pending_operation = X11_PENDING_OP_MOVE; - X11_XMoveWindow(display, data->xwindow, target_x, target_y); - } - + int x, y; + SDL_GlobalToRelativeForWindow(data->window, data->last_xconfigure.x, data->last_xconfigure.y, &x, &y); SDL_SendWindowEvent(window, SDL_EVENT_WINDOW_RESIZED, data->last_xconfigure.width, data->last_xconfigure.height); SDL_SendWindowEvent(window, SDL_EVENT_WINDOW_MOVED, x, y); } - - data->disable_size_position_events = false; } void X11_HideWindow(SDL_VideoDevice *_this, SDL_Window *window) diff --git a/src/video/x11/SDL_x11window.h b/src/video/x11/SDL_x11window.h index 16936033596f2..f1a73ab592480 100644 --- a/src/video/x11/SDL_x11window.h +++ b/src/video/x11/SDL_x11window.h @@ -103,10 +103,15 @@ struct SDL_WindowData X11_PENDING_OP_RESIZE = 0x20 } pending_operation; + enum + { + X11_SIZE_MOVE_EVENTS_DISABLE = 0x01, // Events are completely disabled. + X11_SIZE_MOVE_EVENTS_WAIT_FOR_BORDERS = 0x02, // Events are disabled until a _NET_FRAME_EXTENTS event arrives. + } size_move_event_flags; + bool pending_size; bool pending_position; bool window_was_maximized; - bool disable_size_position_events; bool previous_borders_nonzero; bool toggle_borders; bool fullscreen_borders_forced_on; From a336b62d8b0b97b09214e053203e442e2b6e2be5 Mon Sep 17 00:00:00 2001 From: Petar Popovic Date: Thu, 23 Jan 2025 19:28:51 +0100 Subject: [PATCH 236/340] Remove newlines from error messages --- src/joystick/hidapi/SDL_hidapi_xboxone.c | 2 +- src/joystick/hidapi/SDL_hidapijoystick.c | 2 +- src/joystick/windows/SDL_rawinputjoystick.c | 6 +++--- src/render/direct3d11/SDL_render_d3d11.c | 6 +++--- src/render/direct3d12/SDL_render_d3d12.c | 6 +++--- src/render/metal/SDL_render_metal.m | 4 ++-- src/render/opengl/SDL_render_gl.c | 2 +- src/render/opengles2/SDL_render_gles2.c | 2 +- src/render/vulkan/SDL_render_vulkan.c | 4 ++-- src/video/SDL_yuv.c | 2 +- src/video/kmsdrm/SDL_kmsdrmvulkan.c | 2 +- src/video/wayland/SDL_waylandevents.c | 6 +++--- src/video/x11/SDL_x11window.c | 4 ++-- test/testffmpeg_vulkan.c | 4 ++-- 14 files changed, 26 insertions(+), 26 deletions(-) diff --git a/src/joystick/hidapi/SDL_hidapi_xboxone.c b/src/joystick/hidapi/SDL_hidapi_xboxone.c index d0c93cfcb414e..342eabdf75c6c 100644 --- a/src/joystick/hidapi/SDL_hidapi_xboxone.c +++ b/src/joystick/hidapi/SDL_hidapi_xboxone.c @@ -1323,7 +1323,7 @@ static bool HIDAPI_GIP_SendPacket(SDL_DriverXboxOne_Context *ctx, struct gip_hea hdr_len = HIDAPI_GIP_GetHeaderLength(hdr); size = (hdr_len + hdr->packet_length); if (size > sizeof(packet)) { - SDL_SetError("Couldn't send GIP packet, size (%d) too large\n", size); + SDL_SetError("Couldn't send GIP packet, size (%d) too large", size); return false; } diff --git a/src/joystick/hidapi/SDL_hidapijoystick.c b/src/joystick/hidapi/SDL_hidapijoystick.c index 30bae026fd325..54545eb854aa4 100644 --- a/src/joystick/hidapi/SDL_hidapijoystick.c +++ b/src/joystick/hidapi/SDL_hidapijoystick.c @@ -1492,7 +1492,7 @@ static bool HIDAPI_JoystickOpen(SDL_Joystick *joystick, int device_index) if (!device || !device->driver) { // This should never happen - validated before being called - return SDL_SetError("Couldn't find HIDAPI device at index %d\n", device_index); + return SDL_SetError("Couldn't find HIDAPI device at index %d", device_index); } hwdata = (struct joystick_hwdata *)SDL_calloc(1, sizeof(*hwdata)); diff --git a/src/joystick/windows/SDL_rawinputjoystick.c b/src/joystick/windows/SDL_rawinputjoystick.c index d5adc2daa3500..d5166def0a881 100644 --- a/src/joystick/windows/SDL_rawinputjoystick.c +++ b/src/joystick/windows/SDL_rawinputjoystick.c @@ -703,12 +703,12 @@ static void RAWINPUT_InitWindowsGamingInput(RAWINPUT_DeviceContext *ctx) hr = __x_ABI_CWindows_CGaming_CInput_CIGamepadStatics_add_GamepadAdded(wgi_state.gamepad_statics, &gamepad_added.iface, &wgi_state.gamepad_added_token); if (!SUCCEEDED(hr)) { - SDL_SetError("add_GamepadAdded() failed: 0x%lx\n", hr); + SDL_SetError("add_GamepadAdded() failed: 0x%lx", hr); } hr = __x_ABI_CWindows_CGaming_CInput_CIGamepadStatics_add_GamepadRemoved(wgi_state.gamepad_statics, &gamepad_removed.iface, &wgi_state.gamepad_removed_token); if (!SUCCEEDED(hr)) { - SDL_SetError("add_GamepadRemoved() failed: 0x%lx\n", hr); + SDL_SetError("add_GamepadRemoved() failed: 0x%lx", hr); } } } @@ -1511,7 +1511,7 @@ static bool RAWINPUT_JoystickRumbleTriggers(SDL_Joystick *joystick, Uint16 left_ gamepad_state->vibration.RightTrigger = (DOUBLE)right_rumble / SDL_MAX_UINT16; hr = __x_ABI_CWindows_CGaming_CInput_CIGamepad_put_Vibration(gamepad_state->gamepad, gamepad_state->vibration); if (!SUCCEEDED(hr)) { - return SDL_SetError("Setting vibration failed: 0x%lx\n", hr); + return SDL_SetError("Setting vibration failed: 0x%lx", hr); } return true; } else { diff --git a/src/render/direct3d11/SDL_render_d3d11.c b/src/render/direct3d11/SDL_render_d3d11.c index b723877a033ec..45943e247cbc6 100644 --- a/src/render/direct3d11/SDL_render_d3d11.c +++ b/src/render/direct3d11/SDL_render_d3d11.c @@ -2315,7 +2315,7 @@ static bool D3D11_SetCopyState(SDL_Renderer *renderer, const SDL_RenderCommand * textureSampler = rendererData->samplers[D3D11_SAMPLER_NEAREST_WRAP]; break; default: - return SDL_SetError("Unknown texture address mode: %d\n", cmd->data.draw.texture_address_mode); + return SDL_SetError("Unknown texture address mode: %d", cmd->data.draw.texture_address_mode); } break; case D3D11_FILTER_MIN_MAG_MIP_LINEAR: @@ -2327,11 +2327,11 @@ static bool D3D11_SetCopyState(SDL_Renderer *renderer, const SDL_RenderCommand * textureSampler = rendererData->samplers[D3D11_SAMPLER_LINEAR_WRAP]; break; default: - return SDL_SetError("Unknown texture address mode: %d\n", cmd->data.draw.texture_address_mode); + return SDL_SetError("Unknown texture address mode: %d", cmd->data.draw.texture_address_mode); } break; default: - return SDL_SetError("Unknown scale mode: %d\n", textureData->scaleMode); + return SDL_SetError("Unknown scale mode: %d", textureData->scaleMode); } #ifdef SDL_HAVE_YUV if (textureData->yuv) { diff --git a/src/render/direct3d12/SDL_render_d3d12.c b/src/render/direct3d12/SDL_render_d3d12.c index 3785a7d95be97..64f04740159cd 100644 --- a/src/render/direct3d12/SDL_render_d3d12.c +++ b/src/render/direct3d12/SDL_render_d3d12.c @@ -2742,7 +2742,7 @@ static bool D3D12_SetCopyState(SDL_Renderer *renderer, const SDL_RenderCommand * textureSampler = &rendererData->samplers[D3D12_SAMPLER_NEAREST_WRAP]; break; default: - return SDL_SetError("Unknown texture address mode: %d\n", cmd->data.draw.texture_address_mode); + return SDL_SetError("Unknown texture address mode: %d", cmd->data.draw.texture_address_mode); } break; case D3D12_FILTER_MIN_MAG_MIP_LINEAR: @@ -2754,11 +2754,11 @@ static bool D3D12_SetCopyState(SDL_Renderer *renderer, const SDL_RenderCommand * textureSampler = &rendererData->samplers[D3D12_SAMPLER_LINEAR_WRAP]; break; default: - return SDL_SetError("Unknown texture address mode: %d\n", cmd->data.draw.texture_address_mode); + return SDL_SetError("Unknown texture address mode: %d", cmd->data.draw.texture_address_mode); } break; default: - return SDL_SetError("Unknown scale mode: %d\n", textureData->scaleMode); + return SDL_SetError("Unknown scale mode: %d", textureData->scaleMode); } #ifdef SDL_HAVE_YUV if (textureData->yuv) { diff --git a/src/render/metal/SDL_render_metal.m b/src/render/metal/SDL_render_metal.m index 0aac565d3888b..63d9770d5025a 100644 --- a/src/render/metal/SDL_render_metal.m +++ b/src/render/metal/SDL_render_metal.m @@ -1482,7 +1482,7 @@ static bool SetCopyState(SDL_Renderer *renderer, const SDL_RenderCommand *cmd, c mtlsampler = data.mtlsamplers[SDL_METAL_SAMPLER_NEAREST_WRAP]; break; default: - return SDL_SetError("Unknown texture address mode: %d\n", cmd->data.draw.texture_address_mode); + return SDL_SetError("Unknown texture address mode: %d", cmd->data.draw.texture_address_mode); } } else { switch (cmd->data.draw.texture_address_mode) { @@ -1493,7 +1493,7 @@ static bool SetCopyState(SDL_Renderer *renderer, const SDL_RenderCommand *cmd, c mtlsampler = data.mtlsamplers[SDL_METAL_SAMPLER_LINEAR_WRAP]; break; default: - return SDL_SetError("Unknown texture address mode: %d\n", cmd->data.draw.texture_address_mode); + return SDL_SetError("Unknown texture address mode: %d", cmd->data.draw.texture_address_mode); } } [data.mtlcmdencoder setFragmentSamplerState:mtlsampler atIndex:0]; diff --git a/src/render/opengl/SDL_render_gl.c b/src/render/opengl/SDL_render_gl.c index 64164a6d8bc36..d5344382aa9ef 100644 --- a/src/render/opengl/SDL_render_gl.c +++ b/src/render/opengl/SDL_render_gl.c @@ -1132,7 +1132,7 @@ static bool SetTextureAddressMode(GL_RenderData *data, GLenum textype, SDL_Textu data->glTexParameteri(textype, GL_TEXTURE_WRAP_T, GL_REPEAT); break; default: - return SDL_SetError("Unknown texture address mode: %d\n", addressMode); + return SDL_SetError("Unknown texture address mode: %d", addressMode); } return true; } diff --git a/src/render/opengles2/SDL_render_gles2.c b/src/render/opengles2/SDL_render_gles2.c index a4c5dec154c17..44656293ff61b 100644 --- a/src/render/opengles2/SDL_render_gles2.c +++ b/src/render/opengles2/SDL_render_gles2.c @@ -1041,7 +1041,7 @@ static bool SetTextureAddressMode(GLES2_RenderData *data, GLenum textype, SDL_Te data->glTexParameteri(textype, GL_TEXTURE_WRAP_T, GL_REPEAT); break; default: - return SDL_SetError("Unknown texture address mode: %d\n", addressMode); + return SDL_SetError("Unknown texture address mode: %d", addressMode); } return true; } diff --git a/src/render/vulkan/SDL_render_vulkan.c b/src/render/vulkan/SDL_render_vulkan.c index 8cfc3a4ad7409..7398315a85fc2 100644 --- a/src/render/vulkan/SDL_render_vulkan.c +++ b/src/render/vulkan/SDL_render_vulkan.c @@ -3778,7 +3778,7 @@ static bool VULKAN_SetCopyState(SDL_Renderer *renderer, const SDL_RenderCommand textureSampler = rendererData->samplers[VULKAN_SAMPLER_NEAREST_WRAP]; break; default: - return SDL_SetError("Unknown texture address mode: %d\n", cmd->data.draw.texture_address_mode); + return SDL_SetError("Unknown texture address mode: %d", cmd->data.draw.texture_address_mode); } break; case VK_FILTER_LINEAR: @@ -3790,7 +3790,7 @@ static bool VULKAN_SetCopyState(SDL_Renderer *renderer, const SDL_RenderCommand textureSampler = rendererData->samplers[VULKAN_SAMPLER_LINEAR_WRAP]; break; default: - return SDL_SetError("Unknown texture address mode: %d\n", cmd->data.draw.texture_address_mode); + return SDL_SetError("Unknown texture address mode: %d", cmd->data.draw.texture_address_mode); } break; default: diff --git a/src/video/SDL_yuv.c b/src/video/SDL_yuv.c index da8116e9a94e5..ccacfcf461d6a 100644 --- a/src/video/SDL_yuv.c +++ b/src/video/SDL_yuv.c @@ -921,7 +921,7 @@ static bool SDL_ConvertPixels_XRGB8888_to_YUV(int width, int height, const void int plane_skip; if (dst_pitch < row_size) { - return SDL_SetError("Destination pitch is too small, expected at least %d\n", row_size); + return SDL_SetError("Destination pitch is too small, expected at least %d", row_size); } plane_skip = (dst_pitch - row_size); diff --git a/src/video/kmsdrm/SDL_kmsdrmvulkan.c b/src/video/kmsdrm/SDL_kmsdrmvulkan.c index dd50d39efd8d0..d58277b789aaa 100644 --- a/src/video/kmsdrm/SDL_kmsdrmvulkan.c +++ b/src/video/kmsdrm/SDL_kmsdrmvulkan.c @@ -328,7 +328,7 @@ bool KMSDRM_Vulkan_CreateSurface(SDL_VideoDevice *_this, &mode_count, NULL); if (mode_count == 0) { - SDL_SetError("Vulkan can't find any video modes for display %i (%s)\n", 0, + SDL_SetError("Vulkan can't find any video modes for display %i (%s)", 0, display_props[display_index].displayName); goto clean; } diff --git a/src/video/wayland/SDL_waylandevents.c b/src/video/wayland/SDL_waylandevents.c index c63721ec3d92a..8519b245ef781 100644 --- a/src/video/wayland/SDL_waylandevents.c +++ b/src/video/wayland/SDL_waylandevents.c @@ -1397,7 +1397,7 @@ static void keyboard_handle_keymap(void *data, struct wl_keyboard *keyboard, close(fd); if (!input->xkb.keymap) { - SDL_SetError("failed to compile keymap\n"); + SDL_SetError("failed to compile keymap"); return; } @@ -1422,7 +1422,7 @@ static void keyboard_handle_keymap(void *data, struct wl_keyboard *keyboard, } input->xkb.state = WAYLAND_xkb_state_new(input->xkb.keymap); if (!input->xkb.state) { - SDL_SetError("failed to create XKB state\n"); + SDL_SetError("failed to create XKB state"); WAYLAND_xkb_keymap_unref(input->xkb.keymap); input->xkb.keymap = NULL; return; @@ -1472,7 +1472,7 @@ static void keyboard_handle_keymap(void *data, struct wl_keyboard *keyboard, input->xkb.compose_state = WAYLAND_xkb_compose_state_new(input->xkb.compose_table, XKB_COMPOSE_STATE_NO_FLAGS); if (!input->xkb.compose_state) { - SDL_SetError("could not create XKB compose state\n"); + SDL_SetError("could not create XKB compose state"); WAYLAND_xkb_compose_table_unref(input->xkb.compose_table); input->xkb.compose_table = NULL; } diff --git a/src/video/x11/SDL_x11window.c b/src/video/x11/SDL_x11window.c index c3c125eafeb20..c8c0ffd737a22 100644 --- a/src/video/x11/SDL_x11window.c +++ b/src/video/x11/SDL_x11window.c @@ -1878,7 +1878,7 @@ void *X11_GetWindowICCProfile(SDL_VideoDevice *_this, SDL_Window *window, size_t icc_profile_atom = X11_XInternAtom(display, icc_atom_string, True); if (icc_profile_atom == None) { - SDL_SetError("Screen is not calibrated.\n"); + SDL_SetError("Screen is not calibrated."); return NULL; } @@ -1887,7 +1887,7 @@ void *X11_GetWindowICCProfile(SDL_VideoDevice *_this, SDL_Window *window, size_t real_nitems = atomProp.count; icc_profile_data = atomProp.data; if (real_format == None) { - SDL_SetError("Screen is not calibrated.\n"); + SDL_SetError("Screen is not calibrated."); return NULL; } diff --git a/test/testffmpeg_vulkan.c b/test/testffmpeg_vulkan.c index e0a0ad45064ba..4f2ba81120233 100644 --- a/test/testffmpeg_vulkan.c +++ b/test/testffmpeg_vulkan.c @@ -146,7 +146,7 @@ static int loadDeviceFunctions(VulkanVideoContext *context) #define VULKAN_DEVICE_FUNCTION(name) \ context->name = (PFN_##name)context->vkGetDeviceProcAddr(context->device, #name); \ if (!context->name) { \ - return SDL_SetError("vkGetDeviceProcAddr(device, \"" #name "\") failed\n"); \ + return SDL_SetError("vkGetDeviceProcAddr(device, \"" #name "\") failed"); \ } VULKAN_FUNCTIONS() #undef VULKAN_GLOBAL_FUNCTION @@ -243,7 +243,7 @@ static int createInstance(VulkanVideoContext *context) result = context->vkCreateInstance(&instanceCreateInfo, NULL, &context->instance); if (result != VK_SUCCESS) { context->instance = VK_NULL_HANDLE; - return SDL_SetError("vkCreateInstance(): %s\n", getVulkanResultString(result)); + return SDL_SetError("vkCreateInstance(): %s", getVulkanResultString(result)); } if (loadInstanceFunctions(context) < 0) { return -1; From 129ebc77b99bdc568337db7b074d35aebec44708 Mon Sep 17 00:00:00 2001 From: SDL Wiki Bot Date: Thu, 23 Jan 2025 23:20:22 +0000 Subject: [PATCH 237/340] Sync SDL3 wiki -> header [ci skip] --- include/SDL3/SDL_gpu.h | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/include/SDL3/SDL_gpu.h b/include/SDL3/SDL_gpu.h index 081ab4825525a..854f53d11bb72 100644 --- a/include/SDL3/SDL_gpu.h +++ b/include/SDL3/SDL_gpu.h @@ -3410,7 +3410,9 @@ extern SDL_DECLSPEC void SDLCALL SDL_EndGPUComputePass( /** * Maps a transfer buffer into application address space. * - * You must unmap the transfer buffer before encoding upload commands. + * You must unmap the transfer buffer before encoding upload commands. The + * memory is owned by the graphics driver - do NOT call SDL_free() on the + * returned pointer. * * \param device a GPU context. * \param transfer_buffer a transfer buffer. From 2e381a717f69b0231032687043e195d09901f109 Mon Sep 17 00:00:00 2001 From: nightmareci Date: Thu, 23 Jan 2025 15:47:55 -0800 Subject: [PATCH 238/340] Fix possible integer overflow of size + 1 --- src/io/SDL_iostream.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/io/SDL_iostream.c b/src/io/SDL_iostream.c index adaf5e047e3e0..7f97dfeb3cdc1 100644 --- a/src/io/SDL_iostream.c +++ b/src/io/SDL_iostream.c @@ -1153,7 +1153,7 @@ void *SDL_LoadFile_IO(SDL_IOStream *src, size_t *datasize, bool closeio) size = FILE_CHUNK_SIZE; loading_chunks = true; } - if (size >= SDL_SIZE_MAX) { + if (size >= SDL_SIZE_MAX - 1) { goto done; } data = (char *)SDL_malloc((size_t)(size + 1)); @@ -1166,7 +1166,7 @@ void *SDL_LoadFile_IO(SDL_IOStream *src, size_t *datasize, bool closeio) if (loading_chunks) { if ((size_total + FILE_CHUNK_SIZE) > size) { size = (size_total + FILE_CHUNK_SIZE); - if (size >= SDL_SIZE_MAX) { + if (size >= SDL_SIZE_MAX - 1) { newdata = NULL; } else { newdata = (char *)SDL_realloc(data, (size_t)(size + 1)); From 84c4ff2f10dde6c155c29fd82351a633947a5a20 Mon Sep 17 00:00:00 2001 From: SDL Wiki Bot Date: Fri, 24 Jan 2025 04:47:03 +0000 Subject: [PATCH 239/340] Sync SDL3 wiki -> header [ci skip] --- include/SDL3/SDL_gamepad.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/SDL3/SDL_gamepad.h b/include/SDL3/SDL_gamepad.h index 264f763b28e9d..99f8b6593fab6 100644 --- a/include/SDL3/SDL_gamepad.h +++ b/include/SDL3/SDL_gamepad.h @@ -29,7 +29,7 @@ * "joysticks" now are actually console-style gamepads. So SDL provides the * gamepad API on top of the lower-level joystick functionality. * - * The difference betweena joystick and a gamepad is that a gamepad tells you + * The difference between a joystick and a gamepad is that a gamepad tells you * _where_ a button or axis is on the device. You don't speak to gamepads in * terms of arbitrary numbers like "button 3" or "axis 2" but in standard * locations: the d-pad, the shoulder buttons, triggers, A/B/X/Y (or From cb3d6dc4673d5eced54b360475ab8c73d6617401 Mon Sep 17 00:00:00 2001 From: "Ryan C. Gordon" Date: Fri, 24 Jan 2025 01:53:51 -0500 Subject: [PATCH 240/340] .wikiheaders-options: Removed wikipreamble setting. Reference https://github.com/libsdl-org/sdlwiki/issues/713. --- .wikiheaders-options | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.wikiheaders-options b/.wikiheaders-options index 11f6668776fb6..9c2b5bb9be091 100644 --- a/.wikiheaders-options +++ b/.wikiheaders-options @@ -14,7 +14,7 @@ projecturl = https://libsdl.org/ wikiurl = https://wiki.libsdl.org bugreporturl = https://github.com/libsdl-org/sdlwiki/issues/new warn_about_missing = 0 -wikipreamble = (This is the documentation for SDL3, which is the current stable version. [SDL2](https://wiki.libsdl.org/SDL2/) was the previous version!) +#wikipreamble = (This is the documentation for SDL3, which is the current stable version. [SDL2](https://wiki.libsdl.org/SDL2/) was the previous version!) wikiheaderfiletext = Defined in [](https://github.com/libsdl-org/SDL/blob/main/include/SDL3/%fname%) manpageheaderfiletext = Defined in SDL3/%fname% From fdf33f90478c2269290562197c2685ae171a9562 Mon Sep 17 00:00:00 2001 From: Anonymous Maarten Date: Fri, 24 Jan 2025 20:07:51 +0100 Subject: [PATCH 241/340] xcode+cmake: Use SDL3.framework/SDL3 as IMPORTED_LOCATION Not adding /SDL3 causes CMake to no longer set the RUNPATh on binaries in the build directory. It also breaks compatibility with CMake versions older then 3.28. reverts c56a3f60fe88e9c8b13d7bfd92363e5d2c9a152f (xcode+cmake: use SDL3.framework folder as IMPORTED_LOCATION) reverts ad3c7b92f8726816580033fdaeb52933419102b8 (xcode+cmake: use SDL3.framework folder as IMPORTED_LOCATION) --- Xcode/SDL/pkg-support/resources/cmake/SDL3Config.cmake | 2 +- Xcode/SDL/pkg-support/share/cmake/SDL3/SDL3Config.cmake | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Xcode/SDL/pkg-support/resources/cmake/SDL3Config.cmake b/Xcode/SDL/pkg-support/resources/cmake/SDL3Config.cmake index 03673f3f4879f..784d27dbb018c 100644 --- a/Xcode/SDL/pkg-support/resources/cmake/SDL3Config.cmake +++ b/Xcode/SDL/pkg-support/resources/cmake/SDL3Config.cmake @@ -59,7 +59,7 @@ if(NOT TARGET SDL3::SDL3-shared) set_target_properties(SDL3::SDL3-shared PROPERTIES FRAMEWORK "TRUE" - IMPORTED_LOCATION "${_sdl3_framework_path}" + IMPORTED_LOCATION "${_sdl3_framework_path}/SDL3" INTERFACE_LINK_LIBRARIES "SDL3::Headers" COMPATIBLE_INTERFACE_BOOL "SDL3_SHARED" INTERFACE_SDL3_SHARED "ON" diff --git a/Xcode/SDL/pkg-support/share/cmake/SDL3/SDL3Config.cmake b/Xcode/SDL/pkg-support/share/cmake/SDL3/SDL3Config.cmake index f1585814b8b8b..9d29aae9a3fb3 100644 --- a/Xcode/SDL/pkg-support/share/cmake/SDL3/SDL3Config.cmake +++ b/Xcode/SDL/pkg-support/share/cmake/SDL3/SDL3Config.cmake @@ -112,7 +112,7 @@ if(NOT TARGET SDL3::SDL3-shared) set_target_properties(SDL3::SDL3-shared PROPERTIES FRAMEWORK "TRUE" - IMPORTED_LOCATION "${_sdl3_framework_path}" + IMPORTED_LOCATION "${_sdl3_framework_path}/SDL3" INTERFACE_LINK_LIBRARIES "SDL3::Headers" ) endif() From 303fd5ed5a00e3dedaa8fd25b07787f9d5e0e5b5 Mon Sep 17 00:00:00 2001 From: Anonymous Maarten Date: Fri, 24 Jan 2025 19:40:54 +0100 Subject: [PATCH 242/340] release: rename resources/cmake -> resources/CMake in dmg --- Xcode/SDL/pkg-support/resources/{cmake => CMake}/SDL3Config.cmake | 0 .../resources/{cmake => CMake}/SDL3ConfigVersion.cmake | 0 2 files changed, 0 insertions(+), 0 deletions(-) rename Xcode/SDL/pkg-support/resources/{cmake => CMake}/SDL3Config.cmake (100%) rename Xcode/SDL/pkg-support/resources/{cmake => CMake}/SDL3ConfigVersion.cmake (100%) diff --git a/Xcode/SDL/pkg-support/resources/cmake/SDL3Config.cmake b/Xcode/SDL/pkg-support/resources/CMake/SDL3Config.cmake similarity index 100% rename from Xcode/SDL/pkg-support/resources/cmake/SDL3Config.cmake rename to Xcode/SDL/pkg-support/resources/CMake/SDL3Config.cmake diff --git a/Xcode/SDL/pkg-support/resources/cmake/SDL3ConfigVersion.cmake b/Xcode/SDL/pkg-support/resources/CMake/SDL3ConfigVersion.cmake similarity index 100% rename from Xcode/SDL/pkg-support/resources/cmake/SDL3ConfigVersion.cmake rename to Xcode/SDL/pkg-support/resources/CMake/SDL3ConfigVersion.cmake From 8df17c97d146b6a8bd7fcfb557bda499ae5a096e Mon Sep 17 00:00:00 2001 From: cosmonaut Date: Fri, 24 Jan 2025 12:04:00 -0800 Subject: [PATCH 243/340] GPU: Add notes about shader resource requirements to documentation --- include/SDL3/SDL_gpu.h | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) diff --git a/include/SDL3/SDL_gpu.h b/include/SDL3/SDL_gpu.h index 854f53d11bb72..b13641130596e 100644 --- a/include/SDL3/SDL_gpu.h +++ b/include/SDL3/SDL_gpu.h @@ -2999,6 +2999,8 @@ extern SDL_DECLSPEC void SDLCALL SDL_BindGPUIndexBuffer( * * The textures must have been created with SDL_GPU_TEXTUREUSAGE_SAMPLER. * + * Be sure your shader is set up according to the requirements documented in SDL_CreateGPUShader(). + * * \param render_pass a render pass handle. * \param first_slot the vertex sampler slot to begin binding from. * \param texture_sampler_bindings an array of texture-sampler binding @@ -3007,6 +3009,8 @@ extern SDL_DECLSPEC void SDLCALL SDL_BindGPUIndexBuffer( * array. * * \since This function is available since SDL 3.2.0. + * + * \sa SDL_CreateGPUShader */ extern SDL_DECLSPEC void SDLCALL SDL_BindGPUVertexSamplers( SDL_GPURenderPass *render_pass, @@ -3020,12 +3024,16 @@ extern SDL_DECLSPEC void SDLCALL SDL_BindGPUVertexSamplers( * These textures must have been created with * SDL_GPU_TEXTUREUSAGE_GRAPHICS_STORAGE_READ. * + * Be sure your shader is set up according to the requirements documented in SDL_CreateGPUShader(). + * * \param render_pass a render pass handle. * \param first_slot the vertex storage texture slot to begin binding from. * \param storage_textures an array of storage textures. * \param num_bindings the number of storage texture to bind from the array. * * \since This function is available since SDL 3.2.0. + * + * \sa SDL_CreateGPUShader */ extern SDL_DECLSPEC void SDLCALL SDL_BindGPUVertexStorageTextures( SDL_GPURenderPass *render_pass, @@ -3039,12 +3047,16 @@ extern SDL_DECLSPEC void SDLCALL SDL_BindGPUVertexStorageTextures( * These buffers must have been created with * SDL_GPU_BUFFERUSAGE_GRAPHICS_STORAGE_READ. * + * Be sure your shader is set up according to the requirements documented in SDL_CreateGPUShader(). + * * \param render_pass a render pass handle. * \param first_slot the vertex storage buffer slot to begin binding from. * \param storage_buffers an array of buffers. * \param num_bindings the number of buffers to bind from the array. * * \since This function is available since SDL 3.2.0. + * + * \sa SDL_CreateGPUShader */ extern SDL_DECLSPEC void SDLCALL SDL_BindGPUVertexStorageBuffers( SDL_GPURenderPass *render_pass, @@ -3057,6 +3069,8 @@ extern SDL_DECLSPEC void SDLCALL SDL_BindGPUVertexStorageBuffers( * * The textures must have been created with SDL_GPU_TEXTUREUSAGE_SAMPLER. * + * Be sure your shader is set up according to the requirements documented in SDL_CreateGPUShader(). + * * \param render_pass a render pass handle. * \param first_slot the fragment sampler slot to begin binding from. * \param texture_sampler_bindings an array of texture-sampler binding @@ -3065,6 +3079,8 @@ extern SDL_DECLSPEC void SDLCALL SDL_BindGPUVertexStorageBuffers( * array. * * \since This function is available since SDL 3.2.0. + * + * \sa SDL_CreateGPUShader */ extern SDL_DECLSPEC void SDLCALL SDL_BindGPUFragmentSamplers( SDL_GPURenderPass *render_pass, @@ -3078,12 +3094,16 @@ extern SDL_DECLSPEC void SDLCALL SDL_BindGPUFragmentSamplers( * These textures must have been created with * SDL_GPU_TEXTUREUSAGE_GRAPHICS_STORAGE_READ. * + * Be sure your shader is set up according to the requirements documented in SDL_CreateGPUShader(). + * * \param render_pass a render pass handle. * \param first_slot the fragment storage texture slot to begin binding from. * \param storage_textures an array of storage textures. * \param num_bindings the number of storage textures to bind from the array. * * \since This function is available since SDL 3.2.0. + * + * \sa SDL_CreateGPUShader */ extern SDL_DECLSPEC void SDLCALL SDL_BindGPUFragmentStorageTextures( SDL_GPURenderPass *render_pass, @@ -3097,12 +3117,16 @@ extern SDL_DECLSPEC void SDLCALL SDL_BindGPUFragmentStorageTextures( * These buffers must have been created with * SDL_GPU_BUFFERUSAGE_GRAPHICS_STORAGE_READ. * + * Be sure your shader is set up according to the requirements documented in SDL_CreateGPUShader(). + * * \param render_pass a render pass handle. * \param first_slot the fragment storage buffer slot to begin binding from. * \param storage_buffers an array of storage buffers. * \param num_bindings the number of storage buffers to bind from the array. * * \since This function is available since SDL 3.2.0. + * + * \sa SDL_CreateGPUShader */ extern SDL_DECLSPEC void SDLCALL SDL_BindGPUFragmentStorageBuffers( SDL_GPURenderPass *render_pass, @@ -3290,6 +3314,8 @@ extern SDL_DECLSPEC void SDLCALL SDL_BindGPUComputePipeline( * * The textures must have been created with SDL_GPU_TEXTUREUSAGE_SAMPLER. * + * Be sure your shader is set up according to the requirements documented in SDL_CreateGPUShader(). + * * \param compute_pass a compute pass handle. * \param first_slot the compute sampler slot to begin binding from. * \param texture_sampler_bindings an array of texture-sampler binding @@ -3298,6 +3324,8 @@ extern SDL_DECLSPEC void SDLCALL SDL_BindGPUComputePipeline( * array. * * \since This function is available since SDL 3.2.0. + * + * \sa SDL_CreateGPUShader */ extern SDL_DECLSPEC void SDLCALL SDL_BindGPUComputeSamplers( SDL_GPUComputePass *compute_pass, @@ -3311,12 +3339,16 @@ extern SDL_DECLSPEC void SDLCALL SDL_BindGPUComputeSamplers( * These textures must have been created with * SDL_GPU_TEXTUREUSAGE_COMPUTE_STORAGE_READ. * + * Be sure your shader is set up according to the requirements documented in SDL_CreateGPUShader(). + * * \param compute_pass a compute pass handle. * \param first_slot the compute storage texture slot to begin binding from. * \param storage_textures an array of storage textures. * \param num_bindings the number of storage textures to bind from the array. * * \since This function is available since SDL 3.2.0. + * + * \sa SDL_CreateGPUShader */ extern SDL_DECLSPEC void SDLCALL SDL_BindGPUComputeStorageTextures( SDL_GPUComputePass *compute_pass, @@ -3330,12 +3362,16 @@ extern SDL_DECLSPEC void SDLCALL SDL_BindGPUComputeStorageTextures( * These buffers must have been created with * SDL_GPU_BUFFERUSAGE_COMPUTE_STORAGE_READ. * + * Be sure your shader is set up according to the requirements documented in SDL_CreateGPUShader(). + * * \param compute_pass a compute pass handle. * \param first_slot the compute storage buffer slot to begin binding from. * \param storage_buffers an array of storage buffer binding structs. * \param num_bindings the number of storage buffers to bind from the array. * * \since This function is available since SDL 3.2.0. + * + * \sa SDL_CreateGPUShader */ extern SDL_DECLSPEC void SDLCALL SDL_BindGPUComputeStorageBuffers( SDL_GPUComputePass *compute_pass, From ad8a09000fbe882451dc8e57c2ab0215c43a38d7 Mon Sep 17 00:00:00 2001 From: SDL Wiki Bot Date: Fri, 24 Jan 2025 20:06:31 +0000 Subject: [PATCH 244/340] Sync SDL3 wiki -> header [ci skip] --- include/SDL3/SDL_gpu.h | 27 ++++++++++++++++++--------- 1 file changed, 18 insertions(+), 9 deletions(-) diff --git a/include/SDL3/SDL_gpu.h b/include/SDL3/SDL_gpu.h index b13641130596e..13b8ce215dcdb 100644 --- a/include/SDL3/SDL_gpu.h +++ b/include/SDL3/SDL_gpu.h @@ -2999,7 +2999,8 @@ extern SDL_DECLSPEC void SDLCALL SDL_BindGPUIndexBuffer( * * The textures must have been created with SDL_GPU_TEXTUREUSAGE_SAMPLER. * - * Be sure your shader is set up according to the requirements documented in SDL_CreateGPUShader(). + * Be sure your shader is set up according to the requirements documented in + * SDL_CreateGPUShader(). * * \param render_pass a render pass handle. * \param first_slot the vertex sampler slot to begin binding from. @@ -3024,7 +3025,8 @@ extern SDL_DECLSPEC void SDLCALL SDL_BindGPUVertexSamplers( * These textures must have been created with * SDL_GPU_TEXTUREUSAGE_GRAPHICS_STORAGE_READ. * - * Be sure your shader is set up according to the requirements documented in SDL_CreateGPUShader(). + * Be sure your shader is set up according to the requirements documented in + * SDL_CreateGPUShader(). * * \param render_pass a render pass handle. * \param first_slot the vertex storage texture slot to begin binding from. @@ -3047,7 +3049,8 @@ extern SDL_DECLSPEC void SDLCALL SDL_BindGPUVertexStorageTextures( * These buffers must have been created with * SDL_GPU_BUFFERUSAGE_GRAPHICS_STORAGE_READ. * - * Be sure your shader is set up according to the requirements documented in SDL_CreateGPUShader(). + * Be sure your shader is set up according to the requirements documented in + * SDL_CreateGPUShader(). * * \param render_pass a render pass handle. * \param first_slot the vertex storage buffer slot to begin binding from. @@ -3069,7 +3072,8 @@ extern SDL_DECLSPEC void SDLCALL SDL_BindGPUVertexStorageBuffers( * * The textures must have been created with SDL_GPU_TEXTUREUSAGE_SAMPLER. * - * Be sure your shader is set up according to the requirements documented in SDL_CreateGPUShader(). + * Be sure your shader is set up according to the requirements documented in + * SDL_CreateGPUShader(). * * \param render_pass a render pass handle. * \param first_slot the fragment sampler slot to begin binding from. @@ -3094,7 +3098,8 @@ extern SDL_DECLSPEC void SDLCALL SDL_BindGPUFragmentSamplers( * These textures must have been created with * SDL_GPU_TEXTUREUSAGE_GRAPHICS_STORAGE_READ. * - * Be sure your shader is set up according to the requirements documented in SDL_CreateGPUShader(). + * Be sure your shader is set up according to the requirements documented in + * SDL_CreateGPUShader(). * * \param render_pass a render pass handle. * \param first_slot the fragment storage texture slot to begin binding from. @@ -3117,7 +3122,8 @@ extern SDL_DECLSPEC void SDLCALL SDL_BindGPUFragmentStorageTextures( * These buffers must have been created with * SDL_GPU_BUFFERUSAGE_GRAPHICS_STORAGE_READ. * - * Be sure your shader is set up according to the requirements documented in SDL_CreateGPUShader(). + * Be sure your shader is set up according to the requirements documented in + * SDL_CreateGPUShader(). * * \param render_pass a render pass handle. * \param first_slot the fragment storage buffer slot to begin binding from. @@ -3314,7 +3320,8 @@ extern SDL_DECLSPEC void SDLCALL SDL_BindGPUComputePipeline( * * The textures must have been created with SDL_GPU_TEXTUREUSAGE_SAMPLER. * - * Be sure your shader is set up according to the requirements documented in SDL_CreateGPUShader(). + * Be sure your shader is set up according to the requirements documented in + * SDL_CreateGPUShader(). * * \param compute_pass a compute pass handle. * \param first_slot the compute sampler slot to begin binding from. @@ -3339,7 +3346,8 @@ extern SDL_DECLSPEC void SDLCALL SDL_BindGPUComputeSamplers( * These textures must have been created with * SDL_GPU_TEXTUREUSAGE_COMPUTE_STORAGE_READ. * - * Be sure your shader is set up according to the requirements documented in SDL_CreateGPUShader(). + * Be sure your shader is set up according to the requirements documented in + * SDL_CreateGPUShader(). * * \param compute_pass a compute pass handle. * \param first_slot the compute storage texture slot to begin binding from. @@ -3362,7 +3370,8 @@ extern SDL_DECLSPEC void SDLCALL SDL_BindGPUComputeStorageTextures( * These buffers must have been created with * SDL_GPU_BUFFERUSAGE_COMPUTE_STORAGE_READ. * - * Be sure your shader is set up according to the requirements documented in SDL_CreateGPUShader(). + * Be sure your shader is set up according to the requirements documented in + * SDL_CreateGPUShader(). * * \param compute_pass a compute pass handle. * \param first_slot the compute storage buffer slot to begin binding from. From 17c4bdd754e860f166bdd2090c3d8a346a1a2bba Mon Sep 17 00:00:00 2001 From: SDL Wiki Bot Date: Fri, 24 Jan 2025 21:19:18 +0000 Subject: [PATCH 245/340] Sync SDL3 wiki -> header [ci skip] --- include/SDL3/SDL_storage.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/include/SDL3/SDL_storage.h b/include/SDL3/SDL_storage.h index 8b89ace18dd72..d3599b9327f2c 100644 --- a/include/SDL3/SDL_storage.h +++ b/include/SDL3/SDL_storage.h @@ -636,10 +636,10 @@ extern SDL_DECLSPEC Uint64 SDLCALL SDL_GetStorageSpaceRemaining(SDL_Storage *sto * Enumerate a directory tree, filtered by pattern, and return a list. * * Files are filtered out if they don't match the string in `pattern`, which - * may contain wildcard characters '*' (match everything) and '?' (match one + * may contain wildcard characters `*` (match everything) and `?` (match one * character). If pattern is NULL, no filtering is done and all results are * returned. Subdirectories are permitted, and are specified with a path - * separator of '/'. Wildcard characters '*' and '?' never match a path + * separator of '/'. Wildcard characters `*` and `?` never match a path * separator. * * `flags` may be set to SDL_GLOB_CASEINSENSITIVE to make the pattern matching From fa8c0f0552cc232ab454b4b5ce787e63617ef7ab Mon Sep 17 00:00:00 2001 From: SDL Wiki Bot Date: Sun, 26 Jan 2025 03:57:15 +0000 Subject: [PATCH 246/340] Sync SDL3 wiki -> header [ci skip] --- include/SDL3/SDL_process.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/include/SDL3/SDL_process.h b/include/SDL3/SDL_process.h index 2cc77395bc687..bd6d6a4546ef0 100644 --- a/include/SDL3/SDL_process.h +++ b/include/SDL3/SDL_process.h @@ -173,13 +173,13 @@ typedef enum SDL_ProcessIO * standard input when `SDL_PROP_PROCESS_CREATE_STDIN_NUMBER` is set to * `SDL_PROCESS_STDIO_REDIRECT`. * - `SDL_PROP_PROCESS_CREATE_STDOUT_NUMBER`: an SDL_ProcessIO value - * describing where standard output for the process goes go, defaults to + * describing where standard output for the process goes to, defaults to * `SDL_PROCESS_STDIO_INHERITED`. * - `SDL_PROP_PROCESS_CREATE_STDOUT_POINTER`: an SDL_IOStream pointer used * for standard output when `SDL_PROP_PROCESS_CREATE_STDOUT_NUMBER` is set * to `SDL_PROCESS_STDIO_REDIRECT`. * - `SDL_PROP_PROCESS_CREATE_STDERR_NUMBER`: an SDL_ProcessIO value - * describing where standard error for the process goes go, defaults to + * describing where standard error for the process goes to, defaults to * `SDL_PROCESS_STDIO_INHERITED`. * - `SDL_PROP_PROCESS_CREATE_STDERR_POINTER`: an SDL_IOStream pointer used * for standard error when `SDL_PROP_PROCESS_CREATE_STDERR_NUMBER` is set to From 628130ec8fb2ed5bd6c1ee83b865fa1754e1c55c Mon Sep 17 00:00:00 2001 From: Cameron Gutman Date: Sat, 25 Jan 2025 23:50:04 -0600 Subject: [PATCH 247/340] SDL_migration.cocci: fix incorrect SDL3 API name --- build-scripts/SDL_migration.cocci | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/build-scripts/SDL_migration.cocci b/build-scripts/SDL_migration.cocci index dac94493220b5..fe11b6ecb9545 100644 --- a/build-scripts/SDL_migration.cocci +++ b/build-scripts/SDL_migration.cocci @@ -1136,12 +1136,12 @@ typedef SDL_GameControllerButton, SDL_GamepadButton; @@ @@ - SDL_GameControllerGetNumTouchpadFingers -+ SDL_GetGamepadNumTouchpadFingers ++ SDL_GetNumGamepadTouchpadFingers (...) @@ @@ - SDL_GameControllerGetNumTouchpads -+ SDL_GetGamepadNumTouchpads ++ SDL_GetNumGamepadTouchpads (...) @@ @@ From 913e0a5e53ce60cd97308e3b2b70512d72fee41c Mon Sep 17 00:00:00 2001 From: Cameron Gutman Date: Sat, 25 Jan 2025 23:50:44 -0600 Subject: [PATCH 248/340] SDL_migration.cocci: handle more renamed event fields --- build-scripts/SDL_migration.cocci | 95 +++++++++++++++++++++++++++++++ 1 file changed, 95 insertions(+) diff --git a/build-scripts/SDL_migration.cocci b/build-scripts/SDL_migration.cocci index fe11b6ecb9545..38655aff0e237 100644 --- a/build-scripts/SDL_migration.cocci +++ b/build-scripts/SDL_migration.cocci @@ -1491,6 +1491,51 @@ typedef SDL_GameControllerButton, SDL_GamepadButton; + SDL_TextInputShown (...) @@ +SDL_Event e1; +@@ +- e1.key.keysym.mod ++ e1.key.mod +@@ +SDL_Event *e1; +@@ +- e1->key.keysym.mod ++ e1->key.mod +@@ +SDL_KeyboardEvent *e1; +@@ +- e1->keysym.mod ++ e1->mod +@@ +SDL_Event e1; +@@ +- e1.key.keysym.sym ++ e1.key.key +@@ +SDL_Event *e1; +@@ +- e1->key.keysym.sym ++ e1->key.key +@@ +SDL_KeyboardEvent *e1; +@@ +- e1->keysym.sym ++ e1->key +@@ +SDL_Event e1; +@@ +- e1.key.keysym.scancode ++ e1.key.scancode +@@ +SDL_Event *e1; +@@ +- e1->key.keysym.scancode ++ e1->key.scancode +@@ +SDL_KeyboardEvent *e1; +@@ +- e1->keysym.scancode ++ e1->scancode +@@ @@ - KMOD_ALT + SDL_KMOD_ALT @@ -2443,6 +2488,11 @@ SDL_Event *e1; - e1->wheel.mouseX + e1->wheel.mouse_x @@ +SDL_MouseWheelEvent *e1; +@@ +- e1->mouseX ++ e1->mouse_x +@@ SDL_Event e1; @@ - e1.wheel.mouseY @@ -2453,6 +2503,41 @@ SDL_Event *e1; - e1->wheel.mouseY + e1->wheel.mouse_y @@ +SDL_MouseWheelEvent *e1; +@@ +- e1->mouseY ++ e1->mouse_y +@@ +SDL_Event e1; +@@ +- e1.wheel.preciseX ++ e1.wheel.x +@@ +SDL_Event *e1; +@@ +- e1->wheel.preciseX ++ e1->wheel.x +@@ +SDL_MouseWheelEvent *e1; +@@ +- e1->preciseX ++ e1->x +@@ +SDL_Event e1; +@@ +- e1.wheel.preciseY ++ e1.wheel.y +@@ +SDL_Event *e1; +@@ +- e1->wheel.preciseY ++ e1->wheel.y +@@ +SDL_MouseWheelEvent *e1; +@@ +- e1->preciseY ++ e1->y +@@ SDL_Event e1; @@ - e1.tfinger.touchId @@ -2463,6 +2548,11 @@ SDL_Event *e1; - e1->tfinger.touchId + e1->tfinger.touchID @@ +SDL_TouchFingerEvent *e1; +@@ +- e1->touchId ++ e1->touchID +@@ SDL_Event e1; @@ - e1.tfinger.fingerId @@ -2473,6 +2563,11 @@ SDL_Event *e1; - e1->tfinger.fingerId + e1->tfinger.fingerID @@ +SDL_TouchFingerEvent *e1; +@@ +- e1->fingerId ++ e1->fingerID +@@ expression e1, e2, e3, e4; @@ - SDL_CreateWindow(e1, SDL_WINDOWPOS_UNDEFINED, SDL_WINDOWPOS_UNDEFINED, e2, e3, e4) From 5f8e0ebf584b069b15f88240bda40a8263790079 Mon Sep 17 00:00:00 2001 From: Sam Lantinga Date: Sun, 26 Jan 2025 19:29:47 -0800 Subject: [PATCH 249/340] Fixed memory leak at shutdown --- src/events/SDL_pen.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/src/events/SDL_pen.c b/src/events/SDL_pen.c index afc2ea031daa7..71ddd4c0d8d55 100644 --- a/src/events/SDL_pen.c +++ b/src/events/SDL_pen.c @@ -109,9 +109,14 @@ bool SDL_InitPen(void) void SDL_QuitPen(void) { SDL_DestroyRWLock(pen_device_rwlock); - pen_device_rwlock = 0; - SDL_free(pen_devices); - pen_devices = NULL; + pen_device_rwlock = NULL; + if (pen_devices) { + for (int i = pen_device_count; i--; ) { + SDL_free(pen_devices[i].name); + } + SDL_free(pen_devices); + pen_devices = NULL; + } pen_device_count = 0; pen_touching = 0; } From 09f900f66ed81c2681c2cd525fda059c267f77ab Mon Sep 17 00:00:00 2001 From: "Ryan C. Gordon" Date: Mon, 27 Jan 2025 01:11:22 -0500 Subject: [PATCH 250/340] audio: Remove resampling limits. Audio streams used to accept audio with a src or dest frequency between 4000Hz and 384000Hz. It was arbitrary (or perhaps a relic of older resampler revisions), and testing shows unnecessary, so remove it. Fixes #12098. --- src/audio/SDL_audiocvt.c | 14 +++----------- 1 file changed, 3 insertions(+), 11 deletions(-) diff --git a/src/audio/SDL_audiocvt.c b/src/audio/SDL_audiocvt.c index f128f8b5ae5f8..08beb480b78ea 100644 --- a/src/audio/SDL_audiocvt.c +++ b/src/audio/SDL_audiocvt.c @@ -558,9 +558,9 @@ bool SDL_SetAudioStreamFormat(SDL_AudioStream *stream, const SDL_AudioSpec *src_ return SDL_InvalidParamError("stream"); } - // Picked mostly arbitrarily. - static const int min_freq = 4000; - static const int max_freq = 384000; + // note that while we've removed the maximum frequency checks, SDL _will_ + // fail to resample to extremely high sample rates correctly. Really high, + // like 196608000Hz. File a bug. :P if (src_spec) { if (!SDL_IsSupportedAudioFormat(src_spec->format)) { @@ -569,10 +569,6 @@ bool SDL_SetAudioStreamFormat(SDL_AudioStream *stream, const SDL_AudioSpec *src_ return SDL_InvalidParamError("src_spec->channels"); } else if (src_spec->freq <= 0) { return SDL_InvalidParamError("src_spec->freq"); - } else if (src_spec->freq < min_freq) { - return SDL_SetError("Source rate is too low"); - } else if (src_spec->freq > max_freq) { - return SDL_SetError("Source rate is too high"); } } @@ -583,10 +579,6 @@ bool SDL_SetAudioStreamFormat(SDL_AudioStream *stream, const SDL_AudioSpec *src_ return SDL_InvalidParamError("dst_spec->channels"); } else if (dst_spec->freq <= 0) { return SDL_InvalidParamError("dst_spec->freq"); - } else if (dst_spec->freq < min_freq) { - return SDL_SetError("Destination rate is too low"); - } else if (dst_spec->freq > max_freq) { - return SDL_SetError("Destination rate is too high"); } } From 6f098a920ea19a4676808b053bdb5e9a8ec121bd Mon Sep 17 00:00:00 2001 From: Petar Popovic Date: Sun, 26 Jan 2025 04:56:16 +0100 Subject: [PATCH 251/340] Avoid a crash when a tray without a menu is clicked on Windows. --- src/tray/windows/SDL_tray.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/tray/windows/SDL_tray.c b/src/tray/windows/SDL_tray.c index a7e27c069914d..32b5e85c5656b 100644 --- a/src/tray/windows/SDL_tray.c +++ b/src/tray/windows/SDL_tray.c @@ -115,7 +115,10 @@ LRESULT CALLBACK TrayWindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lPar case WM_TRAYICON: if (LOWORD(lParam) == WM_CONTEXTMENU || LOWORD(lParam) == WM_LBUTTONUP) { SetForegroundWindow(hwnd); - TrackPopupMenu(tray->menu->hMenu, TPM_BOTTOMALIGN | TPM_RIGHTALIGN, GET_X_LPARAM(wParam), GET_Y_LPARAM(wParam), 0, hwnd, NULL); + + if (tray->menu) { + TrackPopupMenu(tray->menu->hMenu, TPM_BOTTOMALIGN | TPM_RIGHTALIGN, GET_X_LPARAM(wParam), GET_Y_LPARAM(wParam), 0, hwnd, NULL); + } } break; From 725ee7665ce25be73fb9ceea3f7eb0bfaa3ac42b Mon Sep 17 00:00:00 2001 From: mausimus <73635663+mausimus@users.noreply.github.com> Date: Mon, 27 Jan 2025 21:52:46 +0900 Subject: [PATCH 252/340] Documentation: fixed typos around floats precision --- include/SDL3/SDL_stdinc.h | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/include/SDL3/SDL_stdinc.h b/include/SDL3/SDL_stdinc.h index 4e15a3c642676..c16392861aaa3 100644 --- a/include/SDL3/SDL_stdinc.h +++ b/include/SDL3/SDL_stdinc.h @@ -4701,7 +4701,7 @@ extern SDL_DECLSPEC double SDLCALL SDL_atan2(double y, double x); * * \since This function is available since SDL 3.2.0. * - * \sa SDL_atan2f + * \sa SDL_atan2 * \sa SDL_atan * \sa SDL_tan */ @@ -4810,7 +4810,7 @@ extern SDL_DECLSPEC double SDLCALL SDL_copysign(double x, double y); * * \since This function is available since SDL 3.2.0. * - * \sa SDL_copysignf + * \sa SDL_copysign * \sa SDL_fabsf */ extern SDL_DECLSPEC float SDLCALL SDL_copysignf(float x, float y); @@ -4943,7 +4943,7 @@ extern SDL_DECLSPEC float SDLCALL SDL_expf(float x); * Range: `0 <= y <= INF` * * This function operates on double-precision floating point values, use - * SDL_copysignf for single-precision floats. + * SDL_fabsf for single-precision floats. * * \param x floating point value to use as the magnitude. * \returns the absolute value of `x`. @@ -4964,7 +4964,7 @@ extern SDL_DECLSPEC double SDLCALL SDL_fabs(double x); * Range: `0 <= y <= INF` * * This function operates on single-precision floating point values, use - * SDL_copysignf for double-precision floats. + * SDL_fabs for double-precision floats. * * \param x floating point value to use as the magnitude. * \returns the absolute value of `x`. @@ -5016,7 +5016,7 @@ extern SDL_DECLSPEC double SDLCALL SDL_floor(double x); * Range: `-INF <= y <= INF`, y integer * * This function operates on single-precision floating point values, use - * SDL_floorf for double-precision floats. + * SDL_floor for double-precision floats. * * \param x floating point value. * \returns the floor of `x`. @@ -5073,7 +5073,7 @@ extern SDL_DECLSPEC double SDLCALL SDL_trunc(double x); * Range: `-INF <= y <= INF`, y integer * * This function operates on single-precision floating point values, use - * SDL_truncf for double-precision floats. + * SDL_trunc for double-precision floats. * * \param x floating point value. * \returns `x` truncated to an integer. @@ -5131,7 +5131,7 @@ extern SDL_DECLSPEC double SDLCALL SDL_fmod(double x, double y); * Range: `-y <= z <= y` * * This function operates on single-precision floating point values, use - * SDL_fmod for single-precision floats. + * SDL_fmod for double-precision floats. * * \param x the numerator. * \param y the denominator. Must not be 0. @@ -5409,7 +5409,7 @@ extern SDL_DECLSPEC double SDLCALL SDL_pow(double x, double y); * instead. * * This function operates on single-precision floating point values, use - * SDL_powf for double-precision floats. + * SDL_pow for double-precision floats. * * This function may use a different approximation across different versions, * platforms and configurations. i.e, it can return a different value given @@ -5469,8 +5469,8 @@ extern SDL_DECLSPEC double SDLCALL SDL_round(double x); * * Range: `-INF <= y <= INF`, y integer * - * This function operates on double-precision floating point values, use - * SDL_roundf for single-precision floats. To get the result as an integer + * This function operates on single-precision floating point values, use + * SDL_round for double-precision floats. To get the result as an integer * type, use SDL_lroundf. * * \param x floating point value. @@ -5499,7 +5499,7 @@ extern SDL_DECLSPEC float SDLCALL SDL_roundf(float x); * Range: `MIN_LONG <= y <= MAX_LONG` * * This function operates on double-precision floating point values, use - * SDL_lround for single-precision floats. To get the result as a + * SDL_lroundf for single-precision floats. To get the result as a * floating-point type, use SDL_round. * * \param x floating point value. @@ -5528,8 +5528,8 @@ extern SDL_DECLSPEC long SDLCALL SDL_lround(double x); * Range: `MIN_LONG <= y <= MAX_LONG` * * This function operates on single-precision floating point values, use - * SDL_lroundf for double-precision floats. To get the result as a - * floating-point type, use SDL_roundf, + * SDL_lround for double-precision floats. To get the result as a + * floating-point type, use SDL_roundf. * * \param x floating point value. * \returns the nearest integer to `x`. @@ -5742,7 +5742,7 @@ extern SDL_DECLSPEC double SDLCALL SDL_tan(double x); * Range: `-INF <= y <= INF` * * This function operates on single-precision floating point values, use - * SDL_tanf for double-precision floats. + * SDL_tan for double-precision floats. * * This function may use a different approximation across different versions, * platforms and configurations. i.e, it can return a different value given From 3b3af7105b020bfd932ba5d0d1471e0d365e0156 Mon Sep 17 00:00:00 2001 From: "Ryan C. Gordon" Date: Mon, 27 Jan 2025 18:46:02 -0500 Subject: [PATCH 253/340] audio: Fix a minor code style thing. --- src/audio/SDL_audiocvt.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/audio/SDL_audiocvt.c b/src/audio/SDL_audiocvt.c index 08beb480b78ea..b247b4c58fb86 100644 --- a/src/audio/SDL_audiocvt.c +++ b/src/audio/SDL_audiocvt.c @@ -237,7 +237,7 @@ static void SwizzleAudio(const int num_frames, void *dst, const void *src, int c void ConvertAudio(int num_frames, const void *src, SDL_AudioFormat src_format, int src_channels, const int *src_map, void *dst, SDL_AudioFormat dst_format, int dst_channels, const int *dst_map, - void* scratch, float gain) + void *scratch, float gain) { SDL_assert(src != NULL); SDL_assert(dst != NULL); From 8f958953f19c8c7a91f0a6a983ff15492c131535 Mon Sep 17 00:00:00 2001 From: "Ryan C. Gordon" Date: Mon, 27 Jan 2025 18:46:45 -0500 Subject: [PATCH 254/340] audio: Fix audio stream gain going wrong in certain scenarios. Fixes #12091. --- src/audio/SDL_audioqueue.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/audio/SDL_audioqueue.c b/src/audio/SDL_audioqueue.c index 18ed346fad170..df7cac880bf74 100644 --- a/src/audio/SDL_audioqueue.c +++ b/src/audio/SDL_audioqueue.c @@ -548,7 +548,7 @@ const Uint8 *SDL_ReadFromAudioQueue(SDL_AudioQueue *queue, size_t dst_present_bytes = present_frames * dst_frame_size; size_t dst_future_bytes = future_frames * dst_frame_size; - bool convert = (src_format != dst_format) || (src_channels != dst_channels); + const bool convert = (src_format != dst_format) || (src_channels != dst_channels) || (gain != 1.0f); if (convert && !dst) { // The user didn't ask for the data to be copied, but we need to convert it, so store it in the scratch buffer From 1c7cc602863821ee62dac65d9e3c26fcc2710b3c Mon Sep 17 00:00:00 2001 From: Sam Lantinga Date: Mon, 27 Jan 2025 22:25:12 -0800 Subject: [PATCH 255/340] Skip IsRegularFileOrPipe() check on Emscripten The sandbox guarantees that this will be true. Fixes https://github.com/libsdl-org/SDL/issues/12108 --- src/io/SDL_iostream.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/io/SDL_iostream.c b/src/io/SDL_iostream.c index 7f97dfeb3cdc1..989f3b9c4c0fd 100644 --- a/src/io/SDL_iostream.c +++ b/src/io/SDL_iostream.c @@ -788,10 +788,13 @@ static bool SDLCALL mem_close(void *userdata) #if defined(HAVE_STDIO_H) && !defined(SDL_PLATFORM_WINDOWS) static bool IsRegularFileOrPipe(FILE *f) { +#ifndef SDL_PLATFORM_EMSCRIPTEN struct stat st; if (fstat(fileno(f), &st) < 0 || !(S_ISREG(st.st_mode) || S_ISFIFO(st.st_mode))) { return false; } +#endif // !SDL_PLATFORM_EMSCRIPTEN + return true; } #endif From c21bc48a7074d8589a2764e287b09d06fd764a2c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Carl=20=C3=85stholm?= Date: Tue, 28 Jan 2025 10:19:57 +0100 Subject: [PATCH 256/340] Fix undefined behavior in SDL_windowsmouse.c This fix prevents C undefined behavior from being invoked on Windows if the user's configured cursor speed is below 6. --- src/video/windows/SDL_windowsmouse.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/video/windows/SDL_windowsmouse.c b/src/video/windows/SDL_windowsmouse.c index 3a1c7cac8924c..a0e9c2550f10d 100644 --- a/src/video/windows/SDL_windowsmouse.c +++ b/src/video/windows/SDL_windowsmouse.c @@ -710,7 +710,7 @@ void WIN_UpdateMouseSystemScale(void) int v = 10; if (SystemParametersInfo(SPI_GETMOUSESPEED, 0, &v, 0)) { v = SDL_max(1, SDL_min(v, 20)); - data->dpiscale = SDL_max(SDL_max(v, (v - 2) << 2), (v - 6) << 3); + data->dpiscale = SDL_max(SDL_max(v, (v - 2) * 4), (v - 6) * 8); } int params[3]; From 1c008d8ed0aebaa2662df52796b02fcf3d2782c2 Mon Sep 17 00:00:00 2001 From: Adam Kewley Date: Tue, 28 Jan 2025 12:42:58 +0100 Subject: [PATCH 257/340] Change DBUS introspection timer from INFINITE -> DEFAULT when introspecting available dialog services --- src/dialog/unix/SDL_portaldialog.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/dialog/unix/SDL_portaldialog.c b/src/dialog/unix/SDL_portaldialog.c index 1d068ff20fa76..efecd12419026 100644 --- a/src/dialog/unix/SDL_portaldialog.c +++ b/src/dialog/unix/SDL_portaldialog.c @@ -497,7 +497,7 @@ bool SDL_Portal_detect(void) goto done; } - reply = dbus->connection_send_with_reply_and_block(dbus->session_conn, msg, DBUS_TIMEOUT_INFINITE, NULL); + reply = dbus->connection_send_with_reply_and_block(dbus->session_conn, msg, DBUS_TIMEOUT_USE_DEFAULT, NULL); dbus->message_unref(msg); if (!reply) { goto done; From 44edbf713729e455582be3ef2e0fde58c6613b4e Mon Sep 17 00:00:00 2001 From: Sam Lantinga Date: Wed, 22 Jan 2025 10:11:46 -0800 Subject: [PATCH 258/340] Use templates for the package support files This makes them more easy to reuse in other projects. --- build-scripts/pkg-support/android/INSTALL.md.in | 4 ++-- .../pkg-support/mingw/{INSTALL.md => INSTALL.md.in} | 10 +++++----- .../pkg-support/msvc/{INSTALL.md => INSTALL.md.in} | 8 ++++---- build-scripts/release-info.json | 4 ++-- 4 files changed, 13 insertions(+), 13 deletions(-) rename build-scripts/pkg-support/mingw/{INSTALL.md => INSTALL.md.in} (74%) rename build-scripts/pkg-support/msvc/{INSTALL.md => INSTALL.md.in} (77%) diff --git a/build-scripts/pkg-support/android/INSTALL.md.in b/build-scripts/pkg-support/android/INSTALL.md.in index 602677335bcc7..80321c2e02d8a 100644 --- a/build-scripts/pkg-support/android/INSTALL.md.in +++ b/build-scripts/pkg-support/android/INSTALL.md.in @@ -1,7 +1,7 @@ # Using this package -This package contains SDL built for the Android platform. +This package contains @<@PROJECT_NAME@>@ built for the Android platform. ## Gradle integration @@ -59,7 +59,7 @@ Add `--help` for a list of all available options. An API reference, tutorials, and additional documentation is available at: -https://wiki.libsdl.org/SDL3 +https://wiki.libsdl.org/@<@PROJECT_NAME@>@ # Example code diff --git a/build-scripts/pkg-support/mingw/INSTALL.md b/build-scripts/pkg-support/mingw/INSTALL.md.in similarity index 74% rename from build-scripts/pkg-support/mingw/INSTALL.md rename to build-scripts/pkg-support/mingw/INSTALL.md.in index 83ea472eeed35..f1a6a7897b467 100644 --- a/build-scripts/pkg-support/mingw/INSTALL.md +++ b/build-scripts/pkg-support/mingw/INSTALL.md.in @@ -1,19 +1,19 @@ # Using this package -This package contains SDL built for the mingw-w64 toolchain. +This package contains @<@PROJECT_NAME@>@ built for the mingw-w64 toolchain. The files for 32-bit architecture are in i686-w64-mingw32 The files for 64-bit architecture are in x86_64-w64-mingw32 You can install them to another location, just type `make` for help. -To use this package, point your include path at _arch_/include and your library path at _arch_/lib, link with the SDL3 library and copy _arch_/bin/SDL3.dll next to your executable. +To use this package, point your include path at _arch_/include and your library path at _arch_/lib, link with the @<@PROJECT_NAME@>@ library and copy _arch_/bin/@<@PROJECT_NAME@>@.dll next to your executable. e.g. ```sh -gcc -o hello.exe hello.c -Ix86_64-w64-mingw32/include -Lx86_64-w64-mingw32/lib -lSDL3 -cp x86_64-w64-mingw32/bin/SDL3.dll . +gcc -o hello.exe hello.c -Ix86_64-w64-mingw32/include -Lx86_64-w64-mingw32/lib -l@<@PROJECT_NAME@>@ +cp x86_64-w64-mingw32/bin/@<@PROJECT_NAME@>@.dll . ./hello.exe ``` @@ -21,7 +21,7 @@ cp x86_64-w64-mingw32/bin/SDL3.dll . An API reference, tutorials, and additional documentation is available at: -https://wiki.libsdl.org/SDL3 +https://wiki.libsdl.org/@<@PROJECT_NAME@>@ # Example code diff --git a/build-scripts/pkg-support/msvc/INSTALL.md b/build-scripts/pkg-support/msvc/INSTALL.md.in similarity index 77% rename from build-scripts/pkg-support/msvc/INSTALL.md rename to build-scripts/pkg-support/msvc/INSTALL.md.in index 82f812f36ee1d..671f5243d81a3 100644 --- a/build-scripts/pkg-support/msvc/INSTALL.md +++ b/build-scripts/pkg-support/msvc/INSTALL.md.in @@ -1,19 +1,19 @@ # Using this package -This package contains SDL built for Visual Studio. +This package contains @<@PROJECT_NAME@>@ built for Visual Studio. To use this package, edit your project properties: - Add the include directory to "VC++ Directories" -> "Include Directories" - Add the lib/_arch_ directory to "VC++ Directories" -> "Library Directories" -- Add SDL3.lib to Linker -> Input -> "Additional Dependencies" -- Copy lib/_arch_/SDL3.dll to your project directory. +- Add @<@PROJECT_NAME@>@.lib to Linker -> Input -> "Additional Dependencies" +- Copy lib/_arch_/@<@PROJECT_NAME@>@.dll to your project directory. # Documentation An API reference, tutorials, and additional documentation is available at: -https://wiki.libsdl.org/SDL3 +https://wiki.libsdl.org/@<@PROJECT_NAME@>@ # Example code diff --git a/build-scripts/release-info.json b/build-scripts/release-info.json index dc0bd31b30b30..d6c52fe425128 100644 --- a/build-scripts/release-info.json +++ b/build-scripts/release-info.json @@ -45,7 +45,7 @@ }, "files": { "": [ - "build-scripts/pkg-support/mingw/INSTALL.md", + "build-scripts/pkg-support/mingw/INSTALL.md.in:INSTALL.md", "build-scripts/pkg-support/mingw/Makefile", "LICENSE.txt", "README.md" @@ -117,7 +117,7 @@ }, "files-devel": { "": [ - "build-scripts/pkg-support/msvc/INSTALL.md", + "build-scripts/pkg-support/msvc/INSTALL.md.in:INSTALL.md", "LICENSE.txt", "README.md" ], From 2a946e91bc2e2a65dccb41a43b2760094fb33cca Mon Sep 17 00:00:00 2001 From: Sam Lantinga Date: Wed, 22 Jan 2025 10:12:25 -0800 Subject: [PATCH 259/340] android: updated release build SDK to match documented requirements --- build-scripts/release-info.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/build-scripts/release-info.json b/build-scripts/release-info.json index d6c52fe425128..8ba213ae2797c 100644 --- a/build-scripts/release-info.json +++ b/build-scripts/release-info.json @@ -181,8 +181,8 @@ "x86", "x86_64" ], - "api-minimum": 19, - "api-target": 29, + "api-minimum": 21, + "api-target": 35, "ndk-minimum": 21, "aar-files": { "": [ From 48f5550651f44275e0b8649720e988676d46af74 Mon Sep 17 00:00:00 2001 From: Frank Praznik Date: Tue, 28 Jan 2025 13:02:29 -0500 Subject: [PATCH 260/340] wayland: Don't send keyboard and mouse added events during initialization Only send them when a device is added post-initialization, as is done on other platforms. --- src/video/wayland/SDL_waylandevents.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/video/wayland/SDL_waylandevents.c b/src/video/wayland/SDL_waylandevents.c index 8519b245ef781..c5aaf4be2ef5c 100644 --- a/src/video/wayland/SDL_waylandevents.c +++ b/src/video/wayland/SDL_waylandevents.c @@ -1987,7 +1987,7 @@ static void seat_handle_capabilities(void *data, struct wl_seat *seat, Wayland_input_init_relative_pointer(input->display); input->pointer_id = SDL_GetNextObjectID(); - SDL_AddMouse(input->pointer_id, WAYLAND_DEFAULT_POINTER_NAME, true); + SDL_AddMouse(input->pointer_id, WAYLAND_DEFAULT_POINTER_NAME, !input->display->initializing); } else if (!(caps & WL_SEAT_CAPABILITY_POINTER) && input->pointer) { if (input->relative_pointer) { zwp_relative_pointer_v1_destroy(input->relative_pointer); @@ -2028,7 +2028,7 @@ static void seat_handle_capabilities(void *data, struct wl_seat *seat, input); input->keyboard_id = SDL_GetNextObjectID(); - SDL_AddKeyboard(input->keyboard_id, WAYLAND_DEFAULT_KEYBOARD_NAME, true); + SDL_AddKeyboard(input->keyboard_id, WAYLAND_DEFAULT_KEYBOARD_NAME, !input->display->initializing); } else if (!(caps & WL_SEAT_CAPABILITY_KEYBOARD) && input->keyboard) { wl_keyboard_destroy(input->keyboard); input->keyboard = NULL; From ccd5fcef12cd259f93155d143ad92e008c869e02 Mon Sep 17 00:00:00 2001 From: "Ryan C. Gordon" Date: Tue, 28 Jan 2025 13:14:25 -0500 Subject: [PATCH 261/340] audio: Fix potential NULL dereference in AudioStream gain adjustment. You can end up with a NULL scratch buffer, which is otherwise not needed on this path, then ConvertAudio will end up needing that scratch space to move to float32 to apply gain. Fixes #12091. (I assume.) --- src/audio/SDL_audiocvt.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/audio/SDL_audiocvt.c b/src/audio/SDL_audiocvt.c index b247b4c58fb86..f751b0e580bdb 100644 --- a/src/audio/SDL_audiocvt.c +++ b/src/audio/SDL_audiocvt.c @@ -1022,7 +1022,7 @@ static bool GetAudioStreamDataInternal(SDL_AudioStream *stream, void *buf, int o Uint8* work_buffer = NULL; // Ensure we have enough scratch space for any conversions - if ((src_format != dst_format) || (src_channels != dst_channels)) { + if ((src_format != dst_format) || (src_channels != dst_channels) || (gain != 1.0f)) { work_buffer = EnsureAudioStreamWorkBufferSize(stream, output_frames * max_frame_size); if (!work_buffer) { From 11dbff246f9015bb79a8f5c761b5b7099a9b579b Mon Sep 17 00:00:00 2001 From: SDL Wiki Bot Date: Tue, 28 Jan 2025 19:01:16 +0000 Subject: [PATCH 262/340] Sync SDL3 wiki -> header [ci skip] --- include/SDL3/SDL_atomic.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/SDL3/SDL_atomic.h b/include/SDL3/SDL_atomic.h index 03e3fb13441d7..78b5e0fa5bf29 100644 --- a/include/SDL3/SDL_atomic.h +++ b/include/SDL3/SDL_atomic.h @@ -498,7 +498,7 @@ extern SDL_DECLSPEC int SDLCALL SDL_AddAtomicInt(SDL_AtomicInt *a, int v); * * ***Note: If you don't know what this macro is for, you shouldn't use it!*** * - * \param a a pointer to an SDL_AtomicInt to increment. + * \param a a pointer to an SDL_AtomicInt to decrement. * \returns true if the variable reached zero after decrementing, false * otherwise. * From cf249b0cb28336d14bbd6cb0bd4f711f6ad4db87 Mon Sep 17 00:00:00 2001 From: Timothee Besset Date: Tue, 28 Jan 2025 13:32:57 -0600 Subject: [PATCH 263/340] fix -Wformat problem in 32 bit builds --- src/video/wayland/SDL_waylanddatamanager.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/video/wayland/SDL_waylanddatamanager.c b/src/video/wayland/SDL_waylanddatamanager.c index d9b1b91e6c55c..8a7bf659cdc98 100644 --- a/src/video/wayland/SDL_waylanddatamanager.c +++ b/src/video/wayland/SDL_waylanddatamanager.c @@ -382,7 +382,7 @@ void *Wayland_data_offer_receive(SDL_WaylandDataOffer *offer, close(pipefd[0]); } SDL_LogTrace(SDL_LOG_CATEGORY_INPUT, - ". In Wayland_data_offer_receive for '%s', buffer (%ld) at %p", + ". In Wayland_data_offer_receive for '%s', buffer (%zu) at %p", mime_type, *length, buffer); return buffer; } @@ -418,7 +418,7 @@ void *Wayland_primary_selection_offer_receive(SDL_WaylandPrimarySelectionOffer * close(pipefd[0]); } SDL_LogTrace(SDL_LOG_CATEGORY_INPUT, - ". In Wayland_primary_selection_offer_receive for '%s', buffer (%ld) at %p", + ". In Wayland_primary_selection_offer_receive for '%s', buffer (%zu) at %p", mime_type, *length, buffer); return buffer; } From 4176e188bf1c534418555b60c6434b3ea7a41258 Mon Sep 17 00:00:00 2001 From: Sam Lantinga Date: Tue, 28 Jan 2025 08:39:30 -0800 Subject: [PATCH 264/340] Enable testgles2 on all platforms We use SDL's headers so we're not dependent on system OpenGL header availability. --- test/CMakeLists.txt | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index 5ac1967279b9d..b5de85381356e 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -354,11 +354,8 @@ elseif(IOS OR TVOS) find_library(GLES_LIB OpenGLES REQUIRED) target_link_libraries(testgles PRIVATE "${GLES_LIB}") endif() -check_include_file("GLES2/gl2platform.h" HAVE_GLES2_GL2PLATFORM_H) -if(HAVE_GLES2_GL2PLATFORM_H OR (TARGET SDL3-static OR SDL3-shared)) - add_sdl_test_executable(testgles2 SOURCES testgles2.c) - add_sdl_test_executable(testgles2_sdf NEEDS_RESOURCES TESTUTILS SOURCES testgles2_sdf.c) -endif() +add_sdl_test_executable(testgles2 SOURCES testgles2.c) +add_sdl_test_executable(testgles2_sdf NEEDS_RESOURCES TESTUTILS SOURCES testgles2_sdf.c) add_sdl_test_executable(testhaptic SOURCES testhaptic.c) add_sdl_test_executable(testhotplug SOURCES testhotplug.c) add_sdl_test_executable(testpen SOURCES testpen.c) From 409f3ade88fd8f48d39541995ea288477a611c92 Mon Sep 17 00:00:00 2001 From: Sam Lantinga Date: Wed, 29 Jan 2025 04:05:33 -0800 Subject: [PATCH 265/340] Removed SDF test program There's a much better example of SDF support in testgputext in SDL_ttf --- test/CMakeLists.txt | 1 - test/testgles2_sdf.c | 785 ------------------------------ test/testgles2_sdf_img_normal.bmp | Bin 68122 -> 0 bytes test/testgles2_sdf_img_sdf.bmp | Bin 72202 -> 0 bytes 4 files changed, 786 deletions(-) delete mode 100644 test/testgles2_sdf.c delete mode 100644 test/testgles2_sdf_img_normal.bmp delete mode 100644 test/testgles2_sdf_img_sdf.bmp diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index b5de85381356e..3be04e215e5ee 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -355,7 +355,6 @@ elseif(IOS OR TVOS) target_link_libraries(testgles PRIVATE "${GLES_LIB}") endif() add_sdl_test_executable(testgles2 SOURCES testgles2.c) -add_sdl_test_executable(testgles2_sdf NEEDS_RESOURCES TESTUTILS SOURCES testgles2_sdf.c) add_sdl_test_executable(testhaptic SOURCES testhaptic.c) add_sdl_test_executable(testhotplug SOURCES testhotplug.c) add_sdl_test_executable(testpen SOURCES testpen.c) diff --git a/test/testgles2_sdf.c b/test/testgles2_sdf.c deleted file mode 100644 index d9acc64a56ce6..0000000000000 --- a/test/testgles2_sdf.c +++ /dev/null @@ -1,785 +0,0 @@ -/* - Copyright (C) 1997-2025 Sam Lantinga - - This software is provided 'as-is', without any express or implied - warranty. In no event will the authors be held liable for any damages - arising from the use of this software. - - Permission is granted to anyone to use this software for any purpose, - including commercial applications, and to alter it and redistribute it - freely. -*/ - -#include -#include -#include "testutils.h" - -#ifdef SDL_PLATFORM_EMSCRIPTEN -#include -#endif - -#include - -#if defined(SDL_PLATFORM_IOS) || defined(SDL_PLATFORM_ANDROID) || defined(SDL_PLATFORM_EMSCRIPTEN) || defined(SDL_PLATFORM_WIN32) || defined(SDL_PLATFORM_LINUX) -#define HAVE_OPENGLES2 -#endif - -#ifdef HAVE_OPENGLES2 - -#include - -typedef struct GLES2_Context -{ -#define SDL_PROC(ret, func, params) ret (APIENTRY *func) params; -#include "../src/render/opengles2/SDL_gles2funcs.h" -#undef SDL_PROC -} GLES2_Context; - -static SDL_Surface *g_surf_sdf = NULL; -static GLenum g_texture; -static GLenum g_texture_type = GL_TEXTURE_2D; -static GLfloat g_verts[24]; -typedef enum -{ - GLES2_ATTRIBUTE_POSITION = 0, - GLES2_ATTRIBUTE_TEXCOORD = 1, - GLES2_ATTRIBUTE_ANGLE = 2, - GLES2_ATTRIBUTE_CENTER = 3, -} GLES2_Attribute; - -typedef enum -{ - GLES2_UNIFORM_PROJECTION, - GLES2_UNIFORM_TEXTURE, - GLES2_UNIFORM_COLOR, -} GLES2_Uniform; - -static GLint g_uniform_locations[16]; - -static SDLTest_CommonState *state; -static SDL_GLContext *context = NULL; -static int depth = 16; -static GLES2_Context ctx; - -static bool LoadContext(GLES2_Context *data) -{ -#ifdef SDL_VIDEO_DRIVER_UIKIT -#define __SDL_NOGETPROCADDR__ -#elif defined(SDL_VIDEO_DRIVER_ANDROID) -#define __SDL_NOGETPROCADDR__ -#endif - -#if defined __SDL_NOGETPROCADDR__ -#define SDL_PROC(ret, func, params) data->func = func; -#else -#define SDL_PROC(ret, func, params) \ - do { \ - data->func = (ret (APIENTRY *) params)SDL_GL_GetProcAddress(#func); \ - if (!data->func) { \ - return SDL_SetError("Couldn't load GLES2 function %s: %s", #func, SDL_GetError()); \ - } \ - } while (0); -#endif /* __SDL_NOGETPROCADDR__ */ - -#include "../src/render/opengles2/SDL_gles2funcs.h" -#undef SDL_PROC - return true; -} - -/* Call this instead of exit(), so we can clean up SDL: atexit() is evil. */ -static void -quit(int rc) -{ - int i; - - if (context) { - for (i = 0; i < state->num_windows; i++) { - if (context[i]) { - SDL_GL_DestroyContext(context[i]); - } - } - - SDL_free(context); - } - - SDLTest_CommonQuit(state); - /* Let 'main()' return normally */ - if (rc != 0) { - exit(rc); - } -} - -#define GL_CHECK(x) \ - x; \ - { \ - GLenum glError = ctx.glGetError(); \ - if (glError != GL_NO_ERROR) { \ - SDL_Log("glGetError() = %i (0x%.8x) at line %i", glError, glError, __LINE__); \ - quit(1); \ - } \ - } - -/** - * Create shader, load in source, compile, dump debug as necessary. - * - * shader: Pointer to return created shader ID. - * source: Passed-in shader source code. - * shader_type: Passed to GL, e.g. GL_VERTEX_SHADER. - */ -static void process_shader(GLenum *shader, const char *source, GLenum shader_type) -{ - GLint status = GL_FALSE; - const char *shaders[1] = { NULL }; - char buffer[1024]; - GLsizei length; - - /* Create shader and load into GL. */ - *shader = GL_CHECK(ctx.glCreateShader(shader_type)); - - shaders[0] = source; - - GL_CHECK(ctx.glShaderSource(*shader, 1, shaders, NULL)); - - /* Clean up shader source. */ - shaders[0] = NULL; - - /* Try compiling the shader. */ - GL_CHECK(ctx.glCompileShader(*shader)); - GL_CHECK(ctx.glGetShaderiv(*shader, GL_COMPILE_STATUS, &status)); - - /* Dump debug info (source and log) if compilation failed. */ - if (status != GL_TRUE) { - ctx.glGetShaderInfoLog(*shader, sizeof(buffer), &length, &buffer[0]); - buffer[length] = '\0'; - SDL_Log("Shader compilation failed: %s", buffer); - quit(-1); - } -} - -/* Notes on a_angle: - * It is a vector containing sine and cosine for rotation matrix - * To get correct rotation for most cases when a_angle is disabled cosine - * value is decremented by 1.0 to get proper output with 0.0 which is default value - */ -static const char GLES2_VertexSrc_Default_[] = " \ - uniform mat4 u_projection; \ - attribute vec2 a_position; \ - attribute vec2 a_texCoord; \ - attribute vec2 a_angle; \ - attribute vec2 a_center; \ - varying vec2 v_texCoord; \ - \ - void main() \ - { \ - float s = a_angle[0]; \ - float c = a_angle[1] + 1.0; \ - mat2 rotationMatrix = mat2(c, -s, s, c); \ - vec2 position = rotationMatrix * (a_position - a_center) + a_center; \ - v_texCoord = a_texCoord; \ - gl_Position = u_projection * vec4(position, 0.0, 1.0);\ - gl_PointSize = 1.0; \ - } \ -"; - -static const char GLES2_FragmentSrc_TextureABGRSrc_[] = " \ - precision mediump float; \ - uniform sampler2D u_texture; \ - uniform vec4 u_color; \ - varying vec2 v_texCoord; \ - \ - void main() \ - { \ - gl_FragColor = texture2D(u_texture, v_texCoord); \ - gl_FragColor *= u_color; \ - } \ -"; - -/* RGB to ABGR conversion */ -static const char GLES2_FragmentSrc_TextureABGRSrc_SDF[] = " \ - #extension GL_OES_standard_derivatives : enable\n\ - \ - precision mediump float; \ - uniform sampler2D u_texture; \ - uniform vec4 u_color; \ - varying vec2 v_texCoord; \ - \ - void main() \ - { \ - vec4 abgr = texture2D(u_texture, v_texCoord); \ -\ - float sigDist = abgr.a; \ - \ - float w = fwidth( sigDist );\ - float alpha = clamp(smoothstep(0.5 - w, 0.5 + w, sigDist), 0.0, 1.0); \ -\ - gl_FragColor = vec4(abgr.rgb, abgr.a * alpha); \ - gl_FragColor.rgb *= gl_FragColor.a; \ - gl_FragColor *= u_color; \ - } \ -"; - -/* RGB to ABGR conversion DEBUG */ -static const char *GLES2_FragmentSrc_TextureABGRSrc_SDF_dbg = " \ - #extension GL_OES_standard_derivatives : enable\n\ - \ - precision mediump float; \ - uniform sampler2D u_texture; \ - uniform vec4 u_color; \ - varying vec2 v_texCoord; \ - \ - void main() \ - { \ - vec4 abgr = texture2D(u_texture, v_texCoord); \ -\ - float a = abgr.a; \ - gl_FragColor = vec4(a, a, a, 1.0); \ - } \ -"; - -static float g_val = 1.0f; -static int g_use_SDF = 1; -static int g_use_SDF_debug = 0; -static float g_angle = 0.0f; -static float matrix_mvp[4][4]; - -typedef struct shader_data -{ - GLint shader_program; - GLenum shader_frag, shader_vert; - - GLint attr_position; - GLint attr_color, attr_mvp; - -} shader_data; - -static void -Render(int width, int height, shader_data *data) -{ - float *verts = g_verts; - ctx.glViewport(0, 0, 640, 480); - - GL_CHECK(ctx.glClear(GL_COLOR_BUFFER_BIT)); - - GL_CHECK(ctx.glUniformMatrix4fv(g_uniform_locations[GLES2_UNIFORM_PROJECTION], 1, GL_FALSE, (const float *)matrix_mvp)); - GL_CHECK(ctx.glUniform4f(g_uniform_locations[GLES2_UNIFORM_COLOR], 1.0f, 1.0f, 1.0f, 1.0f)); - - GL_CHECK(ctx.glVertexAttribPointer(GLES2_ATTRIBUTE_ANGLE, 2, GL_FLOAT, GL_FALSE, 0, (const GLvoid *)(verts + 16))); - GL_CHECK(ctx.glVertexAttribPointer(GLES2_ATTRIBUTE_TEXCOORD, 2, GL_FLOAT, GL_FALSE, 0, (const GLvoid *)(verts + 8))); - GL_CHECK(ctx.glVertexAttribPointer(GLES2_ATTRIBUTE_POSITION, 2, GL_FLOAT, GL_FALSE, 0, (const GLvoid *)verts)); - - GL_CHECK(ctx.glDrawArrays(GL_TRIANGLE_STRIP, 0, 4)); -} - -static void renderCopy_angle(float degree_angle) -{ - const float radian_angle = (float)(3.141592 * degree_angle) / 180.0f; - const GLfloat s = (GLfloat)SDL_sin(radian_angle); - const GLfloat c = (GLfloat)SDL_cos(radian_angle) - 1.0f; - GLfloat *verts = g_verts + 16; - *(verts++) = s; - *(verts++) = c; - *(verts++) = s; - *(verts++) = c; - *(verts++) = s; - *(verts++) = c; - *(verts++) = s; - *(verts++) = c; -} - -static void renderCopy_position(SDL_Rect *srcrect, SDL_Rect *dstrect) -{ - GLfloat minx, miny, maxx, maxy; - GLfloat minu, maxu, minv, maxv; - GLfloat *verts = g_verts; - - minx = (GLfloat)dstrect->x; - miny = (GLfloat)dstrect->y; - maxx = (GLfloat)(dstrect->x + dstrect->w); - maxy = (GLfloat)(dstrect->y + dstrect->h); - - minu = (GLfloat)srcrect->x / (GLfloat)g_surf_sdf->w; - maxu = (GLfloat)(srcrect->x + srcrect->w) / (GLfloat)g_surf_sdf->w; - minv = (GLfloat)srcrect->y / (GLfloat)g_surf_sdf->h; - maxv = (GLfloat)(srcrect->y + srcrect->h) / (GLfloat)g_surf_sdf->h; - - *(verts++) = minx; - *(verts++) = miny; - *(verts++) = maxx; - *(verts++) = miny; - *(verts++) = minx; - *(verts++) = maxy; - *(verts++) = maxx; - *(verts++) = maxy; - - *(verts++) = minu; - *(verts++) = minv; - *(verts++) = maxu; - *(verts++) = minv; - *(verts++) = minu; - *(verts++) = maxv; - *(verts++) = maxu; - *(verts++) = maxv; -} - -static int done; -static Uint32 frames; -static shader_data *datas; - -static void loop(void) -{ - SDL_Event event; - int i; - - /* Check for events */ - ++frames; - while (SDL_PollEvent(&event) && !done) { - switch (event.type) { - case SDL_EVENT_KEY_DOWN: - { - const int sym = event.key.key; - - if (sym == SDLK_TAB) { - SDL_Log("Tab"); - } - - if (sym == SDLK_LEFT) { - g_val -= 0.05f; - } - if (sym == SDLK_RIGHT) { - g_val += 0.05f; - } - if (sym == SDLK_UP) { - g_angle -= 1.0f; - } - if (sym == SDLK_DOWN) { - g_angle += 1.0f; - } - - break; - } - - case SDL_EVENT_WINDOW_RESIZED: - for (i = 0; i < state->num_windows; ++i) { - if (event.window.windowID == SDL_GetWindowID(state->windows[i])) { - int w, h; - if (!SDL_GL_MakeCurrent(state->windows[i], context[i])) { - SDL_Log("SDL_GL_MakeCurrent(): %s", SDL_GetError()); - break; - } - /* Change view port to the new window dimensions */ - SDL_GetWindowSizeInPixels(state->windows[i], &w, &h); - ctx.glViewport(0, 0, w, h); - state->window_w = event.window.data1; - state->window_h = event.window.data2; - /* Update window content */ - Render(event.window.data1, event.window.data2, &datas[i]); - SDL_GL_SwapWindow(state->windows[i]); - break; - } - } - break; - - default: - break; - } - SDLTest_CommonEvent(state, &event, &done); - } - - matrix_mvp[3][0] = -1.0f; - matrix_mvp[3][3] = 1.0f; - - matrix_mvp[0][0] = 2.0f / 640.0f; - matrix_mvp[1][1] = -2.0f / 480.0f; - matrix_mvp[3][1] = 1.0f; - - renderCopy_angle(g_angle); - - { - int w, h; - SDL_Rect rs, rd; - - SDL_GetWindowSizeInPixels(state->windows[0], &w, &h); - - rs.x = 0; - rs.y = 0; - rs.w = g_surf_sdf->w; - rs.h = g_surf_sdf->h; - rd.w = (int)((float)g_surf_sdf->w * g_val); - rd.h = (int)((float)g_surf_sdf->h * g_val); - rd.x = (w - rd.w) / 2; - rd.y = (h - rd.h) / 2; - renderCopy_position(&rs, &rd); - } - - if (!done) { - for (i = 0; i < state->num_windows; ++i) { - if (!SDL_GL_MakeCurrent(state->windows[i], context[i])) { - SDL_Log("SDL_GL_MakeCurrent(): %s", SDL_GetError()); - - /* Continue for next window */ - continue; - } - Render(state->window_w, state->window_h, &datas[i]); - SDL_GL_SwapWindow(state->windows[i]); - } - } -#ifdef SDL_PLATFORM_EMSCRIPTEN - else { - emscripten_cancel_main_loop(); - } -#endif -} - -int main(int argc, char *argv[]) -{ - int fsaa, accel; - int value; - int i; - const SDL_DisplayMode *mode; - Uint64 then, now; - shader_data *data; - char *path = NULL; - - /* Initialize parameters */ - fsaa = 0; - accel = 0; - - /* Initialize test framework */ - state = SDLTest_CommonCreateState(argv, SDL_INIT_VIDEO); - if (!state) { - return 1; - } - for (i = 1; i < argc;) { - int consumed; - - consumed = SDLTest_CommonArg(state, i); - if (consumed == 0) { - if (SDL_strcasecmp(argv[i], "--fsaa") == 0) { - ++fsaa; - consumed = 1; - } else if (SDL_strcasecmp(argv[i], "--accel") == 0) { - ++accel; - consumed = 1; - } else if (SDL_strcasecmp(argv[i], "--zdepth") == 0) { - i++; - if (!argv[i]) { - consumed = -1; - } else { - char *endptr = NULL; - depth = (int)SDL_strtol(argv[i], &endptr, 0); - if (endptr != argv[i] && *endptr == '\0') { - consumed = 1; - } else { - consumed = -1; - } - } - } else { - consumed = -1; - } - } - if (consumed < 0) { - static const char *options[] = { "[--fsaa]", "[--accel]", "[--zdepth %d]", NULL }; - SDLTest_CommonLogUsage(state, argv[0], options); - quit(1); - } - i += consumed; - } - - /* Set OpenGL parameters */ - state->window_flags |= SDL_WINDOW_OPENGL | SDL_WINDOW_RESIZABLE; - state->gl_red_size = 5; - state->gl_green_size = 5; - state->gl_blue_size = 5; - state->gl_depth_size = depth; - state->gl_major_version = 2; - state->gl_minor_version = 0; - state->gl_profile_mask = SDL_GL_CONTEXT_PROFILE_ES; - - if (fsaa) { - state->gl_multisamplebuffers = 1; - state->gl_multisamplesamples = fsaa; - } - if (accel) { - state->gl_accelerated = 1; - } - if (!SDLTest_CommonInit(state)) { - quit(2); - return 0; - } - - context = (SDL_GLContext *)SDL_calloc(state->num_windows, sizeof(*context)); - if (!context) { - SDL_Log("Out of memory!"); - quit(2); - } - - /* Create OpenGL ES contexts */ - for (i = 0; i < state->num_windows; i++) { - context[i] = SDL_GL_CreateContext(state->windows[i]); - if (!context[i]) { - SDL_Log("SDL_GL_CreateContext(): %s", SDL_GetError()); - quit(2); - } - } - - /* Important: call this *after* creating the context */ - if (!LoadContext(&ctx)) { - SDL_Log("Could not load GLES2 functions"); - quit(2); - return 0; - } - - SDL_memset(matrix_mvp, 0, sizeof(matrix_mvp)); - - { - SDL_Surface *tmp; - char *f; - g_use_SDF = 1; - g_use_SDF_debug = 0; - - if (g_use_SDF) { - f = "testgles2_sdf_img_sdf.bmp"; - } else { - f = "testgles2_sdf_img_normal.bmp"; - } - - SDL_Log("SDF is %s", g_use_SDF ? "enabled" : "disabled"); - - /* Load SDF BMP image */ -#if 1 - path = GetNearbyFilename(f); - - if (!path) { - path = SDL_strdup(f); - } - - if (!path) { - SDL_Log("out of memory"); - exit(-1); - } - - tmp = SDL_LoadBMP(path); - if (!tmp) { - SDL_Log("missing image file: %s", path); - exit(-1); - } else { - SDL_Log("Load image file: %s", path); - } - - SDL_free(path); -#else - /* Generate SDF image using SDL_ttf */ - -#include "SDL_ttf.h" - char *font_file = "./font/DroidSansFallback.ttf"; - char *str = "Abcde"; - SDL_Color color = { 0, 0, 0, 255 }; - - TTF_Init(); - TTF_Font *font = TTF_OpenFont(font_file, 72); - - if (font == NULL) { - SDL_Log("Cannot open font %s", font_file); - } - - TTF_SetFontSDF(font, g_use_SDF); - SDL_Surface *tmp = TTF_RenderUTF8_Blended(font, str, color); - - SDL_Log("err: %s", SDL_GetError()); - if (tmp == NULL) { - SDL_Log("can't render text"); - return -1; - } - - SDL_SaveBMP(tmp, f); - - TTF_CloseFont(font); - TTF_Quit(); -#endif - g_surf_sdf = SDL_ConvertSurface(tmp, SDL_PIXELFORMAT_ABGR8888); - - SDL_SetSurfaceBlendMode(g_surf_sdf, SDL_BLENDMODE_BLEND); - } - - SDL_GL_SetSwapInterval(state->render_vsync); - - mode = SDL_GetCurrentDisplayMode(SDL_GetPrimaryDisplay()); - if (mode) { - SDL_Log("Screen bpp: %d", SDL_BITSPERPIXEL(mode->format)); - SDL_Log("%s", ""); - } - SDL_Log("Vendor : %s", ctx.glGetString(GL_VENDOR)); - SDL_Log("Renderer : %s", ctx.glGetString(GL_RENDERER)); - SDL_Log("Version : %s", ctx.glGetString(GL_VERSION)); - SDL_Log("Extensions : %s", ctx.glGetString(GL_EXTENSIONS)); - SDL_Log("%s", ""); - - if (SDL_GL_GetAttribute(SDL_GL_RED_SIZE, &value)) { - SDL_Log("SDL_GL_RED_SIZE: requested %d, got %d", 5, value); - } else { - SDL_Log("Failed to get SDL_GL_RED_SIZE: %s", - SDL_GetError()); - } - if (SDL_GL_GetAttribute(SDL_GL_GREEN_SIZE, &value)) { - SDL_Log("SDL_GL_GREEN_SIZE: requested %d, got %d", 5, value); - } else { - SDL_Log("Failed to get SDL_GL_GREEN_SIZE: %s", - SDL_GetError()); - } - if (SDL_GL_GetAttribute(SDL_GL_BLUE_SIZE, &value)) { - SDL_Log("SDL_GL_BLUE_SIZE: requested %d, got %d", 5, value); - } else { - SDL_Log("Failed to get SDL_GL_BLUE_SIZE: %s", - SDL_GetError()); - } - if (SDL_GL_GetAttribute(SDL_GL_DEPTH_SIZE, &value)) { - SDL_Log("SDL_GL_DEPTH_SIZE: requested %d, got %d", depth, value); - } else { - SDL_Log("Failed to get SDL_GL_DEPTH_SIZE: %s", - SDL_GetError()); - } - if (fsaa) { - if (SDL_GL_GetAttribute(SDL_GL_MULTISAMPLEBUFFERS, &value)) { - SDL_Log("SDL_GL_MULTISAMPLEBUFFERS: requested 1, got %d", value); - } else { - SDL_Log("Failed to get SDL_GL_MULTISAMPLEBUFFERS: %s", - SDL_GetError()); - } - if (SDL_GL_GetAttribute(SDL_GL_MULTISAMPLESAMPLES, &value)) { - SDL_Log("SDL_GL_MULTISAMPLESAMPLES: requested %d, got %d", fsaa, - value); - } else { - SDL_Log("Failed to get SDL_GL_MULTISAMPLESAMPLES: %s", - SDL_GetError()); - } - } - if (accel) { - if (SDL_GL_GetAttribute(SDL_GL_ACCELERATED_VISUAL, &value)) { - SDL_Log("SDL_GL_ACCELERATED_VISUAL: requested 1, got %d", value); - } else { - SDL_Log("Failed to get SDL_GL_ACCELERATED_VISUAL: %s", - SDL_GetError()); - } - } - - datas = (shader_data *)SDL_calloc(state->num_windows, sizeof(shader_data)); - - /* Set rendering settings for each context */ - for (i = 0; i < state->num_windows; ++i) { - - int w, h; - if (!SDL_GL_MakeCurrent(state->windows[i], context[i])) { - SDL_Log("SDL_GL_MakeCurrent(): %s", SDL_GetError()); - - /* Continue for next window */ - continue; - } - - { - int format = GL_RGBA; - int type = GL_UNSIGNED_BYTE; - - GL_CHECK(ctx.glGenTextures(1, &g_texture)); - - ctx.glActiveTexture(GL_TEXTURE0); - ctx.glPixelStorei(GL_PACK_ALIGNMENT, 1); - ctx.glPixelStorei(GL_UNPACK_ALIGNMENT, 1); - - ctx.glBindTexture(g_texture_type, g_texture); - - ctx.glTexParameteri(g_texture_type, GL_TEXTURE_MIN_FILTER, GL_LINEAR); - ctx.glTexParameteri(g_texture_type, GL_TEXTURE_MAG_FILTER, GL_LINEAR); - ctx.glTexParameteri(g_texture_type, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); - ctx.glTexParameteri(g_texture_type, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); - GL_CHECK(ctx.glTexImage2D(g_texture_type, 0, format, g_surf_sdf->w, g_surf_sdf->h, 0, format, type, NULL)); - GL_CHECK(ctx.glTexSubImage2D(g_texture_type, 0, 0 /* xoffset */, 0 /* yoffset */, g_surf_sdf->w, g_surf_sdf->h, format, type, g_surf_sdf->pixels)); - } - - SDL_GetWindowSizeInPixels(state->windows[i], &w, &h); - ctx.glViewport(0, 0, w, h); - - data = &datas[i]; - - /* Shader Initialization */ - process_shader(&data->shader_vert, GLES2_VertexSrc_Default_, GL_VERTEX_SHADER); - - if (g_use_SDF) { - if (g_use_SDF_debug == 0) { - process_shader(&data->shader_frag, GLES2_FragmentSrc_TextureABGRSrc_SDF, GL_FRAGMENT_SHADER); - } else { - process_shader(&data->shader_frag, GLES2_FragmentSrc_TextureABGRSrc_SDF_dbg, GL_FRAGMENT_SHADER); - } - } else { - process_shader(&data->shader_frag, GLES2_FragmentSrc_TextureABGRSrc_, GL_FRAGMENT_SHADER); - } - - /* Create shader_program (ready to attach shaders) */ - data->shader_program = GL_CHECK(ctx.glCreateProgram()); - - /* Attach shaders and link shader_program */ - GL_CHECK(ctx.glAttachShader(data->shader_program, data->shader_vert)); - GL_CHECK(ctx.glAttachShader(data->shader_program, data->shader_frag)); - GL_CHECK(ctx.glLinkProgram(data->shader_program)); - - ctx.glBindAttribLocation(data->shader_program, GLES2_ATTRIBUTE_POSITION, "a_position"); - ctx.glBindAttribLocation(data->shader_program, GLES2_ATTRIBUTE_TEXCOORD, "a_texCoord"); - ctx.glBindAttribLocation(data->shader_program, GLES2_ATTRIBUTE_ANGLE, "a_angle"); - ctx.glBindAttribLocation(data->shader_program, GLES2_ATTRIBUTE_CENTER, "a_center"); - - /* Predetermine locations of uniform variables */ - g_uniform_locations[GLES2_UNIFORM_PROJECTION] = ctx.glGetUniformLocation(data->shader_program, "u_projection"); - g_uniform_locations[GLES2_UNIFORM_TEXTURE] = ctx.glGetUniformLocation(data->shader_program, "u_texture"); - g_uniform_locations[GLES2_UNIFORM_COLOR] = ctx.glGetUniformLocation(data->shader_program, "u_color"); - - GL_CHECK(ctx.glUseProgram(data->shader_program)); - - ctx.glEnableVertexAttribArray((GLenum)GLES2_ATTRIBUTE_ANGLE); - ctx.glDisableVertexAttribArray((GLenum)GLES2_ATTRIBUTE_CENTER); - ctx.glEnableVertexAttribArray(GLES2_ATTRIBUTE_POSITION); - ctx.glEnableVertexAttribArray((GLenum)GLES2_ATTRIBUTE_TEXCOORD); - - ctx.glUniform1i(g_uniform_locations[GLES2_UNIFORM_TEXTURE], 0); /* always texture unit 0. */ - ctx.glActiveTexture(GL_TEXTURE0); - ctx.glBindTexture(g_texture_type, g_texture); - GL_CHECK(ctx.glClearColor(1, 1, 1, 1)); - - /* SDL_BLENDMODE_BLEND */ - GL_CHECK(ctx.glEnable(GL_BLEND)); - ctx.glBlendFuncSeparate(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA, GL_ONE, GL_ONE_MINUS_SRC_ALPHA); - ctx.glBlendEquationSeparate(GL_FUNC_ADD, GL_FUNC_ADD); - } - - /* Main render loop */ - frames = 0; - then = SDL_GetTicks(); - done = 0; - -#ifdef SDL_PLATFORM_EMSCRIPTEN - emscripten_set_main_loop(loop, 0, 1); -#else - while (!done) { - loop(); - } -#endif - - /* Print out some timing information */ - now = SDL_GetTicks(); - if (now > then) { - SDL_Log("%2.2f frames per second", - ((double)frames * 1000) / (now - then)); - } -#ifndef SDL_PLATFORM_ANDROID - quit(0); -#endif - return 0; -} - -#else /* HAVE_OPENGLES2 */ - -int main(int argc, char *argv[]) -{ - SDL_Log("No OpenGL ES support on this system"); - return 1; -} - -#endif /* HAVE_OPENGLES2 */ diff --git a/test/testgles2_sdf_img_normal.bmp b/test/testgles2_sdf_img_normal.bmp deleted file mode 100644 index 1209e1b1df7105dad9e3e401b9dd9a0d255e4162..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 68122 zcmeHP3AA3*6@Ez&No!mPk;*euL8uZ#7ZGD9RU|bh7VSz}sZ^F4O00@`imECLMcT?L zOCvS5B_gD0kkrr`s-iXP!lQ_>`hD@v%6aGQeeSvUp8LnDy_YZd+;jGHzW?rX&%OWu z?ELlqeS5S~P6ECM%mEGrdbG8-^}_L*KA(=G>B%Q;ZJ++fzE9f6jTz|;TGJRX28;n? zz!)$Fi~(c77%&Em0b{@zFb0ePW55_N28;n?z!)$Fi~(c77%&Em0b{@zFb0ePW55_N z28;n?z!)$Fi~(c77%&Em0b{@zFb0ePW55_N28;n?;QyC_l`ys8zHBl24J2=!u83w_uIpZj2jr|oc$d9 zb}XN;K4>=}$nPsSm-PG?TKg{8wg>)loeqYh8Gsf$wf`mf*a;{rYrx=UAT^G!_cZKy zFY{#|ocKDf?dw!+^Uuw{50qI$T>S9JI=>qj3265Ma-*%IQ!v(Q;d&6xgXjG0$&Dt` zbw9>aJ{avX>x`5`2Yl?}`K;UIz5Z0-BS4B*rSGVcNo@yx?iH%UayGoqI1eY>)3`DJ z=*Fua*M}kZ1-{Q*ZLU$8{2l{Rod2Mod(l?OY6!$Vjg-p;1xZNtaa*U&2pqLFK#CRX zdmp}X?6cQfX27JN~D1xUFs8m#!wFxb7R_?2Rn?TgjNp^><} z_q0m*zi!dywRu4jQho4#!T$}+JBr`Gqo4Ok)*jctOMyE9twvpLZ$oD@ppNia%K3{O zIfn(npMbf*QvmnSnoVkba4qhL_;LQ{K<6spbYK#21#mB*aWooZ(q}<`Rb^Kgrri5^ zALG93QQ$scKJW|>_ z{_#qTuM23hA_m3-Zveg>@6#G@7%DCNoQm!n-2WT~tQzq?0AsxGpA5_f!u`Zx^u^>l z4EpnQZSE&liWz1aYlk0=*B>OrNU0C*CH6@0>tz>U8ZZhdlCe;5@xmkT3%uv13a?4t*Frzid8$vRS5(K(L6M(P6=B}r0l3aF z*P{C1JxrPt`%=~ z^MH%*AMYx#%`yCl68qLf=SB7L(?ma#8rNl?55HaJdKv^j+C7r%0N+11Ee9ijpTFO} zr$%r-k7>^&E=C#m-1EN*I9vb7XORudILoAau96Se-u{_lNNzS!;*yip_XDx|;I;Q9 zDR5%nR?zc5AHU6ge5y=_qHpWBuS#`NQ;+M7AJ=blk5)&14rAY6*e>Jy=!maV%Q(uY z%k?dslRM|Vt|>Vaj$Iu8*n$4kXW&?U{4qn~_bNFu-}VIm-1lhv8m>PB5`5HE;hL9Qb0mk!8Det{;4`zvQ)-A+pvW~t^7D&SCk^TGU6GU*`_^k9 z=C+Y|JCukQs}HVgb%pzDjhB=<9viXe?hR0`x|ClN`@Tz*SpO(FzgT^&P|}yA&b4tNAn`I=G6?!&d-GO2mouFyfRsP`a_#R< zkHo-Gl4#Gt%(Lh{Q&NDMN_W6s;_>mCenazK=y+L)H8E5!IM?dq^#Z#x!;e8(;^nmj zC)`6xwtSz}H^DxK${ZyJelNuO&mo7vi8N34rHXd_@ml#TNNkQ#EfHM361 zI9h%1n$9J$y+faZAWvglnk%2ZS|$HPASs8O9C806#b95ma2=L>Jdo<3VLh&AZz(x) zt?9@FZND-L{>zG1AAIkWOJaMZwF-jpy^Hjj^LJIP679E$RruC&-Vp=RJlU5jyuKtK zccnULf!;Mrj#A#a`>K3juhmED_lqf%UJ&7g@26tId!oeCA7Vxs$GCrz;AdevuRweUGH& zp7XjJ9GPn@KQ|WRO3Oc2{}V2Wgkw+WJO|{8o$6<5LT-|ZRv$M?$`$)ghMhJKzNglN z&nBAP4VqEr{#NC%Wn``?Q;OxOahR*WOnq=JXGi9mE2q%Uo+%^>I$C{96LhO~O@d*V zuRD*uqvcxT^upuqRg)=c*DI1k&OPXmNSu_EV_b#YwaIco#hl-aQsloVMfN-J1H^9TdHX9Z8Yw4^*^4P zpriWo?LP{97$ZTZ_R=rFDSMT7ue+-enrV)ZpI+{ zDKW@Vs%Y<_HSTluKbo4Lr*|ycQvBD^zqF^9+T?FkB!BGNEY*pir`1Q5H9>H{sOuK| ztL46oX4KjLpkn(D`g46ZSCGP@zdM!k&-uOEx0QJ^ZmRH|x0EM2JRk!&U&()!b)p}9 zY4_#5F;-S4!a&N6*LNM!>Vw}qrrQEqMERv~EkZjr4USynUJoel6FJ_8y2K;FA zObv0Z;$wcQg91IRKJF;6(}uZ+m*zZ0Gl=v*rTD7*`+2QCnD^?Dd{T$_T%_ws z6zE7CvTvUR`y474MRLgXy9mCo*5;WyhY5<0H&Y!H=xN`RUR_|P4IhL7Y0mtPeOb*& z=-*oL!}}BOQ*|U(AN(ClT^Rxg5(n(NIKlbu5qmz@v_g(R5N!^}WJ)0R?2sB_+en@p zr8-gc`bT^puhZuY&j*SR z-tYNdvuW7?0i@56eSEg6E9=97=AZqkvJ@1x>upS`6Ge~TA80x5s@SA-^WG!*P5pk0 z`xEW`$%vE$3Up%i@koJf$}oLM^XK0JteWBgI=3r6=r;!kDQRfyJKqzmoZ=v&b27#x zj$B{FwA;{iim#d7G|P2dsQBgHnQK^8845!;PyhHX`ct0mw7TtpeVIL)mVc~1nD2I) zVM702(DCQ&x9?7{cPfWO{P6d^Ro(|W->FCL1^xW}_QX^tf?jX*y%6!uIAvrQl>OZN z_TVy(JYC+G_%6lw<=R!B&7J!mXlQHC!A>c1{3XU*F8=X~h)tQHqWZWW&Z_KT_}=y* zz|Yxlr_9~WgT9`R_~QPvY1teB{QUj)YZ&WaF@Z@Dzb-~u*Ygygv(R7VvmCGZV}9QP z>dKjL;O6Qdrx!Tped}$-cKZU`)ZwD~V7^xYtn)I$??L^!`t5&Vtn8Zq-H1Q>o(Po9 z5hiV`@t;JQ0X=^netR~?SjS~#ER?n1-1@%D_@r*^zI|3nXT0aU1^D^6_Os~cy``>f z3^E=j2m=6n;dW!sjr4&lURe&u3zM zP-rNe^Y3)_1vsYX{-pLJ(BZ!2NPxNWbLLue2Eh1y_Vew2hVxXp6pFrW*nR`!-0y7z zkQWNqSbmqZ8^Ezwfza-C^nD=oQ?H7w0;A`FFpfLt=X4sd6|fvYVV8lj896l7#ntu5FY*XO>9*GV1O z1;%A!`th|kuT4HDr$`?tX=|P2pSc#@C*Fh3c7V2z!B8dH5>{^lQeI&n*Nmb(oz1h* zW&Pz8zRQ%ZclL2C6s?|k56>xDeVl?Iyk_nJ94~c_{I255Kn~d%PIyh%$tScuutZ{9 zyZ)9bKKIz%>ruGggn9A2jwY;VLq`tqxM{Z7e51kE2@v8LQ3SVVpWhl=8s>E_OufTq2XHdS2asA=3Q>F4@ z16aFntgG9I=1;QAI5zMI(rH~<(0@ZLBS;5xXZ zh0k+Cfc=0&fy04s0DNv42=oA&67sS=z~`A!0C{2D{yZfW!r#eYhS=W9Os43DN4~h9-iUPn7|ykHyq*Z!XmU_W_qGW1B8E&)U-J=0K=t|pMoQ5^>68fZf3gf$)W<9g| z$Vz8rXI39wsXGRzVSPyF{C>S(SJSL#Rv%gEtnAF{qbqf*;8eO-gf((YSF`MARv+0Z zt>n<^qdRTW(G}K1cwXgu-R_a}9;*+Xn^ulkeROA=-ywzd;Ge&Naen9Cq*#44$!@xD ztB>wn^+p$Kz^@6veR+42>^)W=*(t5$(CR~`?Fw}JHQ~4UJB6mj>Z56f)BIa~$UJR> z?)wBxlhw2LT76`vw30)sk4m&PZe;b*IK@c;tUi)xYPpitN6RS}16qBEv@G#XzGHq` zfdBVVOFYTXK>`~KpMm>aJ_pmcDH;RDfH7bU7z4(DF<=ZB1IBX8( nfH7bU7z4(DF<=ZB1IBX8(fH7bUkb(aJ?X9&q diff --git a/test/testgles2_sdf_img_sdf.bmp b/test/testgles2_sdf_img_sdf.bmp deleted file mode 100644 index 5f983d2d211509e9e91e4e65e173d78c1a9d64cb..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 72202 zcmeI&2Y6If-uUsgUef zcmKokHe2a$mJ4wP-o(*Z>2GcSwhEt#P5--|!<6#xzy0mM|KquTw;eL*n3T%gVJ-r> z2;?I0pBe!-w3VCur}Z(lZ<#jU71`g^wpV03%j?;x{dGS7jClDjo1A7LHp*2JGt z9Csd?>y!0f=k?9qWB=DcY6=w(mX0(s4T8E^z!^k=k}QzS}4JX1nIl)+oS+O~+ArWxfUX z7|W$uS8F!4<@`IhK66*>3FDI5U*|I{UhS!K%=X>=Xl1mdmTPtCC731kXY(6-D2f;R*>yy`cz3gAuJ%>@(1AD+VWS%;9@3)O(a3cDkANn`( zyXQ+`jBLX^at&?^*X6Rl58NMp&Nk=-`*;8j!4WtXC!sG=`{wb=B?By7a z5x5kWHGTU1B3K{9z?eCA-C)kP#X4A;;`?A5_#AW4`8CGRRx=elSnQU;+{muA*)foHN@#0M60cSk|&G4{%@Tj+1c?E=O~H zvfk^w{%qJk`gE$H9voVR}!aNOSGIPIfjbdHaLu{B4w zz^brp2>WgS9Y@fB^tSzOpKSMPm_rv~2>Qckc+R>^^I^=bH~;LT`Pdoe zXQq(E7I^2xgFd4=v;P=#c8QVA_z+!u^P2@ZhmZH={% zURL3Rbb%&tzDowdebwih6UO>pIQ}X;h19+U{d<9brI2@1dUyms;W{%tOr?>5Q+cj?H&RsB%ZF4wWN5(cRuRL!oC!ieWqj|YC%+sK( z#6bZH;cv3u=nHeuvAKqBg3q$Q58*L9joC0x0lynB$78&VZ4%yl3lbQO3vnilSugB~ zZLlU%OKZN^FXK88=9bTLu3kk=glg*SgE{Fq`eA?k9jjq!%NpF+0o`#5E`_;dOkPG* zpRD&fuXjIs6k+$gNS(2E&Tqs$Fc+T1D|i#{V*x(KCrzJze-HnJF_?u1Vg8u+mtiQ( z2glGEn_wkmDr<3aTkMX*&=2RpdAtEWcP7k-d3YVQNbg(FzmKT1e{aESy~mt!9o&bB zFz3$4$v6PU+kV>L<1qw|!|~h+$LBa5ujBUlsd2GwzuPCFJHdV*gF$e;Iwr^F7=wAVzi;3je26;O*MQ$WpBk^1_-+n7 zhUswp=0_YC;dJ!IuGkEzWnI1)N9%`T0(^#J`w9&aKBevj7_TcZ80Le|TMtWHHsD70 zO#3th#wiK&e<7m!WWCoJQ~PBueTGc;)Ny_eoM-dpIn0N7QI8++FZ?@$Upe@`~4%l z_H)=r^XdhdCyv?t7=pvG6T0I>oQ<(CH>YD39N!1{5{}#PXKFiWcMoE&1J;o`4uGM+Ka3$L1JqcL99ncla5+m+*7hGGe&wFq^hQmGYKy<*G2#Wo*f4wmjj>GXdE@P6Z{oveU>TB>IY^NN@ z!ra&#OIx<$#=UVohQU}l9%E!|g7!0gnmaGzKDY*};rwN~*7L^8Iq>r%e2cKSXL^R` zoC{<1K5W~*PDUK(z9`oz!nu0__Ui-q{9h2(hvv>N;a+pt zJ#ap%a1$=Tao8XB)Baw8N$`EWC31-<9QQ5BGWzg&wQ#x0x^`J z2>B>LC%EoUf_)u_+fWJjL!a*$8({mH+R65u>&tQ5|2N>ex))bs2%IzfwjP4gngi$g zU<||WLH-L}UXXlcpghV9S;1276xFbf|dD%aEdljQnp z)FaavoY%KdgN0~mzNA0X_OFT=!=qj>&ig&a?U9`fW+yvbpv*p6Nbo{~yK;I1fi-S8Rl!tir+8=!%nY5pIV0 z@D_eRRGZHCJor8sk24Xh+x0naX|ZqS*x_(~ufqK>USA@rFOIne55l}m!u#rx>Av4N z?>ou4_BhiuEj?%Md&=Z1 z@Dy&vaGZ!i7zNMSZ~Ol#!g9a4b~4pF4-1f~&T|cL{wk3`3?(SSw%7;mOP&wby?Gk+ z^=FR5p1rK+8+mpu+-E9Kj#6|%0aA1~)Uu?S)#>Kqt3*X(_ zp)K}?`EfR`#NC*Mx8dFp)yC4+{l;@Yz*D#t!_gP+qxRGOz69U1j$>)t3A^vBh-aEh zHLwo}#884Fn4j)PWf+CqU|zVE+`pC}tj*2v*M-Ih681G4V9R8;G8tKnlUf+M?*&pC3 z7^mUzcYwbw+=u4CdgIxWHnWXS)EqX@W(_KlKnx`)g8NWkq^^7C_EW5gb)PIm#sLlH;%_JRKRzR@16#vKR@;R7u36_O~X|f0^_g~Hbl0?ez^}FfwOQm z9>B|p+SlyMBDh!0z%_^?31eQ5)c$63?7Pr5ov#H=>iGN|-@*K8?m3IO#`W zXdAZsF%~rO*nBW&enZgLY(BlG29-!4h7!2{xDWZ=eaUtI9Ne#dMmEp(cWVR8lOR@p znj6N;IrUj#^J=VXQH2VWqZD0Gfb_BfCw4?{oQd(c5A(1PQGGV9&V#?ZZ^Q*S0efRB zWK&k=qOH*tC&7K_W|)h$_z_`!Fa~vSZ@mj+5JwW`s4)w>H~qZtE5~b_uH)x1tI2FW zU&Nd68s{ke{`BvzM`LI#&4r;j9K{%j(YOP)@jkN2kDs{C_TRzlaE$g#9=oqNAMe5T z%@@aI-^}q3@Dy&va0GKbm*Y zf&!$MH8{~8zE|!0NZbzN?z}|hj_rPg*|-CvFaSNVJzAr=vNjiV#K9N{*Mw`s`Kd!N zu1udlQ19G63fG`(F^(k6uX<#!%Wnmx!(X^aZNSs?*tf&Bd{|z!aB{^gnIjS6wXEhL7pw*I4owK{}SnK z$2pg5I$zIc)crx-LasCR#@4;$YK+E6jKF1ZPA9>9c@4H5+@I<559;eM2d+(@cRKpP zXWoVy_+%%^S{@dmxjDayb4SmrE{c#qIi*1>s@8TzfJ=gQL?_9VKx<+Ft z!xb>TFW@soJ;OS$aXhZ28*v%V!C(w*;&X?h9GAepUWZAzA2X4Jxp^tBg!$uhzeH3Y zoCnv2<2LVnwlO*teVUxY=MdPo`Rkb7@3R?S1J~7{5(&gm0{0*Hp}Q~#b@&}&eYNfr z%)@jTtIJ_b&O{I^KaH3DJr@_j{4plpb0_S}Gk6xk9%5g-_YmxWwUMc`;^em2560(W zxW_$#cMz4=e^6fs+qECIX&idB&>*fKi@WhWj7wPDJl}vf@GvSc48|yqB&t!5sApLB z1)O(tYXZ!Z?p?{k;s1%Qnpy^WF32ysQAEuIFn}4&%`S zU7H-p=Mix3U9a{voBXj|=duRIB!L(XZ~CGw8RKv^eAYhL8ml0zY(hmB_0) z-LM}H#jzNGq3}Lq)E~oPzC8)wJHH~T4na8aVd}#9-ft!F|Z};hypXqMq|9^>c9#%n8SBe~eX8h+R3qH+rB1uC0M6$4Fd? zi(u@mb8j{7>mjPFO{H^UoP3^fy9>s#4!(!N#_|(&=7u?P3nnb3+qlm;eiuI@ti4~T zGY_7Ec{&p2Ng3iuq8jxGdxqz2Bk1={9A5xqW_-8AN>~|f;G9_JHD3EDYT?+U+Hj7a zhp`-uk(i8Ga4r9iu=|%#_aUCaWH`5{!nrR*KGtZ`nos9=6Ko6jfW6QYy>U2t!8rMx zDR>rj2y5T-#@hLK9L}w4@g(evwpaz0bzq(q!~7YGyD=9F5!FTm^);wO0x|T#CAb|= z;{zCvu;&E*e3EN!h4=PF$x=G5>HdCvo(SW25cY=S+!VpsIs9M6ylIQBFkTnoW|%i` zp}D=`W3G7))0dI){}f?y^ZYk>9W&uO&3Bu7b{XPGq8jyxdd_#$&&PxCIqs{zpLfAV z2+D>W?2IFD7M$}Lun*rNsttb=z69T+_H8t#!Zr38qV9FA8hiKW8!-&dv+sc|5LQ;D zA|G2}dlX?OxVBD%du6t{{yo>efroHC&c)H#6&oWc=GHdYALiglOvY?1K-4%JsINgK z5{ThcT#h?oUVVb7XQa;MbzEydea`YSgl8GMW6=Xe*aT6ffXZE9-q?=`xF6=`mxvnA z*VMnZ9MtfP=5jPxyXK|);2<1=GMKYT*ynmg_1Sg#DjtAi9fDrygmn>=wK#B3vW>wQ zkD!gOIBu?u*SKanCg2L(hnLV?Oc!&FYqk;zxRwuxYhwdsQ}VbdAB8AJ8RAI7K757d z`frSa{tw}}H#)=Trj{-F;{NS^J{%L_`{I2pL0CHt)YYI83B)i6<8UwL;R}S_@A*Y| z8Ro0cSl*mF*Y`O%8Qswl>msbQreb@zj}5>mOu;OCh^Uw}QvdC8@+;2?i`|dZ)#5P( zzdsybdahJ+t{!2}@x1k3mqZ+8C`KWSMNn4fpaYDHd(;@*jTf*GQEdeK=1i`;23Nv4 ze+6G7>fUyskHI(;J78^OTfFukI1FdvDm;K}`%ulbNyJfxVick^Qj5QV_JHru z3ve@>r+4rR!p7P_T@5PXI*8#6T#5T(KNlhFe$Tr%y$GMNA{ej9a30P^DVqD8z$O3n z8^Jy1cnm`Y9)|Dy21JeN&!}@heHo7LYMg~5;T${HaU@ZVdPMc<3+m_L9*o85=!p(k z13~e(%(gfHr(hKB#2hsDJLCth`6nL2^{~$~@H!SFoBp{+kHbJ5gzc~}=GQ^QYHR=)7?&s9MfV(jUr=bVhV>JY2B@VX6e&~lwF$K?}4pD6ce*-pKH+mg?PMJPcG2~?s64alYsQ@L(52B14K^`U_C zT~La0RGyMFeO+JP95cS@U8t?L``;PYA>&?v@;cto)un!zt8RAHy8uf^3*BH&kRE)*|bVob1 zLTYKlm#*l85txKoSb%>=FptcqDpbJVd^0g0jwkBgh1Ac*RE)*|bVob1Lbhc+F5D4^ z<1Ac*nV667u)O+Ez_Yrb6y>Nu6>8Cluy$MrHK;@aF`R{KFcb6f9m4MaGtMufecw^j z;5%k84naq>MpW6H%01wF`#f9+$K`wX8~hpl&(y}}wCx_@dhxfle;b#;zt4+NhB&OR zMm;h;Cpfo|`ni~j(HMa4XoprvEp7PH6@4%QlQ0Vl@CW`K;%CmkjYn}Ku7Rv7?ZI2>o;8qCCee23-LhXS6}1*IrQ1*%YsMufG~KwS+g zkw6S*;Tp`ue0+zn`~Qsdi)jC4Ov88##v$m4)`%+kRCdClD8o41jpxza-wP{hY`@a> z`*<3Y;BPK}!xnwj&^8;)Y678UC{?4FbT7;0RN6) z9+^*7sDSxWi5fH@>fVLa&&5=X#sG9jJG4T!Wj!w35haKrflAb%0n4io1w5+@N>Ppq zRG}7)2y4ea*q2Hq5NqPG=W5V^u>1dv^NVQzWlY0(48|eoh}MWI&egWq4}EYkCgO3p z*G9!=MUBmWJ2b8j!oTawaV-2dmO>Px3~?k;je11&$M@X}aIYAH)6fI$u^NK15(itu zc=W@in1W~VF{0Y|iTbzTZ`2!bHD-Fgqk;&k*x2ds{4%eq|H8ND$S zS7QcV$6`eF;dAO=z}*;w)6fI$u^Lj#CVbf)&dV^|gvam>enD6}t`+CD5(&gG6jx&g zUdLjD-T!BtUqt&aV;aU|Fb+XSv_^Af6E5h2qu{>}I?m~M6^jrxhK1C(RCBriDbJjX zd*I)LgK-!-qY%X?LmWv|qaIQH{DS&I2jU=XhcytCRXO-O4uJ2(QMeP&;ZsDl z@dNe#&G!)e-8=ygz&L(`sC&Pn-f=jdILc6rLS!?CT=rjO9sau$dSM7Ape22HiRYku>Td@35`XiW|JkVJI`{FgxcEMFk8^Hr#U<#A z{b8OvCdXEWIFhJFJ;I*pdF#C{i8x%Nhrn^SMo?T^uCbml7GrS_Ucl#wYNLVr8dTyM z*pBU0qaIQBenb7Mm=4!~YoRyXL-LVraV(DM5Ddn6OvB4qgs47P?{)XXzgf?~VfY8u zMrvupmwjiJ*teEV@9uD~E1 zjP0=|nky@FL0cG~6LBGKhJRQ4`^9}Xto_u#b*6G%6!-Y%elt0z=G6?Cljq=Q?1oKI zh+>o>jwGs4kFY*^{u{i8AYX@aoGD+|;k@~CD9oqvmeF1A*!^daszDK#QoqP48%CNAI!rSh>B5at{eNaa0GUS&ku_4 z@NIDb`r|U(foy&gr?wHSr_;E149p$(n*V#^QAJLv>YjMyK2V)S%;U3I`xfs<(1NFwzd`KXMez+8qF&hgI^^9O|G*&J3I`=d;kDqdl z@iGT5hjBa*?a&I@lsqol4m~gcqhKz~g75Gp2peMqb#LGy+<^1pGvsdpf44me^W|rR zJ?97N-om4}85iLsbj8-NkA)~k8RAHy8ubW!uIGP&?LUrN5Ioy=vd_+k>vbF0p6z;# z*FJ`K(1@ru%va~(PB;(45sdvkj(V-;6B#|n_yFHh4v`IUg!z;!DE_~ z@Yx-GVEk{#({LVtLs%b{G+pxypOY{W{b4S3fblU-o54NjNSuWPro(r$xgPd>&o`h3 zmGHh8PCyWA=f_z8g0Sb9CvV~rI6v8Xh-?1|_tvmy|3TdX%)(@hL|^O&^JFDtTejrF zy>UE-p#l%XwbFpFKKzTi4-m}5r5vAv!Em2;@0yEG5%vtve+k!y@5Ko))<<9$6d(_U zC`K9LNTM3`h=p2BUo80Bz( zF^0{}qt7)L-9I0M_g#p-D8@e6y~)0Ox?XzWI1GTXIv=(<6#ZbG^LP{7qiXRJ!p7kF zg_wu?;BSo~a1Qo>@i9)us3&a0ao&Q*kj?YWqZ(8qff$a)xwsCFeLfZ=te@@)A7U1! zU=)m182dO8PvBkrg0N>>=QWSRakP7 za6TQg`FSMVlbsuLdL~}OA_ULL^!YvYZ{iVnpJN|_t1u1r(fuORy}`L(sW%4C;%<1a zYveSXh+~_a#OJ9n#@1hk3AhmzF#hI&@eAG`j@fa1gP^@kpAFRi6IHkwm%#RqLN6F6 zV4_Q#`0xM$F&#+`*eJop?vqb z_rN}Wf~bA*JL=!SLoj#GgX8Uj0<@&8!Nu)yAk3+exE)X7Jw&bRpdSx&opb8=Mq(14 z#``c|(&G|*Z=lX`q~33A+!wZlB@cxtMj7Hrq8jxGo)z}_GuPOUS-2a{=Lnb=#(fCR z#>KcA&cSSafT*$Cp7U!ze7BloKFfS|@4N%E@ezJQSpPh4zMIca;4WN)%P}0rRQAv3 zj)!Y^GHlm1@CeLrbIko>5XQl=%*AJjYX5iYT^BFFec(E{ri_bYGET%680l}I3l5}0q7ViKN4bNSN9HSgjXOvMBkqoAKY*S%&8ZiTUV1K%R5kIv&u zaO}Z*p%=%Uk&l*^&ADL@90S*;@tld*;arFHWeIg3ViqRjGC1Ga?l%j$c3#u<-ggEZ zM-kSCB@cxtMj7Hrq8jxG>s#viuer{Abx{u$u)nk5S{w`4 z(QruzBq5G{k(zi&WAB_jeLTrJ}#mDL(D?zJoeyw2dsgX zmV9pLghNq=akv}L!~O(g$@FO+*l*|HN>t!sG?z!eaLs#o3eNio^uqyYht*-pLm`S` z-{MH38uiH3r}T5?tJl`z1(*-Udj_UsCLV+1H9xa??zdcL{ySF3JPaqmJUJ8Y56<^o z7(@Gz-mlc}K_AWim+>sj8T%!VJ!hNb6 zemWn|z%kdM5n<2re5QFkp7VQSD=bZE#ZB8{KlH)Hm3 zuK6VhyDw7?lyd#<*bG6*hK)y!4)_Iy>TG=;S$_}D%h6umimmaV`Kdl>hM0yZ+UG0zJPs9%{kvaj_FAR zd(%LU$KX!Pg6r=WgtZ%-cRpSJ#>2Q6ALHa0Y{R;2ViY{jPp_{*B@&3C1l@2FE`)oM zYu2{1nb*Z!XFSsT={j?)uDM^4+K=>O_k%hF^BCtin8zJC-T+HmHsQuDI0|ROaZkr9 zh#H@La!;9sDYzfia6IY#PyKEz9LH3Q#ULDle_&k%C69wb6r&7rBvFleq&_qC_>YJ> z^UAz&PR#QLG$Qr>sN+RkTLbsPn=l-Gus@99kr)c!QNHJ&g>&4JHtfIa*0o}PJ&x+r zXVm*%xfjOBycmY-F%!sde_%xELSfWW4N0>NVLO`yAs{i3DOO!A|In!7vA0 z`_I62`vbChetJK>FLkepdWQK^gG}?-j`OQyY0KK&*bxWgbc}}MGZz-%cZBuLwPSv} zma6b3qT=x*^|g2m?&0R+$>@e{uquL*$3Y>AQHD5@s75`)`V`gQuzRvO@3@@rS-1=1 za3&7NF6e**&oh7uH^8%}`zy%y$>`@#aamn^UTr9a30;T^bsGtJ{BoL`o*GB>xyzBm!) z!c7R)hwZ2LDfn)kYshP}S$|(~-OG3YSK}-kiCwWVQcE6R3Q>$Q#F0cb>JjuI)93Qe zokrUG2+p_j?)(pfzghN!dz$mGGkU>%9)(-+2wsKnk>-AfWEx9z=X`&Ch*_8d+Z}*& zVT|v?b9f)_3C%sPCH1x)73&7-Yfy;=+B!Zf^usNZkC3l`v6yn?7a|BZUbG8=c`a-4>P zP>8jVTJref`C^nIjwGs4kFfatL0ughBCZL$H`96Nz%jmvnQ-1m!oHgiJHq(+8(|yl zjZzp#-(i#Beq(&h6Q7r`M6F?2qB7fWO~gfa@-5e{4w~+#B2@zC+l3 z&Or?-kw6S3D8g3Q1Ma71U^H&S!+06XJ67%`=3g+6zB5L^_3S*_C+Bf_lsq1?9eUtY zT!zV*1?RwhC@f~?wz*P^s9Z7b|HLD>5f|VD?1MH~38}?C6`~krh$D$=)FZ4vp8o{z z;+tl!i+YB2?!6yi9^5-8!hOK`HxJB*Hdqywd~A>XaXik(6_^C`#JPMQU&H;Sx%RWE zcWxHJci;oK3PaEv192(Lof&XnehPjJCY zKv>^hLvN!F_C4&nz?ToYHqIWNIZ*bwO@j}wI`Mj7Hrq8jxGYsd4S!rwUd-Q({O zb$xo>k6gbHZ($D1Mdx5N>~|@;!hBc@sbwR+`~%%_BF=_+G7&y!Hs+%a&hxKGZ$F#w zjofD(+;e^2Gq@9D;5s@ON5PzNe{@YffZ1>z1aXO)v-E!0=9h53U%;C%R_WIT-_4sE zR3d>GN>GG+tdEX30Pa6$!TtxaGWJ1VzvK9K1kY~n(`&uQaheCuVmfYyd*YdJ9`{8% zq|YO#mZ>;4$Jq;KU_9=_JeXTi{rBDcRm3&sjQhjWm<0FCQ((?@z?w)ed7LOjG0G4} z64j_jRDV9B{&_qK`|rB2kBjgj_~tmxX)Vu32N~Y9>=|?fH~Vi@N-nA5M|Sv-upaShIg z>$oe-m7_5jBVqeq_b5{1Vmxj8XV_j47uz*1_RYL}2QT9(RKYme->|u8pw2N?B7qo6 zP=tI~+<$h!0XPoEY7}n3JqY^xCdUil_+2MKoPxgEZ_hQrHSe|Ft-*tEPRnsD_QV#*RPs1kh+>o> zjwGs4kFd5p{~4agUGSdA@EpuP_dD~#JpQ2R)9;?Q-s`;nemMTCa1jQ<-0X%zY>2S3 z5)~WcA8_q?pYMzda0PCH^J_ee?_9hJ`|vi5chEnN?Vq{vI$pvYxYm8&-H8gs;qy<$ zAuwmRgKO$YoQ?}|C2qwum}idHHSz|6w$tNc-|XWPn2yP)LM<8*HW%i$^InMrVkkio z@)48*4t9XCDuuB&=Js_WoWm+Si)zeAEsRajSC2hso!88U_uL1cF&>WJc{mDPu{}1x ziYlA&;5~2*&ck(>3Fq+}gvISg>i!i`|0#9Ohx^SH7>vWv8S5ca$>U@picy9*lBh;K z!usO*g|NM;n1Ea0+Ij#F!S(Va%w<3Q{xGcf9EhjF+bu36Vs&^L4Z2?YJ~*#13&N*DvzkbO*GG%my$@cDBR$C_xeOky?zE`E87i zbzgY>2)M3p!X0oQa38XLV-w7w$M)Ykukl*%@m`UXX2eg}^CR$PL<*dKq#YRFXbI9Z5d*q1nxs75`)`r`S8mHnNI0bWP%sgkE zF&YK$@m`W55qC&2iHWAB(XsTu1G&F>Eij z_2I2I^{1i3DOOK@swisTgDP z!oHd#-QgbOcpdkdFo#m(WS@hIBZ+F%BfYKE?+dA)i>Vlm0XPV~;aWZp z#@adZ)9;>lt`9~x?21BciFL6&itmh#@pp8_9&l~hrhPN!$KrU{x1fKXD}}jnC|nP& zA^YfBZ;Or4T%N4WHJih{a$R?Ydq!&8QE{;k<)}avYSD<)*ry&hP*;OWBoIRhija?} zvKE#0wF7p>K5*Q<;68E;f;ib{k3DCddzIIEkM}y>&EPZt>|)HFBj@;Zn2&ejSuDWs zNR3(4@ef@479PdTxCkeqE4Ice2rGG1n9s#1LmWv|qaIQ1E~I`gro#RYKzBHg=Ae1J z7xr%Y^taJt*a7X)1_f}wqT)#P z|0=CHg@~+b=~qDo}-5G$L#+8mOy5B@&3C1VzY4HYJaX+$$WfYpWB2 zz6No!&mQjv*N@kD?N;z!pYeZHR;J;$aQ}0Eybw3R_`Qkm5f;Dn^IvjpHSWg*7*Bs^ z7>@!(6=P6{Vw53{B&t!5^tMvJFQk4hreZV(pgY>Z_-=~Lu|?CT-#zafn`_44&nm8k zJlOVza2;<3`Tv^gHK;@a zF_fSP`DkfbgB#XCrZ^chV`tsE@Y?^BVr*UK{=OKBt1t~O;R~e3EbMp**L{dtn1WF- zuY1Bh(Hx2@))%4}Wr!n*YSbgFUC%GXTujAi3_y3ZLo4J;%OX&~cFqa9iyS6UW<0xs`@Qk0_tRj5TH!seoZx*Aj>ff!0qgnay!iaBroxdvPd zt_j!1Q+N-*AS{kwQ}-GwaV^e8DRzf{H)d1vxTp}tC_@}cRHGhYZF_zp=3**FV*t9N z9a8upAYrLM<8*HWv-l)xbPRAchhYAs>IWV(z;JO5vJtZOnvgWg)%{ z@e${r!&HpLARK~!z<+zmrsQ!^A&OCkIFhJFJ;LTNx1I>jaxMituM5nBa#WxSwP-}x zTr^NugGwY2LkWtIkH10<9Ol*&!CB6wfai5VDauiSD%7G8VRO+yT@5OcKnx`)LO%X##oTudbj1lc z4_D%L+ynof%Eb4QYw25jKap^+a%%b1C3?T~La0 zRGtL3hSM=!3H{627a(g&4zm-%GBgW6%}t;Qw}* zZSmUeVY>riTdraMJ>+97is0|fIk*#}a4HVO-?1ukrDYNDe~)xOJPPOHdIbO0`xVDw zbMZNKFXI7Bz!3C;`IPPNelGq0s;tatHpforfl~B`IUeRT>imu8d&#xrx>z4ADdzpQ z*dP9T$R(JFhv9Ec=PArw>ioTVBQC^=*cWY(D=m+J?-JL5Yr%i(y#oFQ@!zKWy%07J zFH!dxCgXCL7YD(7$irW?nA@A8Blf@nFfL(wQr8W;!1q#1*Alnpd`>y&swu{h#x~<{gOKW0j%Uay%vz*7{F%%=<{^%Tq8Asj4a4+?J>buE4uYp`y zx(F0-+m1K{{ZS70tFSrnd>og-zY$!A{=V4(>mgVECjzT-Xl{maKU?{KE?=f2-zm<4 zYw9RCmxC}kg7tlI1cKk2xj7^l%TQWz?^f6q2gChs0HWrhjQUgH-_Wil*Q38Va^?Rv z0INz?nE?Ab|o7|o&DG_l0+yb58?>5&+)I2y(-LWS+!nL#ta^?R% z0{-^f4E}B_g!2<-d+N4@^OuKQS$+}lcZYuu`!|rk#lz;n^UhOyxCZ@OAy@wMBH-^1 z*GTIK*87_@S5|BU{9PY457w==V!M!gdM*OF2;?G=i$E>{xd`MUkc&Vr0=Wp}B9Mzf zE&{m-{xd`MUkc&Vr0=Wp}B9MzfE&{m-{xd{CK7J>f<{G2Sw From 8298d60e4a8a7f6c3e01fa0b6032e1a078e07dae Mon Sep 17 00:00:00 2001 From: Sam Lantinga Date: Wed, 29 Jan 2025 04:41:50 -0800 Subject: [PATCH 266/340] Dynamically load CreateWaitableTimerExW and SetWaitableTimerEx These functions are not available on Windows XP --- src/timer/windows/SDL_systimer.c | 26 ++++++++++++++++++++++++-- 1 file changed, 24 insertions(+), 2 deletions(-) diff --git a/src/timer/windows/SDL_systimer.c b/src/timer/windows/SDL_systimer.c index 01e908c6d8c0e..49f27cfe9d511 100644 --- a/src/timer/windows/SDL_systimer.c +++ b/src/timer/windows/SDL_systimer.c @@ -24,6 +24,11 @@ #include "../../core/windows/SDL_windows.h" +typedef HANDLE (WINAPI *CreateWaitableTimerExW_t)(LPSECURITY_ATTRIBUTES lpTimerAttributes, LPCWSTR lpTimerName, DWORD dwFlags, DWORD dwDesiredAccess); +static CreateWaitableTimerExW_t pCreateWaitableTimerExW; + +typedef BOOL (WINAPI *SetWaitableTimerEx_t)(HANDLE hTimer, const LARGE_INTEGER *lpDueTime, LONG lPeriod, PTIMERAPCROUTINE pfnCompletionRoutine, LPVOID lpArgToCompletionRoutine, PREASON_CONTEXT WakeContext, ULONG TolerableDelay); +static SetWaitableTimerEx_t pSetWaitableTimerEx; static void SDL_CleanupWaitableHandle(void *handle) { @@ -36,9 +41,26 @@ static HANDLE SDL_GetWaitableTimer(void) static SDL_TLSID TLS_timer_handle; HANDLE timer; + if (!pCreateWaitableTimerExW || !pSetWaitableTimerEx) { + static bool initialized; + + if (!initialized) { + HMODULE module = GetModuleHandle(TEXT("kernel32.dll")); + if (module) { + pCreateWaitableTimerExW = (CreateWaitableTimerExW_t)GetProcAddress(module, "CreateWaitableTimerExW"); + pSetWaitableTimerEx = (SetWaitableTimerEx_t)GetProcAddress(module, "SetWaitableTimerEx"); + } + initialized = true; + } + + if (!pCreateWaitableTimerExW || !pSetWaitableTimerEx) { + return NULL; + } + } + timer = SDL_GetTLS(&TLS_timer_handle); if (!timer) { - timer = CreateWaitableTimerExW(NULL, NULL, CREATE_WAITABLE_TIMER_HIGH_RESOLUTION, TIMER_ALL_ACCESS); + timer = pCreateWaitableTimerExW(NULL, NULL, CREATE_WAITABLE_TIMER_HIGH_RESOLUTION, TIMER_ALL_ACCESS); if (timer) { SDL_SetTLS(&TLS_timer_handle, timer, SDL_CleanupWaitableHandle); } @@ -89,7 +111,7 @@ void SDL_SYS_DelayNS(Uint64 ns) if (timer) { LARGE_INTEGER due_time; due_time.QuadPart = -((LONGLONG)ns / 100); - if (SetWaitableTimerEx(timer, &due_time, 0, NULL, NULL, NULL, 0)) { + if (pSetWaitableTimerEx(timer, &due_time, 0, NULL, NULL, NULL, 0)) { WaitForSingleObject(timer, INFINITE); } return; From 2abc7735a47b3c47f9c02f7a838a3d47da327a33 Mon Sep 17 00:00:00 2001 From: Seth Anderson Date: Wed, 29 Jan 2025 11:14:55 -0600 Subject: [PATCH 267/340] Free XIDeviceInfo in X11_MaybeAddPenByDeviceID --- src/video/x11/SDL_x11pen.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/video/x11/SDL_x11pen.c b/src/video/x11/SDL_x11pen.c index 38a331f84030f..d382eee7013ab 100644 --- a/src/video/x11/SDL_x11pen.c +++ b/src/video/x11/SDL_x11pen.c @@ -285,7 +285,9 @@ X11_PenHandle *X11_MaybeAddPenByDeviceID(SDL_VideoDevice *_this, int deviceid) XIDeviceInfo *device_info = X11_XIQueryDevice(data->display, deviceid, &num_device_info); if (device_info) { SDL_assert(num_device_info == 1); - return X11_MaybeAddPen(_this, device_info); + X11_PenHandle *handle = X11_MaybeAddPen(_this, device_info); + X11_XIFreeDeviceInfo(device_info); + return handle; } return NULL; } From 36758d70c95cdef2cd6fbb048e62f04c7b70b171 Mon Sep 17 00:00:00 2001 From: Petar Popovic Date: Wed, 29 Jan 2025 23:08:17 +0100 Subject: [PATCH 268/340] Rename parameters of type SDL_AudioDeviceID from dev to devid --- include/SDL3/SDL_audio.h | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/include/SDL3/SDL_audio.h b/include/SDL3/SDL_audio.h index 956938215bea7..ca2b585209c56 100644 --- a/include/SDL3/SDL_audio.h +++ b/include/SDL3/SDL_audio.h @@ -781,7 +781,7 @@ extern SDL_DECLSPEC bool SDLCALL SDL_IsAudioDevicePlayback(SDL_AudioDeviceID dev * Physical devices can not be paused or unpaused, only logical devices * created through SDL_OpenAudioDevice() can be. * - * \param dev a device opened by SDL_OpenAudioDevice(). + * \param devid a device opened by SDL_OpenAudioDevice(). * \returns true on success or false on failure; call SDL_GetError() for more * information. * @@ -792,7 +792,7 @@ extern SDL_DECLSPEC bool SDLCALL SDL_IsAudioDevicePlayback(SDL_AudioDeviceID dev * \sa SDL_ResumeAudioDevice * \sa SDL_AudioDevicePaused */ -extern SDL_DECLSPEC bool SDLCALL SDL_PauseAudioDevice(SDL_AudioDeviceID dev); +extern SDL_DECLSPEC bool SDLCALL SDL_PauseAudioDevice(SDL_AudioDeviceID devid); /** * Use this function to unpause audio playback on a specified device. @@ -809,7 +809,7 @@ extern SDL_DECLSPEC bool SDLCALL SDL_PauseAudioDevice(SDL_AudioDeviceID dev); * Physical devices can not be paused or unpaused, only logical devices * created through SDL_OpenAudioDevice() can be. * - * \param dev a device opened by SDL_OpenAudioDevice(). + * \param devid a device opened by SDL_OpenAudioDevice(). * \returns true on success or false on failure; call SDL_GetError() for more * information. * @@ -820,7 +820,7 @@ extern SDL_DECLSPEC bool SDLCALL SDL_PauseAudioDevice(SDL_AudioDeviceID dev); * \sa SDL_AudioDevicePaused * \sa SDL_PauseAudioDevice */ -extern SDL_DECLSPEC bool SDLCALL SDL_ResumeAudioDevice(SDL_AudioDeviceID dev); +extern SDL_DECLSPEC bool SDLCALL SDL_ResumeAudioDevice(SDL_AudioDeviceID devid); /** * Use this function to query if an audio device is paused. @@ -832,7 +832,7 @@ extern SDL_DECLSPEC bool SDLCALL SDL_ResumeAudioDevice(SDL_AudioDeviceID dev); * created through SDL_OpenAudioDevice() can be. Physical and invalid device * IDs will report themselves as unpaused here. * - * \param dev a device opened by SDL_OpenAudioDevice(). + * \param devid a device opened by SDL_OpenAudioDevice(). * \returns true if device is valid and paused, false otherwise. * * \threadsafety It is safe to call this function from any thread. @@ -842,7 +842,7 @@ extern SDL_DECLSPEC bool SDLCALL SDL_ResumeAudioDevice(SDL_AudioDeviceID dev); * \sa SDL_PauseAudioDevice * \sa SDL_ResumeAudioDevice */ -extern SDL_DECLSPEC bool SDLCALL SDL_AudioDevicePaused(SDL_AudioDeviceID dev); +extern SDL_DECLSPEC bool SDLCALL SDL_AudioDevicePaused(SDL_AudioDeviceID devid); /** * Get the gain of an audio device. From 31364477f21ceafedcedf3c7864b936b08d199d6 Mon Sep 17 00:00:00 2001 From: Petar Popovic Date: Thu, 30 Jan 2025 01:51:32 +0100 Subject: [PATCH 269/340] Rename parameter of type SDL_CameraID from devid to instance_id --- include/SDL3/SDL_camera.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/include/SDL3/SDL_camera.h b/include/SDL3/SDL_camera.h index c4d05962b6387..5f3911fdf9647 100644 --- a/include/SDL3/SDL_camera.h +++ b/include/SDL3/SDL_camera.h @@ -239,7 +239,7 @@ extern SDL_DECLSPEC SDL_CameraID * SDLCALL SDL_GetCameras(int *count); * there _is_ a camera until the user has given you permission to check * through a scary warning popup. * - * \param devid the camera device instance ID to query. + * \param instance_id the camera device instance ID. * \param count a pointer filled in with the number of elements in the list, * may be NULL. * \returns a NULL terminated array of pointers to SDL_CameraSpec or NULL on @@ -254,7 +254,7 @@ extern SDL_DECLSPEC SDL_CameraID * SDLCALL SDL_GetCameras(int *count); * \sa SDL_GetCameras * \sa SDL_OpenCamera */ -extern SDL_DECLSPEC SDL_CameraSpec ** SDLCALL SDL_GetCameraSupportedFormats(SDL_CameraID devid, int *count); +extern SDL_DECLSPEC SDL_CameraSpec ** SDLCALL SDL_GetCameraSupportedFormats(SDL_CameraID instance_id, int *count); /** * Get the human-readable device name for a camera. From 943579a545485a070a96680770835d0ddbfb8a0d Mon Sep 17 00:00:00 2001 From: Aki <75532970+AkiSakurai@users.noreply.github.com> Date: Thu, 30 Jan 2025 12:32:16 +0800 Subject: [PATCH 270/340] Fix inverted pen Y tilt on macOS and add tilt display to example - Negate tilt.y in Cocoa pen handling to correct inverted Y tilt axis - Update drawing example to display X/Y tilt values for visualization - see https://github.com/qt/qtbase/blob/0f128fd7c5a9ee721d1e631743f6eb61d927cf3b/src/plugins/platforms/cocoa/qnsview_tablet.mm#L63 - see https://source.chromium.org/chromium/chromium/src/+/main:components/input/web_input_event_builders_mac.mm;drc=0af5ffa1e4cc4cc4f818725f8fee93ec57855e4b;l=421 --- examples/pen/01-drawing-lines/drawing-lines.c | 10 ++++++++++ src/video/cocoa/SDL_cocoapen.m | 2 +- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/examples/pen/01-drawing-lines/drawing-lines.c b/examples/pen/01-drawing-lines/drawing-lines.c index a530ab60fde2a..32c29595ca9f6 100644 --- a/examples/pen/01-drawing-lines/drawing-lines.c +++ b/examples/pen/01-drawing-lines/drawing-lines.c @@ -19,6 +19,8 @@ static SDL_Texture *render_target = NULL; static float pressure = 0.0f; static float previous_touch_x = -1.0f; static float previous_touch_y = -1.0f; +static float tilt_x = 0.0f; +static float tilt_y = 0.0f; /* This function runs once at startup. */ SDL_AppResult SDL_AppInit(void **appstate, int argc, char *argv[]) @@ -84,6 +86,10 @@ SDL_AppResult SDL_AppEvent(void *appstate, SDL_Event *event) } else if (event->type == SDL_EVENT_PEN_AXIS) { if (event->paxis.axis == SDL_PEN_AXIS_PRESSURE) { pressure = event->paxis.value; /* remember new pressure for later draws. */ + } else if(event->paxis.axis == SDL_PEN_AXIS_XTILT) { + tilt_x = event->paxis.value; + } else if(event->paxis.axis == SDL_PEN_AXIS_YTILT) { + tilt_y = event->paxis.value; } } @@ -93,11 +99,15 @@ SDL_AppResult SDL_AppEvent(void *appstate, SDL_Event *event) /* This function runs once per frame, and is the heart of the program. */ SDL_AppResult SDL_AppIterate(void *appstate) { + char debug_text[1024] = {}; + /* make sure we're drawing to the window and not the render target */ SDL_SetRenderTarget(renderer, NULL); SDL_SetRenderDrawColor(renderer, 0, 0, 0, SDL_ALPHA_OPAQUE); SDL_RenderClear(renderer); /* just in case. */ SDL_RenderTexture(renderer, render_target, NULL, NULL); + SDL_snprintf(debug_text, sizeof(debug_text), "Tilt: %f %f", tilt_x, tilt_y); + SDL_RenderDebugText(renderer, 0, 8, debug_text); SDL_RenderPresent(renderer); return SDL_APP_CONTINUE; /* carry on with the program! */ } diff --git a/src/video/cocoa/SDL_cocoapen.m b/src/video/cocoa/SDL_cocoapen.m index 35fe792630dbe..6c30bfb157d03 100644 --- a/src/video/cocoa/SDL_cocoapen.m +++ b/src/video/cocoa/SDL_cocoapen.m @@ -135,7 +135,7 @@ static void Cocoa_HandlePenPointEvent(SDL_CocoaWindowData *_data, NSEvent *event SDL_SendPenAxis(timestamp, pen, window, SDL_PEN_AXIS_PRESSURE, [event pressure]); SDL_SendPenAxis(timestamp, pen, window, SDL_PEN_AXIS_ROTATION, [event rotation]); SDL_SendPenAxis(timestamp, pen, window, SDL_PEN_AXIS_XTILT, ((float) tilt.x) * 90.0f); - SDL_SendPenAxis(timestamp, pen, window, SDL_PEN_AXIS_YTILT, ((float) tilt.y) * 90.0f); + SDL_SendPenAxis(timestamp, pen, window, SDL_PEN_AXIS_YTILT, ((float) -tilt.y) * 90.0f); SDL_SendPenAxis(timestamp, pen, window, SDL_PEN_AXIS_TANGENTIAL_PRESSURE, event.tangentialPressure); } From 943c4abcb4ad633818471f3290c5e8477d7b5579 Mon Sep 17 00:00:00 2001 From: "Ryan C. Gordon" Date: Thu, 30 Jan 2025 02:41:43 -0500 Subject: [PATCH 271/340] pipewire: Report correct device default formats instead of hardcoding Float32. The comment in the source wasn't true; PipeWire doesn't _have_ to work in float format. It presumably does if it has to mix, but if a game is the only thing making noise on the system--a common scenario--then it might be able to pass, say, Sint16 data straight through to the hardware without conversion. Fixes #12129. --- src/audio/pipewire/SDL_pipewire.c | 32 ++++++++++++++++++++++++++++++- 1 file changed, 31 insertions(+), 1 deletion(-) diff --git a/src/audio/pipewire/SDL_pipewire.c b/src/audio/pipewire/SDL_pipewire.c index 08f0db6ca7e0f..4e71dd52aa794 100644 --- a/src/audio/pipewire/SDL_pipewire.c +++ b/src/audio/pipewire/SDL_pipewire.c @@ -513,6 +513,25 @@ static bool get_int_param(const struct spa_pod *param, Uint32 key, int *val) return false; } +static SDL_AudioFormat SPAFormatToSDL(enum spa_audio_format spafmt) +{ + switch (spafmt) { + #define CHECKFMT(spa,sdl) case SPA_AUDIO_FORMAT_##spa: return SDL_AUDIO_##sdl + CHECKFMT(U8, U8); + CHECKFMT(S8, S8); + CHECKFMT(S16_LE, S16LE); + CHECKFMT(S16_BE, S16BE); + CHECKFMT(S32_LE, S32LE); + CHECKFMT(S32_BE, S32BE); + CHECKFMT(F32_LE, F32LE); + CHECKFMT(F32_BE, F32BE); + #undef CHECKFMT + default: break; + } + + return SDL_AUDIO_UNKNOWN; +} + // Interface node callbacks static void node_event_info(void *object, const struct pw_node_info *info) { @@ -541,6 +560,15 @@ static void node_event_param(void *object, int seq, uint32_t id, uint32_t index, struct node_object *node = object; struct io_node *io = node->userdata; + if ((id == SPA_PARAM_Format) && (io->spec.format == SDL_AUDIO_UNKNOWN)) { + struct spa_audio_info_raw info; + SDL_zero(info); + if (spa_format_audio_raw_parse(param, &info) == 0) { + //SDL_Log("Sink Format: %d, Rate: %d Hz, Channels: %d", info.format, info.rate, info.channels); + io->spec.format = SPAFormatToSDL(info.format); + } + } + // Get the default frequency if (io->spec.freq == 0) { get_range_param(param, SPA_FORMAT_AUDIO_rate, &io->spec.freq, NULL, NULL); @@ -672,7 +700,9 @@ static void registry_event_global_callback(void *object, uint32_t id, uint32_t p // Begin setting the node properties io->id = id; io->recording = recording; - io->spec.format = SDL_AUDIO_F32; // Pipewire uses floats internally, other formats require conversion. + if (io->spec.format == SDL_AUDIO_UNKNOWN) { + io->spec.format = SDL_AUDIO_S16; // we'll go conservative here if for some reason the format isn't known. + } io->name = io->buf; io->path = io->buf + desc_buffer_len; SDL_strlcpy(io->buf, node_desc, desc_buffer_len); From 50b8c6cdfb8880ddcfeea7beac0ae02873cbc13e Mon Sep 17 00:00:00 2001 From: SDL Wiki Bot Date: Thu, 30 Jan 2025 19:31:13 +0000 Subject: [PATCH 272/340] Sync SDL3 wiki -> header [ci skip] --- include/SDL3/SDL_audio.h | 3 +++ 1 file changed, 3 insertions(+) diff --git a/include/SDL3/SDL_audio.h b/include/SDL3/SDL_audio.h index ca2b585209c56..31d672e510f7a 100644 --- a/include/SDL3/SDL_audio.h +++ b/include/SDL3/SDL_audio.h @@ -1583,6 +1583,9 @@ extern SDL_DECLSPEC bool SDLCALL SDL_PauseAudioStreamDevice(SDL_AudioStream *str * previously been paused. Once unpaused, any bound audio streams will begin * to progress again, and audio can be generated. * + * Remember, SDL_OpenAudioDeviceStream opens device in an unpaused state, so + * this function call is required for audio playback to begin on such device. + * * \param stream the audio stream associated with the audio device to resume. * \returns true on success or false on failure; call SDL_GetError() for more * information. From 14edb21aec281dd0c8d07cef6683796c001aeeab Mon Sep 17 00:00:00 2001 From: John Alanbrook Date: Thu, 30 Jan 2025 13:15:25 -0600 Subject: [PATCH 273/340] check for backslashes as well as the forward slash --- src/filesystem/SDL_filesystem.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/filesystem/SDL_filesystem.c b/src/filesystem/SDL_filesystem.c index 28388517c4978..75556524d93da 100644 --- a/src/filesystem/SDL_filesystem.c +++ b/src/filesystem/SDL_filesystem.c @@ -363,16 +363,16 @@ char **SDL_InternalGlobDirectory(const char *path, const char *pattern, SDL_Glob return NULL; } - // if path ends with any '/', chop them off, so we don't confuse the pattern matcher later. + // if path ends with any slash, chop them off, so we don't confuse the pattern matcher later. char *pathcpy = NULL; size_t pathlen = SDL_strlen(path); - if ((pathlen > 1) && (path[pathlen-1] == '/')) { + if ((pathlen > 1) && ((path[pathlen-1] == '/') || (path[pathlen-1] == '\\'))) { pathcpy = SDL_strdup(path); if (!pathcpy) { return NULL; } char *ptr = &pathcpy[pathlen-1]; - while ((ptr >= pathcpy) && (*ptr == '/')) { + while ((ptr >= pathcpy) && ((*ptr == '/') || (*ptr == '\\'))) { *(ptr--) = '\0'; } path = pathcpy; From e4fcc7b6e778ec51ac357f3c345b12391120cb74 Mon Sep 17 00:00:00 2001 From: Ozkan Sezer Date: Fri, 31 Jan 2025 02:50:00 +0300 Subject: [PATCH 274/340] gpu/vulkan/SDL_gpu_vulkan.c: fix type redefinition error src/gpu/vulkan/SDL_gpu_vulkan.c:763: error: redefinition of typedef 'VulkanUniformBuffer' src/gpu/vulkan/SDL_gpu_vulkan.c:482: note: previous declaration of 'VulkanUniformBuffer' was here --- src/gpu/vulkan/SDL_gpu_vulkan.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/gpu/vulkan/SDL_gpu_vulkan.c b/src/gpu/vulkan/SDL_gpu_vulkan.c index d684ff9d11c3b..05dac8ef5f5b6 100644 --- a/src/gpu/vulkan/SDL_gpu_vulkan.c +++ b/src/gpu/vulkan/SDL_gpu_vulkan.c @@ -755,12 +755,12 @@ typedef struct VulkanPresentData Uint32 swapchainImageIndex; } VulkanPresentData; -typedef struct VulkanUniformBuffer +struct VulkanUniformBuffer { VulkanBuffer *buffer; Uint32 drawOffset; Uint32 writeOffset; -} VulkanUniformBuffer; +}; typedef struct VulkanDescriptorInfo { From 8c2682a219bc3708050172de96ab2c39d96efa98 Mon Sep 17 00:00:00 2001 From: SDL Wiki Bot Date: Fri, 31 Jan 2025 00:56:29 +0000 Subject: [PATCH 275/340] Sync SDL3 wiki -> header [ci skip] --- include/SDL3/SDL_gpu.h | 1 + 1 file changed, 1 insertion(+) diff --git a/include/SDL3/SDL_gpu.h b/include/SDL3/SDL_gpu.h index 13b8ce215dcdb..6b0f06a3134a6 100644 --- a/include/SDL3/SDL_gpu.h +++ b/include/SDL3/SDL_gpu.h @@ -1814,6 +1814,7 @@ typedef struct SDL_GPUGraphicsPipelineTargetInfo * \since This struct is available since SDL 3.2.0. * * \sa SDL_CreateGPUGraphicsPipeline + * \sa SDL_GPUShader * \sa SDL_GPUVertexInputState * \sa SDL_GPUPrimitiveType * \sa SDL_GPURasterizerState From 43924ec87325c32b5c60d8bc22087d1d77efcacd Mon Sep 17 00:00:00 2001 From: SDL Wiki Bot Date: Fri, 31 Jan 2025 01:04:48 +0000 Subject: [PATCH 276/340] Sync SDL3 wiki -> header [ci skip] --- include/SDL3/SDL_gpu.h | 1 + 1 file changed, 1 insertion(+) diff --git a/include/SDL3/SDL_gpu.h b/include/SDL3/SDL_gpu.h index 6b0f06a3134a6..e558cdd234697 100644 --- a/include/SDL3/SDL_gpu.h +++ b/include/SDL3/SDL_gpu.h @@ -1842,6 +1842,7 @@ typedef struct SDL_GPUGraphicsPipelineCreateInfo * \since This struct is available since SDL 3.2.0. * * \sa SDL_CreateGPUComputePipeline + * \sa SDL_GPUShaderFormat */ typedef struct SDL_GPUComputePipelineCreateInfo { From 8e766c925229af922630ec72812c034b16b8c974 Mon Sep 17 00:00:00 2001 From: Evan Hemsley <2342303+thatcosmonaut@users.noreply.github.com> Date: Fri, 31 Jan 2025 08:34:10 -0800 Subject: [PATCH 277/340] GPU: Resource binding state shadowing (#12138) --------- Co-authored-by: Caleb Cornett --- src/gpu/d3d12/SDL_gpu_d3d12.c | 207 ++++++++------ src/gpu/metal/SDL_gpu_metal.m | 479 ++++++++++++++++++-------------- src/gpu/vulkan/SDL_gpu_vulkan.c | 281 +++++++++++-------- 3 files changed, 556 insertions(+), 411 deletions(-) diff --git a/src/gpu/d3d12/SDL_gpu_d3d12.c b/src/gpu/d3d12/SDL_gpu_d3d12.c index c142bae4486f2..aa5dc6ca77ae4 100644 --- a/src/gpu/d3d12/SDL_gpu_d3d12.c +++ b/src/gpu/d3d12/SDL_gpu_d3d12.c @@ -4552,15 +4552,18 @@ static void D3D12_BindVertexBuffers( for (Uint32 i = 0; i < numBindings; i += 1) { D3D12Buffer *currentBuffer = ((D3D12BufferContainer *)bindings[i].buffer)->activeBuffer; - d3d12CommandBuffer->vertexBuffers[firstSlot + i] = currentBuffer; - d3d12CommandBuffer->vertexBufferOffsets[firstSlot + i] = bindings[i].offset; - D3D12_INTERNAL_TrackBuffer(d3d12CommandBuffer, currentBuffer); + + if (d3d12CommandBuffer->vertexBuffers[firstSlot + i] != currentBuffer || d3d12CommandBuffer->vertexBufferOffsets[firstSlot + i] != bindings[i].offset) { + D3D12_INTERNAL_TrackBuffer(d3d12CommandBuffer, currentBuffer); + + d3d12CommandBuffer->vertexBuffers[firstSlot + i] = currentBuffer; + d3d12CommandBuffer->vertexBufferOffsets[firstSlot + i] = bindings[i].offset; + d3d12CommandBuffer->needVertexBufferBind = true; + } } d3d12CommandBuffer->vertexBufferCount = SDL_max(d3d12CommandBuffer->vertexBufferCount, firstSlot + numBindings); - - d3d12CommandBuffer->needVertexBufferBind = true; } static void D3D12_BindIndexBuffer( @@ -4596,19 +4599,24 @@ static void D3D12_BindVertexSamplers( D3D12TextureContainer *container = (D3D12TextureContainer *)textureSamplerBindings[i].texture; D3D12Sampler *sampler = (D3D12Sampler *)textureSamplerBindings[i].sampler; - D3D12_INTERNAL_TrackTexture( - d3d12CommandBuffer, - container->activeTexture); + if (d3d12CommandBuffer->vertexSamplers[firstSlot + i] != sampler) { + D3D12_INTERNAL_TrackSampler( + d3d12CommandBuffer, + sampler); - D3D12_INTERNAL_TrackSampler( - d3d12CommandBuffer, - sampler); + d3d12CommandBuffer->vertexSamplers[firstSlot + i] = sampler; + d3d12CommandBuffer->needVertexSamplerBind = true; + } - d3d12CommandBuffer->vertexSamplers[firstSlot + i] = sampler; - d3d12CommandBuffer->vertexSamplerTextures[firstSlot + i] = container->activeTexture; - } + if (d3d12CommandBuffer->vertexSamplerTextures[firstSlot + i] != container->activeTexture) { + D3D12_INTERNAL_TrackTexture( + d3d12CommandBuffer, + container->activeTexture); - d3d12CommandBuffer->needVertexSamplerBind = true; + d3d12CommandBuffer->vertexSamplerTextures[firstSlot + i] = container->activeTexture; + d3d12CommandBuffer->needVertexSamplerBind = true; + } + } } static void D3D12_BindVertexStorageTextures( @@ -4623,12 +4631,13 @@ static void D3D12_BindVertexStorageTextures( D3D12TextureContainer *container = (D3D12TextureContainer *)storageTextures[i]; D3D12Texture *texture = container->activeTexture; - D3D12_INTERNAL_TrackTexture(d3d12CommandBuffer, texture); + if (d3d12CommandBuffer->vertexStorageTextures[firstSlot + i] != texture) { + D3D12_INTERNAL_TrackTexture(d3d12CommandBuffer, texture); - d3d12CommandBuffer->vertexStorageTextures[firstSlot + i] = texture; + d3d12CommandBuffer->vertexStorageTextures[firstSlot + i] = texture; + d3d12CommandBuffer->needVertexStorageTextureBind = true; + } } - - d3d12CommandBuffer->needVertexStorageTextureBind = true; } static void D3D12_BindVertexStorageBuffers( @@ -4641,15 +4650,15 @@ static void D3D12_BindVertexStorageBuffers( for (Uint32 i = 0; i < numBindings; i += 1) { D3D12BufferContainer *container = (D3D12BufferContainer *)storageBuffers[i]; + if (d3d12CommandBuffer->vertexStorageBuffers[firstSlot + i] != container->activeBuffer) { + D3D12_INTERNAL_TrackBuffer( + d3d12CommandBuffer, + container->activeBuffer); - D3D12_INTERNAL_TrackBuffer( - d3d12CommandBuffer, - container->activeBuffer); - - d3d12CommandBuffer->vertexStorageBuffers[firstSlot + i] = container->activeBuffer; + d3d12CommandBuffer->vertexStorageBuffers[firstSlot + i] = container->activeBuffer; + d3d12CommandBuffer->needVertexStorageBufferBind = true; + } } - - d3d12CommandBuffer->needVertexStorageBufferBind = true; } static void D3D12_BindFragmentSamplers( @@ -4664,19 +4673,24 @@ static void D3D12_BindFragmentSamplers( D3D12TextureContainer *container = (D3D12TextureContainer *)textureSamplerBindings[i].texture; D3D12Sampler *sampler = (D3D12Sampler *)textureSamplerBindings[i].sampler; - D3D12_INTERNAL_TrackTexture( - d3d12CommandBuffer, - container->activeTexture); + if (d3d12CommandBuffer->fragmentSamplers[firstSlot + i] != sampler) { + D3D12_INTERNAL_TrackSampler( + d3d12CommandBuffer, + sampler); - D3D12_INTERNAL_TrackSampler( - d3d12CommandBuffer, - sampler); + d3d12CommandBuffer->fragmentSamplers[firstSlot + i] = sampler; + d3d12CommandBuffer->needFragmentSamplerBind = true; + } - d3d12CommandBuffer->fragmentSamplers[firstSlot + i] = sampler; - d3d12CommandBuffer->fragmentSamplerTextures[firstSlot + i] = container->activeTexture; - } + if (d3d12CommandBuffer->fragmentSamplerTextures[firstSlot + i] != container->activeTexture) { + D3D12_INTERNAL_TrackTexture( + d3d12CommandBuffer, + container->activeTexture); - d3d12CommandBuffer->needFragmentSamplerBind = true; + d3d12CommandBuffer->fragmentSamplerTextures[firstSlot + i] = container->activeTexture; + d3d12CommandBuffer->needFragmentSamplerBind = true; + } + } } static void D3D12_BindFragmentStorageTextures( @@ -4691,12 +4705,13 @@ static void D3D12_BindFragmentStorageTextures( D3D12TextureContainer *container = (D3D12TextureContainer *)storageTextures[i]; D3D12Texture *texture = container->activeTexture; - D3D12_INTERNAL_TrackTexture(d3d12CommandBuffer, texture); + if (d3d12CommandBuffer->fragmentStorageTextures[firstSlot + i] != texture) { + D3D12_INTERNAL_TrackTexture(d3d12CommandBuffer, texture); - d3d12CommandBuffer->fragmentStorageTextures[firstSlot + i] = texture; + d3d12CommandBuffer->fragmentStorageTextures[firstSlot + i] = texture; + d3d12CommandBuffer->needFragmentStorageTextureBind = true; + } } - - d3d12CommandBuffer->needFragmentStorageTextureBind = true; } static void D3D12_BindFragmentStorageBuffers( @@ -4710,14 +4725,15 @@ static void D3D12_BindFragmentStorageBuffers( for (Uint32 i = 0; i < numBindings; i += 1) { D3D12BufferContainer *container = (D3D12BufferContainer *)storageBuffers[i]; - D3D12_INTERNAL_TrackBuffer( - d3d12CommandBuffer, - container->activeBuffer); + if (d3d12CommandBuffer->fragmentStorageBuffers[firstSlot + i] != container->activeBuffer) { + D3D12_INTERNAL_TrackBuffer( + d3d12CommandBuffer, + container->activeBuffer); - d3d12CommandBuffer->fragmentStorageBuffers[firstSlot + i] = container->activeBuffer; + d3d12CommandBuffer->fragmentStorageBuffers[firstSlot + i] = container->activeBuffer; + d3d12CommandBuffer->needFragmentStorageBufferBind = true; + } } - - d3d12CommandBuffer->needFragmentStorageBufferBind = true; } static void D3D12_PushVertexUniformData( @@ -5330,20 +5346,26 @@ static void D3D12_BindComputeSamplers( for (Uint32 i = 0; i < numBindings; i += 1) { D3D12TextureContainer *container = (D3D12TextureContainer *)textureSamplerBindings[i].texture; + D3D12Sampler *sampler = (D3D12Sampler *)textureSamplerBindings[i].sampler; - D3D12_INTERNAL_TrackSampler( - d3d12CommandBuffer, - (D3D12Sampler *)textureSamplerBindings[i].sampler); + if (d3d12CommandBuffer->computeSamplers[firstSlot + i] != sampler) { + D3D12_INTERNAL_TrackSampler( + d3d12CommandBuffer, + (D3D12Sampler *)textureSamplerBindings[i].sampler); - D3D12_INTERNAL_TrackTexture( - d3d12CommandBuffer, - container->activeTexture); + d3d12CommandBuffer->computeSamplers[firstSlot + i] = (D3D12Sampler *)textureSamplerBindings[i].sampler; + d3d12CommandBuffer->needComputeSamplerBind = true; + } - d3d12CommandBuffer->computeSamplerTextures[firstSlot + i] = container->activeTexture; - d3d12CommandBuffer->computeSamplers[firstSlot + i] = (D3D12Sampler *)textureSamplerBindings[i].sampler; - } + if (d3d12CommandBuffer->computeSamplerTextures[firstSlot + i] != container->activeTexture) { + D3D12_INTERNAL_TrackTexture( + d3d12CommandBuffer, + container->activeTexture); - d3d12CommandBuffer->needComputeSamplerBind = true; + d3d12CommandBuffer->computeSamplerTextures[firstSlot + i] = container->activeTexture; + d3d12CommandBuffer->needComputeSamplerBind = true; + } + } } static void D3D12_BindComputeStorageTextures( @@ -5355,27 +5377,31 @@ static void D3D12_BindComputeStorageTextures( D3D12CommandBuffer *d3d12CommandBuffer = (D3D12CommandBuffer *)commandBuffer; for (Uint32 i = 0; i < numBindings; i += 1) { - if (d3d12CommandBuffer->computeReadOnlyStorageTextures[firstSlot + i] != NULL) { - D3D12_INTERNAL_TextureTransitionToDefaultUsage( + D3D12TextureContainer *container = (D3D12TextureContainer *)storageTextures[i]; + + if (d3d12CommandBuffer->computeReadOnlyStorageTextures[firstSlot + i] != container->activeTexture) { + /* If a different texture was in this slot, transition it back to its default usage */ + if (d3d12CommandBuffer->computeReadOnlyStorageTextures[firstSlot + i] != NULL) { + D3D12_INTERNAL_TextureTransitionToDefaultUsage( + d3d12CommandBuffer, + D3D12_RESOURCE_STATE_NON_PIXEL_SHADER_RESOURCE, + d3d12CommandBuffer->computeReadOnlyStorageTextures[firstSlot + i]); + } + + /* Then transition the new texture and prepare it for binding */ + D3D12_INTERNAL_TextureTransitionFromDefaultUsage( d3d12CommandBuffer, D3D12_RESOURCE_STATE_NON_PIXEL_SHADER_RESOURCE, - d3d12CommandBuffer->computeReadOnlyStorageTextures[firstSlot + i]); - } + container->activeTexture); - D3D12TextureContainer *container = (D3D12TextureContainer *)storageTextures[i]; - d3d12CommandBuffer->computeReadOnlyStorageTextures[firstSlot + i] = container->activeTexture; - - D3D12_INTERNAL_TextureTransitionFromDefaultUsage( - d3d12CommandBuffer, - D3D12_RESOURCE_STATE_NON_PIXEL_SHADER_RESOURCE, - container->activeTexture); + D3D12_INTERNAL_TrackTexture( + d3d12CommandBuffer, + container->activeTexture); - D3D12_INTERNAL_TrackTexture( - d3d12CommandBuffer, - container->activeTexture); + d3d12CommandBuffer->computeReadOnlyStorageTextures[firstSlot + i] = container->activeTexture; + d3d12CommandBuffer->needComputeReadOnlyStorageTextureBind = true; + } } - - d3d12CommandBuffer->needComputeReadOnlyStorageTextureBind = true; } static void D3D12_BindComputeStorageBuffers( @@ -5387,29 +5413,32 @@ static void D3D12_BindComputeStorageBuffers( D3D12CommandBuffer *d3d12CommandBuffer = (D3D12CommandBuffer *)commandBuffer; for (Uint32 i = 0; i < numBindings; i += 1) { - if (d3d12CommandBuffer->computeReadOnlyStorageBuffers[firstSlot + i] != NULL) { - D3D12_INTERNAL_BufferTransitionToDefaultUsage( - d3d12CommandBuffer, - D3D12_RESOURCE_STATE_NON_PIXEL_SHADER_RESOURCE, - d3d12CommandBuffer->computeReadOnlyStorageBuffers[firstSlot + i]); - } - D3D12BufferContainer *container = (D3D12BufferContainer *)storageBuffers[i]; D3D12Buffer *buffer = container->activeBuffer; - d3d12CommandBuffer->computeReadOnlyStorageBuffers[firstSlot + i] = buffer; + if (d3d12CommandBuffer->computeReadOnlyStorageBuffers[firstSlot + i] != buffer) { + /* If a different buffer was in this slot, transition it back to its default usage */ + if (d3d12CommandBuffer->computeReadOnlyStorageBuffers[firstSlot + i] != NULL) { + D3D12_INTERNAL_BufferTransitionToDefaultUsage( + d3d12CommandBuffer, + D3D12_RESOURCE_STATE_NON_PIXEL_SHADER_RESOURCE, + d3d12CommandBuffer->computeReadOnlyStorageBuffers[firstSlot + i]); + } - D3D12_INTERNAL_BufferTransitionFromDefaultUsage( - d3d12CommandBuffer, - D3D12_RESOURCE_STATE_NON_PIXEL_SHADER_RESOURCE, - buffer); + /* Then transition the new buffer and prepare it for binding */ + D3D12_INTERNAL_BufferTransitionFromDefaultUsage( + d3d12CommandBuffer, + D3D12_RESOURCE_STATE_NON_PIXEL_SHADER_RESOURCE, + buffer); - D3D12_INTERNAL_TrackBuffer( - d3d12CommandBuffer, - buffer); - } + D3D12_INTERNAL_TrackBuffer( + d3d12CommandBuffer, + buffer); - d3d12CommandBuffer->needComputeReadOnlyStorageBufferBind = true; + d3d12CommandBuffer->computeReadOnlyStorageBuffers[firstSlot + i] = buffer; + d3d12CommandBuffer->needComputeReadOnlyStorageBufferBind = true; + } + } } static void D3D12_PushComputeUniformData( diff --git a/src/gpu/metal/SDL_gpu_metal.m b/src/gpu/metal/SDL_gpu_metal.m index ac712d52fa90b..3020492d91334 100644 --- a/src/gpu/metal/SDL_gpu_metal.m +++ b/src/gpu/metal/SDL_gpu_metal.m @@ -567,30 +567,37 @@ static MTLDepthClipMode SDLToMetal_DepthClipMode( MetalComputePipeline *compute_pipeline; // Resource slot state + bool needVertexBufferBind; bool needVertexSamplerBind; bool needVertexStorageTextureBind; bool needVertexStorageBufferBind; - bool needVertexUniformBind; + bool needVertexUniformBufferBind[MAX_UNIFORM_BUFFERS_PER_STAGE]; bool needFragmentSamplerBind; bool needFragmentStorageTextureBind; bool needFragmentStorageBufferBind; - bool needFragmentUniformBind; + bool needFragmentUniformBufferBind[MAX_UNIFORM_BUFFERS_PER_STAGE]; bool needComputeSamplerBind; - bool needComputeTextureBind; - bool needComputeBufferBind; - bool needComputeUniformBind; + bool needComputeReadOnlyStorageTextureBind; + bool needComputeReadOnlyStorageBufferBind; + bool needComputeUniformBufferBind[MAX_UNIFORM_BUFFERS_PER_STAGE]; + + id vertexBuffers[MAX_VERTEX_BUFFERS]; + Uint32 vertexBufferOffsets[MAX_VERTEX_BUFFERS]; + Uint32 vertexBufferCount; id vertexSamplers[MAX_TEXTURE_SAMPLERS_PER_STAGE]; id vertexTextures[MAX_TEXTURE_SAMPLERS_PER_STAGE]; id vertexStorageTextures[MAX_STORAGE_TEXTURES_PER_STAGE]; id vertexStorageBuffers[MAX_STORAGE_BUFFERS_PER_STAGE]; + MetalUniformBuffer *vertexUniformBuffers[MAX_UNIFORM_BUFFERS_PER_STAGE]; id fragmentSamplers[MAX_TEXTURE_SAMPLERS_PER_STAGE]; id fragmentTextures[MAX_TEXTURE_SAMPLERS_PER_STAGE]; id fragmentStorageTextures[MAX_STORAGE_TEXTURES_PER_STAGE]; id fragmentStorageBuffers[MAX_STORAGE_BUFFERS_PER_STAGE]; + MetalUniformBuffer *fragmentUniformBuffers[MAX_UNIFORM_BUFFERS_PER_STAGE]; id computeSamplerTextures[MAX_TEXTURE_SAMPLERS_PER_STAGE]; id computeSamplers[MAX_TEXTURE_SAMPLERS_PER_STAGE]; @@ -598,10 +605,6 @@ static MTLDepthClipMode SDLToMetal_DepthClipMode( id computeReadOnlyBuffers[MAX_STORAGE_BUFFERS_PER_STAGE]; id computeReadWriteTextures[MAX_COMPUTE_WRITE_TEXTURES]; id computeReadWriteBuffers[MAX_COMPUTE_WRITE_BUFFERS]; - - // Uniform buffers - MetalUniformBuffer *vertexUniformBuffers[MAX_UNIFORM_BUFFERS_PER_STAGE]; - MetalUniformBuffer *fragmentUniformBuffers[MAX_UNIFORM_BUFFERS_PER_STAGE]; MetalUniformBuffer *computeUniformBuffers[MAX_UNIFORM_BUFFERS_PER_STAGE]; MetalUniformBuffer **usedUniformBuffers; @@ -2130,20 +2133,6 @@ static bool METAL_INTERNAL_AcquireFence( commandBuffer->computeUniformBuffers[i] = NULL; } - // FIXME: Do we actually need to set this? - commandBuffer->needVertexSamplerBind = true; - commandBuffer->needVertexStorageTextureBind = true; - commandBuffer->needVertexStorageBufferBind = true; - commandBuffer->needVertexUniformBind = true; - commandBuffer->needFragmentSamplerBind = true; - commandBuffer->needFragmentStorageTextureBind = true; - commandBuffer->needFragmentStorageBufferBind = true; - commandBuffer->needFragmentUniformBind = true; - commandBuffer->needComputeSamplerBind = true; - commandBuffer->needComputeBufferBind = true; - commandBuffer->needComputeTextureBind = true; - commandBuffer->needComputeUniformBind = true; - commandBuffer->autoReleaseFence = true; SDL_UnlockMutex(renderer->acquireCommandBufferLock); @@ -2397,73 +2386,71 @@ static void METAL_BindGraphicsPipeline( { @autoreleasepool { MetalCommandBuffer *metalCommandBuffer = (MetalCommandBuffer *)commandBuffer; - MetalGraphicsPipeline *metalGraphicsPipeline = (MetalGraphicsPipeline *)graphicsPipeline; - SDL_GPURasterizerState *rast = &metalGraphicsPipeline->rasterizerState; + MetalGraphicsPipeline *pipeline = (MetalGraphicsPipeline *)graphicsPipeline; + SDL_GPURasterizerState *rast = &pipeline->rasterizerState; + Uint32 i; - metalCommandBuffer->graphics_pipeline = metalGraphicsPipeline; + metalCommandBuffer->graphics_pipeline = pipeline; - [metalCommandBuffer->renderEncoder setRenderPipelineState:metalGraphicsPipeline->handle]; + [metalCommandBuffer->renderEncoder setRenderPipelineState:pipeline->handle]; // Apply rasterizer state - [metalCommandBuffer->renderEncoder setTriangleFillMode:SDLToMetal_PolygonMode[metalGraphicsPipeline->rasterizerState.fill_mode]]; - [metalCommandBuffer->renderEncoder setCullMode:SDLToMetal_CullMode[metalGraphicsPipeline->rasterizerState.cull_mode]]; - [metalCommandBuffer->renderEncoder setFrontFacingWinding:SDLToMetal_FrontFace[metalGraphicsPipeline->rasterizerState.front_face]]; - [metalCommandBuffer->renderEncoder setDepthClipMode:SDLToMetal_DepthClipMode(metalGraphicsPipeline->rasterizerState.enable_depth_clip)]; + [metalCommandBuffer->renderEncoder setTriangleFillMode:SDLToMetal_PolygonMode[pipeline->rasterizerState.fill_mode]]; + [metalCommandBuffer->renderEncoder setCullMode:SDLToMetal_CullMode[pipeline->rasterizerState.cull_mode]]; + [metalCommandBuffer->renderEncoder setFrontFacingWinding:SDLToMetal_FrontFace[pipeline->rasterizerState.front_face]]; + [metalCommandBuffer->renderEncoder setDepthClipMode:SDLToMetal_DepthClipMode(pipeline->rasterizerState.enable_depth_clip)]; [metalCommandBuffer->renderEncoder setDepthBias:((rast->enable_depth_bias) ? rast->depth_bias_constant_factor : 0) slopeScale:((rast->enable_depth_bias) ? rast->depth_bias_slope_factor : 0) clamp:((rast->enable_depth_bias) ? rast->depth_bias_clamp : 0)]; // Apply depth-stencil state - if (metalGraphicsPipeline->depth_stencil_state != NULL) { + if (pipeline->depth_stencil_state != NULL) { [metalCommandBuffer->renderEncoder - setDepthStencilState:metalGraphicsPipeline->depth_stencil_state]; + setDepthStencilState:pipeline->depth_stencil_state]; + } + + for (i = 0; i < MAX_UNIFORM_BUFFERS_PER_STAGE; i += 1) { + metalCommandBuffer->needVertexUniformBufferBind[i] = true; + metalCommandBuffer->needFragmentUniformBufferBind[i] = true; } - for (Uint32 i = 0; i < metalGraphicsPipeline->vertexUniformBufferCount; i += 1) { + for (i = 0; i < pipeline->vertexUniformBufferCount; i += 1) { if (metalCommandBuffer->vertexUniformBuffers[i] == NULL) { metalCommandBuffer->vertexUniformBuffers[i] = METAL_INTERNAL_AcquireUniformBufferFromPool( metalCommandBuffer); } } - for (Uint32 i = 0; i < metalGraphicsPipeline->fragmentUniformBufferCount; i += 1) { + for (i = 0; i < pipeline->fragmentUniformBufferCount; i += 1) { if (metalCommandBuffer->fragmentUniformBuffers[i] == NULL) { metalCommandBuffer->fragmentUniformBuffers[i] = METAL_INTERNAL_AcquireUniformBufferFromPool( metalCommandBuffer); } } - - metalCommandBuffer->needVertexUniformBind = true; - metalCommandBuffer->needFragmentUniformBind = true; } } static void METAL_BindVertexBuffers( SDL_GPUCommandBuffer *commandBuffer, - Uint32 firstBinding, + Uint32 firstSlot, const SDL_GPUBufferBinding *bindings, Uint32 numBindings) { - @autoreleasepool { - MetalCommandBuffer *metalCommandBuffer = (MetalCommandBuffer *)commandBuffer; - id metalBuffers[MAX_VERTEX_BUFFERS]; - NSUInteger bufferOffsets[MAX_VERTEX_BUFFERS]; - NSRange range = NSMakeRange(METAL_FIRST_VERTEX_BUFFER_SLOT + firstBinding, numBindings); - - if (range.length == 0) { - return; - } + MetalCommandBuffer *metalCommandBuffer = (MetalCommandBuffer *)commandBuffer; - for (Uint32 i = 0; i < numBindings; i += 1) { - MetalBuffer *currentBuffer = ((MetalBufferContainer *)bindings[i].buffer)->activeBuffer; - metalBuffers[firstBinding + i] = currentBuffer->handle; - bufferOffsets[firstBinding + i] = bindings[i].offset; + for (Uint32 i = 0; i < numBindings; i += 1) { + MetalBuffer *currentBuffer = ((MetalBufferContainer *)bindings[i].buffer)->activeBuffer; + if (metalCommandBuffer->vertexBuffers[firstSlot + i] != currentBuffer->handle || metalCommandBuffer->vertexBufferOffsets[firstSlot + i] != bindings[i].offset) { + metalCommandBuffer->vertexBuffers[firstSlot + i] = currentBuffer->handle; + metalCommandBuffer->vertexBufferOffsets[firstSlot + i] = bindings[i].offset; + metalCommandBuffer->needVertexBufferBind = true; METAL_INTERNAL_TrackBuffer(metalCommandBuffer, currentBuffer); } - - [metalCommandBuffer->renderEncoder setVertexBuffers:metalBuffers offsets:bufferOffsets withRange:range]; } + + metalCommandBuffer->vertexBufferCount = + SDL_max(metalCommandBuffer->vertexBufferCount, firstSlot + numBindings); } static void METAL_BindIndexBuffer( @@ -2487,22 +2474,28 @@ static void METAL_BindVertexSamplers( { MetalCommandBuffer *metalCommandBuffer = (MetalCommandBuffer *)commandBuffer; MetalTextureContainer *textureContainer; + MetalSampler *sampler; for (Uint32 i = 0; i < numBindings; i += 1) { textureContainer = (MetalTextureContainer *)textureSamplerBindings[i].texture; + sampler = (MetalSampler *)textureSamplerBindings[i].sampler; - METAL_INTERNAL_TrackTexture( - metalCommandBuffer, - textureContainer->activeTexture); + if (metalCommandBuffer->vertexSamplers[firstSlot + i] != sampler->handle) { + metalCommandBuffer->vertexSamplers[firstSlot + i] = sampler->handle; + metalCommandBuffer->needVertexSamplerBind = true; + } - metalCommandBuffer->vertexSamplers[firstSlot + i] = - ((MetalSampler *)textureSamplerBindings[i].sampler)->handle; + if (metalCommandBuffer->vertexTextures[firstSlot + i] != textureContainer->activeTexture->handle) { + METAL_INTERNAL_TrackTexture( + metalCommandBuffer, + textureContainer->activeTexture); - metalCommandBuffer->vertexTextures[firstSlot + i] = - textureContainer->activeTexture->handle; - } + metalCommandBuffer->vertexTextures[firstSlot + i] = + textureContainer->activeTexture->handle; - metalCommandBuffer->needVertexSamplerBind = true; + metalCommandBuffer->needVertexSamplerBind = true; + } + } } static void METAL_BindVertexStorageTextures( @@ -2517,15 +2510,17 @@ static void METAL_BindVertexStorageTextures( for (Uint32 i = 0; i < numBindings; i += 1) { textureContainer = (MetalTextureContainer *)storageTextures[i]; - METAL_INTERNAL_TrackTexture( - metalCommandBuffer, - textureContainer->activeTexture); + if (metalCommandBuffer->vertexStorageTextures[firstSlot + i] != textureContainer->activeTexture->handle) { + METAL_INTERNAL_TrackTexture( + metalCommandBuffer, + textureContainer->activeTexture); - metalCommandBuffer->vertexStorageTextures[firstSlot + i] = - textureContainer->activeTexture->handle; - } + metalCommandBuffer->vertexStorageTextures[firstSlot + i] = + textureContainer->activeTexture->handle; - metalCommandBuffer->needVertexStorageTextureBind = true; + metalCommandBuffer->needVertexStorageTextureBind = true; + } + } } static void METAL_BindVertexStorageBuffers( @@ -2540,15 +2535,17 @@ static void METAL_BindVertexStorageBuffers( for (Uint32 i = 0; i < numBindings; i += 1) { bufferContainer = (MetalBufferContainer *)storageBuffers[i]; - METAL_INTERNAL_TrackBuffer( - metalCommandBuffer, - bufferContainer->activeBuffer); + if (metalCommandBuffer->vertexStorageBuffers[firstSlot + i] != bufferContainer->activeBuffer->handle) { + METAL_INTERNAL_TrackBuffer( + metalCommandBuffer, + bufferContainer->activeBuffer); + + metalCommandBuffer->vertexStorageBuffers[firstSlot + i] = + bufferContainer->activeBuffer->handle; - metalCommandBuffer->vertexStorageBuffers[firstSlot + i] = - bufferContainer->activeBuffer->handle; + metalCommandBuffer->needVertexStorageBufferBind = true; + } } - - metalCommandBuffer->needVertexStorageBufferBind = true; } static void METAL_BindFragmentSamplers( @@ -2559,22 +2556,28 @@ static void METAL_BindFragmentSamplers( { MetalCommandBuffer *metalCommandBuffer = (MetalCommandBuffer *)commandBuffer; MetalTextureContainer *textureContainer; + MetalSampler *sampler; for (Uint32 i = 0; i < numBindings; i += 1) { textureContainer = (MetalTextureContainer *)textureSamplerBindings[i].texture; + sampler = (MetalSampler *)textureSamplerBindings[i].sampler; - METAL_INTERNAL_TrackTexture( - metalCommandBuffer, - textureContainer->activeTexture); + if (metalCommandBuffer->fragmentSamplers[firstSlot + i] != sampler->handle) { + metalCommandBuffer->fragmentSamplers[firstSlot + i] = sampler->handle; + metalCommandBuffer->needFragmentSamplerBind = true; + } - metalCommandBuffer->fragmentSamplers[firstSlot + i] = - ((MetalSampler *)textureSamplerBindings[i].sampler)->handle; + if (metalCommandBuffer->fragmentTextures[firstSlot + i] != textureContainer->activeTexture->handle) { + METAL_INTERNAL_TrackTexture( + metalCommandBuffer, + textureContainer->activeTexture); - metalCommandBuffer->fragmentTextures[firstSlot + i] = - textureContainer->activeTexture->handle; - } + metalCommandBuffer->fragmentTextures[firstSlot + i] = + textureContainer->activeTexture->handle; - metalCommandBuffer->needFragmentSamplerBind = true; + metalCommandBuffer->needFragmentSamplerBind = true; + } + } } static void METAL_BindFragmentStorageTextures( @@ -2589,15 +2592,17 @@ static void METAL_BindFragmentStorageTextures( for (Uint32 i = 0; i < numBindings; i += 1) { textureContainer = (MetalTextureContainer *)storageTextures[i]; - METAL_INTERNAL_TrackTexture( - metalCommandBuffer, - textureContainer->activeTexture); + if (metalCommandBuffer->fragmentStorageTextures[firstSlot + i] != textureContainer->activeTexture->handle) { + METAL_INTERNAL_TrackTexture( + metalCommandBuffer, + textureContainer->activeTexture); + + metalCommandBuffer->fragmentStorageTextures[firstSlot + i] = + textureContainer->activeTexture->handle; - metalCommandBuffer->fragmentStorageTextures[firstSlot + i] = - textureContainer->activeTexture->handle; + metalCommandBuffer->needFragmentStorageTextureBind = true; + } } - - metalCommandBuffer->needFragmentStorageTextureBind = true; } static void METAL_BindFragmentStorageBuffers( @@ -2612,15 +2617,17 @@ static void METAL_BindFragmentStorageBuffers( for (Uint32 i = 0; i < numBindings; i += 1) { bufferContainer = (MetalBufferContainer *)storageBuffers[i]; - METAL_INTERNAL_TrackBuffer( - metalCommandBuffer, - bufferContainer->activeBuffer); + if (metalCommandBuffer->fragmentStorageBuffers[firstSlot + i] != bufferContainer->activeBuffer->handle) { + METAL_INTERNAL_TrackBuffer( + metalCommandBuffer, + bufferContainer->activeBuffer); - metalCommandBuffer->fragmentStorageBuffers[firstSlot + i] = - bufferContainer->activeBuffer->handle; - } + metalCommandBuffer->fragmentStorageBuffers[firstSlot + i] = + bufferContainer->activeBuffer->handle; - metalCommandBuffer->needFragmentStorageBufferBind = true; + metalCommandBuffer->needFragmentStorageBufferBind = true; + } + } } // This function assumes that it's called from within an autorelease pool @@ -2630,85 +2637,115 @@ static void METAL_INTERNAL_BindGraphicsResources( MetalGraphicsPipeline *graphicsPipeline = commandBuffer->graphics_pipeline; NSUInteger offsets[MAX_STORAGE_BUFFERS_PER_STAGE] = { 0 }; + // Vertex Buffers + if (commandBuffer->needVertexBufferBind) { + id metalBuffers[MAX_VERTEX_BUFFERS]; + NSUInteger bufferOffsets[MAX_VERTEX_BUFFERS]; + NSRange range = NSMakeRange(METAL_FIRST_VERTEX_BUFFER_SLOT, commandBuffer->vertexBufferCount); + for (Uint32 i = 0; i < commandBuffer->vertexBufferCount; i += 1) { + metalBuffers[i] = commandBuffer->vertexBuffers[i]; + bufferOffsets[i] = commandBuffer->vertexBufferOffsets[i]; + } + [commandBuffer->renderEncoder setVertexBuffers:metalBuffers offsets:bufferOffsets withRange:range]; + commandBuffer->needVertexBufferBind = false; + } + // Vertex Samplers+Textures - if (graphicsPipeline->vertexSamplerCount > 0 && commandBuffer->needVertexSamplerBind) { - [commandBuffer->renderEncoder setVertexSamplerStates:commandBuffer->vertexSamplers - withRange:NSMakeRange(0, graphicsPipeline->vertexSamplerCount)]; - [commandBuffer->renderEncoder setVertexTextures:commandBuffer->vertexTextures - withRange:NSMakeRange(0, graphicsPipeline->vertexSamplerCount)]; + if (commandBuffer->needVertexSamplerBind) { + if (graphicsPipeline->vertexSamplerCount > 0) { + [commandBuffer->renderEncoder setVertexSamplerStates:commandBuffer->vertexSamplers + withRange:NSMakeRange(0, graphicsPipeline->vertexSamplerCount)]; + [commandBuffer->renderEncoder setVertexTextures:commandBuffer->vertexTextures + withRange:NSMakeRange(0, graphicsPipeline->vertexSamplerCount)]; + } commandBuffer->needVertexSamplerBind = false; } // Vertex Storage Textures - if (graphicsPipeline->vertexStorageTextureCount > 0 && commandBuffer->needVertexStorageTextureBind) { - [commandBuffer->renderEncoder setVertexTextures:commandBuffer->vertexStorageTextures - withRange:NSMakeRange(graphicsPipeline->vertexSamplerCount, - graphicsPipeline->vertexStorageTextureCount)]; + if (commandBuffer->needVertexStorageTextureBind) { + if (graphicsPipeline->vertexStorageTextureCount > 0) { + [commandBuffer->renderEncoder setVertexTextures:commandBuffer->vertexStorageTextures + withRange:NSMakeRange(graphicsPipeline->vertexSamplerCount, + graphicsPipeline->vertexStorageTextureCount)]; + } commandBuffer->needVertexStorageTextureBind = false; } // Vertex Storage Buffers - if (graphicsPipeline->vertexStorageBufferCount > 0 && commandBuffer->needVertexStorageBufferBind) { - [commandBuffer->renderEncoder setVertexBuffers:commandBuffer->vertexStorageBuffers - offsets:offsets - withRange:NSMakeRange(graphicsPipeline->vertexUniformBufferCount, - graphicsPipeline->vertexStorageBufferCount)]; + if (commandBuffer->needVertexStorageBufferBind) { + if (graphicsPipeline->vertexStorageBufferCount > 0) { + [commandBuffer->renderEncoder setVertexBuffers:commandBuffer->vertexStorageBuffers + offsets:offsets + withRange:NSMakeRange(graphicsPipeline->vertexUniformBufferCount, + graphicsPipeline->vertexStorageBufferCount)]; + } commandBuffer->needVertexStorageBufferBind = false; } // Vertex Uniform Buffers - if (graphicsPipeline->vertexUniformBufferCount > 0 && commandBuffer->needVertexUniformBind) { - for (Uint32 i = 0; i < graphicsPipeline->vertexUniformBufferCount; i += 1) { - [commandBuffer->renderEncoder - setVertexBuffer:commandBuffer->vertexUniformBuffers[i]->handle - offset:commandBuffer->vertexUniformBuffers[i]->drawOffset - atIndex:i]; + for (Uint32 i = 0; i < graphicsPipeline->vertexUniformBufferCount; i += 1) { + if (commandBuffer->needVertexUniformBufferBind[i]) { + if (graphicsPipeline->vertexUniformBufferCount > i) { + [commandBuffer->renderEncoder + setVertexBuffer:commandBuffer->vertexUniformBuffers[i]->handle + offset:commandBuffer->vertexUniformBuffers[i]->drawOffset + atIndex:i]; + } + commandBuffer->needVertexUniformBufferBind[i] = false; } - commandBuffer->needVertexUniformBind = false; } // Fragment Samplers+Textures - if (graphicsPipeline->fragmentSamplerCount > 0 && commandBuffer->needFragmentSamplerBind) { - [commandBuffer->renderEncoder setFragmentSamplerStates:commandBuffer->fragmentSamplers - withRange:NSMakeRange(0, graphicsPipeline->fragmentSamplerCount)]; - [commandBuffer->renderEncoder setFragmentTextures:commandBuffer->fragmentTextures - withRange:NSMakeRange(0, graphicsPipeline->fragmentSamplerCount)]; + if (commandBuffer->needFragmentSamplerBind) { + if (graphicsPipeline->fragmentSamplerCount > 0) { + [commandBuffer->renderEncoder setFragmentSamplerStates:commandBuffer->fragmentSamplers + withRange:NSMakeRange(0, graphicsPipeline->fragmentSamplerCount)]; + [commandBuffer->renderEncoder setFragmentTextures:commandBuffer->fragmentTextures + withRange:NSMakeRange(0, graphicsPipeline->fragmentSamplerCount)]; + } commandBuffer->needFragmentSamplerBind = false; } // Fragment Storage Textures - if (graphicsPipeline->fragmentStorageTextureCount > 0 && commandBuffer->needFragmentStorageTextureBind) { - [commandBuffer->renderEncoder setFragmentTextures:commandBuffer->fragmentStorageTextures - withRange:NSMakeRange(graphicsPipeline->fragmentSamplerCount, - graphicsPipeline->fragmentStorageTextureCount)]; + if (commandBuffer->needFragmentStorageTextureBind) { + if (graphicsPipeline->fragmentStorageTextureCount > 0) { + [commandBuffer->renderEncoder setFragmentTextures:commandBuffer->fragmentStorageTextures + withRange:NSMakeRange(graphicsPipeline->fragmentSamplerCount, + graphicsPipeline->fragmentStorageTextureCount)]; + } commandBuffer->needFragmentStorageTextureBind = false; } // Fragment Storage Buffers - if (graphicsPipeline->fragmentStorageBufferCount > 0 && commandBuffer->needFragmentStorageBufferBind) { - [commandBuffer->renderEncoder setFragmentBuffers:commandBuffer->fragmentStorageBuffers - offsets:offsets - withRange:NSMakeRange(graphicsPipeline->fragmentUniformBufferCount, - graphicsPipeline->fragmentStorageBufferCount)]; + if (commandBuffer->needFragmentStorageBufferBind) { + if (graphicsPipeline->fragmentStorageBufferCount > 0) { + [commandBuffer->renderEncoder setFragmentBuffers:commandBuffer->fragmentStorageBuffers + offsets:offsets + withRange:NSMakeRange(graphicsPipeline->fragmentUniformBufferCount, + graphicsPipeline->fragmentStorageBufferCount)]; + } commandBuffer->needFragmentStorageBufferBind = false; } // Fragment Uniform Buffers - if (graphicsPipeline->fragmentUniformBufferCount > 0 && commandBuffer->needFragmentUniformBind) { - for (Uint32 i = 0; i < graphicsPipeline->fragmentUniformBufferCount; i += 1) { - [commandBuffer->renderEncoder - setFragmentBuffer:commandBuffer->fragmentUniformBuffers[i]->handle - offset:commandBuffer->fragmentUniformBuffers[i]->drawOffset - atIndex:i]; + + for (Uint32 i = 0; i < graphicsPipeline->fragmentUniformBufferCount; i += 1) { + if (commandBuffer->needFragmentUniformBufferBind[i]) { + if (graphicsPipeline->fragmentUniformBufferCount > i) { + [commandBuffer->renderEncoder + setFragmentBuffer:commandBuffer->fragmentUniformBuffers[i]->handle + offset:commandBuffer->fragmentUniformBuffers[i]->drawOffset + atIndex:i]; + } + commandBuffer->needFragmentUniformBufferBind[i] = false; } - commandBuffer->needFragmentUniformBind = false; } } @@ -2720,7 +2757,6 @@ static void METAL_INTERNAL_BindComputeResources( NSUInteger offsets[MAX_STORAGE_BUFFERS_PER_STAGE] = { 0 }; if (commandBuffer->needComputeSamplerBind) { - // Bind sampler textures if (computePipeline->numSamplers > 0) { [commandBuffer->computeEncoder setTextures:commandBuffer->computeSamplerTextures withRange:NSMakeRange(0, computePipeline->numSamplers)]; @@ -2730,54 +2766,36 @@ static void METAL_INTERNAL_BindComputeResources( commandBuffer->needComputeSamplerBind = false; } - if (commandBuffer->needComputeTextureBind) { - // Bind read-only textures + if (commandBuffer->needComputeReadOnlyStorageTextureBind) { if (computePipeline->numReadonlyStorageTextures > 0) { [commandBuffer->computeEncoder setTextures:commandBuffer->computeReadOnlyTextures withRange:NSMakeRange( computePipeline->numSamplers, computePipeline->numReadonlyStorageTextures)]; } - - // Bind write-only textures - if (computePipeline->numReadWriteStorageTextures > 0) { - [commandBuffer->computeEncoder setTextures:commandBuffer->computeReadWriteTextures - withRange:NSMakeRange( - computePipeline->numSamplers + computePipeline->numReadonlyStorageTextures, - computePipeline->numReadWriteStorageTextures)]; - } - commandBuffer->needComputeTextureBind = false; + commandBuffer->needComputeReadOnlyStorageTextureBind = false; } - if (commandBuffer->needComputeBufferBind) { - // Bind read-only buffers + if (commandBuffer->needComputeReadOnlyStorageBufferBind) { if (computePipeline->numReadonlyStorageBuffers > 0) { [commandBuffer->computeEncoder setBuffers:commandBuffer->computeReadOnlyBuffers offsets:offsets withRange:NSMakeRange(computePipeline->numUniformBuffers, computePipeline->numReadonlyStorageBuffers)]; } - // Bind write-only buffers - if (computePipeline->numReadWriteStorageBuffers > 0) { - [commandBuffer->computeEncoder setBuffers:commandBuffer->computeReadWriteBuffers - offsets:offsets - withRange:NSMakeRange( - computePipeline->numUniformBuffers + - computePipeline->numReadonlyStorageBuffers, - computePipeline->numReadWriteStorageBuffers)]; - } - commandBuffer->needComputeBufferBind = false; + commandBuffer->needComputeReadOnlyStorageBufferBind = false; } - if (commandBuffer->needComputeUniformBind) { - for (Uint32 i = 0; i < computePipeline->numUniformBuffers; i += 1) { - [commandBuffer->computeEncoder - setBuffer:commandBuffer->computeUniformBuffers[i]->handle - offset:commandBuffer->computeUniformBuffers[i]->drawOffset - atIndex:i]; + for (Uint32 i = 0; i < MAX_UNIFORM_BUFFERS_PER_STAGE; i += 1) { + if (commandBuffer->needComputeUniformBufferBind[i]) { + if (computePipeline->numUniformBuffers > i) { + [commandBuffer->computeEncoder + setBuffer:commandBuffer->computeUniformBuffers[i]->handle + offset:commandBuffer->computeUniformBuffers[i]->drawOffset + atIndex:i]; + } } - - commandBuffer->needComputeUniformBind = false; + commandBuffer->needComputeUniformBufferBind[i] = false; } } @@ -2892,6 +2910,11 @@ static void METAL_EndRenderPass( [metalCommandBuffer->renderEncoder endEncoding]; metalCommandBuffer->renderEncoder = nil; + for (Uint32 i = 0; i < MAX_VERTEX_BUFFERS; i += 1) { + metalCommandBuffer->vertexBuffers[i] = nil; + metalCommandBuffer->vertexBufferOffsets[i] = 0; + metalCommandBuffer->vertexBufferCount = 0; + } for (Uint32 i = 0; i < MAX_TEXTURE_SAMPLERS_PER_STAGE; i += 1) { metalCommandBuffer->vertexSamplers[i] = nil; metalCommandBuffer->vertexTextures[i] = nil; @@ -2976,11 +2999,11 @@ static void METAL_INTERNAL_PushUniformData( metalUniformBuffer->writeOffset += alignedDataLength; if (shaderStage == SDL_GPU_SHADERSTAGE_VERTEX) { - metalCommandBuffer->needVertexUniformBind = true; + metalCommandBuffer->needVertexUniformBufferBind[slotIndex] = true; } else if (shaderStage == SDL_GPU_SHADERSTAGE_FRAGMENT) { - metalCommandBuffer->needFragmentUniformBind = true; + metalCommandBuffer->needFragmentUniformBufferBind[slotIndex] = true; } else if (shaderStage == SDL_GPU_SHADERSTAGE_COMPUTE) { - metalCommandBuffer->needComputeUniformBind = true; + metalCommandBuffer->needComputeUniformBufferBind[slotIndex] = true; } else { SDL_LogError(SDL_LOG_CATEGORY_GPU, "Unrecognized shader stage!"); } @@ -3078,7 +3101,6 @@ static void METAL_BeginComputePass( slices:NSMakeRange(storageTextureBindings[i].layer, 1)]; metalCommandBuffer->computeReadWriteTextures[i] = textureView; - metalCommandBuffer->needComputeTextureBind = true; } for (Uint32 i = 0; i < numStorageBufferBindings; i += 1) { @@ -3094,7 +3116,6 @@ static void METAL_BeginComputePass( buffer); metalCommandBuffer->computeReadWriteBuffers[i] = buffer->handle; - metalCommandBuffer->needComputeBufferBind = true; } } } @@ -3111,6 +3132,10 @@ static void METAL_BindComputePipeline( [metalCommandBuffer->computeEncoder setComputePipelineState:pipeline->handle]; + for (Uint32 i = 0; i < MAX_UNIFORM_BUFFERS_PER_STAGE; i += 1) { + metalCommandBuffer->needComputeUniformBufferBind[i] = true; + } + for (Uint32 i = 0; i < pipeline->numUniformBuffers; i += 1) { if (metalCommandBuffer->computeUniformBuffers[i] == NULL) { metalCommandBuffer->computeUniformBuffers[i] = METAL_INTERNAL_AcquireUniformBufferFromPool( @@ -3118,7 +3143,24 @@ static void METAL_BindComputePipeline( } } - metalCommandBuffer->needComputeUniformBind = true; + // Bind write-only resources + if (pipeline->numReadWriteStorageTextures > 0) { + [metalCommandBuffer->computeEncoder setTextures:metalCommandBuffer->computeReadWriteTextures + withRange:NSMakeRange( + pipeline->numSamplers + + pipeline->numReadonlyStorageTextures, + pipeline->numReadWriteStorageTextures)]; + } + + NSUInteger offsets[MAX_COMPUTE_WRITE_BUFFERS] = { 0 }; + if (pipeline->numReadWriteStorageBuffers > 0) { + [metalCommandBuffer->computeEncoder setBuffers:metalCommandBuffer->computeReadWriteBuffers + offsets:offsets + withRange:NSMakeRange( + pipeline->numUniformBuffers + + pipeline->numReadonlyStorageBuffers, + pipeline->numReadWriteStorageBuffers)]; + } } } @@ -3130,22 +3172,28 @@ static void METAL_BindComputeSamplers( { MetalCommandBuffer *metalCommandBuffer = (MetalCommandBuffer *)commandBuffer; MetalTextureContainer *textureContainer; + MetalSampler *sampler; for (Uint32 i = 0; i < numBindings; i += 1) { textureContainer = (MetalTextureContainer *)textureSamplerBindings[i].texture; + sampler = (MetalSampler *)textureSamplerBindings[i].sampler; - METAL_INTERNAL_TrackTexture( - metalCommandBuffer, - textureContainer->activeTexture); + if (metalCommandBuffer->computeSamplers[firstSlot + i] != sampler->handle) { + metalCommandBuffer->computeSamplers[firstSlot + i] = sampler->handle; + metalCommandBuffer->needComputeSamplerBind = true; + } - metalCommandBuffer->computeSamplers[firstSlot + i] = - ((MetalSampler *)textureSamplerBindings[i].sampler)->handle; + if (metalCommandBuffer->computeSamplerTextures[firstSlot + i] != textureContainer->activeTexture->handle) { + METAL_INTERNAL_TrackTexture( + metalCommandBuffer, + textureContainer->activeTexture); - metalCommandBuffer->computeSamplerTextures[firstSlot + i] = - textureContainer->activeTexture->handle; - } + metalCommandBuffer->computeSamplerTextures[firstSlot + i] = + textureContainer->activeTexture->handle; - metalCommandBuffer->needComputeSamplerBind = true; + metalCommandBuffer->needComputeSamplerBind = true; + } + } } static void METAL_BindComputeStorageTextures( @@ -3160,15 +3208,17 @@ static void METAL_BindComputeStorageTextures( for (Uint32 i = 0; i < numBindings; i += 1) { textureContainer = (MetalTextureContainer *)storageTextures[i]; - METAL_INTERNAL_TrackTexture( - metalCommandBuffer, - textureContainer->activeTexture); + if (metalCommandBuffer->computeReadOnlyTextures[firstSlot + i] != textureContainer->activeTexture->handle) { + METAL_INTERNAL_TrackTexture( + metalCommandBuffer, + textureContainer->activeTexture); + + metalCommandBuffer->computeReadOnlyTextures[firstSlot + i] = + textureContainer->activeTexture->handle; - metalCommandBuffer->computeReadOnlyTextures[firstSlot + i] = - textureContainer->activeTexture->handle; + metalCommandBuffer->needComputeReadOnlyStorageTextureBind = true; + } } - - metalCommandBuffer->needComputeTextureBind = true; } static void METAL_BindComputeStorageBuffers( @@ -3183,15 +3233,17 @@ static void METAL_BindComputeStorageBuffers( for (Uint32 i = 0; i < numBindings; i += 1) { bufferContainer = (MetalBufferContainer *)storageBuffers[i]; - METAL_INTERNAL_TrackBuffer( - metalCommandBuffer, - bufferContainer->activeBuffer); + if (metalCommandBuffer->computeReadOnlyBuffers[firstSlot + i] != bufferContainer->activeBuffer->handle) { + METAL_INTERNAL_TrackBuffer( + metalCommandBuffer, + bufferContainer->activeBuffer); - metalCommandBuffer->computeReadOnlyBuffers[firstSlot + i] = - bufferContainer->activeBuffer->handle; - } + metalCommandBuffer->computeReadOnlyBuffers[firstSlot + i] = + bufferContainer->activeBuffer->handle; - metalCommandBuffer->needComputeBufferBind = true; + metalCommandBuffer->needComputeReadOnlyStorageBufferBind = true; + } + } } static void METAL_PushComputeUniformData( @@ -3368,6 +3420,11 @@ static void METAL_INTERNAL_CleanCommandBuffer( commandBuffer->windowDataCount = 0; // Reset bindings + for (i = 0; i < MAX_VERTEX_BUFFERS; i += 1) { + commandBuffer->vertexBuffers[i] = nil; + commandBuffer->vertexBufferOffsets[i] = 0; + } + commandBuffer->vertexBufferCount = 0; commandBuffer->indexBuffer = NULL; for (i = 0; i < MAX_TEXTURE_SAMPLERS_PER_STAGE; i += 1) { commandBuffer->vertexSamplers[i] = nil; @@ -3394,6 +3451,22 @@ static void METAL_INTERNAL_CleanCommandBuffer( commandBuffer->computeReadWriteBuffers[i] = nil; } + commandBuffer->needVertexBufferBind = false; + commandBuffer->needVertexSamplerBind = false; + commandBuffer->needVertexStorageBufferBind = false; + commandBuffer->needVertexStorageTextureBind = false; + SDL_zeroa(commandBuffer->needVertexUniformBufferBind); + + commandBuffer->needFragmentSamplerBind = false; + commandBuffer->needFragmentStorageBufferBind = false; + commandBuffer->needFragmentStorageTextureBind = false; + SDL_zeroa(commandBuffer->needFragmentUniformBufferBind); + + commandBuffer->needComputeSamplerBind = false; + commandBuffer->needComputeReadOnlyStorageBufferBind = false; + commandBuffer->needComputeReadOnlyStorageTextureBind = false; + SDL_zeroa(commandBuffer->needComputeUniformBufferBind); + // The fence is now available (unless SubmitAndAcquireFence was called) if (commandBuffer->autoReleaseFence) { METAL_ReleaseFence( diff --git a/src/gpu/vulkan/SDL_gpu_vulkan.c b/src/gpu/vulkan/SDL_gpu_vulkan.c index 05dac8ef5f5b6..d240712636f28 100644 --- a/src/gpu/vulkan/SDL_gpu_vulkan.c +++ b/src/gpu/vulkan/SDL_gpu_vulkan.c @@ -1035,6 +1035,11 @@ typedef struct VulkanCommandBuffer VkDescriptorSet computeReadWriteDescriptorSet; VkDescriptorSet computeUniformDescriptorSet; + VkBuffer vertexBuffers[MAX_VERTEX_BUFFERS]; + VkDeviceSize vertexBufferOffsets[MAX_VERTEX_BUFFERS]; + Uint32 vertexBufferCount; + bool needVertexBufferBind; + VulkanTexture *vertexSamplerTextures[MAX_TEXTURE_SAMPLERS_PER_STAGE]; VulkanSampler *vertexSamplers[MAX_TEXTURE_SAMPLERS_PER_STAGE]; VulkanTexture *vertexStorageTextures[MAX_STORAGE_TEXTURES_PER_STAGE]; @@ -5027,6 +5032,7 @@ static void VULKAN_INTERNAL_BindGraphicsDescriptorSets( Uint32 dynamicOffsetCount = 0; if ( + !commandBuffer->needVertexBufferBind && !commandBuffer->needNewVertexResourceDescriptorSet && !commandBuffer->needNewVertexUniformDescriptorSet && !commandBuffer->needNewVertexUniformOffsets && @@ -5037,6 +5043,17 @@ static void VULKAN_INTERNAL_BindGraphicsDescriptorSets( return; } + if (commandBuffer->needVertexBufferBind && commandBuffer->vertexBufferCount > 0) { + renderer->vkCmdBindVertexBuffers( + commandBuffer->commandBuffer, + 0, + commandBuffer->vertexBufferCount, + commandBuffer->vertexBuffers, + commandBuffer->vertexBufferOffsets); + + commandBuffer->needVertexBufferBind = false; + } + resourceLayout = commandBuffer->currentGraphicsPipeline->resourceLayout; if (commandBuffer->needNewVertexResourceDescriptorSet) { @@ -7404,19 +7421,26 @@ static void VULKAN_BindVertexSamplers( for (Uint32 i = 0; i < numBindings; i += 1) { VulkanTextureContainer *textureContainer = (VulkanTextureContainer *)textureSamplerBindings[i].texture; - vulkanCommandBuffer->vertexSamplerTextures[firstSlot + i] = textureContainer->activeTexture; - vulkanCommandBuffer->vertexSamplers[firstSlot + i] = (VulkanSampler *)textureSamplerBindings[i].sampler; + VulkanSampler *sampler = (VulkanSampler *)textureSamplerBindings[i].sampler; - VULKAN_INTERNAL_TrackSampler( - vulkanCommandBuffer, - (VulkanSampler *)textureSamplerBindings[i].sampler); + if (vulkanCommandBuffer->vertexSamplers[firstSlot + i] != sampler) { + VULKAN_INTERNAL_TrackSampler( + vulkanCommandBuffer, + (VulkanSampler *)textureSamplerBindings[i].sampler); - VULKAN_INTERNAL_TrackTexture( - vulkanCommandBuffer, - textureContainer->activeTexture); - } + vulkanCommandBuffer->vertexSamplers[firstSlot + i] = (VulkanSampler *)textureSamplerBindings[i].sampler; + vulkanCommandBuffer->needNewVertexResourceDescriptorSet = true; + } - vulkanCommandBuffer->needNewVertexResourceDescriptorSet = true; + if (vulkanCommandBuffer->vertexSamplerTextures[firstSlot + i] != textureContainer->activeTexture) { + VULKAN_INTERNAL_TrackTexture( + vulkanCommandBuffer, + textureContainer->activeTexture); + + vulkanCommandBuffer->vertexSamplerTextures[firstSlot + i] = textureContainer->activeTexture; + vulkanCommandBuffer->needNewVertexResourceDescriptorSet = true; + } + } } static void VULKAN_BindVertexStorageTextures( @@ -7430,14 +7454,15 @@ static void VULKAN_BindVertexStorageTextures( for (Uint32 i = 0; i < numBindings; i += 1) { VulkanTextureContainer *textureContainer = (VulkanTextureContainer *)storageTextures[i]; - vulkanCommandBuffer->vertexStorageTextures[firstSlot + i] = textureContainer->activeTexture; + if (vulkanCommandBuffer->vertexStorageTextures[firstSlot + i] != textureContainer->activeTexture) { + VULKAN_INTERNAL_TrackTexture( + vulkanCommandBuffer, + textureContainer->activeTexture); - VULKAN_INTERNAL_TrackTexture( - vulkanCommandBuffer, - textureContainer->activeTexture); + vulkanCommandBuffer->vertexStorageTextures[firstSlot + i] = textureContainer->activeTexture; + vulkanCommandBuffer->needNewVertexResourceDescriptorSet = true; + } } - - vulkanCommandBuffer->needNewVertexResourceDescriptorSet = true; } static void VULKAN_BindVertexStorageBuffers( @@ -7447,20 +7472,19 @@ static void VULKAN_BindVertexStorageBuffers( Uint32 numBindings) { VulkanCommandBuffer *vulkanCommandBuffer = (VulkanCommandBuffer *)commandBuffer; - VulkanBufferContainer *bufferContainer; - Uint32 i; - for (i = 0; i < numBindings; i += 1) { - bufferContainer = (VulkanBufferContainer *)storageBuffers[i]; + for (Uint32 i = 0; i < numBindings; i += 1) { + VulkanBufferContainer *bufferContainer = (VulkanBufferContainer *)storageBuffers[i]; - vulkanCommandBuffer->vertexStorageBuffers[firstSlot + i] = bufferContainer->activeBuffer; + if (vulkanCommandBuffer->vertexStorageBuffers[firstSlot + i] != bufferContainer->activeBuffer) { + VULKAN_INTERNAL_TrackBuffer( + vulkanCommandBuffer, + bufferContainer->activeBuffer); - VULKAN_INTERNAL_TrackBuffer( - vulkanCommandBuffer, - bufferContainer->activeBuffer); + vulkanCommandBuffer->vertexStorageBuffers[firstSlot + i] = bufferContainer->activeBuffer; + vulkanCommandBuffer->needNewVertexResourceDescriptorSet = true; + } } - - vulkanCommandBuffer->needNewVertexResourceDescriptorSet = true; } static void VULKAN_BindFragmentSamplers( @@ -7473,19 +7497,26 @@ static void VULKAN_BindFragmentSamplers( for (Uint32 i = 0; i < numBindings; i += 1) { VulkanTextureContainer *textureContainer = (VulkanTextureContainer *)textureSamplerBindings[i].texture; - vulkanCommandBuffer->fragmentSamplerTextures[firstSlot + i] = textureContainer->activeTexture; - vulkanCommandBuffer->fragmentSamplers[firstSlot + i] = (VulkanSampler *)textureSamplerBindings[i].sampler; + VulkanSampler *sampler = (VulkanSampler *)textureSamplerBindings[i].sampler; - VULKAN_INTERNAL_TrackSampler( - vulkanCommandBuffer, - (VulkanSampler *)textureSamplerBindings[i].sampler); + if (vulkanCommandBuffer->fragmentSamplers[firstSlot + i] != sampler) { + VULKAN_INTERNAL_TrackSampler( + vulkanCommandBuffer, + (VulkanSampler *)textureSamplerBindings[i].sampler); - VULKAN_INTERNAL_TrackTexture( - vulkanCommandBuffer, - textureContainer->activeTexture); - } + vulkanCommandBuffer->fragmentSamplers[firstSlot + i] = (VulkanSampler *)textureSamplerBindings[i].sampler; + vulkanCommandBuffer->needNewFragmentResourceDescriptorSet = true; + } - vulkanCommandBuffer->needNewFragmentResourceDescriptorSet = true; + if (vulkanCommandBuffer->fragmentSamplerTextures[firstSlot + i] != textureContainer->activeTexture) { + VULKAN_INTERNAL_TrackTexture( + vulkanCommandBuffer, + textureContainer->activeTexture); + + vulkanCommandBuffer->fragmentSamplerTextures[firstSlot + i] = textureContainer->activeTexture; + vulkanCommandBuffer->needNewFragmentResourceDescriptorSet = true; + } + } } static void VULKAN_BindFragmentStorageTextures( @@ -7499,15 +7530,15 @@ static void VULKAN_BindFragmentStorageTextures( for (Uint32 i = 0; i < numBindings; i += 1) { VulkanTextureContainer *textureContainer = (VulkanTextureContainer *)storageTextures[i]; - vulkanCommandBuffer->fragmentStorageTextures[firstSlot + i] = - textureContainer->activeTexture; + if (vulkanCommandBuffer->fragmentStorageTextures[firstSlot + i] != textureContainer->activeTexture) { + VULKAN_INTERNAL_TrackTexture( + vulkanCommandBuffer, + textureContainer->activeTexture); - VULKAN_INTERNAL_TrackTexture( - vulkanCommandBuffer, - textureContainer->activeTexture); + vulkanCommandBuffer->fragmentStorageTextures[firstSlot + i] = textureContainer->activeTexture; + vulkanCommandBuffer->needNewFragmentResourceDescriptorSet = true; + } } - - vulkanCommandBuffer->needNewFragmentResourceDescriptorSet = true; } static void VULKAN_BindFragmentStorageBuffers( @@ -7523,14 +7554,15 @@ static void VULKAN_BindFragmentStorageBuffers( for (i = 0; i < numBindings; i += 1) { bufferContainer = (VulkanBufferContainer *)storageBuffers[i]; - vulkanCommandBuffer->fragmentStorageBuffers[firstSlot + i] = bufferContainer->activeBuffer; + if (vulkanCommandBuffer->fragmentStorageBuffers[firstSlot + i] != bufferContainer->activeBuffer) { + VULKAN_INTERNAL_TrackBuffer( + vulkanCommandBuffer, + bufferContainer->activeBuffer); - VULKAN_INTERNAL_TrackBuffer( - vulkanCommandBuffer, - bufferContainer->activeBuffer); + vulkanCommandBuffer->fragmentStorageBuffers[firstSlot + i] = bufferContainer->activeBuffer; + vulkanCommandBuffer->needNewFragmentResourceDescriptorSet = true; + } } - - vulkanCommandBuffer->needNewFragmentResourceDescriptorSet = true; } static VulkanUniformBuffer *VULKAN_INTERNAL_AcquireUniformBufferFromPool( @@ -7922,28 +7954,20 @@ static void VULKAN_BindVertexBuffers( Uint32 numBindings) { VulkanCommandBuffer *vulkanCommandBuffer = (VulkanCommandBuffer *)commandBuffer; - VulkanRenderer *renderer = (VulkanRenderer *)vulkanCommandBuffer->renderer; - VulkanBuffer *currentVulkanBuffer; - VkBuffer *buffers = SDL_stack_alloc(VkBuffer, numBindings); - VkDeviceSize *offsets = SDL_stack_alloc(VkDeviceSize, numBindings); - Uint32 i; - for (i = 0; i < numBindings; i += 1) { - currentVulkanBuffer = ((VulkanBufferContainer *)bindings[i].buffer)->activeBuffer; - buffers[i] = currentVulkanBuffer->buffer; - offsets[i] = (VkDeviceSize)bindings[i].offset; - VULKAN_INTERNAL_TrackBuffer(vulkanCommandBuffer, currentVulkanBuffer); - } + for (Uint32 i = 0; i < numBindings; i += 1) { + VulkanBuffer *buffer = ((VulkanBufferContainer *)bindings[i].buffer)->activeBuffer; + if (vulkanCommandBuffer->vertexBuffers[i] != buffer->buffer || vulkanCommandBuffer->vertexBufferOffsets[i] != bindings[i].offset) { + VULKAN_INTERNAL_TrackBuffer(vulkanCommandBuffer, buffer); - renderer->vkCmdBindVertexBuffers( - vulkanCommandBuffer->commandBuffer, - firstSlot, - numBindings, - buffers, - offsets); + vulkanCommandBuffer->vertexBuffers[i] = buffer->buffer; + vulkanCommandBuffer->vertexBufferOffsets[i] = bindings[i].offset; + vulkanCommandBuffer->needVertexBufferBind = true; + } + } - SDL_stack_free(buffers); - SDL_stack_free(offsets); + vulkanCommandBuffer->vertexBufferCount = + SDL_max(vulkanCommandBuffer->vertexBufferCount, firstSlot + numBindings); } static void VULKAN_BindIndexBuffer( @@ -8045,6 +8069,10 @@ static void VULKAN_EndRenderPass( SDL_zeroa(vulkanCommandBuffer->resolveAttachmentSubresources); vulkanCommandBuffer->depthStencilAttachmentSubresource = NULL; + SDL_zeroa(vulkanCommandBuffer->vertexBuffers); + SDL_zeroa(vulkanCommandBuffer->vertexBufferOffsets); + vulkanCommandBuffer->vertexBufferCount = 0; + SDL_zeroa(vulkanCommandBuffer->vertexSamplers); SDL_zeroa(vulkanCommandBuffer->vertexSamplerTextures); SDL_zeroa(vulkanCommandBuffer->vertexStorageTextures); @@ -8148,19 +8176,26 @@ static void VULKAN_BindComputeSamplers( for (Uint32 i = 0; i < numBindings; i += 1) { VulkanTextureContainer *textureContainer = (VulkanTextureContainer *)textureSamplerBindings[i].texture; - vulkanCommandBuffer->computeSamplerTextures[firstSlot + i] = textureContainer->activeTexture; - vulkanCommandBuffer->computeSamplers[firstSlot + i] = (VulkanSampler *)textureSamplerBindings[i].sampler; + VulkanSampler *sampler = (VulkanSampler *)textureSamplerBindings[i].sampler; - VULKAN_INTERNAL_TrackSampler( - vulkanCommandBuffer, - (VulkanSampler *)textureSamplerBindings[i].sampler); + if (vulkanCommandBuffer->computeSamplers[firstSlot + i] != sampler) { + VULKAN_INTERNAL_TrackSampler( + vulkanCommandBuffer, + sampler); - VULKAN_INTERNAL_TrackTexture( - vulkanCommandBuffer, - textureContainer->activeTexture); - } + vulkanCommandBuffer->computeSamplers[firstSlot + i] = sampler; + vulkanCommandBuffer->needNewComputeReadOnlyDescriptorSet = true; + } - vulkanCommandBuffer->needNewComputeReadOnlyDescriptorSet = true; + if (vulkanCommandBuffer->computeSamplerTextures[firstSlot + i] != textureContainer->activeTexture) { + VULKAN_INTERNAL_TrackTexture( + vulkanCommandBuffer, + textureContainer->activeTexture); + + vulkanCommandBuffer->computeSamplerTextures[firstSlot + i] = textureContainer->activeTexture; + vulkanCommandBuffer->needNewComputeReadOnlyDescriptorSet = true; + } + } } static void VULKAN_BindComputeStorageTextures( @@ -8173,31 +8208,34 @@ static void VULKAN_BindComputeStorageTextures( VulkanRenderer *renderer = vulkanCommandBuffer->renderer; for (Uint32 i = 0; i < numBindings; i += 1) { - if (vulkanCommandBuffer->readOnlyComputeStorageTextures[firstSlot + i] != NULL) { - VULKAN_INTERNAL_TextureTransitionToDefaultUsage( + VulkanTextureContainer *textureContainer = (VulkanTextureContainer *)storageTextures[i]; + + if (vulkanCommandBuffer->readOnlyComputeStorageTextures[firstSlot + i] != textureContainer->activeTexture) { + /* If a different texture as in this slot, transition it back to its default usage */ + if (vulkanCommandBuffer->readOnlyComputeStorageTextures[firstSlot + i] != NULL) { + VULKAN_INTERNAL_TextureTransitionToDefaultUsage( + renderer, + vulkanCommandBuffer, + VULKAN_TEXTURE_USAGE_MODE_COMPUTE_STORAGE_READ, + vulkanCommandBuffer->readOnlyComputeStorageTextures[firstSlot + i]); + } + + /* Then transition the new texture and prepare it for binding */ + VULKAN_INTERNAL_TextureTransitionFromDefaultUsage( renderer, vulkanCommandBuffer, VULKAN_TEXTURE_USAGE_MODE_COMPUTE_STORAGE_READ, - vulkanCommandBuffer->readOnlyComputeStorageTextures[firstSlot + i]); - } - - VulkanTextureContainer *textureContainer = (VulkanTextureContainer *)storageTextures[i]; + textureContainer->activeTexture); - vulkanCommandBuffer->readOnlyComputeStorageTextures[firstSlot + i] = - textureContainer->activeTexture; - VULKAN_INTERNAL_TextureTransitionFromDefaultUsage( - renderer, - vulkanCommandBuffer, - VULKAN_TEXTURE_USAGE_MODE_COMPUTE_STORAGE_READ, - textureContainer->activeTexture); + VULKAN_INTERNAL_TrackTexture( + vulkanCommandBuffer, + textureContainer->activeTexture); - VULKAN_INTERNAL_TrackTexture( - vulkanCommandBuffer, - textureContainer->activeTexture); + vulkanCommandBuffer->readOnlyComputeStorageTextures[firstSlot + i] = textureContainer->activeTexture; + vulkanCommandBuffer->needNewComputeReadOnlyDescriptorSet = true; + } } - - vulkanCommandBuffer->needNewComputeReadOnlyDescriptorSet = true; } static void VULKAN_BindComputeStorageBuffers( @@ -8208,34 +8246,35 @@ static void VULKAN_BindComputeStorageBuffers( { VulkanCommandBuffer *vulkanCommandBuffer = (VulkanCommandBuffer *)commandBuffer; VulkanRenderer *renderer = vulkanCommandBuffer->renderer; - VulkanBufferContainer *bufferContainer; - Uint32 i; - for (i = 0; i < numBindings; i += 1) { - if (vulkanCommandBuffer->readOnlyComputeStorageBuffers[firstSlot + i] != NULL) { - VULKAN_INTERNAL_BufferTransitionToDefaultUsage( + for (Uint32 i = 0; i < numBindings; i += 1) { + VulkanBufferContainer *bufferContainer = (VulkanBufferContainer *)storageBuffers[i]; + + if (vulkanCommandBuffer->readOnlyComputeStorageBuffers[firstSlot + i] != bufferContainer->activeBuffer) { + /* If a different buffer was in this slot, transition it back to its default usage */ + if (vulkanCommandBuffer->readOnlyComputeStorageBuffers[firstSlot + i] != NULL) { + VULKAN_INTERNAL_BufferTransitionToDefaultUsage( + renderer, + vulkanCommandBuffer, + VULKAN_BUFFER_USAGE_MODE_COMPUTE_STORAGE_READ, + vulkanCommandBuffer->readOnlyComputeStorageBuffers[firstSlot + i]); + } + + /* Then transition the new buffer and prepare it for binding */ + VULKAN_INTERNAL_BufferTransitionFromDefaultUsage( renderer, vulkanCommandBuffer, VULKAN_BUFFER_USAGE_MODE_COMPUTE_STORAGE_READ, - vulkanCommandBuffer->readOnlyComputeStorageBuffers[firstSlot + i]); - } - - bufferContainer = (VulkanBufferContainer *)storageBuffers[i]; - - vulkanCommandBuffer->readOnlyComputeStorageBuffers[firstSlot + i] = bufferContainer->activeBuffer; + bufferContainer->activeBuffer); - VULKAN_INTERNAL_BufferTransitionFromDefaultUsage( - renderer, - vulkanCommandBuffer, - VULKAN_BUFFER_USAGE_MODE_COMPUTE_STORAGE_READ, - bufferContainer->activeBuffer); + VULKAN_INTERNAL_TrackBuffer( + vulkanCommandBuffer, + bufferContainer->activeBuffer); - VULKAN_INTERNAL_TrackBuffer( - vulkanCommandBuffer, - bufferContainer->activeBuffer); + vulkanCommandBuffer->readOnlyComputeStorageBuffers[firstSlot + i] = bufferContainer->activeBuffer; + vulkanCommandBuffer->needNewComputeReadOnlyDescriptorSet = true; + } } - - vulkanCommandBuffer->needNewComputeReadOnlyDescriptorSet = true; } static void VULKAN_PushComputeUniformData( @@ -9226,6 +9265,7 @@ static bool VULKAN_INTERNAL_AllocateCommandBuffer( // Resource bind tracking + commandBuffer->needVertexBufferBind = false; commandBuffer->needNewVertexResourceDescriptorSet = true; commandBuffer->needNewVertexUniformDescriptorSet = true; commandBuffer->needNewVertexUniformOffsets = true; @@ -9419,6 +9459,7 @@ static SDL_GPUCommandBuffer *VULKAN_AcquireCommandBuffer( commandBuffer->computeUniformBuffers[i] = NULL; } + commandBuffer->needVertexBufferBind = false; commandBuffer->needNewVertexResourceDescriptorSet = true; commandBuffer->needNewVertexUniformDescriptorSet = true; commandBuffer->needNewVertexUniformOffsets = true; @@ -9439,6 +9480,10 @@ static SDL_GPUCommandBuffer *VULKAN_AcquireCommandBuffer( commandBuffer->computeReadWriteDescriptorSet = VK_NULL_HANDLE; commandBuffer->computeUniformDescriptorSet = VK_NULL_HANDLE; + SDL_zeroa(commandBuffer->vertexBuffers); + SDL_zeroa(commandBuffer->vertexBufferOffsets); + commandBuffer->vertexBufferCount = 0; + SDL_zeroa(commandBuffer->vertexSamplerTextures); SDL_zeroa(commandBuffer->vertexSamplers); SDL_zeroa(commandBuffer->vertexStorageTextures); @@ -9868,8 +9913,6 @@ static bool VULKAN_INTERNAL_AcquireSwapchainTexture( VK_NULL_HANDLE, &swapchainImageIndex); - //if (acquireResult == VK_ERROR_OUT_OF_DATE_KHR) { SDL_Log("VULKAN SWAPCHAIN OUT OF DATE"); } - if (acquireResult == VK_SUCCESS || acquireResult == VK_SUBOPTIMAL_KHR) { break; // we got the next image! } From 0825d07a43a891350e6ae7ea02912c87eb1db952 Mon Sep 17 00:00:00 2001 From: Frank Praznik Date: Fri, 31 Jan 2025 12:05:44 -0500 Subject: [PATCH 278/340] wayland: Don't send size events while the window is hidden Some clients don't expect this, and it can cause issues, particularly if events are emitted while creating a hidden window. --- src/video/wayland/SDL_waylandwindow.c | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/src/video/wayland/SDL_waylandwindow.c b/src/video/wayland/SDL_waylandwindow.c index ebf79a2609290..2cec73cac24f0 100644 --- a/src/video/wayland/SDL_waylandwindow.c +++ b/src/video/wayland/SDL_waylandwindow.c @@ -441,13 +441,15 @@ static bool ConfigureWindowGeometry(SDL_Window *window) */ SetMinMaxDimensions(window); - // Unconditionally send the window and drawable size, the video core will deduplicate when required. - if (!data->scale_to_display) { - SDL_SendWindowEvent(window, SDL_EVENT_WINDOW_RESIZED, window_width, window_height); - } else { - SDL_SendWindowEvent(window, SDL_EVENT_WINDOW_RESIZED, data->current.pixel_width, data->current.pixel_height); + if (data->shell_surface_status != WAYLAND_SHELL_SURFACE_STATUS_HIDDEN) { + // Unconditionally send the window and drawable size, the video core will deduplicate when required. + if (!data->scale_to_display) { + SDL_SendWindowEvent(window, SDL_EVENT_WINDOW_RESIZED, window_width, window_height); + } else { + SDL_SendWindowEvent(window, SDL_EVENT_WINDOW_RESIZED, data->current.pixel_width, data->current.pixel_height); + } + SDL_SendWindowEvent(window, SDL_EVENT_WINDOW_PIXEL_SIZE_CHANGED, data->current.pixel_width, data->current.pixel_height); } - SDL_SendWindowEvent(window, SDL_EVENT_WINDOW_PIXEL_SIZE_CHANGED, data->current.pixel_width, data->current.pixel_height); /* Send an exposure event if the window is in the shown state and the size has changed, * even if the window is occluded, as the client needs to commit a new frame for the From 6beda342155036c01e08589a6cd8d67d30563ed1 Mon Sep 17 00:00:00 2001 From: Timothee Besset Date: Fri, 31 Jan 2025 11:48:09 -0600 Subject: [PATCH 279/340] do not build camera drivers if camera support is disabled --- src/camera/SDL_camera.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/camera/SDL_camera.c b/src/camera/SDL_camera.c index fdd9090411a9c..142709f9a68f8 100644 --- a/src/camera/SDL_camera.c +++ b/src/camera/SDL_camera.c @@ -32,6 +32,7 @@ // Available camera drivers static const CameraBootStrap *const bootstrap[] = { +#ifndef SDL_CAMERA_DISABLED #ifdef SDL_CAMERA_DRIVER_V4L2 &V4L2_bootstrap, #endif @@ -55,6 +56,7 @@ static const CameraBootStrap *const bootstrap[] = { #endif #ifdef SDL_CAMERA_DRIVER_DUMMY &DUMMYCAMERA_bootstrap, +#endif #endif NULL }; From 16f8122a0d481825cfd77dea02ec75d3e02ddce4 Mon Sep 17 00:00:00 2001 From: Sam Lantinga Date: Fri, 31 Jan 2025 12:07:08 -0800 Subject: [PATCH 280/340] Keep the simplest mapping of scancode + modifer for a given keycode Fixes https://github.com/libsdl-org/sdl2-compat/issues/259 --- src/events/SDL_keymap.c | 32 ++++++++++++++++++++++++-------- 1 file changed, 24 insertions(+), 8 deletions(-) diff --git a/src/events/SDL_keymap.c b/src/events/SDL_keymap.c index 5c3f784c6c7b8..bc21c33103476 100644 --- a/src/events/SDL_keymap.c +++ b/src/events/SDL_keymap.c @@ -72,20 +72,36 @@ void SDL_SetKeymapEntry(SDL_Keymap *keymap, SDL_Scancode scancode, SDL_Keymod mo return; } - if (keycode == SDL_GetKeymapKeycode(keymap, scancode, modstate)) { - return; - } - - Uint32 key = ((Uint32)NormalizeModifierStateForKeymap(modstate) << 16) | scancode; + modstate = NormalizeModifierStateForKeymap(modstate); + Uint32 key = ((Uint32)modstate << 16) | scancode; const void *value; if (SDL_FindInHashTable(keymap->scancode_to_keycode, (void *)(uintptr_t)key, &value)) { + SDL_Keycode existing_keycode = (SDL_Keycode)(uintptr_t)value; + if (existing_keycode == keycode) { + // We already have this mapping + return; + } + // Changing the mapping, need to remove the existing entry from the keymap SDL_RemoveFromHashTable(keymap->scancode_to_keycode, (void *)(uintptr_t)key); - SDL_RemoveFromHashTable(keymap->keycode_to_scancode, value); } - SDL_InsertIntoHashTable(keymap->scancode_to_keycode, (void *)(uintptr_t)key, (void *)(uintptr_t)keycode); - SDL_InsertIntoHashTable(keymap->keycode_to_scancode, (void *)(uintptr_t)keycode, (void *)(uintptr_t)key); + + bool update_keycode = true; + if (SDL_FindInHashTable(keymap->keycode_to_scancode, (void *)(uintptr_t)keycode, &value)) { + Uint32 existing_value = (Uint32)(uintptr_t)value; + SDL_Keymod existing_modstate = (SDL_Keymod)(existing_value >> 16); + + // Keep the simplest combination of scancode and modifiers to generate this keycode + if (existing_modstate <= modstate) { + update_keycode = false; + } else { + SDL_RemoveFromHashTable(keymap->keycode_to_scancode, (void *)(uintptr_t)keycode); + } + } + if (update_keycode) { + SDL_InsertIntoHashTable(keymap->keycode_to_scancode, (void *)(uintptr_t)keycode, (void *)(uintptr_t)key); + } } SDL_Keycode SDL_GetKeymapKeycode(SDL_Keymap *keymap, SDL_Scancode scancode, SDL_Keymod modstate) From ab5cb707a604b9672d56b644d3468ef4776ca5b9 Mon Sep 17 00:00:00 2001 From: Sam Lantinga Date: Fri, 31 Jan 2025 14:22:29 -0800 Subject: [PATCH 281/340] Fixed enabling call logging --- src/dynapi/SDL_dynapi.c | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/src/dynapi/SDL_dynapi.c b/src/dynapi/SDL_dynapi.c index f35f3e8bcb564..335e74407d865 100644 --- a/src/dynapi/SDL_dynapi.c +++ b/src/dynapi/SDL_dynapi.c @@ -309,6 +309,30 @@ static size_t SDLCALL SDL_IOprintf_LOGSDLCALLS(SDL_IOStream *context, SDL_PRINTF va_end(ap); return result; } +static bool SDLCALL SDL_RenderDebugTextFormat_LOGSDLCALLS(SDL_Renderer *renderer, float x, float y, SDL_PRINTF_FORMAT_STRING const char *fmt, ...) +{ + char buf[128], *str = buf; + int result; + va_list ap; + SDL_Log_REAL("SDL3CALL SDL_RenderDebugTextFormat"); + va_start(ap, fmt); + result = jump_table.SDL_vsnprintf(buf, sizeof(buf), fmt, ap); + va_end(ap); + if (result >= 0 && (size_t)result >= sizeof(buf)) { + str = NULL; + va_start(ap, fmt); + result = SDL_vasprintf_REAL(&str, fmt, ap); + va_end(ap); + } + bool retval = false; + if (result >= 0) { + retval = SDL_RenderDebugTextFormat_REAL(renderer, x, y, "%s", str); + } + if (str != buf) { + jump_table.SDL_free(str); + } + return retval; +} static void SDLCALL SDL_Log_LOGSDLCALLS(SDL_PRINTF_FORMAT_STRING const char *fmt, ...) { va_list ap; From 4c6d949e6d64798d5a03cee952300e0b66a29d7b Mon Sep 17 00:00:00 2001 From: Sam Lantinga Date: Fri, 31 Jan 2025 14:53:40 -0800 Subject: [PATCH 282/340] wayland: make sure the desktop mode is in the fullscreen mode list Fixes https://github.com/libsdl-org/SDL/issues/12079 --- src/video/wayland/SDL_waylandvideo.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/video/wayland/SDL_waylandvideo.c b/src/video/wayland/SDL_waylandvideo.c index d1066b4d92a1e..fc8edc1e025a5 100644 --- a/src/video/wayland/SDL_waylandvideo.c +++ b/src/video/wayland/SDL_waylandvideo.c @@ -1025,6 +1025,10 @@ static void display_handle_done(void *data, // Expose the unscaled, native resolution if the scale is 1.0 or viewports are available... if (internal->scale_factor == 1.0 || video->viewporter) { SDL_AddFullscreenDisplayMode(dpy, &native_mode); + if (native_mode.w != desktop_mode.w || + native_mode.h != desktop_mode.h) { + SDL_AddFullscreenDisplayMode(dpy, &desktop_mode); + } } else { // ...otherwise expose the integer scaled variants of the desktop resolution down to 1. int i; From 70a239210e08f5c91d762940d08e42d40a21a090 Mon Sep 17 00:00:00 2001 From: Evan Hemsley <2342303+thatcosmonaut@users.noreply.github.com> Date: Fri, 31 Jan 2025 15:07:33 -0800 Subject: [PATCH 283/340] GPU: Describe "readonly storage" images as sampled images on Vulkan backend (#12149) --- src/gpu/vulkan/SDL_gpu_vulkan.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/src/gpu/vulkan/SDL_gpu_vulkan.c b/src/gpu/vulkan/SDL_gpu_vulkan.c index d240712636f28..eedbaedc3f6ae 100644 --- a/src/gpu/vulkan/SDL_gpu_vulkan.c +++ b/src/gpu/vulkan/SDL_gpu_vulkan.c @@ -3641,7 +3641,7 @@ static bool VULKAN_INTERNAL_AllocateDescriptorsFromPool( } for (Uint32 i = descriptorSetLayout->samplerCount; i < descriptorSetLayout->samplerCount + descriptorSetLayout->storageTextureCount; i += 1) { - descriptorPoolSizes[i].type = VK_DESCRIPTOR_TYPE_STORAGE_IMAGE; + descriptorPoolSizes[i].type = VK_DESCRIPTOR_TYPE_SAMPLED_IMAGE; // Yes, we are declaring the storage image as a sampled image, because shaders are stupid. descriptorPoolSizes[i].descriptorCount = DESCRIPTOR_POOL_SIZE; } @@ -3771,7 +3771,7 @@ static DescriptorSetLayout *VULKAN_INTERNAL_FetchDescriptorSetLayout( for (Uint32 i = samplerCount; i < samplerCount + storageTextureCount; i += 1) { descriptorSetLayoutBindings[i].binding = i; descriptorSetLayoutBindings[i].descriptorCount = 1; - descriptorSetLayoutBindings[i].descriptorType = VK_DESCRIPTOR_TYPE_STORAGE_IMAGE; + descriptorSetLayoutBindings[i].descriptorType = VK_DESCRIPTOR_TYPE_SAMPLED_IMAGE; // Yes, we are declaring the storage image as a sampled image, because shaders are stupid. descriptorSetLayoutBindings[i].stageFlags = shaderStage; descriptorSetLayoutBindings[i].pImmutableSamplers = NULL; } @@ -5093,7 +5093,7 @@ static void VULKAN_INTERNAL_BindGraphicsDescriptorSets( currentWriteDescriptorSet->sType = VK_STRUCTURE_TYPE_WRITE_DESCRIPTOR_SET; currentWriteDescriptorSet->pNext = NULL; currentWriteDescriptorSet->descriptorCount = 1; - currentWriteDescriptorSet->descriptorType = VK_DESCRIPTOR_TYPE_STORAGE_IMAGE; + currentWriteDescriptorSet->descriptorType = VK_DESCRIPTOR_TYPE_SAMPLED_IMAGE; // Yes, we are declaring a storage image as a sampled image, because shaders are stupid. currentWriteDescriptorSet->dstArrayElement = 0; currentWriteDescriptorSet->dstBinding = resourceLayout->vertexSamplerCount + i; currentWriteDescriptorSet->dstSet = commandBuffer->vertexResourceDescriptorSet; @@ -5212,7 +5212,7 @@ static void VULKAN_INTERNAL_BindGraphicsDescriptorSets( currentWriteDescriptorSet->sType = VK_STRUCTURE_TYPE_WRITE_DESCRIPTOR_SET; currentWriteDescriptorSet->pNext = NULL; currentWriteDescriptorSet->descriptorCount = 1; - currentWriteDescriptorSet->descriptorType = VK_DESCRIPTOR_TYPE_STORAGE_IMAGE; + currentWriteDescriptorSet->descriptorType = VK_DESCRIPTOR_TYPE_SAMPLED_IMAGE; // Yes, we are declaring a storage image as a sampled image, because shaders are stupid. currentWriteDescriptorSet->dstArrayElement = 0; currentWriteDescriptorSet->dstBinding = resourceLayout->fragmentSamplerCount + i; currentWriteDescriptorSet->dstSet = commandBuffer->fragmentResourceDescriptorSet; @@ -5619,7 +5619,9 @@ static VulkanTexture *VULKAN_INTERNAL_CreateTexture( imageCreateFlags |= VK_IMAGE_CREATE_2D_ARRAY_COMPATIBLE_BIT; } - if (createinfo->usage & SDL_GPU_TEXTUREUSAGE_SAMPLER) { + if (createinfo->usage & (SDL_GPU_TEXTUREUSAGE_SAMPLER | + SDL_GPU_TEXTUREUSAGE_GRAPHICS_STORAGE_READ | + SDL_GPU_TEXTUREUSAGE_COMPUTE_STORAGE_READ)) { vkUsageFlags |= VK_IMAGE_USAGE_SAMPLED_BIT; } if (createinfo->usage & SDL_GPU_TEXTUREUSAGE_COLOR_TARGET) { @@ -5628,9 +5630,7 @@ static VulkanTexture *VULKAN_INTERNAL_CreateTexture( if (createinfo->usage & SDL_GPU_TEXTUREUSAGE_DEPTH_STENCIL_TARGET) { vkUsageFlags |= VK_IMAGE_USAGE_DEPTH_STENCIL_ATTACHMENT_BIT; } - if (createinfo->usage & (SDL_GPU_TEXTUREUSAGE_GRAPHICS_STORAGE_READ | - SDL_GPU_TEXTUREUSAGE_COMPUTE_STORAGE_READ | - SDL_GPU_TEXTUREUSAGE_COMPUTE_STORAGE_WRITE | + if (createinfo->usage & (SDL_GPU_TEXTUREUSAGE_COMPUTE_STORAGE_WRITE | SDL_GPU_TEXTUREUSAGE_COMPUTE_STORAGE_SIMULTANEOUS_READ_WRITE)) { vkUsageFlags |= VK_IMAGE_USAGE_STORAGE_BIT; } @@ -8362,7 +8362,7 @@ static void VULKAN_INTERNAL_BindComputeDescriptorSets( currentWriteDescriptorSet->sType = VK_STRUCTURE_TYPE_WRITE_DESCRIPTOR_SET; currentWriteDescriptorSet->pNext = NULL; currentWriteDescriptorSet->descriptorCount = 1; - currentWriteDescriptorSet->descriptorType = VK_DESCRIPTOR_TYPE_STORAGE_IMAGE; + currentWriteDescriptorSet->descriptorType = VK_DESCRIPTOR_TYPE_SAMPLED_IMAGE; // Yes, we are declaring the readonly storage texture as a sampled image, because shaders are stupid. currentWriteDescriptorSet->dstArrayElement = 0; currentWriteDescriptorSet->dstBinding = resourceLayout->numSamplers + i; currentWriteDescriptorSet->dstSet = commandBuffer->computeReadOnlyDescriptorSet; From 69d361dee1b7f62067c3d03f9d7ee5b5fe92bff2 Mon Sep 17 00:00:00 2001 From: Sam Lantinga Date: Fri, 31 Jan 2025 15:47:59 -0800 Subject: [PATCH 284/340] Ignore SDL_HINT_RENDER_DRIVER set to software when creating a window surface We handled the case where software was in a list of render drivers, but not when the hint was set to exactly "software". Fixes https://github.com/libsdl-org/sdl2-compat/issues/266 --- src/video/SDL_video.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/video/SDL_video.c b/src/video/SDL_video.c index 80b1bb025c0ca..466f312d5f6d0 100644 --- a/src/video/SDL_video.c +++ b/src/video/SDL_video.c @@ -334,6 +334,9 @@ static bool SDL_CreateWindowTexture(SDL_VideoDevice *_this, SDL_Window *window, if (!render_driver) { render_driver = SDL_GetHint(SDL_HINT_RENDER_DRIVER); } + if (render_driver && SDL_strcasecmp(render_driver, SDL_SOFTWARE_RENDERER) == 0) { + render_driver = NULL; + } char *render_driver_copy = NULL; if (render_driver && *render_driver) { From bc3264130d3e2fd21f471d0f6aaccbe6c9828171 Mon Sep 17 00:00:00 2001 From: Sam Lantinga Date: Fri, 31 Jan 2025 23:45:09 -0800 Subject: [PATCH 285/340] Fixed mouse motion events while the mouse is grabbed When the mouse is grabbed, the X server sends mouse events only to the grabbing client, and XInput2 events for the master device are not delivered. We should consider using the window mouse rect confinement instead of a true X server grab for SDL mouse grab functionality. --- src/video/x11/SDL_x11events.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/video/x11/SDL_x11events.c b/src/video/x11/SDL_x11events.c index aebed3ef0710c..7bca58b373c3e 100644 --- a/src/video/x11/SDL_x11events.c +++ b/src/video/x11/SDL_x11events.c @@ -1614,7 +1614,7 @@ static void X11_DispatchEvent(SDL_VideoDevice *_this, XEvent *xevent) case MotionNotify: { - if (data->xinput2_mouse_enabled) { + if (data->xinput2_mouse_enabled && !data->mouse_grabbed) { // This input is being handled by XInput2 break; } From fe6bd8e9bf88672624ff13ae742341aa61029afb Mon Sep 17 00:00:00 2001 From: SDL Wiki Bot Date: Sat, 1 Feb 2025 10:40:21 +0000 Subject: [PATCH 286/340] Sync SDL3 wiki -> header [ci skip] --- include/SDL3/SDL_audio.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/include/SDL3/SDL_audio.h b/include/SDL3/SDL_audio.h index 31d672e510f7a..541c5dfbab293 100644 --- a/include/SDL3/SDL_audio.h +++ b/include/SDL3/SDL_audio.h @@ -1583,8 +1583,8 @@ extern SDL_DECLSPEC bool SDLCALL SDL_PauseAudioStreamDevice(SDL_AudioStream *str * previously been paused. Once unpaused, any bound audio streams will begin * to progress again, and audio can be generated. * - * Remember, SDL_OpenAudioDeviceStream opens device in an unpaused state, so - * this function call is required for audio playback to begin on such device. + * Remember, SDL_OpenAudioDeviceStream opens device in a paused state, so this + * function call is required for audio playback to begin on such device. * * \param stream the audio stream associated with the audio device to resume. * \returns true on success or false on failure; call SDL_GetError() for more From dc13a6ae95fda976e6719fe55be7f4baa877cd2b Mon Sep 17 00:00:00 2001 From: John Kvalevog Date: Sat, 1 Feb 2025 11:13:47 -0600 Subject: [PATCH 287/340] SDL_SaveBMP_IO: Write bitmap header v5 values bV4CSType was changed to LCS_sRGB to work with Preview on macOS. Fixes: #11903 --- src/video/SDL_bmp.c | 40 ++++++++++++++++++++++++++++++++++++---- 1 file changed, 36 insertions(+), 4 deletions(-) diff --git a/src/video/SDL_bmp.c b/src/video/SDL_bmp.c index d8b1c9dbba63c..bcde0c5786e02 100644 --- a/src/video/SDL_bmp.c +++ b/src/video/SDL_bmp.c @@ -46,11 +46,23 @@ #endif // Logical color space values for BMP files +// https://learn.microsoft.com/en-us/openspecs/windows_protocols/ms-wmf/eb4bbd50-b3ce-4917-895c-be31f214797f #ifndef LCS_WINDOWS_COLOR_SPACE // 0x57696E20 == "Win " #define LCS_WINDOWS_COLOR_SPACE 0x57696E20 #endif +#ifndef LCS_sRGB +// 0x73524742 == "sRGB" +#define LCS_sRGB 0x73524742 +#endif + +// Logical/physical color relationship +// https://learn.microsoft.com/en-us/openspecs/windows_protocols/ms-wmf/9fec0834-607d-427d-abd5-ab240fb0db38 +#ifndef LCS_GM_GRAPHICS +#define LCS_GM_GRAPHICS 0x00000002 +#endif + static bool readRlePixels(SDL_Surface *surface, SDL_IOStream *src, int isRle8) { /* @@ -637,6 +649,12 @@ bool SDL_SaveBMP_IO(SDL_Surface *surface, SDL_IOStream *dst, bool closeio) Uint32 bV4GammaGreen = 0; Uint32 bV4GammaBlue = 0; + // The additional header members from the Win32 BITMAPV5HEADER struct (124 bytes in total) + Uint32 bV5Intent = 0; + Uint32 bV5ProfileData = 0; + Uint32 bV5ProfileSize = 0; + Uint32 bV5Reserved = 0; + // Make sure we have somewhere to save if (!SDL_SurfaceValid(surface)) { SDL_InvalidParamError("surface"); @@ -728,19 +746,25 @@ bool SDL_SaveBMP_IO(SDL_Surface *surface, SDL_IOStream *dst, bool closeio) } biClrImportant = 0; - // Set the BMP info values for the version 4 header + // Set the BMP info values if (save32bit && !saveLegacyBMP) { - biSize = 108; + biSize = 124; + // Version 4 values biCompression = BI_BITFIELDS; // The BMP format is always little endian, these masks stay the same bV4RedMask = 0x00ff0000; bV4GreenMask = 0x0000ff00; bV4BlueMask = 0x000000ff; bV4AlphaMask = 0xff000000; - bV4CSType = LCS_WINDOWS_COLOR_SPACE; + bV4CSType = LCS_sRGB; bV4GammaRed = 0; bV4GammaGreen = 0; bV4GammaBlue = 0; + // Version 5 values + bV5Intent = LCS_GM_GRAPHICS; + bV5ProfileData = 0; + bV5ProfileSize = 0; + bV5Reserved = 0; } // Write the BMP info values @@ -758,8 +782,9 @@ bool SDL_SaveBMP_IO(SDL_Surface *surface, SDL_IOStream *dst, bool closeio) goto done; } - // Write the BMP info values for the version 4 header + // Write the BMP info values if (save32bit && !saveLegacyBMP) { + // Version 4 values if (!SDL_WriteU32LE(dst, bV4RedMask) || !SDL_WriteU32LE(dst, bV4GreenMask) || !SDL_WriteU32LE(dst, bV4BlueMask) || @@ -777,6 +802,13 @@ bool SDL_SaveBMP_IO(SDL_Surface *surface, SDL_IOStream *dst, bool closeio) !SDL_WriteU32LE(dst, bV4GammaBlue)) { goto done; } + // Version 5 values + if (!SDL_WriteU32LE(dst, bV5Intent) || + !SDL_WriteU32LE(dst, bV5ProfileData) || + !SDL_WriteU32LE(dst, bV5ProfileSize) || + !SDL_WriteU32LE(dst, bV5Reserved)) { + goto done; + } } // Write the palette (in BGR color order) From 235022fe2fb26d4dc434641e27fb59294b555658 Mon Sep 17 00:00:00 2001 From: Sam Lantinga Date: Sat, 1 Feb 2025 15:32:38 -0800 Subject: [PATCH 288/340] Fixed error C2059: syntax error: '}' Fixes https://github.com/libsdl-org/SDL/issues/12155 --- examples/pen/01-drawing-lines/drawing-lines.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/pen/01-drawing-lines/drawing-lines.c b/examples/pen/01-drawing-lines/drawing-lines.c index 32c29595ca9f6..d0d78eafc3d7b 100644 --- a/examples/pen/01-drawing-lines/drawing-lines.c +++ b/examples/pen/01-drawing-lines/drawing-lines.c @@ -99,7 +99,7 @@ SDL_AppResult SDL_AppEvent(void *appstate, SDL_Event *event) /* This function runs once per frame, and is the heart of the program. */ SDL_AppResult SDL_AppIterate(void *appstate) { - char debug_text[1024] = {}; + char debug_text[1024]; /* make sure we're drawing to the window and not the render target */ SDL_SetRenderTarget(renderer, NULL); From c922762791e474b575ff0738df63add2ebae508d Mon Sep 17 00:00:00 2001 From: Em Date: Wed, 29 Jan 2025 01:13:35 -0500 Subject: [PATCH 289/340] proposed fix: set curr_src.h is to bottom_height before drawing bottom edges / corners in SDL_RenderTexture9Grid, to avoid issue where inadvertently using top height if the npatch existed on a larger texture than the drawn edge would cause too many pixels to be included in the bottom part of the render. --- src/render/SDL_render.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/render/SDL_render.c b/src/render/SDL_render.c index 45f3686a31380..b6d6db7162d3d 100644 --- a/src/render/SDL_render.c +++ b/src/render/SDL_render.c @@ -4426,6 +4426,7 @@ bool SDL_RenderTexture9Grid(SDL_Renderer *renderer, SDL_Texture *texture, const // Lower-right corner curr_src.y = srcrect->y + srcrect->h - bottom_height; + curr_src.h = bottom_height; curr_dst.y = dstrect->y + dstrect->h - dst_bottom_height; curr_dst.h = dst_bottom_height; if (!SDL_RenderTexture(renderer, texture, &curr_src, &curr_dst)) { @@ -4474,6 +4475,7 @@ bool SDL_RenderTexture9Grid(SDL_Renderer *renderer, SDL_Texture *texture, const // Bottom curr_src.y = srcrect->y + srcrect->h - bottom_height; + curr_src.h = bottom_height; curr_dst.y = dstrect->y + dstrect->h - dst_bottom_height; curr_dst.h = dst_bottom_height; if (!SDL_RenderTexture(renderer, texture, &curr_src, &curr_dst)) { From 2fa1e7258a1fd9e3a7a546218b5ed1564953ad39 Mon Sep 17 00:00:00 2001 From: Sam Lantinga Date: Sat, 1 Feb 2025 17:01:45 -0800 Subject: [PATCH 290/340] Updated to version 3.2.2 for release --- CMakeLists.txt | 2 +- Xcode/SDL/Info-Framework.plist | 4 ++-- Xcode/SDL/SDL.xcodeproj/project.pbxproj | 8 ++++---- Xcode/SDL/pkg-support/SDL.info | 2 +- .../app/src/main/java/org/libsdl/app/SDLActivity.java | 2 +- include/SDL3/SDL.h | 2 +- include/SDL3/SDL_version.h | 2 +- src/core/windows/version.rc | 8 ++++---- 8 files changed, 15 insertions(+), 15 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index a18e2ca3195ef..6d55365bd2eae 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -5,7 +5,7 @@ if(NOT DEFINED CMAKE_BUILD_TYPE) endif() # See docs/release_checklist.md -project(SDL3 LANGUAGES C VERSION "3.2.1") +project(SDL3 LANGUAGES C VERSION "3.2.2") if(CMAKE_SOURCE_DIR STREQUAL PROJECT_SOURCE_DIR) set(SDL3_MAINPROJECT ON) diff --git a/Xcode/SDL/Info-Framework.plist b/Xcode/SDL/Info-Framework.plist index d7ec19f892437..a2ba5403caece 100644 --- a/Xcode/SDL/Info-Framework.plist +++ b/Xcode/SDL/Info-Framework.plist @@ -19,10 +19,10 @@ CFBundlePackageType FMWK CFBundleShortVersionString - 3.2.1 + 3.2.2 CFBundleSignature SDLX CFBundleVersion - 3.2.1 + 3.2.2 diff --git a/Xcode/SDL/SDL.xcodeproj/project.pbxproj b/Xcode/SDL/SDL.xcodeproj/project.pbxproj index 869ae6d9e904d..6f68b4519fac2 100644 --- a/Xcode/SDL/SDL.xcodeproj/project.pbxproj +++ b/Xcode/SDL/SDL.xcodeproj/project.pbxproj @@ -3062,7 +3062,7 @@ CLANG_ENABLE_OBJC_ARC = YES; DEPLOYMENT_POSTPROCESSING = YES; DYLIB_COMPATIBILITY_VERSION = 201.0.0; - DYLIB_CURRENT_VERSION = 201.1.0; + DYLIB_CURRENT_VERSION = 201.2.0; DYLIB_INSTALL_NAME_BASE = "@rpath"; ENABLE_STRICT_OBJC_MSGSEND = YES; GCC_ALTIVEC_EXTENSIONS = YES; @@ -3097,7 +3097,7 @@ "@loader_path/Frameworks", ); MACOSX_DEPLOYMENT_TARGET = 10.13; - MARKETING_VERSION = 3.2.1; + MARKETING_VERSION = 3.2.2; OTHER_LDFLAGS = "$(CONFIG_FRAMEWORK_LDFLAGS)"; PRODUCT_BUNDLE_IDENTIFIER = org.libsdl.SDL3; PRODUCT_NAME = SDL3; @@ -3126,7 +3126,7 @@ CLANG_ENABLE_MODULES = YES; CLANG_ENABLE_OBJC_ARC = YES; DYLIB_COMPATIBILITY_VERSION = 201.0.0; - DYLIB_CURRENT_VERSION = 201.1.0; + DYLIB_CURRENT_VERSION = 201.2.0; DYLIB_INSTALL_NAME_BASE = "@rpath"; ENABLE_STRICT_OBJC_MSGSEND = YES; ENABLE_TESTABILITY = YES; @@ -3158,7 +3158,7 @@ "@loader_path/Frameworks", ); MACOSX_DEPLOYMENT_TARGET = 10.13; - MARKETING_VERSION = 3.2.1; + MARKETING_VERSION = 3.2.2; ONLY_ACTIVE_ARCH = YES; OTHER_LDFLAGS = "$(CONFIG_FRAMEWORK_LDFLAGS)"; PRODUCT_BUNDLE_IDENTIFIER = org.libsdl.SDL3; diff --git a/Xcode/SDL/pkg-support/SDL.info b/Xcode/SDL/pkg-support/SDL.info index a763e8c7ea03e..684b10b9fcd68 100644 --- a/Xcode/SDL/pkg-support/SDL.info +++ b/Xcode/SDL/pkg-support/SDL.info @@ -1,4 +1,4 @@ -Title SDL 3.2.1 +Title SDL 3.2.2 Version 1 Description SDL Library for macOS (http://www.libsdl.org) DefaultLocation /Library/Frameworks diff --git a/android-project/app/src/main/java/org/libsdl/app/SDLActivity.java b/android-project/app/src/main/java/org/libsdl/app/SDLActivity.java index 0e32fed4e0d83..3fa16a573460b 100644 --- a/android-project/app/src/main/java/org/libsdl/app/SDLActivity.java +++ b/android-project/app/src/main/java/org/libsdl/app/SDLActivity.java @@ -60,7 +60,7 @@ public class SDLActivity extends Activity implements View.OnSystemUiVisibilityCh private static final String TAG = "SDL"; private static final int SDL_MAJOR_VERSION = 3; private static final int SDL_MINOR_VERSION = 2; - private static final int SDL_MICRO_VERSION = 1; + private static final int SDL_MICRO_VERSION = 2; /* // Display InputType.SOURCE/CLASS of events and devices // diff --git a/include/SDL3/SDL.h b/include/SDL3/SDL.h index f4b1ac61dfd50..dca0b69ce1673 100644 --- a/include/SDL3/SDL.h +++ b/include/SDL3/SDL.h @@ -20,7 +20,7 @@ */ /** - * Main include header for the SDL library, version 3.2.1 + * Main include header for the SDL library, version 3.2.2 * * It is almost always best to include just this one header instead of * picking out individual headers included here. There are exceptions to diff --git a/include/SDL3/SDL_version.h b/include/SDL3/SDL_version.h index 43a1807554366..409609abbdccf 100644 --- a/include/SDL3/SDL_version.h +++ b/include/SDL3/SDL_version.h @@ -62,7 +62,7 @@ extern "C" { * * \since This macro is available since SDL 3.2.0. */ -#define SDL_MICRO_VERSION 1 +#define SDL_MICRO_VERSION 2 /** * This macro turns the version numbers into a numeric value. diff --git a/src/core/windows/version.rc b/src/core/windows/version.rc index bd878f9191adb..e1e8973c7acb0 100644 --- a/src/core/windows/version.rc +++ b/src/core/windows/version.rc @@ -9,8 +9,8 @@ LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US // VS_VERSION_INFO VERSIONINFO - FILEVERSION 3,2,1,0 - PRODUCTVERSION 3,2,1,0 + FILEVERSION 3,2,2,0 + PRODUCTVERSION 3,2,2,0 FILEFLAGSMASK 0x3fL FILEFLAGS 0x0L FILEOS 0x40004L @@ -23,12 +23,12 @@ BEGIN BEGIN VALUE "CompanyName", "\0" VALUE "FileDescription", "SDL\0" - VALUE "FileVersion", "3, 2, 1, 0\0" + VALUE "FileVersion", "3, 2, 2, 0\0" VALUE "InternalName", "SDL\0" VALUE "LegalCopyright", "Copyright (C) 2025 Sam Lantinga\0" VALUE "OriginalFilename", "SDL3.dll\0" VALUE "ProductName", "Simple DirectMedia Layer\0" - VALUE "ProductVersion", "3, 2, 1, 0\0" + VALUE "ProductVersion", "3, 2, 2, 0\0" END END BLOCK "VarFileInfo" From be991239d9bc6df06b0ca7a9ae9dbb7251e93c12 Mon Sep 17 00:00:00 2001 From: Sam Lantinga Date: Sat, 1 Feb 2025 17:43:38 -0800 Subject: [PATCH 291/340] Updated to version 3.2.3 for development --- CMakeLists.txt | 2 +- Xcode/SDL/Info-Framework.plist | 4 ++-- Xcode/SDL/SDL.xcodeproj/project.pbxproj | 8 ++++---- Xcode/SDL/pkg-support/SDL.info | 2 +- .../app/src/main/java/org/libsdl/app/SDLActivity.java | 2 +- include/SDL3/SDL.h | 2 +- include/SDL3/SDL_version.h | 2 +- src/core/windows/version.rc | 8 ++++---- 8 files changed, 15 insertions(+), 15 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 6d55365bd2eae..0681a286cbef6 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -5,7 +5,7 @@ if(NOT DEFINED CMAKE_BUILD_TYPE) endif() # See docs/release_checklist.md -project(SDL3 LANGUAGES C VERSION "3.2.2") +project(SDL3 LANGUAGES C VERSION "3.2.3") if(CMAKE_SOURCE_DIR STREQUAL PROJECT_SOURCE_DIR) set(SDL3_MAINPROJECT ON) diff --git a/Xcode/SDL/Info-Framework.plist b/Xcode/SDL/Info-Framework.plist index a2ba5403caece..dea5be270196c 100644 --- a/Xcode/SDL/Info-Framework.plist +++ b/Xcode/SDL/Info-Framework.plist @@ -19,10 +19,10 @@ CFBundlePackageType FMWK CFBundleShortVersionString - 3.2.2 + 3.2.3 CFBundleSignature SDLX CFBundleVersion - 3.2.2 + 3.2.3 diff --git a/Xcode/SDL/SDL.xcodeproj/project.pbxproj b/Xcode/SDL/SDL.xcodeproj/project.pbxproj index 6f68b4519fac2..f0ae0f88060b1 100644 --- a/Xcode/SDL/SDL.xcodeproj/project.pbxproj +++ b/Xcode/SDL/SDL.xcodeproj/project.pbxproj @@ -3062,7 +3062,7 @@ CLANG_ENABLE_OBJC_ARC = YES; DEPLOYMENT_POSTPROCESSING = YES; DYLIB_COMPATIBILITY_VERSION = 201.0.0; - DYLIB_CURRENT_VERSION = 201.2.0; + DYLIB_CURRENT_VERSION = 201.3.0; DYLIB_INSTALL_NAME_BASE = "@rpath"; ENABLE_STRICT_OBJC_MSGSEND = YES; GCC_ALTIVEC_EXTENSIONS = YES; @@ -3097,7 +3097,7 @@ "@loader_path/Frameworks", ); MACOSX_DEPLOYMENT_TARGET = 10.13; - MARKETING_VERSION = 3.2.2; + MARKETING_VERSION = 3.2.3; OTHER_LDFLAGS = "$(CONFIG_FRAMEWORK_LDFLAGS)"; PRODUCT_BUNDLE_IDENTIFIER = org.libsdl.SDL3; PRODUCT_NAME = SDL3; @@ -3126,7 +3126,7 @@ CLANG_ENABLE_MODULES = YES; CLANG_ENABLE_OBJC_ARC = YES; DYLIB_COMPATIBILITY_VERSION = 201.0.0; - DYLIB_CURRENT_VERSION = 201.2.0; + DYLIB_CURRENT_VERSION = 201.3.0; DYLIB_INSTALL_NAME_BASE = "@rpath"; ENABLE_STRICT_OBJC_MSGSEND = YES; ENABLE_TESTABILITY = YES; @@ -3158,7 +3158,7 @@ "@loader_path/Frameworks", ); MACOSX_DEPLOYMENT_TARGET = 10.13; - MARKETING_VERSION = 3.2.2; + MARKETING_VERSION = 3.2.3; ONLY_ACTIVE_ARCH = YES; OTHER_LDFLAGS = "$(CONFIG_FRAMEWORK_LDFLAGS)"; PRODUCT_BUNDLE_IDENTIFIER = org.libsdl.SDL3; diff --git a/Xcode/SDL/pkg-support/SDL.info b/Xcode/SDL/pkg-support/SDL.info index 684b10b9fcd68..39f351cf7b780 100644 --- a/Xcode/SDL/pkg-support/SDL.info +++ b/Xcode/SDL/pkg-support/SDL.info @@ -1,4 +1,4 @@ -Title SDL 3.2.2 +Title SDL 3.2.3 Version 1 Description SDL Library for macOS (http://www.libsdl.org) DefaultLocation /Library/Frameworks diff --git a/android-project/app/src/main/java/org/libsdl/app/SDLActivity.java b/android-project/app/src/main/java/org/libsdl/app/SDLActivity.java index 3fa16a573460b..72f60d1dda56e 100644 --- a/android-project/app/src/main/java/org/libsdl/app/SDLActivity.java +++ b/android-project/app/src/main/java/org/libsdl/app/SDLActivity.java @@ -60,7 +60,7 @@ public class SDLActivity extends Activity implements View.OnSystemUiVisibilityCh private static final String TAG = "SDL"; private static final int SDL_MAJOR_VERSION = 3; private static final int SDL_MINOR_VERSION = 2; - private static final int SDL_MICRO_VERSION = 2; + private static final int SDL_MICRO_VERSION = 3; /* // Display InputType.SOURCE/CLASS of events and devices // diff --git a/include/SDL3/SDL.h b/include/SDL3/SDL.h index dca0b69ce1673..a6313f3646b7e 100644 --- a/include/SDL3/SDL.h +++ b/include/SDL3/SDL.h @@ -20,7 +20,7 @@ */ /** - * Main include header for the SDL library, version 3.2.2 + * Main include header for the SDL library, version 3.2.3 * * It is almost always best to include just this one header instead of * picking out individual headers included here. There are exceptions to diff --git a/include/SDL3/SDL_version.h b/include/SDL3/SDL_version.h index 409609abbdccf..f3586e69eee7b 100644 --- a/include/SDL3/SDL_version.h +++ b/include/SDL3/SDL_version.h @@ -62,7 +62,7 @@ extern "C" { * * \since This macro is available since SDL 3.2.0. */ -#define SDL_MICRO_VERSION 2 +#define SDL_MICRO_VERSION 3 /** * This macro turns the version numbers into a numeric value. diff --git a/src/core/windows/version.rc b/src/core/windows/version.rc index e1e8973c7acb0..8bd402a657ff6 100644 --- a/src/core/windows/version.rc +++ b/src/core/windows/version.rc @@ -9,8 +9,8 @@ LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US // VS_VERSION_INFO VERSIONINFO - FILEVERSION 3,2,2,0 - PRODUCTVERSION 3,2,2,0 + FILEVERSION 3,2,3,0 + PRODUCTVERSION 3,2,3,0 FILEFLAGSMASK 0x3fL FILEFLAGS 0x0L FILEOS 0x40004L @@ -23,12 +23,12 @@ BEGIN BEGIN VALUE "CompanyName", "\0" VALUE "FileDescription", "SDL\0" - VALUE "FileVersion", "3, 2, 2, 0\0" + VALUE "FileVersion", "3, 2, 3, 0\0" VALUE "InternalName", "SDL\0" VALUE "LegalCopyright", "Copyright (C) 2025 Sam Lantinga\0" VALUE "OriginalFilename", "SDL3.dll\0" VALUE "ProductName", "Simple DirectMedia Layer\0" - VALUE "ProductVersion", "3, 2, 2, 0\0" + VALUE "ProductVersion", "3, 2, 3, 0\0" END END BLOCK "VarFileInfo" From 73a8143581e6fb01fbcd18c73af5f3badd24377e Mon Sep 17 00:00:00 2001 From: Ozkan Sezer Date: Sun, 2 Feb 2025 08:04:24 +0300 Subject: [PATCH 292/340] timer, windows: allow building high resolution code with old SDKs. --- src/timer/windows/SDL_systimer.c | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/src/timer/windows/SDL_systimer.c b/src/timer/windows/SDL_systimer.c index 49f27cfe9d511..f6f4b15c72b7f 100644 --- a/src/timer/windows/SDL_systimer.c +++ b/src/timer/windows/SDL_systimer.c @@ -24,6 +24,11 @@ #include "../../core/windows/SDL_windows.h" +/* CREATE_WAITABLE_TIMER_HIGH_RESOLUTION flag was added in Windows 10 version 1803. */ +#ifndef CREATE_WAITABLE_TIMER_HIGH_RESOLUTION +#define CREATE_WAITABLE_TIMER_HIGH_RESOLUTION 0x2 +#endif + typedef HANDLE (WINAPI *CreateWaitableTimerExW_t)(LPSECURITY_ATTRIBUTES lpTimerAttributes, LPCWSTR lpTimerName, DWORD dwFlags, DWORD dwDesiredAccess); static CreateWaitableTimerExW_t pCreateWaitableTimerExW; @@ -35,7 +40,6 @@ static void SDL_CleanupWaitableHandle(void *handle) CloseHandle(handle); } -#ifdef CREATE_WAITABLE_TIMER_HIGH_RESOLUTION static HANDLE SDL_GetWaitableTimer(void) { static SDL_TLSID TLS_timer_handle; @@ -67,7 +71,6 @@ static HANDLE SDL_GetWaitableTimer(void) } return timer; } -#endif // CREATE_WAITABLE_TIMER_HIGH_RESOLUTION static HANDLE SDL_GetWaitableEvent(void) { @@ -102,11 +105,6 @@ Uint64 SDL_GetPerformanceFrequency(void) void SDL_SYS_DelayNS(Uint64 ns) { - /* CREATE_WAITABLE_TIMER_HIGH_RESOLUTION flag was added in Windows 10 version 1803. - * - * Use the compiler version to determine availability. - */ -#ifdef CREATE_WAITABLE_TIMER_HIGH_RESOLUTION HANDLE timer = SDL_GetWaitableTimer(); if (timer) { LARGE_INTEGER due_time; @@ -116,7 +114,6 @@ void SDL_SYS_DelayNS(Uint64 ns) } return; } -#endif const Uint64 max_delay = 0xffffffffLL * SDL_NS_PER_MS; if (ns > max_delay) { From c06172dc1c832e1768350c58384d6711723ea02e Mon Sep 17 00:00:00 2001 From: Sam Lantinga Date: Sun, 2 Feb 2025 12:58:45 -0800 Subject: [PATCH 293/340] Track mouse button state by real mouse ID We'll switch to the global mouse ID just once we are ready to deliver events. This makes sure that any button events that come in for a specific mouse ID maintain that state if we switch to relative mode and start using that mouse ID for events. Fixes https://github.com/libsdl-org/sdl2-compat/issues/263 --- src/events/SDL_mouse.c | 35 +++++++++++++++++++---------------- 1 file changed, 19 insertions(+), 16 deletions(-) diff --git a/src/events/SDL_mouse.c b/src/events/SDL_mouse.c index 25dfef7f2a7f9..42933af95facb 100644 --- a/src/events/SDL_mouse.c +++ b/src/events/SDL_mouse.c @@ -687,11 +687,6 @@ static void SDL_PrivateSendMouseMotion(Uint64 timestamp, SDL_Window *window, SDL float yrel = 0.0f; bool window_is_relative = mouse->focus && (mouse->focus->flags & SDL_WINDOW_MOUSE_RELATIVE_MODE); - if ((!mouse->relative_mode || mouse->warp_emulation_active) && mouseID != SDL_TOUCH_MOUSEID) { - // We're not in relative mode, so all mouse events are global mouse events - mouseID = SDL_GLOBAL_MOUSE_ID; - } - // SDL_HINT_MOUSE_TOUCH_EVENTS: controlling whether mouse events should generate synthetic touch events if (mouse->mouse_touch_events) { if (mouseID != SDL_TOUCH_MOUSEID && !relative && track_mouse_down) { @@ -784,6 +779,11 @@ static void SDL_PrivateSendMouseMotion(Uint64 timestamp, SDL_Window *window, SDL // Post the event, if desired if (SDL_EventEnabled(SDL_EVENT_MOUSE_MOTION)) { + if ((!mouse->relative_mode || mouse->warp_emulation_active) && mouseID != SDL_TOUCH_MOUSEID) { + // We're not in relative mode, so all mouse events are global mouse events + mouseID = SDL_GLOBAL_MOUSE_ID; + } + if (!relative && window_is_relative) { if (!mouse->relative_mode_warp_motion) { return; @@ -791,6 +791,7 @@ static void SDL_PrivateSendMouseMotion(Uint64 timestamp, SDL_Window *window, SDL xrel = 0.0f; yrel = 0.0f; } + SDL_Event event; event.type = SDL_EVENT_MOUSE_MOTION; event.common.timestamp = timestamp; @@ -873,11 +874,6 @@ static void SDL_PrivateSendMouseButton(Uint64 timestamp, SDL_Window *window, SDL Uint32 buttonstate; SDL_MouseInputSource *source; - if (!mouse->relative_mode && mouseID != SDL_TOUCH_MOUSEID) { - // We're not in relative mode, so all mouse events are global mouse events - mouseID = SDL_GLOBAL_MOUSE_ID; - } - source = GetMouseInputSource(mouse, mouseID, down, button); if (!source) { return; @@ -954,11 +950,18 @@ static void SDL_PrivateSendMouseButton(Uint64 timestamp, SDL_Window *window, SDL // Post the event, if desired if (SDL_EventEnabled(type)) { + if ((!mouse->relative_mode || mouse->warp_emulation_active) && mouseID != SDL_TOUCH_MOUSEID) { + // We're not in relative mode, so all mouse events are global mouse events + mouseID = SDL_GLOBAL_MOUSE_ID; + } else { + mouseID = source->mouseID; + } + SDL_Event event; event.type = type; event.common.timestamp = timestamp; event.button.windowID = mouse->focus ? mouse->focus->id : 0; - event.button.which = source->mouseID; + event.button.which = mouseID; event.button.down = down; event.button.button = button; event.button.clicks = (Uint8)SDL_min(clicks, 255); @@ -1001,13 +1004,13 @@ void SDL_SendMouseWheel(Uint64 timestamp, SDL_Window *window, SDL_MouseID mouseI return; } - if (!mouse->relative_mode || mouse->warp_emulation_active) { - // We're not in relative mode, so all mouse events are global mouse events - mouseID = SDL_GLOBAL_MOUSE_ID; - } - // Post the event, if desired if (SDL_EventEnabled(SDL_EVENT_MOUSE_WHEEL)) { + if (!mouse->relative_mode || mouse->warp_emulation_active) { + // We're not in relative mode, so all mouse events are global mouse events + mouseID = SDL_GLOBAL_MOUSE_ID; + } + SDL_Event event; event.type = SDL_EVENT_MOUSE_WHEEL; event.common.timestamp = timestamp; From 842f85da05557f168e79ef1c95057223cd3fa7fa Mon Sep 17 00:00:00 2001 From: SDL Wiki Bot Date: Sun, 2 Feb 2025 21:17:22 +0000 Subject: [PATCH 294/340] Sync SDL3 wiki -> header [ci skip] --- include/SDL3/SDL_gpu.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/include/SDL3/SDL_gpu.h b/include/SDL3/SDL_gpu.h index e558cdd234697..d42e0889c0660 100644 --- a/include/SDL3/SDL_gpu.h +++ b/include/SDL3/SDL_gpu.h @@ -4074,6 +4074,8 @@ extern SDL_DECLSPEC bool SDLCALL SDL_QueryGPUFence( /** * Releases a fence obtained from SDL_SubmitGPUCommandBufferAndAcquireFence. * + * You must not reference the fence after calling this function. + * * \param device a GPU context. * \param fence a fence. * From a98a4b8a6849656678bb62eb2604127da7b0658c Mon Sep 17 00:00:00 2001 From: Sam Lantinga Date: Sun, 2 Feb 2025 13:40:57 -0800 Subject: [PATCH 295/340] Re-added SDL_SoftStretch() to the API This is needed for sdl2-compat, since a blit is not quite equivalent. --- include/SDL3/SDL_surface.h | 23 +++++++++++++++++++++++ src/dynapi/SDL_dynapi.sym | 1 + src/dynapi/SDL_dynapi_overrides.h | 1 + src/dynapi/SDL_dynapi_procs.h | 1 + 4 files changed, 26 insertions(+) diff --git a/include/SDL3/SDL_surface.h b/include/SDL3/SDL_surface.h index 0752f53072cb4..6e28854c4a212 100644 --- a/include/SDL3/SDL_surface.h +++ b/include/SDL3/SDL_surface.h @@ -1173,6 +1173,29 @@ extern SDL_DECLSPEC bool SDLCALL SDL_BlitSurfaceScaled(SDL_Surface *src, const S */ extern SDL_DECLSPEC bool SDLCALL SDL_BlitSurfaceUncheckedScaled(SDL_Surface *src, const SDL_Rect *srcrect, SDL_Surface *dst, const SDL_Rect *dstrect, SDL_ScaleMode scaleMode); +/** + * Perform a stretched pixel copy from one surface to another. + * + * \param src the SDL_Surface structure to be copied from. + * \param srcrect the SDL_Rect structure representing the rectangle to be + * copied, may not be NULL. + * \param dst the SDL_Surface structure that is the blit target. + * \param dstrect the SDL_Rect structure representing the target rectangle in + * the destination surface, may not be NULL. + * \param scaleMode the SDL_ScaleMode to be used. + * \returns true on success or false on failure; call SDL_GetError() for more + * information. + * + * \threadsafety The same destination surface should not be used from two + * threads at once. It is safe to use the same source surface + * from multiple threads. + * + * \since This function is available since SDL 3.2.0. + * + * \sa SDL_BlitSurfaceScaled + */ +extern SDL_DECLSPEC bool SDLCALL SDL_SoftStretch(SDL_Surface *src, const SDL_Rect *srcrect, SDL_Surface *dst, const SDL_Rect *dstrect, SDL_ScaleMode scaleMode); + /** * Perform a tiled blit to a destination surface, which may be of a different * format. diff --git a/src/dynapi/SDL_dynapi.sym b/src/dynapi/SDL_dynapi.sym index b4dcc38396bb1..9c7621b8060ba 100644 --- a/src/dynapi/SDL_dynapi.sym +++ b/src/dynapi/SDL_dynapi.sym @@ -1233,6 +1233,7 @@ SDL3_0.0.0 { SDL_AudioStreamDevicePaused; SDL_ClickTrayEntry; SDL_UpdateTrays; + SDL_SoftStretch; # extra symbols go here (don't modify this line) local: *; }; diff --git a/src/dynapi/SDL_dynapi_overrides.h b/src/dynapi/SDL_dynapi_overrides.h index d90b6fd074b54..27051a8c04723 100644 --- a/src/dynapi/SDL_dynapi_overrides.h +++ b/src/dynapi/SDL_dynapi_overrides.h @@ -1258,3 +1258,4 @@ #define SDL_AudioStreamDevicePaused SDL_AudioStreamDevicePaused_REAL #define SDL_ClickTrayEntry SDL_ClickTrayEntry_REAL #define SDL_UpdateTrays SDL_UpdateTrays_REAL +#define SDL_SoftStretch SDL_SoftStretch_REAL diff --git a/src/dynapi/SDL_dynapi_procs.h b/src/dynapi/SDL_dynapi_procs.h index e57603d185522..df98958d7818f 100644 --- a/src/dynapi/SDL_dynapi_procs.h +++ b/src/dynapi/SDL_dynapi_procs.h @@ -1266,3 +1266,4 @@ SDL_DYNAPI_PROC(SDL_ThreadState,SDL_GetThreadState,(SDL_Thread *a),(a),return) SDL_DYNAPI_PROC(bool,SDL_AudioStreamDevicePaused,(SDL_AudioStream *a),(a),return) SDL_DYNAPI_PROC(void,SDL_ClickTrayEntry,(SDL_TrayEntry *a),(a),) SDL_DYNAPI_PROC(void,SDL_UpdateTrays,(void),(),) +SDL_DYNAPI_PROC(bool,SDL_SoftStretch,(SDL_Surface *a,const SDL_Rect *b,SDL_Surface *c,const SDL_Rect *d,SDL_ScaleMode e),(a,b,c,d,e),return) From 8848f86560d29c43afb5676836bc5786b26cb990 Mon Sep 17 00:00:00 2001 From: Sam Lantinga Date: Sun, 2 Feb 2025 14:13:13 -0800 Subject: [PATCH 296/340] Corrected the version where SDL_SoftStretch() was added --- include/SDL3/SDL_surface.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/SDL3/SDL_surface.h b/include/SDL3/SDL_surface.h index 6e28854c4a212..b7ba99ab2561c 100644 --- a/include/SDL3/SDL_surface.h +++ b/include/SDL3/SDL_surface.h @@ -1190,7 +1190,7 @@ extern SDL_DECLSPEC bool SDLCALL SDL_BlitSurfaceUncheckedScaled(SDL_Surface *src * threads at once. It is safe to use the same source surface * from multiple threads. * - * \since This function is available since SDL 3.2.0. + * \since This function is available since SDL 3.2.4. * * \sa SDL_BlitSurfaceScaled */ From 614ae843a9d7c952961d954a0b96d3b9593cf915 Mon Sep 17 00:00:00 2001 From: SDL Wiki Bot Date: Sun, 2 Feb 2025 22:14:15 +0000 Subject: [PATCH 297/340] Sync SDL3 wiki -> header [ci skip] --- include/SDL3/SDL_surface.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/SDL3/SDL_surface.h b/include/SDL3/SDL_surface.h index b7ba99ab2561c..6e28854c4a212 100644 --- a/include/SDL3/SDL_surface.h +++ b/include/SDL3/SDL_surface.h @@ -1190,7 +1190,7 @@ extern SDL_DECLSPEC bool SDLCALL SDL_BlitSurfaceUncheckedScaled(SDL_Surface *src * threads at once. It is safe to use the same source surface * from multiple threads. * - * \since This function is available since SDL 3.2.4. + * \since This function is available since SDL 3.2.0. * * \sa SDL_BlitSurfaceScaled */ From f40ef62a2a5a798f1d5b887cb861499533a2f4ab Mon Sep 17 00:00:00 2001 From: SDL Wiki Bot Date: Sun, 2 Feb 2025 23:14:17 +0000 Subject: [PATCH 298/340] Sync SDL3 wiki -> header [ci skip] --- include/SDL3/SDL_gpu.h | 1 + 1 file changed, 1 insertion(+) diff --git a/include/SDL3/SDL_gpu.h b/include/SDL3/SDL_gpu.h index d42e0889c0660..177a01f8d6d99 100644 --- a/include/SDL3/SDL_gpu.h +++ b/include/SDL3/SDL_gpu.h @@ -1366,6 +1366,7 @@ typedef struct SDL_GPUTextureLocation * * \sa SDL_UploadToGPUTexture * \sa SDL_DownloadFromGPUTexture + * \sa SDL_CreateGPUTexture */ typedef struct SDL_GPUTextureRegion { From 8e51b2468ad783b233e8c654549b0f529e7c13db Mon Sep 17 00:00:00 2001 From: Sam Lantinga Date: Mon, 3 Feb 2025 08:32:37 -0800 Subject: [PATCH 299/340] Renamed SDL_SoftStretch() to SDL_StretchSurface() Fixes https://github.com/libsdl-org/SDL/issues/12168 --- docs/README-migration.md | 6 ++---- include/SDL3/SDL_surface.h | 2 +- src/camera/SDL_camera.c | 4 ++-- src/dynapi/SDL_dynapi.sym | 2 +- src/dynapi/SDL_dynapi_overrides.h | 2 +- src/dynapi/SDL_dynapi_procs.h | 2 +- src/render/SDL_yuv_sw.c | 2 +- src/video/SDL_stretch.c | 18 +++++++++--------- src/video/SDL_surface.c | 8 ++++---- src/video/SDL_surface_c.h | 1 - src/video/windows/SDL_windowsshape.c | 2 +- src/video/x11/SDL_x11shape.c | 2 +- 12 files changed, 24 insertions(+), 27 deletions(-) diff --git a/docs/README-migration.md b/docs/README-migration.md index 750a1f05447e0..0cbe9fe3e4bf3 100644 --- a/docs/README-migration.md +++ b/docs/README-migration.md @@ -1845,8 +1845,6 @@ SDL_BlitSurface() and SDL_BlitSurfaceScaled() now have a const `dstrect` paramet SDL_BlitSurfaceScaled() and SDL_BlitSurfaceUncheckedScaled() now take a scale parameter. -SDL_SoftStretch() now takes a scale parameter. - SDL_PixelFormat is used instead of Uint32 for API functions that refer to pixel format by enumerated value. SDL_SetSurfaceColorKey() takes an bool to enable and disable colorkey. RLE acceleration isn't controlled by the parameter, you should use SDL_SetSurfaceRLE() to change that separately. @@ -1880,8 +1878,8 @@ The following functions have been removed: * SDL_GetYUVConversionMode() * SDL_GetYUVConversionModeForResolution() * SDL_SetYUVConversionMode() - use SDL_SetSurfaceColorspace() to set the surface colorspace and SDL_PROP_TEXTURE_CREATE_COLORSPACE_NUMBER with SDL_CreateTextureWithProperties() to set the texture colorspace. The default colorspace for YUV pixel formats is SDL_COLORSPACE_JPEG. -* SDL_SoftStretch() - use SDL_BlitSurfaceScaled() with SDL_SCALEMODE_NEAREST -* SDL_SoftStretchLinear() - use SDL_BlitSurfaceScaled() with SDL_SCALEMODE_LINEAR +* SDL_SoftStretch() - use SDL_StretchSurface() with SDL_SCALEMODE_NEAREST +* SDL_SoftStretchLinear() - use SDL_StretchSurface() with SDL_SCALEMODE_LINEAR The following symbols have been renamed: * SDL_PREALLOC => SDL_SURFACE_PREALLOCATED diff --git a/include/SDL3/SDL_surface.h b/include/SDL3/SDL_surface.h index 6e28854c4a212..59691c479ec3f 100644 --- a/include/SDL3/SDL_surface.h +++ b/include/SDL3/SDL_surface.h @@ -1194,7 +1194,7 @@ extern SDL_DECLSPEC bool SDLCALL SDL_BlitSurfaceUncheckedScaled(SDL_Surface *src * * \sa SDL_BlitSurfaceScaled */ -extern SDL_DECLSPEC bool SDLCALL SDL_SoftStretch(SDL_Surface *src, const SDL_Rect *srcrect, SDL_Surface *dst, const SDL_Rect *dstrect, SDL_ScaleMode scaleMode); +extern SDL_DECLSPEC bool SDLCALL SDL_StretchSurface(SDL_Surface *src, const SDL_Rect *srcrect, SDL_Surface *dst, const SDL_Rect *dstrect, SDL_ScaleMode scaleMode); /** * Perform a tiled blit to a destination surface, which may be of a different diff --git a/src/camera/SDL_camera.c b/src/camera/SDL_camera.c index 142709f9a68f8..1849d04e8ca77 100644 --- a/src/camera/SDL_camera.c +++ b/src/camera/SDL_camera.c @@ -888,7 +888,7 @@ bool SDL_CameraThreadIterate(SDL_Camera *device) SDL_Surface *srcsurf = acquired; if (device->needs_scaling == -1) { // downscaling? Do it first. -1: downscale, 0: no scaling, 1: upscale SDL_Surface *dstsurf = device->needs_conversion ? device->conversion_surface : output_surface; - SDL_SoftStretch(srcsurf, NULL, dstsurf, NULL, SDL_SCALEMODE_NEAREST); // !!! FIXME: linear scale? letterboxing? + SDL_StretchSurface(srcsurf, NULL, dstsurf, NULL, SDL_SCALEMODE_NEAREST); // !!! FIXME: linear scale? letterboxing? srcsurf = dstsurf; } if (device->needs_conversion) { @@ -899,7 +899,7 @@ bool SDL_CameraThreadIterate(SDL_Camera *device) srcsurf = dstsurf; } if (device->needs_scaling == 1) { // upscaling? Do it last. -1: downscale, 0: no scaling, 1: upscale - SDL_SoftStretch(srcsurf, NULL, output_surface, NULL, SDL_SCALEMODE_NEAREST); // !!! FIXME: linear scale? letterboxing? + SDL_StretchSurface(srcsurf, NULL, output_surface, NULL, SDL_SCALEMODE_NEAREST); // !!! FIXME: linear scale? letterboxing? } // we made a copy, so we can give the driver back its resources. diff --git a/src/dynapi/SDL_dynapi.sym b/src/dynapi/SDL_dynapi.sym index 9c7621b8060ba..73f34843d887b 100644 --- a/src/dynapi/SDL_dynapi.sym +++ b/src/dynapi/SDL_dynapi.sym @@ -1233,7 +1233,7 @@ SDL3_0.0.0 { SDL_AudioStreamDevicePaused; SDL_ClickTrayEntry; SDL_UpdateTrays; - SDL_SoftStretch; + SDL_StretchSurface; # extra symbols go here (don't modify this line) local: *; }; diff --git a/src/dynapi/SDL_dynapi_overrides.h b/src/dynapi/SDL_dynapi_overrides.h index 27051a8c04723..77fd553c471f0 100644 --- a/src/dynapi/SDL_dynapi_overrides.h +++ b/src/dynapi/SDL_dynapi_overrides.h @@ -1258,4 +1258,4 @@ #define SDL_AudioStreamDevicePaused SDL_AudioStreamDevicePaused_REAL #define SDL_ClickTrayEntry SDL_ClickTrayEntry_REAL #define SDL_UpdateTrays SDL_UpdateTrays_REAL -#define SDL_SoftStretch SDL_SoftStretch_REAL +#define SDL_StretchSurface SDL_StretchSurface_REAL diff --git a/src/dynapi/SDL_dynapi_procs.h b/src/dynapi/SDL_dynapi_procs.h index df98958d7818f..e86ac2a325118 100644 --- a/src/dynapi/SDL_dynapi_procs.h +++ b/src/dynapi/SDL_dynapi_procs.h @@ -1266,4 +1266,4 @@ SDL_DYNAPI_PROC(SDL_ThreadState,SDL_GetThreadState,(SDL_Thread *a),(a),return) SDL_DYNAPI_PROC(bool,SDL_AudioStreamDevicePaused,(SDL_AudioStream *a),(a),return) SDL_DYNAPI_PROC(void,SDL_ClickTrayEntry,(SDL_TrayEntry *a),(a),) SDL_DYNAPI_PROC(void,SDL_UpdateTrays,(void),(),) -SDL_DYNAPI_PROC(bool,SDL_SoftStretch,(SDL_Surface *a,const SDL_Rect *b,SDL_Surface *c,const SDL_Rect *d,SDL_ScaleMode e),(a,b,c,d,e),return) +SDL_DYNAPI_PROC(bool,SDL_StretchSurface,(SDL_Surface *a,const SDL_Rect *b,SDL_Surface *c,const SDL_Rect *d,SDL_ScaleMode e),(a,b,c,d,e),return) diff --git a/src/render/SDL_yuv_sw.c b/src/render/SDL_yuv_sw.c index 64250de323892..abe9e16212c3b 100644 --- a/src/render/SDL_yuv_sw.c +++ b/src/render/SDL_yuv_sw.c @@ -385,7 +385,7 @@ bool SDL_SW_CopyYUVToRGB(SDL_SW_YUVTexture *swdata, const SDL_Rect *srcrect, SDL } if (stretch) { SDL_Rect rect = *srcrect; - return SDL_SoftStretch(swdata->stretch, &rect, swdata->display, NULL, SDL_SCALEMODE_NEAREST); + return SDL_StretchSurface(swdata->stretch, &rect, swdata->display, NULL, SDL_SCALEMODE_NEAREST); } else { return true; } diff --git a/src/video/SDL_stretch.c b/src/video/SDL_stretch.c index acdc63bd168b1..c893cc34595ef 100644 --- a/src/video/SDL_stretch.c +++ b/src/video/SDL_stretch.c @@ -22,10 +22,10 @@ #include "SDL_surface_c.h" -static bool SDL_LowerSoftStretchNearest(SDL_Surface *src, const SDL_Rect *srcrect, SDL_Surface *dst, const SDL_Rect *dstrect); -static bool SDL_LowerSoftStretchLinear(SDL_Surface *src, const SDL_Rect *srcrect, SDL_Surface *dst, const SDL_Rect *dstrect); +static bool SDL_StretchSurfaceUncheckedNearest(SDL_Surface *src, const SDL_Rect *srcrect, SDL_Surface *dst, const SDL_Rect *dstrect); +static bool SDL_StretchSurfaceUncheckedLinear(SDL_Surface *src, const SDL_Rect *srcrect, SDL_Surface *dst, const SDL_Rect *dstrect); -bool SDL_SoftStretch(SDL_Surface *src, const SDL_Rect *srcrect, SDL_Surface *dst, const SDL_Rect *dstrect, SDL_ScaleMode scaleMode) +bool SDL_StretchSurface(SDL_Surface *src, const SDL_Rect *srcrect, SDL_Surface *dst, const SDL_Rect *dstrect, SDL_ScaleMode scaleMode) { bool result; int src_locked; @@ -46,7 +46,7 @@ bool SDL_SoftStretch(SDL_Surface *src, const SDL_Rect *srcrect, SDL_Surface *dst if (!src_tmp) { return false; } - result = SDL_SoftStretch(src_tmp, srcrect, dst, dstrect, scaleMode); + result = SDL_StretchSurface(src_tmp, srcrect, dst, dstrect, scaleMode); SDL_DestroySurface(src_tmp); return result; } @@ -64,7 +64,7 @@ bool SDL_SoftStretch(SDL_Surface *src, const SDL_Rect *srcrect, SDL_Surface *dst SDL_Surface *src_tmp = SDL_ConvertSurface(src, SDL_PIXELFORMAT_XRGB8888); SDL_Surface *dst_tmp = SDL_CreateSurface(dstrect->w, dstrect->h, SDL_PIXELFORMAT_XRGB8888); if (src_tmp && dst_tmp) { - result = SDL_SoftStretch(src_tmp, srcrect, dst_tmp, NULL, scaleMode); + result = SDL_StretchSurface(src_tmp, srcrect, dst_tmp, NULL, scaleMode); if (result) { result = SDL_ConvertPixelsAndColorspace(dstrect->w, dstrect->h, dst_tmp->format, SDL_COLORSPACE_SRGB, 0, @@ -152,9 +152,9 @@ bool SDL_SoftStretch(SDL_Surface *src, const SDL_Rect *srcrect, SDL_Surface *dst } if (scaleMode == SDL_SCALEMODE_NEAREST) { - result = SDL_LowerSoftStretchNearest(src, srcrect, dst, dstrect); + result = SDL_StretchSurfaceUncheckedNearest(src, srcrect, dst, dstrect); } else { - result = SDL_LowerSoftStretchLinear(src, srcrect, dst, dstrect); + result = SDL_StretchSurfaceUncheckedLinear(src, srcrect, dst, dstrect); } // We need to unlock the surfaces if they're locked @@ -825,7 +825,7 @@ static bool scale_mat_NEON(const Uint32 *src, int src_w, int src_h, int src_pitc } #endif -bool SDL_LowerSoftStretchLinear(SDL_Surface *s, const SDL_Rect *srcrect, SDL_Surface *d, const SDL_Rect *dstrect) +bool SDL_StretchSurfaceUncheckedLinear(SDL_Surface *s, const SDL_Rect *srcrect, SDL_Surface *d, const SDL_Rect *dstrect) { bool result = false; int src_w = srcrect->w; @@ -953,7 +953,7 @@ static bool scale_mat_nearest_4(const Uint32 *src_ptr, int src_w, int src_h, int return true; } -bool SDL_LowerSoftStretchNearest(SDL_Surface *s, const SDL_Rect *srcrect, SDL_Surface *d, const SDL_Rect *dstrect) +bool SDL_StretchSurfaceUncheckedNearest(SDL_Surface *s, const SDL_Rect *srcrect, SDL_Surface *d, const SDL_Rect *dstrect) { int src_w = srcrect->w; int src_h = srcrect->h; diff --git a/src/video/SDL_surface.c b/src/video/SDL_surface.c index 84db8bb44fb17..d8f831c20862c 100644 --- a/src/video/SDL_surface.c +++ b/src/video/SDL_surface.c @@ -1256,7 +1256,7 @@ bool SDL_BlitSurfaceUncheckedScaled(SDL_Surface *src, const SDL_Rect *srcrect, S src->format == dst->format && !SDL_ISPIXELFORMAT_INDEXED(src->format) && SDL_BYTESPERPIXEL(src->format) <= 4) { - return SDL_SoftStretch(src, srcrect, dst, dstrect, SDL_SCALEMODE_NEAREST); + return SDL_StretchSurface(src, srcrect, dst, dstrect, SDL_SCALEMODE_NEAREST); } else if (SDL_BITSPERPIXEL(src->format) < 8) { // Scaling bitmap not yet supported, convert to RGBA for blit bool result = false; @@ -1276,7 +1276,7 @@ bool SDL_BlitSurfaceUncheckedScaled(SDL_Surface *src, const SDL_Rect *srcrect, S SDL_BYTESPERPIXEL(src->format) == 4 && src->format != SDL_PIXELFORMAT_ARGB2101010) { // fast path - return SDL_SoftStretch(src, srcrect, dst, dstrect, SDL_SCALEMODE_LINEAR); + return SDL_StretchSurface(src, srcrect, dst, dstrect, SDL_SCALEMODE_LINEAR); } else if (SDL_BITSPERPIXEL(src->format) < 8) { // Scaling bitmap not yet supported, convert to RGBA for blit bool result = false; @@ -1335,7 +1335,7 @@ bool SDL_BlitSurfaceUncheckedScaled(SDL_Surface *src, const SDL_Rect *srcrect, S if (is_complex_copy_flags || src->format != dst->format) { SDL_Rect tmprect; SDL_Surface *tmp2 = SDL_CreateSurface(dstrect->w, dstrect->h, src->format); - SDL_SoftStretch(src, &srcrect2, tmp2, NULL, SDL_SCALEMODE_LINEAR); + SDL_StretchSurface(src, &srcrect2, tmp2, NULL, SDL_SCALEMODE_LINEAR); SDL_SetSurfaceColorMod(tmp2, r, g, b); SDL_SetSurfaceAlphaMod(tmp2, alpha); @@ -1348,7 +1348,7 @@ bool SDL_BlitSurfaceUncheckedScaled(SDL_Surface *src, const SDL_Rect *srcrect, S result = SDL_BlitSurfaceUnchecked(tmp2, &tmprect, dst, dstrect); SDL_DestroySurface(tmp2); } else { - result = SDL_SoftStretch(src, &srcrect2, dst, dstrect, SDL_SCALEMODE_LINEAR); + result = SDL_StretchSurface(src, &srcrect2, dst, dstrect, SDL_SCALEMODE_LINEAR); } SDL_DestroySurface(tmp1); diff --git a/src/video/SDL_surface_c.h b/src/video/SDL_surface_c.h index 1dc430f541128..27dc88a6251fa 100644 --- a/src/video/SDL_surface_c.h +++ b/src/video/SDL_surface_c.h @@ -88,6 +88,5 @@ extern float SDL_GetSurfaceSDRWhitePoint(SDL_Surface *surface, SDL_Colorspace co extern float SDL_GetDefaultHDRHeadroom(SDL_Colorspace colorspace); extern float SDL_GetSurfaceHDRHeadroom(SDL_Surface *surface, SDL_Colorspace colorspace); extern SDL_Surface *SDL_GetSurfaceImage(SDL_Surface *surface, float display_scale); -extern bool SDL_SoftStretch(SDL_Surface *src, const SDL_Rect *srcrect, SDL_Surface *dst, const SDL_Rect *dstrect, SDL_ScaleMode scaleMode); #endif // SDL_surface_c_h_ diff --git a/src/video/windows/SDL_windowsshape.c b/src/video/windows/SDL_windowsshape.c index ae6b95106112f..2c3f1cc2b6e1c 100644 --- a/src/video/windows/SDL_windowsshape.c +++ b/src/video/windows/SDL_windowsshape.c @@ -82,7 +82,7 @@ bool WIN_UpdateWindowShape(SDL_VideoDevice *_this, SDL_Window *window, SDL_Surfa if (!stretched) { return false; } - if (!SDL_SoftStretch(shape, NULL, stretched, NULL, SDL_SCALEMODE_LINEAR)) { + if (!SDL_StretchSurface(shape, NULL, stretched, NULL, SDL_SCALEMODE_LINEAR)) { SDL_DestroySurface(stretched); return false; } diff --git a/src/video/x11/SDL_x11shape.c b/src/video/x11/SDL_x11shape.c index 710eb3299f79f..92c44f96ee5da 100644 --- a/src/video/x11/SDL_x11shape.c +++ b/src/video/x11/SDL_x11shape.c @@ -71,7 +71,7 @@ bool X11_UpdateWindowShape(SDL_VideoDevice *_this, SDL_Window *window, SDL_Surfa if (!stretched) { return false; } - if (!SDL_SoftStretch(shape, NULL, stretched, NULL, SDL_SCALEMODE_LINEAR)) { + if (!SDL_StretchSurface(shape, NULL, stretched, NULL, SDL_SCALEMODE_LINEAR)) { SDL_DestroySurface(stretched); return false; } From ec959a4349eca93f52765ea70ea6967eceb92300 Mon Sep 17 00:00:00 2001 From: SDL Wiki Bot Date: Mon, 3 Feb 2025 16:52:24 +0000 Subject: [PATCH 300/340] Sync SDL3 wiki -> header [ci skip] --- include/SDL3/SDL_surface.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/SDL3/SDL_surface.h b/include/SDL3/SDL_surface.h index 59691c479ec3f..47b90c1bd47c5 100644 --- a/include/SDL3/SDL_surface.h +++ b/include/SDL3/SDL_surface.h @@ -1190,7 +1190,7 @@ extern SDL_DECLSPEC bool SDLCALL SDL_BlitSurfaceUncheckedScaled(SDL_Surface *src * threads at once. It is safe to use the same source surface * from multiple threads. * - * \since This function is available since SDL 3.2.0. + * \since This function is available since SDL 3.4.0. * * \sa SDL_BlitSurfaceScaled */ From 6243a06539931882646642543e30fa26d33224cb Mon Sep 17 00:00:00 2001 From: Sam Lantinga Date: Mon, 3 Feb 2025 09:00:14 -0800 Subject: [PATCH 301/340] Call the windows message hook for WM_ENTERSIZEMOVE and WM_ENTERMENULOOP Fixes https://github.com/libsdl-org/SDL/issues/12169 --- src/video/windows/SDL_windowsevents.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/video/windows/SDL_windowsevents.c b/src/video/windows/SDL_windowsevents.c index c9bf2a4989654..64765dc53a2e2 100644 --- a/src/video/windows/SDL_windowsevents.c +++ b/src/video/windows/SDL_windowsevents.c @@ -1721,6 +1721,10 @@ LRESULT CALLBACK WIN_WindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lPara case WM_ENTERSIZEMOVE: case WM_ENTERMENULOOP: { + if (!DispatchModalLoopMessageHook(&hwnd, &msg, &wParam, &lParam)) { + return 0; + } + ++data->in_modal_loop; if (data->in_modal_loop == 1) { data->initial_size_rect.left = data->window->x; From eac07bda0aa89a1239935ae3facec5a63f34225d Mon Sep 17 00:00:00 2001 From: Sam Lantinga Date: Mon, 3 Feb 2025 12:37:35 -0800 Subject: [PATCH 302/340] Sort the controller lists by VID/PID --- src/joystick/SDL_joystick.c | 52 ++++++++++++++++++------------------- 1 file changed, 26 insertions(+), 26 deletions(-) diff --git a/src/joystick/SDL_joystick.c b/src/joystick/SDL_joystick.c index 224f07fa581d9..6633bd86d80b3 100644 --- a/src/joystick/SDL_joystick.c +++ b/src/joystick/SDL_joystick.c @@ -287,9 +287,9 @@ static SDL_vidpid_list blacklist_devices = { static Uint32 initial_flightstick_devices[] = { MAKE_VIDPID(0x044f, 0x0402), // HOTAS Warthog Joystick - MAKE_VIDPID(0x0738, 0x2221), // Saitek Pro Flight X-56 Rhino Stick MAKE_VIDPID(0x044f, 0xb10a), // ThrustMaster, Inc. T.16000M Joystick MAKE_VIDPID(0x046d, 0xc215), // Logitech Extreme 3D + MAKE_VIDPID(0x0738, 0x2221), // Saitek Pro Flight X-56 Rhino Stick MAKE_VIDPID(0x231d, 0x0126), // Gunfighter Mk.III 'Space Combat Edition' (right) MAKE_VIDPID(0x231d, 0x0127), // Gunfighter Mk.III 'Space Combat Edition' (left) MAKE_VIDPID(0x362c, 0x0001), // Yawman Arrow @@ -313,10 +313,10 @@ static SDL_vidpid_list gamecube_devices = { }; static Uint32 initial_rog_gamepad_mice[] = { - MAKE_VIDPID(0x0b05, 0x1906), // ROG Pugio II - MAKE_VIDPID(0x0b05, 0x1958), // ROG Chakram Core Mouse MAKE_VIDPID(0x0b05, 0x18e3), // ROG Chakram (wired) Mouse MAKE_VIDPID(0x0b05, 0x18e5), // ROG Chakram (wireless) Mouse + MAKE_VIDPID(0x0b05, 0x1906), // ROG Pugio II + MAKE_VIDPID(0x0b05, 0x1958), // ROG Chakram Core Mouse MAKE_VIDPID(0x0b05, 0x1a18), // ROG Chakram X (wired) Mouse MAKE_VIDPID(0x0b05, 0x1a1a), // ROG Chakram X (wireless) Mouse MAKE_VIDPID(0x0b05, 0x1a1c), // ROG Chakram X (Bluetooth) Mouse @@ -341,37 +341,37 @@ static SDL_vidpid_list throttle_devices = { static Uint32 initial_wheel_devices[] = { MAKE_VIDPID(0x0079, 0x1864), // DragonRise Inc. Wired Wheel (active mode) (also known as PXN V900 (PS3), Superdrive SV-750, or a Genesis Seaborg 400) - MAKE_VIDPID(0x046d, 0xc294), // Logitech generic wheel - MAKE_VIDPID(0x046d, 0xc295), // Logitech Momo Force - MAKE_VIDPID(0x046d, 0xc298), // Logitech Driving Force Pro - MAKE_VIDPID(0x046d, 0xc299), // Logitech G25 - MAKE_VIDPID(0x046d, 0xc29a), // Logitech Driving Force GT - MAKE_VIDPID(0x046d, 0xc29b), // Logitech G27 + MAKE_VIDPID(0x044f, 0xb65d), // Thrustmaster Wheel FFB + MAKE_VIDPID(0x044f, 0xb65e), // Thrustmaster T500RS + MAKE_VIDPID(0x044f, 0xb664), // Thrustmaster TX (initial mode) + MAKE_VIDPID(0x044f, 0xb669), // Thrustmaster TX (active mode) + MAKE_VIDPID(0x044f, 0xb66d), // Thrustmaster T300RS (PS4 mode) + MAKE_VIDPID(0x044f, 0xb66d), // Thrustmaster Wheel FFB + MAKE_VIDPID(0x044f, 0xb66e), // Thrustmaster T300RS (normal mode) + MAKE_VIDPID(0x044f, 0xb66f), // Thrustmaster T300RS (advanced mode) + MAKE_VIDPID(0x044f, 0xb677), // Thrustmaster T150 + MAKE_VIDPID(0x044f, 0xb67f), // Thrustmaster TMX + MAKE_VIDPID(0x044f, 0xb691), // Thrustmaster TS-XW (initial mode) + MAKE_VIDPID(0x044f, 0xb692), // Thrustmaster TS-XW (active mode) + MAKE_VIDPID(0x044f, 0xb696), // Thrustmaster T248 MAKE_VIDPID(0x046d, 0xc24f), // Logitech G29 (PS3) MAKE_VIDPID(0x046d, 0xc260), // Logitech G29 (PS4) MAKE_VIDPID(0x046d, 0xc261), // Logitech G920 (initial mode) MAKE_VIDPID(0x046d, 0xc262), // Logitech G920 (active mode) + MAKE_VIDPID(0x046d, 0xc266), // Logitech G923 for Playstation 4 and PC (PC mode) + MAKE_VIDPID(0x046d, 0xc267), // Logitech G923 for Playstation 4 and PC (PS4 mode) MAKE_VIDPID(0x046d, 0xc268), // Logitech PRO Racing Wheel (PC mode) MAKE_VIDPID(0x046d, 0xc269), // Logitech PRO Racing Wheel (PS4/PS5 mode) - MAKE_VIDPID(0x046d, 0xc272), // Logitech PRO Racing Wheel for Xbox (PC mode) MAKE_VIDPID(0x046d, 0xc26d), // Logitech G923 (Xbox) MAKE_VIDPID(0x046d, 0xc26e), // Logitech G923 - MAKE_VIDPID(0x046d, 0xc266), // Logitech G923 for Playstation 4 and PC (PC mode) - MAKE_VIDPID(0x046d, 0xc267), // Logitech G923 for Playstation 4 and PC (PS4 mode) + MAKE_VIDPID(0x046d, 0xc272), // Logitech PRO Racing Wheel for Xbox (PC mode) + MAKE_VIDPID(0x046d, 0xc294), // Logitech generic wheel + MAKE_VIDPID(0x046d, 0xc295), // Logitech Momo Force + MAKE_VIDPID(0x046d, 0xc298), // Logitech Driving Force Pro + MAKE_VIDPID(0x046d, 0xc299), // Logitech G25 + MAKE_VIDPID(0x046d, 0xc29a), // Logitech Driving Force GT + MAKE_VIDPID(0x046d, 0xc29b), // Logitech G27 MAKE_VIDPID(0x046d, 0xca03), // Logitech Momo Racing - MAKE_VIDPID(0x044f, 0xb65d), // Thrustmaster Wheel FFB - MAKE_VIDPID(0x044f, 0xb66d), // Thrustmaster Wheel FFB - MAKE_VIDPID(0x044f, 0xb677), // Thrustmaster T150 - MAKE_VIDPID(0x044f, 0xb696), // Thrustmaster T248 - MAKE_VIDPID(0x044f, 0xb66e), // Thrustmaster T300RS (normal mode) - MAKE_VIDPID(0x044f, 0xb66f), // Thrustmaster T300RS (advanced mode) - MAKE_VIDPID(0x044f, 0xb66d), // Thrustmaster T300RS (PS4 mode) - MAKE_VIDPID(0x044f, 0xb65e), // Thrustmaster T500RS - MAKE_VIDPID(0x044f, 0xb664), // Thrustmaster TX (initial mode) - MAKE_VIDPID(0x044f, 0xb669), // Thrustmaster TX (active mode) - MAKE_VIDPID(0x044f, 0xb67f), // Thrustmaster TMX - MAKE_VIDPID(0x044f, 0xb691), // Thrustmaster TS-XW (initial mode) - MAKE_VIDPID(0x044f, 0xb692), // Thrustmaster TS-XW (active mode) MAKE_VIDPID(0x0483, 0x0522), // Simagic Wheelbase (including M10, Alpha Mini, Alpha, Alpha U) MAKE_VIDPID(0x0483, 0xa355), // VRS DirectForce Pro Wheel Base MAKE_VIDPID(0x0eb7, 0x0001), // Fanatec ClubSport Wheel Base V2 @@ -410,8 +410,8 @@ static SDL_vidpid_list wheel_devices = { }; static Uint32 initial_zero_centered_devices[] = { - MAKE_VIDPID(0x0e8f, 0x3013), // HuiJia SNES USB adapter MAKE_VIDPID(0x05a0, 0x3232), // 8Bitdo Zero Gamepad + MAKE_VIDPID(0x0e8f, 0x3013), // HuiJia SNES USB adapter }; static SDL_vidpid_list zero_centered_devices = { SDL_HINT_JOYSTICK_ZERO_CENTERED_DEVICES, 0, 0, NULL, From 84bc2abdad291552da9d9e5f9e0a3d1791386dda Mon Sep 17 00:00:00 2001 From: Sam Lantinga Date: Mon, 3 Feb 2025 13:11:02 -0800 Subject: [PATCH 303/340] Corrected the entry for the PXN V900 racing wheel --- src/joystick/controller_list.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/joystick/controller_list.h b/src/joystick/controller_list.h index 5594d2bd6c023..e0cc22fc5c811 100644 --- a/src/joystick/controller_list.h +++ b/src/joystick/controller_list.h @@ -455,6 +455,7 @@ static const ControllerDescription_t arrControllers[] = { { MAKE_CONTROLLER_ID( 0x03eb, 0xff01 ), k_eControllerType_XBox360Controller, NULL }, // Unknown Controller { MAKE_CONTROLLER_ID( 0x0c12, 0x0ef8 ), k_eControllerType_XBox360Controller, NULL }, // Homemade fightstick based on brook pcb (with XInput driver??) { MAKE_CONTROLLER_ID( 0x046d, 0x1000 ), k_eControllerType_XBox360Controller, NULL }, // Unknown Controller + { MAKE_CONTROLLER_ID( 0x11ff, 0x0511 ), k_eControllerType_XBox360Controller, NULL }, // PXN V900 { MAKE_CONTROLLER_ID( 0x1345, 0x6006 ), k_eControllerType_XBox360Controller, NULL }, // Unknown Controller { MAKE_CONTROLLER_ID( 0x056e, 0x2012 ), k_eControllerType_XBox360Controller, NULL }, // Unknown Controller @@ -488,7 +489,6 @@ static const ControllerDescription_t arrControllers[] = { // Added from Minidumps 10-9-19 { MAKE_CONTROLLER_ID( 0x0, 0x6686 ), k_eControllerType_XBoxOneController, NULL }, // Unknown Controller - { MAKE_CONTROLLER_ID( 0x11ff, 0x511 ), k_eControllerType_XBoxOneController, NULL }, // Unknown Controller { MAKE_CONTROLLER_ID( 0x12ab, 0x304 ), k_eControllerType_XBoxOneController, NULL }, // Unknown Controller { MAKE_CONTROLLER_ID( 0x1430, 0x291 ), k_eControllerType_XBoxOneController, NULL }, // Unknown Controller { MAKE_CONTROLLER_ID( 0x1430, 0x2a9 ), k_eControllerType_XBoxOneController, NULL }, // Unknown Controller From a8a2874ef45caa8eceb257467d1cc9d7a28fd296 Mon Sep 17 00:00:00 2001 From: Sam Lantinga Date: Mon, 3 Feb 2025 13:26:04 -0800 Subject: [PATCH 304/340] Added distinct VID/PIDs for the PS4 vs Xbox eSwap Pro controllers --- src/joystick/SDL_joystick.c | 2 +- src/joystick/usb_ids.h | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/joystick/SDL_joystick.c b/src/joystick/SDL_joystick.c index 6633bd86d80b3..a8bbe0c23f71b 100644 --- a/src/joystick/SDL_joystick.c +++ b/src/joystick/SDL_joystick.c @@ -2963,7 +2963,7 @@ bool SDL_IsJoystickXboxSeriesX(Uint16 vendor_id, Uint16 product_id) } } if (vendor_id == USB_VENDOR_THRUSTMASTER) { - if (product_id == USB_PRODUCT_THRUSTMASTER_ESWAPX_PRO) { + if (product_id == USB_PRODUCT_THRUSTMASTER_ESWAPX_PRO_SERIES_X) { return true; } } diff --git a/src/joystick/usb_ids.h b/src/joystick/usb_ids.h index c978c1988ef25..794beb864b9c5 100644 --- a/src/joystick/usb_ids.h +++ b/src/joystick/usb_ids.h @@ -123,7 +123,8 @@ #define USB_PRODUCT_SONY_DS5 0x0ce6 #define USB_PRODUCT_SONY_DS5_EDGE 0x0df2 #define USB_PRODUCT_SWITCH_RETROBIT_CONTROLLER 0x0575 -#define USB_PRODUCT_THRUSTMASTER_ESWAPX_PRO 0xd012 +#define USB_PRODUCT_THRUSTMASTER_ESWAPX_PRO_PS4 0xd00e +#define USB_PRODUCT_THRUSTMASTER_ESWAPX_PRO_SERIES_X 0xd012 #define USB_PRODUCT_TURTLE_BEACH_SERIES_X_REACT_R 0x7013 #define USB_PRODUCT_TURTLE_BEACH_SERIES_X_RECON 0x7009 #define USB_PRODUCT_VALVE_STEAM_CONTROLLER_DONGLE 0x1142 From 94409d35047b7c706fa9688b62de76da7791379b Mon Sep 17 00:00:00 2001 From: Sam Lantinga Date: Mon, 3 Feb 2025 16:49:29 -0800 Subject: [PATCH 305/340] Added Switch Input-only controller entries for Zuiki MasCon controller for Nintendo Switch. The device string indicates RED on the one I have and is PIDs 0003 and some other posts online say 0001 for the normal model, so I'll try 0001-0003 to get all 3 color variants --- src/joystick/controller_list.h | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/joystick/controller_list.h b/src/joystick/controller_list.h index e0cc22fc5c811..5a62ece1c37f1 100644 --- a/src/joystick/controller_list.h +++ b/src/joystick/controller_list.h @@ -591,6 +591,9 @@ static const ControllerDescription_t arrControllers[] = { { MAKE_CONTROLLER_ID( 0x20d6, 0xa715 ), k_eControllerType_SwitchInputOnlyController, NULL }, // Power A Fusion Wireless Arcade Stick (USB Mode) Over BT is shows up as 057e 2009 { MAKE_CONTROLLER_ID( 0x20d6, 0xa716 ), k_eControllerType_SwitchInputOnlyController, NULL }, // PowerA Nintendo Switch Fusion Pro Controller - USB requires toggling switch on back of device { MAKE_CONTROLLER_ID( 0x20d6, 0xa718 ), k_eControllerType_SwitchInputOnlyController, NULL }, // PowerA Nintendo Switch Nano Wired Controller + { MAKE_CONTROLLER_ID( 0x33dd, 0x0001 ), k_eControllerType_SwitchInputOnlyController, NULL }, // ZUIKI MasCon for Nintendo Switch Black + { MAKE_CONTROLLER_ID( 0x33dd, 0x0002 ), k_eControllerType_SwitchInputOnlyController, NULL }, // ZUIKI MasCon for Nintendo Switch ?? + { MAKE_CONTROLLER_ID( 0x33dd, 0x0003 ), k_eControllerType_SwitchInputOnlyController, NULL }, // ZUIKI MasCon for Nintendo Switch Red // Valve products { MAKE_CONTROLLER_ID( 0x0000, 0x11fb ), k_eControllerType_MobileTouch, NULL }, // Streaming mobile touch virtual controls From 8ccf85c59e89c7e2f6896608ffc4423995dc4fb0 Mon Sep 17 00:00:00 2001 From: Petar Popovic Date: Tue, 4 Feb 2025 01:14:56 +0100 Subject: [PATCH 306/340] Formatting spaces around pointer symbol. --- include/SDL3/SDL_gpu.h | 30 +++++++++++++++--------------- include/SDL3/SDL_hints.h | 2 +- include/SDL3/SDL_mouse.h | 6 +++--- include/SDL3/SDL_process.h | 8 ++++---- include/SDL3/SDL_test_common.h | 2 +- include/SDL3/SDL_thread.h | 2 +- include/SDL3/SDL_tray.h | 22 +++++++++++----------- include/SDL3/SDL_vulkan.h | 2 +- src/core/SDL_core_unsupported.c | 12 ++++++------ src/stdlib/SDL_malloc.c | 8 ++++---- src/stdlib/SDL_qsort.c | 8 ++++---- src/test/SDL_test_memory.c | 6 +++--- src/thread/SDL_thread.c | 2 +- src/video/SDL_video.c | 2 +- test/testdialog.c | 2 +- 15 files changed, 57 insertions(+), 57 deletions(-) diff --git a/include/SDL3/SDL_gpu.h b/include/SDL3/SDL_gpu.h index 177a01f8d6d99..2db585c6fbc15 100644 --- a/include/SDL3/SDL_gpu.h +++ b/include/SDL3/SDL_gpu.h @@ -2112,7 +2112,7 @@ extern SDL_DECLSPEC bool SDLCALL SDL_GPUSupportsProperties( * \sa SDL_DestroyGPUDevice * \sa SDL_GPUSupportsShaderFormats */ -extern SDL_DECLSPEC SDL_GPUDevice *SDLCALL SDL_CreateGPUDevice( +extern SDL_DECLSPEC SDL_GPUDevice * SDLCALL SDL_CreateGPUDevice( SDL_GPUShaderFormat format_flags, bool debug_mode, const char *name); @@ -2160,7 +2160,7 @@ extern SDL_DECLSPEC SDL_GPUDevice *SDLCALL SDL_CreateGPUDevice( * \sa SDL_DestroyGPUDevice * \sa SDL_GPUSupportsProperties */ -extern SDL_DECLSPEC SDL_GPUDevice *SDLCALL SDL_CreateGPUDeviceWithProperties( +extern SDL_DECLSPEC SDL_GPUDevice * SDLCALL SDL_CreateGPUDeviceWithProperties( SDL_PropertiesID props); #define SDL_PROP_GPU_DEVICE_CREATE_DEBUGMODE_BOOLEAN "SDL.gpu.device.create.debugmode" @@ -2283,7 +2283,7 @@ extern SDL_DECLSPEC SDL_GPUShaderFormat SDLCALL SDL_GetGPUShaderFormats(SDL_GPUD * \sa SDL_BindGPUComputePipeline * \sa SDL_ReleaseGPUComputePipeline */ -extern SDL_DECLSPEC SDL_GPUComputePipeline *SDLCALL SDL_CreateGPUComputePipeline( +extern SDL_DECLSPEC SDL_GPUComputePipeline * SDLCALL SDL_CreateGPUComputePipeline( SDL_GPUDevice *device, const SDL_GPUComputePipelineCreateInfo *createinfo); @@ -2310,7 +2310,7 @@ extern SDL_DECLSPEC SDL_GPUComputePipeline *SDLCALL SDL_CreateGPUComputePipeline * \sa SDL_BindGPUGraphicsPipeline * \sa SDL_ReleaseGPUGraphicsPipeline */ -extern SDL_DECLSPEC SDL_GPUGraphicsPipeline *SDLCALL SDL_CreateGPUGraphicsPipeline( +extern SDL_DECLSPEC SDL_GPUGraphicsPipeline * SDLCALL SDL_CreateGPUGraphicsPipeline( SDL_GPUDevice *device, const SDL_GPUGraphicsPipelineCreateInfo *createinfo); @@ -2337,7 +2337,7 @@ extern SDL_DECLSPEC SDL_GPUGraphicsPipeline *SDLCALL SDL_CreateGPUGraphicsPipeli * \sa SDL_BindGPUFragmentSamplers * \sa SDL_ReleaseGPUSampler */ -extern SDL_DECLSPEC SDL_GPUSampler *SDLCALL SDL_CreateGPUSampler( +extern SDL_DECLSPEC SDL_GPUSampler * SDLCALL SDL_CreateGPUSampler( SDL_GPUDevice *device, const SDL_GPUSamplerCreateInfo *createinfo); @@ -2416,7 +2416,7 @@ extern SDL_DECLSPEC SDL_GPUSampler *SDLCALL SDL_CreateGPUSampler( * \sa SDL_CreateGPUGraphicsPipeline * \sa SDL_ReleaseGPUShader */ -extern SDL_DECLSPEC SDL_GPUShader *SDLCALL SDL_CreateGPUShader( +extern SDL_DECLSPEC SDL_GPUShader * SDLCALL SDL_CreateGPUShader( SDL_GPUDevice *device, const SDL_GPUShaderCreateInfo *createinfo); @@ -2477,7 +2477,7 @@ extern SDL_DECLSPEC SDL_GPUShader *SDLCALL SDL_CreateGPUShader( * \sa SDL_ReleaseGPUTexture * \sa SDL_GPUTextureSupportsFormat */ -extern SDL_DECLSPEC SDL_GPUTexture *SDLCALL SDL_CreateGPUTexture( +extern SDL_DECLSPEC SDL_GPUTexture * SDLCALL SDL_CreateGPUTexture( SDL_GPUDevice *device, const SDL_GPUTextureCreateInfo *createinfo); @@ -2533,7 +2533,7 @@ extern SDL_DECLSPEC SDL_GPUTexture *SDLCALL SDL_CreateGPUTexture( * \sa SDL_DispatchGPUComputeIndirect * \sa SDL_ReleaseGPUBuffer */ -extern SDL_DECLSPEC SDL_GPUBuffer *SDLCALL SDL_CreateGPUBuffer( +extern SDL_DECLSPEC SDL_GPUBuffer * SDLCALL SDL_CreateGPUBuffer( SDL_GPUDevice *device, const SDL_GPUBufferCreateInfo *createinfo); @@ -2566,7 +2566,7 @@ extern SDL_DECLSPEC SDL_GPUBuffer *SDLCALL SDL_CreateGPUBuffer( * \sa SDL_DownloadFromGPUTexture * \sa SDL_ReleaseGPUTransferBuffer */ -extern SDL_DECLSPEC SDL_GPUTransferBuffer *SDLCALL SDL_CreateGPUTransferBuffer( +extern SDL_DECLSPEC SDL_GPUTransferBuffer * SDLCALL SDL_CreateGPUTransferBuffer( SDL_GPUDevice *device, const SDL_GPUTransferBufferCreateInfo *createinfo); @@ -2794,7 +2794,7 @@ extern SDL_DECLSPEC void SDLCALL SDL_ReleaseGPUGraphicsPipeline( * \sa SDL_SubmitGPUCommandBuffer * \sa SDL_SubmitGPUCommandBufferAndAcquireFence */ -extern SDL_DECLSPEC SDL_GPUCommandBuffer *SDLCALL SDL_AcquireGPUCommandBuffer( +extern SDL_DECLSPEC SDL_GPUCommandBuffer * SDLCALL SDL_AcquireGPUCommandBuffer( SDL_GPUDevice *device); /* Uniform Data */ @@ -2892,7 +2892,7 @@ extern SDL_DECLSPEC void SDLCALL SDL_PushGPUComputeUniformData( * * \sa SDL_EndGPURenderPass */ -extern SDL_DECLSPEC SDL_GPURenderPass *SDLCALL SDL_BeginGPURenderPass( +extern SDL_DECLSPEC SDL_GPURenderPass * SDLCALL SDL_BeginGPURenderPass( SDL_GPUCommandBuffer *command_buffer, const SDL_GPUColorTargetInfo *color_target_infos, Uint32 num_color_targets, @@ -3299,7 +3299,7 @@ extern SDL_DECLSPEC void SDLCALL SDL_EndGPURenderPass( * * \sa SDL_EndGPUComputePass */ -extern SDL_DECLSPEC SDL_GPUComputePass *SDLCALL SDL_BeginGPUComputePass( +extern SDL_DECLSPEC SDL_GPUComputePass * SDLCALL SDL_BeginGPUComputePass( SDL_GPUCommandBuffer *command_buffer, const SDL_GPUStorageTextureReadWriteBinding *storage_texture_bindings, Uint32 num_storage_texture_bindings, @@ -3470,7 +3470,7 @@ extern SDL_DECLSPEC void SDLCALL SDL_EndGPUComputePass( * * \since This function is available since SDL 3.2.0. */ -extern SDL_DECLSPEC void *SDLCALL SDL_MapGPUTransferBuffer( +extern SDL_DECLSPEC void * SDLCALL SDL_MapGPUTransferBuffer( SDL_GPUDevice *device, SDL_GPUTransferBuffer *transfer_buffer, bool cycle); @@ -3501,7 +3501,7 @@ extern SDL_DECLSPEC void SDLCALL SDL_UnmapGPUTransferBuffer( * * \since This function is available since SDL 3.2.0. */ -extern SDL_DECLSPEC SDL_GPUCopyPass *SDLCALL SDL_BeginGPUCopyPass( +extern SDL_DECLSPEC SDL_GPUCopyPass * SDLCALL SDL_BeginGPUCopyPass( SDL_GPUCommandBuffer *command_buffer); /** @@ -3993,7 +3993,7 @@ extern SDL_DECLSPEC bool SDLCALL SDL_SubmitGPUCommandBuffer( * \sa SDL_SubmitGPUCommandBuffer * \sa SDL_ReleaseGPUFence */ -extern SDL_DECLSPEC SDL_GPUFence *SDLCALL SDL_SubmitGPUCommandBufferAndAcquireFence( +extern SDL_DECLSPEC SDL_GPUFence * SDLCALL SDL_SubmitGPUCommandBufferAndAcquireFence( SDL_GPUCommandBuffer *command_buffer); /** diff --git a/include/SDL3/SDL_hints.h b/include/SDL3/SDL_hints.h index 8f2d074d19ad0..f7d5f535a6705 100644 --- a/include/SDL3/SDL_hints.h +++ b/include/SDL3/SDL_hints.h @@ -4360,7 +4360,7 @@ extern SDL_DECLSPEC void SDLCALL SDL_ResetHints(void); * \sa SDL_SetHint * \sa SDL_SetHintWithPriority */ -extern SDL_DECLSPEC const char *SDLCALL SDL_GetHint(const char *name); +extern SDL_DECLSPEC const char * SDLCALL SDL_GetHint(const char *name); /** * Get the boolean value of a hint variable. diff --git a/include/SDL3/SDL_mouse.h b/include/SDL3/SDL_mouse.h index 18856e20e97ac..864135d2be09a 100644 --- a/include/SDL3/SDL_mouse.h +++ b/include/SDL3/SDL_mouse.h @@ -353,7 +353,7 @@ extern SDL_DECLSPEC SDL_MouseButtonFlags SDLCALL SDL_GetRelativeMouseState(float * * \sa SDL_WarpMouseGlobal */ -extern SDL_DECLSPEC void SDLCALL SDL_WarpMouseInWindow(SDL_Window * window, +extern SDL_DECLSPEC void SDLCALL SDL_WarpMouseInWindow(SDL_Window *window, float x, float y); /** @@ -514,8 +514,8 @@ extern SDL_DECLSPEC bool SDLCALL SDL_CaptureMouse(bool enabled); * \sa SDL_DestroyCursor * \sa SDL_SetCursor */ -extern SDL_DECLSPEC SDL_Cursor * SDLCALL SDL_CreateCursor(const Uint8 * data, - const Uint8 * mask, +extern SDL_DECLSPEC SDL_Cursor * SDLCALL SDL_CreateCursor(const Uint8 *data, + const Uint8 *mask, int w, int h, int hot_x, int hot_y); diff --git a/include/SDL3/SDL_process.h b/include/SDL3/SDL_process.h index bd6d6a4546ef0..511b2f9c51f96 100644 --- a/include/SDL3/SDL_process.h +++ b/include/SDL3/SDL_process.h @@ -103,7 +103,7 @@ typedef struct SDL_Process SDL_Process; * \sa SDL_WaitProcess * \sa SDL_DestroyProcess */ -extern SDL_DECLSPEC SDL_Process *SDLCALL SDL_CreateProcess(const char * const *args, bool pipe_stdio); +extern SDL_DECLSPEC SDL_Process * SDLCALL SDL_CreateProcess(const char * const *args, bool pipe_stdio); /** * Description of where standard I/O should be directed when creating a @@ -215,7 +215,7 @@ typedef enum SDL_ProcessIO * \sa SDL_WaitProcess * \sa SDL_DestroyProcess */ -extern SDL_DECLSPEC SDL_Process *SDLCALL SDL_CreateProcessWithProperties(SDL_PropertiesID props); +extern SDL_DECLSPEC SDL_Process * SDLCALL SDL_CreateProcessWithProperties(SDL_PropertiesID props); #define SDL_PROP_PROCESS_CREATE_ARGS_POINTER "SDL.process.create.args" #define SDL_PROP_PROCESS_CREATE_ENVIRONMENT_POINTER "SDL.process.create.environment" @@ -320,7 +320,7 @@ extern SDL_DECLSPEC void * SDLCALL SDL_ReadProcess(SDL_Process *process, size_t * \sa SDL_CreateProcessWithProperties * \sa SDL_GetProcessOutput */ -extern SDL_DECLSPEC SDL_IOStream *SDLCALL SDL_GetProcessInput(SDL_Process *process); +extern SDL_DECLSPEC SDL_IOStream * SDLCALL SDL_GetProcessInput(SDL_Process *process); /** * Get the SDL_IOStream associated with process standard output. @@ -344,7 +344,7 @@ extern SDL_DECLSPEC SDL_IOStream *SDLCALL SDL_GetProcessInput(SDL_Process *proce * \sa SDL_CreateProcessWithProperties * \sa SDL_GetProcessInput */ -extern SDL_DECLSPEC SDL_IOStream *SDLCALL SDL_GetProcessOutput(SDL_Process *process); +extern SDL_DECLSPEC SDL_IOStream * SDLCALL SDL_GetProcessOutput(SDL_Process *process); /** * Stop a process. diff --git a/include/SDL3/SDL_test_common.h b/include/SDL3/SDL_test_common.h index 3ab1ad01c23d0..91efe8ac34301 100644 --- a/include/SDL3/SDL_test_common.h +++ b/include/SDL3/SDL_test_common.h @@ -177,7 +177,7 @@ extern "C" { * * \returns a newly allocated common state object. */ -SDLTest_CommonState *SDLCALL SDLTest_CommonCreateState(char **argv, SDL_InitFlags flags); +SDLTest_CommonState * SDLCALL SDLTest_CommonCreateState(char **argv, SDL_InitFlags flags); /** * Free the common state object. diff --git a/include/SDL3/SDL_thread.h b/include/SDL3/SDL_thread.h index 277535fcb65cf..e981b54293210 100644 --- a/include/SDL3/SDL_thread.h +++ b/include/SDL3/SDL_thread.h @@ -139,7 +139,7 @@ typedef enum SDL_ThreadState * * \since This datatype is available since SDL 3.2.0. */ -typedef int (SDLCALL * SDL_ThreadFunction) (void *data); +typedef int (SDLCALL *SDL_ThreadFunction) (void *data); #ifdef SDL_WIKI_DOCUMENTATION_SECTION diff --git a/include/SDL3/SDL_tray.h b/include/SDL3/SDL_tray.h index 0b05db25b1c01..c096e003fb4f6 100644 --- a/include/SDL3/SDL_tray.h +++ b/include/SDL3/SDL_tray.h @@ -118,7 +118,7 @@ typedef void (SDLCALL *SDL_TrayCallback)(void *userdata, SDL_TrayEntry *entry); * \sa SDL_GetTrayMenu * \sa SDL_DestroyTray */ -extern SDL_DECLSPEC SDL_Tray *SDLCALL SDL_CreateTray(SDL_Surface *icon, const char *tooltip); +extern SDL_DECLSPEC SDL_Tray * SDLCALL SDL_CreateTray(SDL_Surface *icon, const char *tooltip); /** * Updates the system tray icon's icon. @@ -172,7 +172,7 @@ extern SDL_DECLSPEC void SDLCALL SDL_SetTrayTooltip(SDL_Tray *tray, const char * * \sa SDL_GetTrayMenu * \sa SDL_GetTrayMenuParentTray */ -extern SDL_DECLSPEC SDL_TrayMenu *SDLCALL SDL_CreateTrayMenu(SDL_Tray *tray); +extern SDL_DECLSPEC SDL_TrayMenu * SDLCALL SDL_CreateTrayMenu(SDL_Tray *tray); /** * Create a submenu for a system tray entry. @@ -196,7 +196,7 @@ extern SDL_DECLSPEC SDL_TrayMenu *SDLCALL SDL_CreateTrayMenu(SDL_Tray *tray); * \sa SDL_GetTraySubmenu * \sa SDL_GetTrayMenuParentEntry */ -extern SDL_DECLSPEC SDL_TrayMenu *SDLCALL SDL_CreateTraySubmenu(SDL_TrayEntry *entry); +extern SDL_DECLSPEC SDL_TrayMenu * SDLCALL SDL_CreateTraySubmenu(SDL_TrayEntry *entry); /** * Gets a previously created tray menu. @@ -220,7 +220,7 @@ extern SDL_DECLSPEC SDL_TrayMenu *SDLCALL SDL_CreateTraySubmenu(SDL_TrayEntry *e * \sa SDL_CreateTray * \sa SDL_CreateTrayMenu */ -extern SDL_DECLSPEC SDL_TrayMenu *SDLCALL SDL_GetTrayMenu(SDL_Tray *tray); +extern SDL_DECLSPEC SDL_TrayMenu * SDLCALL SDL_GetTrayMenu(SDL_Tray *tray); /** * Gets a previously created tray entry submenu. @@ -244,7 +244,7 @@ extern SDL_DECLSPEC SDL_TrayMenu *SDLCALL SDL_GetTrayMenu(SDL_Tray *tray); * \sa SDL_InsertTrayEntryAt * \sa SDL_CreateTraySubmenu */ -extern SDL_DECLSPEC SDL_TrayMenu *SDLCALL SDL_GetTraySubmenu(SDL_TrayEntry *entry); +extern SDL_DECLSPEC SDL_TrayMenu * SDLCALL SDL_GetTraySubmenu(SDL_TrayEntry *entry); /** * Returns a list of entries in the menu, in order. @@ -264,7 +264,7 @@ extern SDL_DECLSPEC SDL_TrayMenu *SDLCALL SDL_GetTraySubmenu(SDL_TrayEntry *entr * \sa SDL_RemoveTrayEntry * \sa SDL_InsertTrayEntryAt */ -extern SDL_DECLSPEC const SDL_TrayEntry **SDLCALL SDL_GetTrayEntries(SDL_TrayMenu *menu, int *size); +extern SDL_DECLSPEC const SDL_TrayEntry ** SDLCALL SDL_GetTrayEntries(SDL_TrayMenu *menu, int *size); /** * Removes a tray entry. @@ -307,7 +307,7 @@ extern SDL_DECLSPEC void SDLCALL SDL_RemoveTrayEntry(SDL_TrayEntry *entry); * \sa SDL_RemoveTrayEntry * \sa SDL_GetTrayEntryParent */ -extern SDL_DECLSPEC SDL_TrayEntry *SDLCALL SDL_InsertTrayEntryAt(SDL_TrayMenu *menu, int pos, const char *label, SDL_TrayEntryFlags flags); +extern SDL_DECLSPEC SDL_TrayEntry * SDLCALL SDL_InsertTrayEntryAt(SDL_TrayMenu *menu, int pos, const char *label, SDL_TrayEntryFlags flags); /** * Sets the label of an entry. @@ -348,7 +348,7 @@ extern SDL_DECLSPEC void SDLCALL SDL_SetTrayEntryLabel(SDL_TrayEntry *entry, con * \sa SDL_InsertTrayEntryAt * \sa SDL_SetTrayEntryLabel */ -extern SDL_DECLSPEC const char *SDLCALL SDL_GetTrayEntryLabel(SDL_TrayEntry *entry); +extern SDL_DECLSPEC const char * SDLCALL SDL_GetTrayEntryLabel(SDL_TrayEntry *entry); /** * Sets whether or not an entry is checked. @@ -481,7 +481,7 @@ extern SDL_DECLSPEC void SDLCALL SDL_DestroyTray(SDL_Tray *tray); * * \sa SDL_InsertTrayEntryAt */ -extern SDL_DECLSPEC SDL_TrayMenu *SDLCALL SDL_GetTrayEntryParent(SDL_TrayEntry *entry); +extern SDL_DECLSPEC SDL_TrayMenu * SDLCALL SDL_GetTrayEntryParent(SDL_TrayEntry *entry); /** * Gets the entry for which the menu is a submenu, if the current menu is a @@ -501,7 +501,7 @@ extern SDL_DECLSPEC SDL_TrayMenu *SDLCALL SDL_GetTrayEntryParent(SDL_TrayEntry * * \sa SDL_CreateTraySubmenu * \sa SDL_GetTrayMenuParentTray */ -extern SDL_DECLSPEC SDL_TrayEntry *SDLCALL SDL_GetTrayMenuParentEntry(SDL_TrayMenu *menu); +extern SDL_DECLSPEC SDL_TrayEntry * SDLCALL SDL_GetTrayMenuParentEntry(SDL_TrayMenu *menu); /** * Gets the tray for which this menu is the first-level menu, if the current @@ -521,7 +521,7 @@ extern SDL_DECLSPEC SDL_TrayEntry *SDLCALL SDL_GetTrayMenuParentEntry(SDL_TrayMe * \sa SDL_CreateTrayMenu * \sa SDL_GetTrayMenuParentEntry */ -extern SDL_DECLSPEC SDL_Tray *SDLCALL SDL_GetTrayMenuParentTray(SDL_TrayMenu *menu); +extern SDL_DECLSPEC SDL_Tray * SDLCALL SDL_GetTrayMenuParentTray(SDL_TrayMenu *menu); /** * Update the trays. diff --git a/include/SDL3/SDL_vulkan.h b/include/SDL3/SDL_vulkan.h index 5a487561a8ee4..710afbe631437 100644 --- a/include/SDL3/SDL_vulkan.h +++ b/include/SDL3/SDL_vulkan.h @@ -226,7 +226,7 @@ extern SDL_DECLSPEC char const * const * SDLCALL SDL_Vulkan_GetInstanceExtension extern SDL_DECLSPEC bool SDLCALL SDL_Vulkan_CreateSurface(SDL_Window *window, VkInstance instance, const struct VkAllocationCallbacks *allocator, - VkSurfaceKHR* surface); + VkSurfaceKHR *surface); /** * Destroy the Vulkan rendering surface of a window. diff --git a/src/core/SDL_core_unsupported.c b/src/core/SDL_core_unsupported.c index 9a6b98f58db3b..af963ed8f43a4 100644 --- a/src/core/SDL_core_unsupported.c +++ b/src/core/SDL_core_unsupported.c @@ -111,14 +111,14 @@ void SDL_SendAndroidBackButton(void) SDL_Unsupported(); } -SDL_DECLSPEC void *SDLCALL SDL_GetAndroidActivity(void); +SDL_DECLSPEC void * SDLCALL SDL_GetAndroidActivity(void); void *SDL_GetAndroidActivity(void) { SDL_Unsupported(); return NULL; } -SDL_DECLSPEC const char *SDLCALL SDL_GetAndroidCachePath(void); +SDL_DECLSPEC const char * SDLCALL SDL_GetAndroidCachePath(void); const char* SDL_GetAndroidCachePath(void) { SDL_Unsupported(); @@ -126,7 +126,7 @@ const char* SDL_GetAndroidCachePath(void) } -SDL_DECLSPEC const char *SDLCALL SDL_GetAndroidExternalStoragePath(void); +SDL_DECLSPEC const char * SDLCALL SDL_GetAndroidExternalStoragePath(void); const char* SDL_GetAndroidExternalStoragePath(void) { SDL_Unsupported(); @@ -139,14 +139,14 @@ Uint32 SDL_GetAndroidExternalStorageState(void) SDL_Unsupported(); return 0; } -SDL_DECLSPEC const char *SDLCALL SDL_GetAndroidInternalStoragePath(void); +SDL_DECLSPEC const char * SDLCALL SDL_GetAndroidInternalStoragePath(void); const char *SDL_GetAndroidInternalStoragePath(void) { SDL_Unsupported(); return NULL; } -SDL_DECLSPEC void *SDLCALL SDL_GetAndroidJNIEnv(void); +SDL_DECLSPEC void * SDLCALL SDL_GetAndroidJNIEnv(void); void *SDL_GetAndroidJNIEnv(void) { SDL_Unsupported(); @@ -171,7 +171,7 @@ bool SDL_SendAndroidMessage(Uint32 command, int param) return SDL_Unsupported(); } -SDL_DECLSPEC bool SDLCALL SDL_ShowAndroidToast(const char* message, int duration, int gravity, int xoffset, int yoffset); +SDL_DECLSPEC bool SDLCALL SDL_ShowAndroidToast(const char *message, int duration, int gravity, int xoffset, int yoffset); bool SDL_ShowAndroidToast(const char* message, int duration, int gravity, int xoffset, int yoffset) { (void)message; diff --git a/src/stdlib/SDL_malloc.c b/src/stdlib/SDL_malloc.c index ea09d1e5cbf77..008675f312f01 100644 --- a/src/stdlib/SDL_malloc.c +++ b/src/stdlib/SDL_malloc.c @@ -6324,10 +6324,10 @@ int mspace_mallopt(int param_number, int value) { #endif /* !HAVE_MALLOC */ #ifdef HAVE_MALLOC -static void* SDLCALL real_malloc(size_t s) { return malloc(s); } -static void* SDLCALL real_calloc(size_t n, size_t s) { return calloc(n, s); } -static void* SDLCALL real_realloc(void *p, size_t s) { return realloc(p,s); } -static void SDLCALL real_free(void *p) { free(p); } +static void * SDLCALL real_malloc(size_t s) { return malloc(s); } +static void * SDLCALL real_calloc(size_t n, size_t s) { return calloc(n, s); } +static void * SDLCALL real_realloc(void *p, size_t s) { return realloc(p,s); } +static void SDLCALL real_free(void *p) { free(p); } #else #define real_malloc dlmalloc #define real_calloc dlcalloc diff --git a/src/stdlib/SDL_qsort.c b/src/stdlib/SDL_qsort.c index 901e92508110f..4ed2863e504b7 100644 --- a/src/stdlib/SDL_qsort.c +++ b/src/stdlib/SDL_qsort.c @@ -361,7 +361,7 @@ typedef struct { char * first; char * last; } stack_entry; /* ---------------------------------------------------------------------- */ static char * pivot_big(char *first, char *mid, char *last, size_t size, - int (SDLCALL * compare)(void *, const void *, const void *), void *userdata) { + int (SDLCALL *compare)(void *, const void *, const void *), void *userdata) { size_t d=(((last-first)/size)>>3)*size; #ifdef DEBUG_QSORT fprintf(stderr, "pivot_big: first=%p last=%p size=%lu n=%lu\n", first, (unsigned long)last, size, (unsigned long)((last-first+1)/size)); @@ -402,7 +402,7 @@ fprintf(stderr,"-> %d %d %d @ %p %p %p\n",*(int*)m1,*(int*)m2,*(int*)m3, m1,m2,m /* ---------------------------------------------------------------------- */ static void qsort_r_nonaligned(void *base, size_t nmemb, size_t size, - int (SDLCALL * compare)(void *, const void *, const void *), void *userdata) { + int (SDLCALL *compare)(void *, const void *, const void *), void *userdata) { stack_entry stack[STACK_SIZE]; int stacktop=0; @@ -433,7 +433,7 @@ static void qsort_r_nonaligned(void *base, size_t nmemb, size_t size, } static void qsort_r_aligned(void *base, size_t nmemb, size_t size, - int (SDLCALL * compare)(void *,const void *, const void *), void *userdata) { + int (SDLCALL *compare)(void *,const void *, const void *), void *userdata) { stack_entry stack[STACK_SIZE]; int stacktop=0; @@ -464,7 +464,7 @@ static void qsort_r_aligned(void *base, size_t nmemb, size_t size, } static void qsort_r_words(void *base, size_t nmemb, - int (SDLCALL * compare)(void *,const void *, const void *), void *userdata) { + int (SDLCALL *compare)(void *,const void *, const void *), void *userdata) { stack_entry stack[STACK_SIZE]; int stacktop=0; diff --git a/src/test/SDL_test_memory.c b/src/test/SDL_test_memory.c index 8b853c6224475..b90c4a5d97379 100644 --- a/src/test/SDL_test_memory.c +++ b/src/test/SDL_test_memory.c @@ -229,7 +229,7 @@ static void rand_fill_memory(void* ptr, size_t start, size_t end) } } -static void *SDLCALL SDLTest_TrackedMalloc(size_t size) +static void * SDLCALL SDLTest_TrackedMalloc(size_t size) { void *mem; @@ -241,7 +241,7 @@ static void *SDLCALL SDLTest_TrackedMalloc(size_t size) return mem; } -static void *SDLCALL SDLTest_TrackedCalloc(size_t nmemb, size_t size) +static void * SDLCALL SDLTest_TrackedCalloc(size_t nmemb, size_t size) { void *mem; @@ -252,7 +252,7 @@ static void *SDLCALL SDLTest_TrackedCalloc(size_t nmemb, size_t size) return mem; } -static void *SDLCALL SDLTest_TrackedRealloc(void *ptr, size_t size) +static void * SDLCALL SDLTest_TrackedRealloc(void *ptr, size_t size) { void *mem; size_t old_size = 0; diff --git a/src/thread/SDL_thread.c b/src/thread/SDL_thread.c index 884a6cd665c32..ee9f9bbb56f79 100644 --- a/src/thread/SDL_thread.c +++ b/src/thread/SDL_thread.c @@ -314,7 +314,7 @@ static bool ThreadValid(SDL_Thread *thread) void SDL_RunThread(SDL_Thread *thread) { void *userdata = thread->userdata; - int(SDLCALL * userfunc)(void *) = thread->userfunc; + int(SDLCALL *userfunc)(void *) = thread->userfunc; int *statusloc = &thread->status; diff --git a/src/video/SDL_video.c b/src/video/SDL_video.c index 466f312d5f6d0..f30de9fe7afd2 100644 --- a/src/video/SDL_video.c +++ b/src/video/SDL_video.c @@ -2154,7 +2154,7 @@ void SDL_ToggleDragAndDropSupport(void) } } -SDL_Window **SDLCALL SDL_GetWindows(int *count) +SDL_Window ** SDLCALL SDL_GetWindows(int *count) { if (count) { *count = 0; diff --git a/test/testdialog.c b/test/testdialog.c index 49a7310b72c51..3d19fb9416c15 100644 --- a/test/testdialog.c +++ b/test/testdialog.c @@ -21,7 +21,7 @@ const SDL_DialogFileFilter filters[3] = { { "PNG images", "png" } }; -static void SDLCALL callback(void* userdata, const char* const* files, int filter) { +static void SDLCALL callback(void *userdata, const char * const *files, int filter) { if (files) { const char* filter_name = "(filter fetching unsupported)"; From 07c22da46432df8e63d13293be1f6e8ac31a0431 Mon Sep 17 00:00:00 2001 From: Sam Lantinga Date: Mon, 3 Feb 2025 19:34:38 -0800 Subject: [PATCH 307/340] Fixed decoding 4-bit RLE encoded BMP files Also flipped the return value of readRlePixels() to match convention. Fixes https://github.com/libsdl-org/sdl2-compat/issues/308 --- src/video/SDL_bmp.c | 87 ++++++++++++++++----------------------------- 1 file changed, 31 insertions(+), 56 deletions(-) diff --git a/src/video/SDL_bmp.c b/src/video/SDL_bmp.c index bcde0c5786e02..2880ba03ef2b4 100644 --- a/src/video/SDL_bmp.c +++ b/src/video/SDL_bmp.c @@ -76,16 +76,16 @@ static bool readRlePixels(SDL_Surface *surface, SDL_IOStream *src, int isRle8) int ofs = 0; Uint8 ch; Uint8 needsPad; + const int pixels_per_byte = (isRle8 ? 1 : 2); #define COPY_PIXEL(x) \ spot = &bits[ofs++]; \ if (spot >= start && spot < end) \ - *spot = (x) + *spot = (x) - // !!! FIXME: for all these reads, handle error vs eof? handle -2 if non-blocking? for (;;) { if (!SDL_ReadU8(src, &ch)) { - return true; + return false; } /* | encoded mode starts with a run length, and then a byte @@ -94,26 +94,12 @@ static bool readRlePixels(SDL_Surface *surface, SDL_IOStream *src, int isRle8) if (ch) { Uint8 pixel; if (!SDL_ReadU8(src, &pixel)) { - return true; - } - if (isRle8) { // 256-color bitmap, compressed - do { - COPY_PIXEL(pixel); - } while (--ch); - } else { // 16-color bitmap, compressed - Uint8 pixel0 = pixel >> 4; - Uint8 pixel1 = pixel & 0x0F; - for (;;) { - COPY_PIXEL(pixel0); // even count, high nibble - if (!--ch) { - break; - } - COPY_PIXEL(pixel1); // odd count, low nibble - if (!--ch) { - break; - } - } + return false; } + ch /= pixels_per_byte; + do { + COPY_PIXEL(pixel); + } while (--ch); } else { /* | A leading zero is an escape; it may signal the end of the bitmap, @@ -121,7 +107,7 @@ static bool readRlePixels(SDL_Surface *surface, SDL_IOStream *src, int isRle8) | zero tag may be absolute mode or an escape */ if (!SDL_ReadU8(src, &ch)) { - return true; + return false; } switch (ch) { case 0: // end of line @@ -129,47 +115,33 @@ static bool readRlePixels(SDL_Surface *surface, SDL_IOStream *src, int isRle8) bits -= pitch; // go to previous break; case 1: // end of bitmap - return false; // success! +printf("SUCCESS!\n"); + return true; // success! case 2: // delta if (!SDL_ReadU8(src, &ch)) { - return true; + return false; } - ofs += ch; + ofs += ch / pixels_per_byte; + if (!SDL_ReadU8(src, &ch)) { - return true; + return false; } - bits -= (ch * pitch); + bits -= ((ch / pixels_per_byte) * pitch); break; default: // no compression - if (isRle8) { - needsPad = (ch & 1); - do { - Uint8 pixel; - if (!SDL_ReadU8(src, &pixel)) { - return true; - } - COPY_PIXEL(pixel); - } while (--ch); - } else { - needsPad = (((ch + 1) >> 1) & 1); // (ch+1)>>1: bytes size - for (;;) { - Uint8 pixel; - if (!SDL_ReadU8(src, &pixel)) { - return true; - } - COPY_PIXEL(pixel >> 4); - if (!--ch) { - break; - } - COPY_PIXEL(pixel & 0x0F); - if (!--ch) { - break; - } + ch /= pixels_per_byte; + needsPad = (ch & 1); + do { + Uint8 pixel; + if (!SDL_ReadU8(src, &pixel)) { + return false; } - } + COPY_PIXEL(pixel); + } while (--ch); + // pad at even boundary if (needsPad && !SDL_ReadU8(src, &ch)) { - return true; + return false; } break; } @@ -513,10 +485,13 @@ SDL_Surface *SDL_LoadBMP_IO(SDL_IOStream *src, bool closeio) goto done; } if ((biCompression == BI_RLE4) || (biCompression == BI_RLE8)) { - was_error = readRlePixels(surface, src, biCompression == BI_RLE8); - if (was_error) { + if (!readRlePixels(surface, src, biCompression == BI_RLE8)) { SDL_SetError("Error reading from datastream"); + goto done; } + + // Success! + was_error = false; goto done; } top = (Uint8 *)surface->pixels; From 8527d042bc2207d6efa15670b1fd85fb613208e6 Mon Sep 17 00:00:00 2001 From: Petar Popovic Date: Tue, 4 Feb 2025 02:28:03 +0100 Subject: [PATCH 308/340] Remove const from parameter of inline function SDL_RectsEqualEpsilon() --- include/SDL3/SDL_rect.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/SDL3/SDL_rect.h b/include/SDL3/SDL_rect.h index 8998de6f45fe3..eb2d34a69a1a7 100644 --- a/include/SDL3/SDL_rect.h +++ b/include/SDL3/SDL_rect.h @@ -371,7 +371,7 @@ SDL_FORCE_INLINE bool SDL_RectEmptyFloat(const SDL_FRect *r) * * \sa SDL_RectsEqualFloat */ -SDL_FORCE_INLINE bool SDL_RectsEqualEpsilon(const SDL_FRect *a, const SDL_FRect *b, const float epsilon) +SDL_FORCE_INLINE bool SDL_RectsEqualEpsilon(const SDL_FRect *a, const SDL_FRect *b, float epsilon) { return (a && b && ((a == b) || ((SDL_fabsf(a->x - b->x) <= epsilon) && From f1b3523c6794bf9b8fef008b0d608998ad78d403 Mon Sep 17 00:00:00 2001 From: Petar Popovic Date: Tue, 4 Feb 2025 02:17:03 +0100 Subject: [PATCH 309/340] Remove redundant parenthesis in SDL_MUSTLOCK macro --- include/SDL3/SDL_surface.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/SDL3/SDL_surface.h b/include/SDL3/SDL_surface.h index 47b90c1bd47c5..f2d20654bf0d0 100644 --- a/include/SDL3/SDL_surface.h +++ b/include/SDL3/SDL_surface.h @@ -73,7 +73,7 @@ typedef Uint32 SDL_SurfaceFlags; * * \since This macro is available since SDL 3.2.0. */ -#define SDL_MUSTLOCK(S) ((((S)->flags & SDL_SURFACE_LOCK_NEEDED)) == SDL_SURFACE_LOCK_NEEDED) +#define SDL_MUSTLOCK(S) (((S)->flags & SDL_SURFACE_LOCK_NEEDED) == SDL_SURFACE_LOCK_NEEDED) /** * The scaling mode. From 61b1c25eeb0dc84a6f8a75ebedf4d5ef6da5e528 Mon Sep 17 00:00:00 2001 From: "Ryan C. Gordon" Date: Mon, 3 Feb 2025 22:50:51 -0500 Subject: [PATCH 310/340] x11: SDL_SetWindowPosition on an unmapped window will do the actual move later. Fixes https://github.com/libsdl-org/sdl2-compat/issues/303 --- src/video/x11/SDL_x11window.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/video/x11/SDL_x11window.c b/src/video/x11/SDL_x11window.c index c8c0ffd737a22..c26ee7f5a7e03 100644 --- a/src/video/x11/SDL_x11window.c +++ b/src/video/x11/SDL_x11window.c @@ -1065,8 +1065,12 @@ void X11_UpdateWindowPosition(SDL_Window *window, bool use_current_position) &data->expected.x, &data->expected.y); // Attempt to move the window - data->pending_operation |= X11_PENDING_OP_MOVE; - X11_XMoveWindow(display, data->xwindow, data->expected.x, data->expected.y); + if (window->flags & SDL_WINDOW_HIDDEN) { + window->internal->pending_position = true; + } else { + data->pending_operation |= X11_PENDING_OP_MOVE; + X11_XMoveWindow(display, data->xwindow, data->expected.x, data->expected.y); + } } bool X11_SetWindowPosition(SDL_VideoDevice *_this, SDL_Window *window) From e7f326a84ea5a15dd35b23345f9c503009b53e7b Mon Sep 17 00:00:00 2001 From: "Ryan C. Gordon" Date: Mon, 3 Feb 2025 23:35:08 -0500 Subject: [PATCH 311/340] bmp: Removed debug printf call. --- src/video/SDL_bmp.c | 1 - 1 file changed, 1 deletion(-) diff --git a/src/video/SDL_bmp.c b/src/video/SDL_bmp.c index 2880ba03ef2b4..688086fc43742 100644 --- a/src/video/SDL_bmp.c +++ b/src/video/SDL_bmp.c @@ -115,7 +115,6 @@ static bool readRlePixels(SDL_Surface *surface, SDL_IOStream *src, int isRle8) bits -= pitch; // go to previous break; case 1: // end of bitmap -printf("SUCCESS!\n"); return true; // success! case 2: // delta if (!SDL_ReadU8(src, &ch)) { From eb5ab220324ebef14a74f976c577bb20f0904133 Mon Sep 17 00:00:00 2001 From: WinterSquire <135317392+WinterSquire@users.noreply.github.com> Date: Tue, 4 Feb 2025 12:46:17 +0800 Subject: [PATCH 312/340] Check nullptr before calling the windows message hook for WM_ENTERSIZEMOVE and WM_ENTERMENULOOP --- src/video/windows/SDL_windowsevents.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/video/windows/SDL_windowsevents.c b/src/video/windows/SDL_windowsevents.c index 64765dc53a2e2..947a05e4f4b00 100644 --- a/src/video/windows/SDL_windowsevents.c +++ b/src/video/windows/SDL_windowsevents.c @@ -1721,8 +1721,10 @@ LRESULT CALLBACK WIN_WindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lPara case WM_ENTERSIZEMOVE: case WM_ENTERMENULOOP: { - if (!DispatchModalLoopMessageHook(&hwnd, &msg, &wParam, &lParam)) { - return 0; + if (g_WindowsMessageHook) { + if (!DispatchModalLoopMessageHook(&hwnd, &msg, &wParam, &lParam)) { + return 0; + } } ++data->in_modal_loop; From 33c0654d544cb3e767afd5fc28bb6453c660eb6d Mon Sep 17 00:00:00 2001 From: Jean-Philip Desjardins Date: Mon, 3 Feb 2025 19:02:31 -0500 Subject: [PATCH 313/340] Allow OpenGL initialization on XB1 and XSX. --- src/video/windows/SDL_windowswindow.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/video/windows/SDL_windowswindow.c b/src/video/windows/SDL_windowswindow.c index bb3f3cf6907ab..2ae107ec9bf3f 100644 --- a/src/video/windows/SDL_windowswindow.c +++ b/src/video/windows/SDL_windowswindow.c @@ -842,6 +842,7 @@ bool WIN_CreateWindow(SDL_VideoDevice *_this, SDL_Window *window, SDL_Properties return WIN_SetError("SetPixelFormat()"); } } else { +#endif // !defined(SDL_PLATFORM_XBOXONE) && !defined(SDL_PLATFORM_XBOXSERIES) if (!(window->flags & SDL_WINDOW_OPENGL)) { return true; } @@ -874,6 +875,7 @@ bool WIN_CreateWindow(SDL_VideoDevice *_this, SDL_Window *window, SDL_Properties #else return SDL_SetError("Could not create GL window (WGL support not configured)"); #endif +#if !defined(SDL_PLATFORM_XBOXONE) && !defined(SDL_PLATFORM_XBOXSERIES) } #endif // !defined(SDL_PLATFORM_XBOXONE) && !defined(SDL_PLATFORM_XBOXSERIES) From 691a6133d37013b2490a5fe48004d42441b40921 Mon Sep 17 00:00:00 2001 From: Cameron Cawley Date: Tue, 4 Feb 2025 21:51:55 +0000 Subject: [PATCH 314/340] Remove #undef __3DS__ --- include/SDL3/SDL_platform_defines.h | 2 -- 1 file changed, 2 deletions(-) diff --git a/include/SDL3/SDL_platform_defines.h b/include/SDL3/SDL_platform_defines.h index 7e9a0a92a28d3..6b240a8be4579 100644 --- a/include/SDL3/SDL_platform_defines.h +++ b/include/SDL3/SDL_platform_defines.h @@ -471,8 +471,6 @@ * \since This macro is available since SDL 3.2.0. */ #define SDL_PLATFORM_3DS 1 - -#undef __3DS__ #endif #endif /* SDL_platform_defines_h_ */ From c4c185283fadd2820d048a3061dbdc2c3bc4285e Mon Sep 17 00:00:00 2001 From: Cameron Gutman Date: Tue, 4 Feb 2025 17:36:45 -0600 Subject: [PATCH 315/340] dbus: fix spurious leak reports with SDL_SHUTDOWN_DBUS_ON_QUIT=0 --- src/core/linux/SDL_dbus.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/core/linux/SDL_dbus.c b/src/core/linux/SDL_dbus.c index e0ffea3c5d3ea..9a2fc1ea53194 100644 --- a/src/core/linux/SDL_dbus.c +++ b/src/core/linux/SDL_dbus.c @@ -189,10 +189,16 @@ void SDL_DBus_Quit(void) if (dbus.shutdown) { dbus.shutdown(); } + + UnloadDBUSLibrary(); + } else { + /* Leaving libdbus loaded when skipping dbus_shutdown() avoids + * spurious leak warnings from LeakSanitizer on internal D-Bus + * allocations that would be freed by dbus_shutdown(). */ + dbus_handle = NULL; } SDL_zero(dbus); - UnloadDBUSLibrary(); if (inhibit_handle) { SDL_free(inhibit_handle); inhibit_handle = NULL; From 2cd2834dfe07ab4e9106ee85659a802818c35d08 Mon Sep 17 00:00:00 2001 From: Sam Lantinga Date: Tue, 4 Feb 2025 23:49:12 -0800 Subject: [PATCH 316/340] Fixed memory leak in the pen cleanup Fixes https://github.com/libsdl-org/SDL/issues/12099 --- src/video/SDL_video.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/video/SDL_video.c b/src/video/SDL_video.c index f30de9fe7afd2..37fd8bb28ad00 100644 --- a/src/video/SDL_video.c +++ b/src/video/SDL_video.c @@ -4294,7 +4294,9 @@ void SDL_VideoQuit(void) } // Halt event processing before doing anything else +#if 0 // This was moved to the end to fix a memory leak SDL_QuitPen(); +#endif SDL_QuitTouch(); SDL_QuitMouse(); SDL_QuitKeyboard(); @@ -4325,6 +4327,9 @@ void SDL_VideoQuit(void) } _this->free(_this); _this = NULL; + + // This needs to happen after the video subsystem has removed pen data + SDL_QuitPen(); } bool SDL_GL_LoadLibrary(const char *path) From 8ba8cca69bc468c9f9a6054aa6a383ade9bd39a2 Mon Sep 17 00:00:00 2001 From: Sam Lantinga Date: Tue, 4 Feb 2025 23:59:08 -0800 Subject: [PATCH 317/340] Fixed memory leak looking up pen tool names --- src/video/x11/SDL_x11pen.c | 1 + 1 file changed, 1 insertion(+) diff --git a/src/video/x11/SDL_x11pen.c b/src/video/x11/SDL_x11pen.c index d382eee7013ab..c7e4c8bba6f05 100644 --- a/src/video/x11/SDL_x11pen.c +++ b/src/video/x11/SDL_x11pen.c @@ -85,6 +85,7 @@ static bool X11_XInput2PenIsEraser(SDL_VideoDevice *_this, int deviceid, char *d result = true; } X11_XFree(tooltype_name_info); + X11_XFree(tooltype_name); return result; } From b99e19c0a2cbdd30b50e4272ad324c45e2741a28 Mon Sep 17 00:00:00 2001 From: Sam Lantinga Date: Wed, 5 Feb 2025 00:04:45 -0800 Subject: [PATCH 318/340] Fixed potential double-free --- src/video/x11/SDL_x11pen.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/video/x11/SDL_x11pen.c b/src/video/x11/SDL_x11pen.c index c7e4c8bba6f05..f63654542f1c0 100644 --- a/src/video/x11/SDL_x11pen.c +++ b/src/video/x11/SDL_x11pen.c @@ -81,10 +81,12 @@ static bool X11_XInput2PenIsEraser(SDL_VideoDevice *_this, int deviceid, char *d } if (tooltype_name) { - if (0 == SDL_strcasecmp(tooltype_name, PEN_ERASER_NAME_TAG)) { + if (SDL_strcasecmp(tooltype_name, PEN_ERASER_NAME_TAG) == 0) { result = true; } - X11_XFree(tooltype_name_info); + if (tooltype_name != (char *)tooltype_name_info) { + X11_XFree(tooltype_name_info); + } X11_XFree(tooltype_name); return result; From 68dabd48c44e4cde65cd21c9c8d439803c426937 Mon Sep 17 00:00:00 2001 From: Petar Popovic Date: Wed, 5 Feb 2025 14:04:15 +0100 Subject: [PATCH 319/340] SDL_GetTrayEntries(): Rename parameter `size` to `count` --- include/SDL3/SDL_tray.h | 4 ++-- src/tray/cocoa/SDL_tray.m | 6 +++--- src/tray/dummy/SDL_tray.c | 2 +- src/tray/unix/SDL_tray.c | 6 +++--- src/tray/windows/SDL_tray.c | 6 +++--- 5 files changed, 12 insertions(+), 12 deletions(-) diff --git a/include/SDL3/SDL_tray.h b/include/SDL3/SDL_tray.h index c096e003fb4f6..4343c9efdedc2 100644 --- a/include/SDL3/SDL_tray.h +++ b/include/SDL3/SDL_tray.h @@ -250,7 +250,7 @@ extern SDL_DECLSPEC SDL_TrayMenu * SDLCALL SDL_GetTraySubmenu(SDL_TrayEntry *ent * Returns a list of entries in the menu, in order. * * \param menu The menu to get entries from. - * \param size An optional pointer to obtain the number of entries in the + * \param count An optional pointer to obtain the number of entries in the * menu. * \returns a NULL-terminated list of entries within the given menu. The * pointer becomes invalid when any function that inserts or deletes @@ -264,7 +264,7 @@ extern SDL_DECLSPEC SDL_TrayMenu * SDLCALL SDL_GetTraySubmenu(SDL_TrayEntry *ent * \sa SDL_RemoveTrayEntry * \sa SDL_InsertTrayEntryAt */ -extern SDL_DECLSPEC const SDL_TrayEntry ** SDLCALL SDL_GetTrayEntries(SDL_TrayMenu *menu, int *size); +extern SDL_DECLSPEC const SDL_TrayEntry ** SDLCALL SDL_GetTrayEntries(SDL_TrayMenu *menu, int *count); /** * Removes a tray entry. diff --git a/src/tray/cocoa/SDL_tray.m b/src/tray/cocoa/SDL_tray.m index ae8d6be835f27..fd7f95517c2da 100644 --- a/src/tray/cocoa/SDL_tray.m +++ b/src/tray/cocoa/SDL_tray.m @@ -285,15 +285,15 @@ void SDL_SetTrayTooltip(SDL_Tray *tray, const char *tooltip) return entry->submenu; } -const SDL_TrayEntry **SDL_GetTrayEntries(SDL_TrayMenu *menu, int *size) +const SDL_TrayEntry **SDL_GetTrayEntries(SDL_TrayMenu *menu, int *count) { if (!menu) { SDL_InvalidParamError("menu"); return NULL; } - if (size) { - *size = menu->nEntries; + if (count) { + *count = menu->nEntries; } return (const SDL_TrayEntry **)menu->entries; } diff --git a/src/tray/dummy/SDL_tray.c b/src/tray/dummy/SDL_tray.c index db76db25269bf..766fb92584ef9 100644 --- a/src/tray/dummy/SDL_tray.c +++ b/src/tray/dummy/SDL_tray.c @@ -66,7 +66,7 @@ SDL_TrayMenu *SDL_GetTraySubmenu(SDL_TrayEntry *entry) return NULL; } -const SDL_TrayEntry **SDL_GetTrayEntries(SDL_TrayMenu *menu, int *size) +const SDL_TrayEntry **SDL_GetTrayEntries(SDL_TrayMenu *menu, int *count) { SDL_InvalidParamError("menu"); return NULL; diff --git a/src/tray/unix/SDL_tray.c b/src/tray/unix/SDL_tray.c index 5f017c2f59c20..f10f92aa4e202 100644 --- a/src/tray/unix/SDL_tray.c +++ b/src/tray/unix/SDL_tray.c @@ -540,15 +540,15 @@ SDL_TrayMenu *SDL_GetTraySubmenu(SDL_TrayEntry *entry) return entry->submenu; } -const SDL_TrayEntry **SDL_GetTrayEntries(SDL_TrayMenu *menu, int *size) +const SDL_TrayEntry **SDL_GetTrayEntries(SDL_TrayMenu *menu, int *count) { if (!menu) { SDL_InvalidParamError("menu"); return NULL; } - if (size) { - *size = menu->nEntries; + if (count) { + *count = menu->nEntries; } return (const SDL_TrayEntry **)menu->entries; } diff --git a/src/tray/windows/SDL_tray.c b/src/tray/windows/SDL_tray.c index 32b5e85c5656b..18008ee29888c 100644 --- a/src/tray/windows/SDL_tray.c +++ b/src/tray/windows/SDL_tray.c @@ -367,15 +367,15 @@ SDL_TrayMenu *SDL_GetTraySubmenu(SDL_TrayEntry *entry) return entry->submenu; } -const SDL_TrayEntry **SDL_GetTrayEntries(SDL_TrayMenu *menu, int *size) +const SDL_TrayEntry **SDL_GetTrayEntries(SDL_TrayMenu *menu, int *count) { if (!menu) { SDL_InvalidParamError("menu"); return NULL; } - if (size) { - *size = menu->nEntries; + if (count) { + *count = menu->nEntries; } return (const SDL_TrayEntry **)menu->entries; } From 5ad0337685cc9f6dad94ed9f490880aeb81d484c Mon Sep 17 00:00:00 2001 From: SDL Wiki Bot Date: Wed, 5 Feb 2025 15:45:41 +0000 Subject: [PATCH 320/340] Sync SDL3 wiki -> header [ci skip] --- include/SDL3/SDL_tray.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/SDL3/SDL_tray.h b/include/SDL3/SDL_tray.h index 4343c9efdedc2..1780b0ba52bb7 100644 --- a/include/SDL3/SDL_tray.h +++ b/include/SDL3/SDL_tray.h @@ -251,7 +251,7 @@ extern SDL_DECLSPEC SDL_TrayMenu * SDLCALL SDL_GetTraySubmenu(SDL_TrayEntry *ent * * \param menu The menu to get entries from. * \param count An optional pointer to obtain the number of entries in the - * menu. + * menu. * \returns a NULL-terminated list of entries within the given menu. The * pointer becomes invalid when any function that inserts or deletes * entries in the menu is called. From c4550d906af3fd46aad9715e83cdcd65b65939e8 Mon Sep 17 00:00:00 2001 From: Sam Lantinga Date: Wed, 5 Feb 2025 08:26:06 -0800 Subject: [PATCH 321/340] testcontroller: show the gamepad device type --- test/testcontroller.c | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/test/testcontroller.c b/test/testcontroller.c index 6e9b662cceddb..8f74c3ba3c3b7 100644 --- a/test/testcontroller.c +++ b/test/testcontroller.c @@ -1057,6 +1057,35 @@ static void HandleGamepadAdded(SDL_JoystickID id, bool verbose) if (SDL_GetGamepadPlayerIndex(gamepad) >= 0) { SDL_Log("Player index: %d", SDL_GetGamepadPlayerIndex(gamepad)); } + + switch (SDL_GetJoystickTypeForID(id)) { + case SDL_JOYSTICK_TYPE_WHEEL: + SDL_Log("Controller is a wheel"); + break; + case SDL_JOYSTICK_TYPE_ARCADE_STICK: + SDL_Log("Controller is an arcade stick"); + break; + case SDL_JOYSTICK_TYPE_FLIGHT_STICK: + SDL_Log("Controller is a flight stick"); + break; + case SDL_JOYSTICK_TYPE_DANCE_PAD: + SDL_Log("Controller is a dance pad"); + break; + case SDL_JOYSTICK_TYPE_GUITAR: + SDL_Log("Controller is a guitar"); + break; + case SDL_JOYSTICK_TYPE_DRUM_KIT: + SDL_Log("Controller is a drum kit"); + break; + case SDL_JOYSTICK_TYPE_ARCADE_PAD: + SDL_Log("Controller is an arcade pad"); + break; + case SDL_JOYSTICK_TYPE_THROTTLE: + SDL_Log("Controller is a throttle"); + break; + default: + break; + } } for (i = 0; i < SDL_arraysize(sensors); ++i) { From 1c0e2b7f97548eccaddbfcea4c6fb557e51f917a Mon Sep 17 00:00:00 2001 From: Sam Lantinga Date: Wed, 5 Feb 2025 17:08:02 -0800 Subject: [PATCH 322/340] SDL_OpenHapticFromJoystick() returns a valid haptic object --- src/haptic/SDL_haptic.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/haptic/SDL_haptic.c b/src/haptic/SDL_haptic.c index ca1ab381ba291..671a702736356 100644 --- a/src/haptic/SDL_haptic.c +++ b/src/haptic/SDL_haptic.c @@ -131,6 +131,7 @@ SDL_Haptic *SDL_OpenHaptic(SDL_HapticID instance_id) haptic->instance_id = instance_id; haptic->rumble_id = -1; if (!SDL_SYS_HapticOpen(haptic)) { + SDL_SetObjectValid(haptic, SDL_OBJECT_TYPE_HAPTIC, false); SDL_free(haptic); return NULL; } @@ -268,9 +269,11 @@ SDL_Haptic *SDL_OpenHapticFromJoystick(SDL_Joystick *joystick) /* Initialize the haptic device * This function should fill in the instance ID and name. */ + SDL_SetObjectValid(haptic, SDL_OBJECT_TYPE_HAPTIC, true); haptic->rumble_id = -1; if (!SDL_SYS_HapticOpenFromJoystick(haptic, joystick)) { SDL_SetError("Haptic: SDL_SYS_HapticOpenFromJoystick failed."); + SDL_SetObjectValid(haptic, SDL_OBJECT_TYPE_HAPTIC, false); SDL_free(haptic); SDL_UnlockJoysticks(); return NULL; From 6782cfe2c5af72d70b7da4940f8d45ce7160d38e Mon Sep 17 00:00:00 2001 From: Sam Lantinga Date: Wed, 5 Feb 2025 17:19:59 -0800 Subject: [PATCH 323/340] Don't use the HIDAPI driver for Thrustmaster wheels Closes https://github.com/libsdl-org/SDL/pull/12173 --- src/joystick/hidapi/SDL_hidapijoystick.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/joystick/hidapi/SDL_hidapijoystick.c b/src/joystick/hidapi/SDL_hidapijoystick.c index 54545eb854aa4..6885f8b3312e0 100644 --- a/src/joystick/hidapi/SDL_hidapijoystick.c +++ b/src/joystick/hidapi/SDL_hidapijoystick.c @@ -192,7 +192,13 @@ bool HIDAPI_SupportsPlaystationDetection(Uint16 vendor, Uint16 product) case USB_VENDOR_SHANWAN_ALT: return true; case USB_VENDOR_THRUSTMASTER: - return true; + /* Most of these are wheels, don't have the full set of effects, and + * at least in the case of the T248 and T300 RS, the hid-tmff2 driver + * puts them in a non-standard report mode and they can't be read. + * + * If these should use the HIDAPI driver, add them to controller_list.h + */ + return false; case USB_VENDOR_ZEROPLUS: return true; case 0x7545 /* SZ-MYPOWER */: From 86691d325be41f0662edbb2982b75e5ecbb6b1e7 Mon Sep 17 00:00:00 2001 From: Evan Hemsley <2342303+thatcosmonaut@users.noreply.github.com> Date: Wed, 5 Feb 2025 17:52:35 -0800 Subject: [PATCH 324/340] GPU: Remove stencil bit from sampler aspect mask on Vulkan (#12196) --- src/gpu/vulkan/SDL_gpu_vulkan.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/gpu/vulkan/SDL_gpu_vulkan.c b/src/gpu/vulkan/SDL_gpu_vulkan.c index eedbaedc3f6ae..bad67db0431c6 100644 --- a/src/gpu/vulkan/SDL_gpu_vulkan.c +++ b/src/gpu/vulkan/SDL_gpu_vulkan.c @@ -5689,7 +5689,7 @@ static VulkanTexture *VULKAN_INTERNAL_CreateTexture( imageViewCreateInfo.image = texture->image; imageViewCreateInfo.format = SDLToVK_TextureFormat[createinfo->format]; imageViewCreateInfo.components = texture->swizzle; - imageViewCreateInfo.subresourceRange.aspectMask = texture->aspectFlags; + imageViewCreateInfo.subresourceRange.aspectMask = texture->aspectFlags & ~VK_IMAGE_ASPECT_STENCIL_BIT; // Can't sample stencil values imageViewCreateInfo.subresourceRange.baseMipLevel = 0; imageViewCreateInfo.subresourceRange.levelCount = createinfo->num_levels; imageViewCreateInfo.subresourceRange.baseArrayLayer = 0; From 7691cabe4a4b627e12ffff04fdfb95d97b1a01e7 Mon Sep 17 00:00:00 2001 From: Sam Lantinga Date: Thu, 6 Feb 2025 08:36:48 -0800 Subject: [PATCH 325/340] Removed incorrect HIDAPI gamepad mapping --- src/joystick/SDL_gamepad_db.h | 1 - 1 file changed, 1 deletion(-) diff --git a/src/joystick/SDL_gamepad_db.h b/src/joystick/SDL_gamepad_db.h index 417eb6c4d888e..cd84e0a09f50c 100644 --- a/src/joystick/SDL_gamepad_db.h +++ b/src/joystick/SDL_gamepad_db.h @@ -893,6 +893,5 @@ static const char *s_GamepadMappings[] = { #ifdef SDL_JOYSTICK_N3DS "000000004e696e74656e646f20334400,Nintendo 3DS,crc:3210,a:b0,b:b1,back:b2,dpdown:b7,dpleft:b5,dpright:b4,dpup:b6,leftshoulder:b9,lefttrigger:b14,leftx:a0,lefty:a1,rightshoulder:b8,righttrigger:b15,rightx:a2,righty:a3,start:b3,x:b10,y:b11,", #endif - "hidapi,*,a:b0,b:b1,back:b4,dpdown:b12,dpleft:b13,dpright:b14,dpup:b11,guide:b5,leftshoulder:b9,leftstick:b7,lefttrigger:a4,leftx:a0,lefty:a1,rightshoulder:b10,rightstick:b8,righttrigger:a5,rightx:a2,righty:a3,start:b6,x:b2,y:b3,", NULL }; From 8397e1fcc0d59a02924bd554bd73f3c31008dc4b Mon Sep 17 00:00:00 2001 From: Sam Lantinga Date: Thu, 6 Feb 2025 09:21:52 -0800 Subject: [PATCH 326/340] Fix up SDL2 style mappings for HIDAPI controllers Fixes https://github.com/libsdl-org/sdl2-compat/issues/316 --- src/joystick/SDL_gamepad.c | 53 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 53 insertions(+) diff --git a/src/joystick/SDL_gamepad.c b/src/joystick/SDL_gamepad.c index d931ed23a3075..2efa9c305eebc 100644 --- a/src/joystick/SDL_gamepad.c +++ b/src/joystick/SDL_gamepad.c @@ -1393,6 +1393,55 @@ static void SDL_UpdateGamepadFaceStyle(SDL_Gamepad *gamepad) } } +static void SDL_FixupHIDAPIMapping(SDL_Gamepad *gamepad) +{ + // Check to see if we need fixup + for (int i = 0; i < gamepad->num_bindings; ++i) { + SDL_GamepadBinding *binding = &gamepad->bindings[i]; + if (binding->output_type == SDL_GAMEPAD_BINDTYPE_BUTTON && + binding->output.button == SDL_GAMEPAD_BUTTON_DPAD_UP) { + if (binding->input_type != SDL_GAMEPAD_BINDTYPE_BUTTON || + binding->input.button != SDL_GAMEPAD_BUTTON_DPAD_UP) { + // New style binding + return; + } + } + } + + for (int i = 0; i < gamepad->num_bindings; ++i) { + SDL_GamepadBinding *binding = &gamepad->bindings[i]; + if (binding->input_type == SDL_GAMEPAD_BINDTYPE_BUTTON && + binding->output_type == SDL_GAMEPAD_BINDTYPE_BUTTON) { + switch (binding->output.button) { + case SDL_GAMEPAD_BUTTON_DPAD_UP: + binding->input_type = SDL_GAMEPAD_BINDTYPE_HAT; + binding->input.hat.hat = 0; + binding->input.hat.hat_mask = SDL_HAT_UP; + break; + case SDL_GAMEPAD_BUTTON_DPAD_DOWN: + binding->input_type = SDL_GAMEPAD_BINDTYPE_HAT; + binding->input.hat.hat = 0; + binding->input.hat.hat_mask = SDL_HAT_DOWN; + break; + case SDL_GAMEPAD_BUTTON_DPAD_LEFT: + binding->input_type = SDL_GAMEPAD_BINDTYPE_HAT; + binding->input.hat.hat = 0; + binding->input.hat.hat_mask = SDL_HAT_LEFT; + break; + case SDL_GAMEPAD_BUTTON_DPAD_RIGHT: + binding->input_type = SDL_GAMEPAD_BINDTYPE_HAT; + binding->input.hat.hat = 0; + binding->input.hat.hat_mask = SDL_HAT_RIGHT; + break; + default: + if (binding->output.button > SDL_GAMEPAD_BUTTON_DPAD_RIGHT) { + binding->input.button -= 4; + } + break; + } + } + } +} /* * Make a new button mapping struct @@ -1415,6 +1464,10 @@ static void SDL_PrivateLoadButtonMapping(SDL_Gamepad *gamepad, GamepadMapping_t SDL_PrivateParseGamepadConfigString(gamepad, pGamepadMapping->mapping); + if (SDL_IsJoystickHIDAPI(pGamepadMapping->guid)) { + SDL_FixupHIDAPIMapping(gamepad); + } + // Set the zero point for triggers for (i = 0; i < gamepad->num_bindings; ++i) { SDL_GamepadBinding *binding = &gamepad->bindings[i]; From c9341489cc363946247a848997b4b378cf7dbd93 Mon Sep 17 00:00:00 2001 From: Quan Zhuo Date: Fri, 7 Feb 2025 01:34:41 +0800 Subject: [PATCH 327/340] Fix #12197: Force set /utf-8 for msvc compilers (#12198) The MSVC compiler determines the encoding of the source code based on the BOM of the source code when reading it. If there is no BOM, it defaults to the local encoding, which is gb2312, codepage 936, on Simplified Chinese Windows. This can cause errors such as newline characters in strings. --- CMakeLists.txt | 6 ++++++ VisualC-GDK/SDL/SDL.vcxproj | 7 +++++++ VisualC-GDK/SDL_test/SDL_test.vcxproj | 7 +++++++ VisualC-GDK/tests/testcontroller/testcontroller.vcxproj | 7 +++++++ VisualC-GDK/tests/testgdk/testgdk.vcxproj | 7 +++++++ VisualC-GDK/tests/testsprite/testsprite.vcxproj | 7 +++++++ VisualC/SDL/Directory.Build.props | 8 ++++++++ VisualC/SDL/SDL.vcxproj | 5 +++++ VisualC/SDL_test/Directory.Build.props | 8 ++++++++ VisualC/SDL_test/SDL_test.vcxproj | 5 +++++ VisualC/examples/Directory.Build.props | 1 + VisualC/tests/checkkeys/checkkeys.vcxproj | 5 +++++ VisualC/tests/loopwave/loopwave.vcxproj | 5 +++++ VisualC/tests/testatomic/testatomic.vcxproj | 5 +++++ VisualC/tests/testautomation/testautomation.vcxproj | 5 +++++ VisualC/tests/testcontroller/testcontroller.vcxproj | 5 +++++ VisualC/tests/testdialog/testdialog.vcxproj | 5 +++++ VisualC/tests/testdraw/testdraw.vcxproj | 5 +++++ VisualC/tests/testfile/testfile.vcxproj | 5 +++++ VisualC/tests/testgl/testgl.vcxproj | 5 +++++ VisualC/tests/testgles2/testgles2.vcxproj | 5 +++++ VisualC/tests/testoverlay/testoverlay.vcxproj | 5 +++++ VisualC/tests/testpen/testpen.vcxproj | 5 +++++ VisualC/tests/testplatform/testplatform.vcxproj | 5 +++++ VisualC/tests/testpower/testpower.vcxproj | 5 +++++ VisualC/tests/testrendertarget/testrendertarget.vcxproj | 5 +++++ VisualC/tests/testrumble/testrumble.vcxproj | 5 +++++ VisualC/tests/testscale/testscale.vcxproj | 5 +++++ VisualC/tests/testsensor/testsensor.vcxproj | 5 +++++ VisualC/tests/testshape/testshape.vcxproj | 5 +++++ VisualC/tests/testsprite/testsprite.vcxproj | 5 +++++ VisualC/tests/testsurround/testsurround.vcxproj | 5 +++++ VisualC/tests/testvulkan/testvulkan.vcxproj | 5 +++++ VisualC/tests/testwm/testwm.vcxproj | 5 +++++ VisualC/tests/testyuv/testyuv.vcxproj | 5 +++++ 35 files changed, 188 insertions(+) create mode 100644 VisualC/SDL/Directory.Build.props create mode 100644 VisualC/SDL_test/Directory.Build.props diff --git a/CMakeLists.txt b/CMakeLists.txt index 0681a286cbef6..6859775744611 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -13,6 +13,12 @@ else() set(SDL3_MAINPROJECT OFF) endif() +# Add UTF-8 encoding support for MSVC compiler. +# This ensures that the MSVC compiler interprets source files as UTF-8 encoded, +# which is useful for projects containing non-ASCII characters in source files. +add_compile_options("$<$:/utf-8>") +add_compile_options("$<$:/utf-8>") + # By default, configure SDL3 in RelWithDebInfo configuration if(SDL3_MAINPROJECT) get_property(is_multi_config GLOBAL PROPERTY GENERATOR_IS_MULTI_CONFIG) diff --git a/VisualC-GDK/SDL/SDL.vcxproj b/VisualC-GDK/SDL/SDL.vcxproj index 07a9b3be36f2c..7376967129430 100644 --- a/VisualC-GDK/SDL/SDL.vcxproj +++ b/VisualC-GDK/SDL/SDL.vcxproj @@ -115,6 +115,7 @@ .\Debug/SDL.tlb + %(AdditionalOptions) /utf-8 Disabled $(ProjectDir)\..\..\include;$(ProjectDir)\..\..\include\build_config;$(ProjectDir)\..\..\src;%(AdditionalIncludeDirectories) %(AdditionalUsingDirectories) @@ -145,6 +146,7 @@ .\Debug/SDL.tlb + %(AdditionalOptions) /utf-8 Disabled $(ProjectDir)\..\..\include;$(ProjectDir)\..\..\include\build_config;$(ProjectDir)\..\..\src;%(AdditionalIncludeDirectories) %(AdditionalUsingDirectories) @@ -182,6 +184,7 @@ .\Debug/SDL.tlb + %(AdditionalOptions) /utf-8 Disabled $(ProjectDir)\..\..\include;$(ProjectDir)\..\..\include\build_config;$(ProjectDir)\..\..\src;%(AdditionalIncludeDirectories) %(AdditionalUsingDirectories) @@ -219,6 +222,7 @@ .\Release/SDL.tlb + %(AdditionalOptions) /utf-8 $(ProjectDir)\..\..\include;$(ProjectDir)\..\..\include\build_config;$(ProjectDir)\..\..\src;%(AdditionalIncludeDirectories) %(AdditionalUsingDirectories) DLL_EXPORT;NDEBUG;_WINDOWS;%(PreprocessorDefinitions) @@ -250,6 +254,7 @@ .\Release/SDL.tlb + %(AdditionalOptions) /utf-8 $(ProjectDir)\..\..\include;$(ProjectDir)\..\..\include\build_config;$(ProjectDir)\..\..\src;%(AdditionalIncludeDirectories) %(AdditionalUsingDirectories) DLL_EXPORT;NDEBUG;_WINDOWS;%(PreprocessorDefinitions) @@ -288,6 +293,7 @@ .\Release/SDL.tlb + %(AdditionalOptions) /utf-8 $(ProjectDir)\..\..\include;$(ProjectDir)\..\..\include\build_config;$(ProjectDir)\..\..\src;%(AdditionalIncludeDirectories) %(AdditionalUsingDirectories) DLL_EXPORT;NDEBUG;_WINDOWS;%(PreprocessorDefinitions) @@ -320,6 +326,7 @@ + %(AdditionalOptions) /utf-8 $(TreatWarningsAsError) diff --git a/VisualC-GDK/SDL_test/SDL_test.vcxproj b/VisualC-GDK/SDL_test/SDL_test.vcxproj index 7505baf8602c6..8d5106cbd6a34 100644 --- a/VisualC-GDK/SDL_test/SDL_test.vcxproj +++ b/VisualC-GDK/SDL_test/SDL_test.vcxproj @@ -103,6 +103,7 @@ + %(AdditionalOptions) /utf-8 $(ProjectDir)/../../include;%(AdditionalIncludeDirectories) %(AdditionalUsingDirectories) WIN32;NDEBUG;_WINDOWS;%(PreprocessorDefinitions) @@ -117,6 +118,7 @@ + %(AdditionalOptions) /utf-8 $(ProjectDir)/../../include;%(AdditionalIncludeDirectories) %(AdditionalUsingDirectories) WIN32;NDEBUG;_WINDOWS;%(PreprocessorDefinitions) @@ -131,6 +133,7 @@ + %(AdditionalOptions) /utf-8 $(ProjectDir)/../../include;%(AdditionalIncludeDirectories) %(AdditionalUsingDirectories) WIN32;NDEBUG;_WINDOWS;%(PreprocessorDefinitions) @@ -145,6 +148,7 @@ + %(AdditionalOptions) /utf-8 Disabled $(ProjectDir)/../../include;%(AdditionalIncludeDirectories) %(AdditionalUsingDirectories) @@ -159,6 +163,7 @@ + %(AdditionalOptions) /utf-8 Disabled $(ProjectDir)/../../include;%(AdditionalIncludeDirectories) %(AdditionalUsingDirectories) @@ -173,6 +178,7 @@ + %(AdditionalOptions) /utf-8 Disabled $(ProjectDir)/../../include;%(AdditionalIncludeDirectories) %(AdditionalUsingDirectories) @@ -186,6 +192,7 @@ + %(AdditionalOptions) /utf-8 $(TreatWarningsAsError) diff --git a/VisualC-GDK/tests/testcontroller/testcontroller.vcxproj b/VisualC-GDK/tests/testcontroller/testcontroller.vcxproj index d7ad95cf244c7..f600ce203cf2e 100644 --- a/VisualC-GDK/tests/testcontroller/testcontroller.vcxproj +++ b/VisualC-GDK/tests/testcontroller/testcontroller.vcxproj @@ -121,6 +121,7 @@ .\Release/testcontroller.tlb + %(AdditionalOptions) /utf-8 $(SolutionDir)/../include;%(AdditionalIncludeDirectories) %(AdditionalUsingDirectories) WIN32;NDEBUG;_WINDOWS;%(PreprocessorDefinitions) @@ -144,6 +145,7 @@ .\Release/testcontroller.tlb + %(AdditionalOptions) /utf-8 $(SolutionDir)/../include;%(AdditionalIncludeDirectories) %(AdditionalUsingDirectories) WIN32;NDEBUG;_WINDOWS;%(PreprocessorDefinitions) @@ -167,6 +169,7 @@ .\Release/testcontroller.tlb + %(AdditionalOptions) /utf-8 $(SolutionDir)/../include;%(AdditionalIncludeDirectories) %(AdditionalUsingDirectories) WIN32;NDEBUG;_WINDOWS;%(PreprocessorDefinitions) @@ -190,6 +193,7 @@ .\Debug/testcontroller.tlb + %(AdditionalOptions) /utf-8 Disabled $(SolutionDir)/../include;%(AdditionalIncludeDirectories) %(AdditionalUsingDirectories) @@ -216,6 +220,7 @@ .\Debug/testcontroller.tlb + %(AdditionalOptions) /utf-8 Disabled $(SolutionDir)/../include;%(AdditionalIncludeDirectories) %(AdditionalUsingDirectories) @@ -242,6 +247,7 @@ .\Debug/testcontroller.tlb + %(AdditionalOptions) /utf-8 Disabled $(SolutionDir)/../include;%(AdditionalIncludeDirectories) %(AdditionalUsingDirectories) @@ -262,6 +268,7 @@ + %(AdditionalOptions) /utf-8 $(TreatWarningsAsError) diff --git a/VisualC-GDK/tests/testgdk/testgdk.vcxproj b/VisualC-GDK/tests/testgdk/testgdk.vcxproj index 41293cadae55e..c16fadefe11ee 100644 --- a/VisualC-GDK/tests/testgdk/testgdk.vcxproj +++ b/VisualC-GDK/tests/testgdk/testgdk.vcxproj @@ -121,6 +121,7 @@ .\Release/testsprite.tlb + %(AdditionalOptions) /utf-8 $(SolutionDir)/../include;%(AdditionalIncludeDirectories) %(AdditionalUsingDirectories) WIN32;NDEBUG;_WINDOWS;%(PreprocessorDefinitions) @@ -148,6 +149,7 @@ .\Release/testsprite.tlb + %(AdditionalOptions) /utf-8 $(SolutionDir)/../include;%(AdditionalIncludeDirectories) %(AdditionalUsingDirectories) WIN32;NDEBUG;_WINDOWS;%(PreprocessorDefinitions) @@ -175,6 +177,7 @@ .\Release/testsprite.tlb + %(AdditionalOptions) /utf-8 $(SolutionDir)/../include;%(AdditionalIncludeDirectories) %(AdditionalUsingDirectories) WIN32;NDEBUG;_WINDOWS;%(PreprocessorDefinitions) @@ -202,6 +205,7 @@ .\Debug/testsprite.tlb + %(AdditionalOptions) /utf-8 Disabled $(SolutionDir)/../include;%(AdditionalIncludeDirectories) %(AdditionalUsingDirectories) @@ -232,6 +236,7 @@ .\Debug/testsprite.tlb + %(AdditionalOptions) /utf-8 Disabled $(SolutionDir)/../include;%(AdditionalIncludeDirectories) %(AdditionalUsingDirectories) @@ -262,6 +267,7 @@ .\Debug/testsprite.tlb + %(AdditionalOptions) /utf-8 Disabled $(SolutionDir)/../include;%(AdditionalIncludeDirectories) %(AdditionalUsingDirectories) @@ -286,6 +292,7 @@ + %(AdditionalOptions) /utf-8 $(TreatWarningsAsError) diff --git a/VisualC-GDK/tests/testsprite/testsprite.vcxproj b/VisualC-GDK/tests/testsprite/testsprite.vcxproj index 3885aec28aa3f..15ea690af87ff 100644 --- a/VisualC-GDK/tests/testsprite/testsprite.vcxproj +++ b/VisualC-GDK/tests/testsprite/testsprite.vcxproj @@ -121,6 +121,7 @@ .\Release/testsprite.tlb + %(AdditionalOptions) /utf-8 $(SolutionDir)/../include;%(AdditionalIncludeDirectories) %(AdditionalUsingDirectories) WIN32;NDEBUG;_WINDOWS;%(PreprocessorDefinitions) @@ -148,6 +149,7 @@ .\Release/testsprite.tlb + %(AdditionalOptions) /utf-8 $(SolutionDir)/../include;%(AdditionalIncludeDirectories) %(AdditionalUsingDirectories) WIN32;NDEBUG;_WINDOWS;%(PreprocessorDefinitions) @@ -175,6 +177,7 @@ .\Release/testsprite.tlb + %(AdditionalOptions) /utf-8 $(SolutionDir)/../include;%(AdditionalIncludeDirectories) %(AdditionalUsingDirectories) WIN32;NDEBUG;_WINDOWS;%(PreprocessorDefinitions) @@ -202,6 +205,7 @@ .\Debug/testsprite.tlb + %(AdditionalOptions) /utf-8 Disabled $(SolutionDir)/../include;%(AdditionalIncludeDirectories) %(AdditionalUsingDirectories) @@ -232,6 +236,7 @@ .\Debug/testsprite.tlb + %(AdditionalOptions) /utf-8 Disabled $(SolutionDir)/../include;%(AdditionalIncludeDirectories) %(AdditionalUsingDirectories) @@ -262,6 +267,7 @@ .\Debug/testsprite.tlb + %(AdditionalOptions) /utf-8 Disabled $(SolutionDir)/../include;%(AdditionalIncludeDirectories) %(AdditionalUsingDirectories) @@ -286,6 +292,7 @@ + %(AdditionalOptions) /utf-8 $(TreatWarningsAsError) diff --git a/VisualC/SDL/Directory.Build.props b/VisualC/SDL/Directory.Build.props new file mode 100644 index 0000000000000..24033f439e39b --- /dev/null +++ b/VisualC/SDL/Directory.Build.props @@ -0,0 +1,8 @@ + + + + + SDL_VENDOR_INFO="libsdl.org";%(PreprocessorDefinitions) + + + diff --git a/VisualC/SDL/SDL.vcxproj b/VisualC/SDL/SDL.vcxproj index 134c730c30f71..79d5c4681311e 100644 --- a/VisualC/SDL/SDL.vcxproj +++ b/VisualC/SDL/SDL.vcxproj @@ -106,6 +106,7 @@ .\Debug/SDL.tlb + %(AdditionalOptions) /utf-8 Disabled $(ProjectDir)/../../include;$(ProjectDir)/../../include/build_config;%(AdditionalIncludeDirectories) %(AdditionalUsingDirectories) @@ -139,6 +140,7 @@ .\Debug/SDL.tlb + %(AdditionalOptions) /utf-8 Disabled $(ProjectDir)/../../include;$(ProjectDir)/../../include/build_config;%(AdditionalIncludeDirectories) %(AdditionalUsingDirectories) @@ -175,6 +177,7 @@ .\Release/SDL.tlb + %(AdditionalOptions) /utf-8 $(ProjectDir)/../../include;$(ProjectDir)/../../include/build_config;%(AdditionalIncludeDirectories) %(AdditionalUsingDirectories) DLL_EXPORT;NDEBUG;_WINDOWS;%(PreprocessorDefinitions) @@ -209,6 +212,7 @@ .\Release/SDL.tlb + %(AdditionalOptions) /utf-8 $(ProjectDir)/../../include;$(ProjectDir)/../../include/build_config;%(AdditionalIncludeDirectories) %(AdditionalUsingDirectories) DLL_EXPORT;NDEBUG;_WINDOWS;%(PreprocessorDefinitions) @@ -235,6 +239,7 @@ + %(AdditionalOptions) /utf-8 $(TreatWarningsAsError) diff --git a/VisualC/SDL_test/Directory.Build.props b/VisualC/SDL_test/Directory.Build.props new file mode 100644 index 0000000000000..24033f439e39b --- /dev/null +++ b/VisualC/SDL_test/Directory.Build.props @@ -0,0 +1,8 @@ + + + + + SDL_VENDOR_INFO="libsdl.org";%(PreprocessorDefinitions) + + + diff --git a/VisualC/SDL_test/SDL_test.vcxproj b/VisualC/SDL_test/SDL_test.vcxproj index 541f7cb0cf6f6..4313bbe1f36fe 100644 --- a/VisualC/SDL_test/SDL_test.vcxproj +++ b/VisualC/SDL_test/SDL_test.vcxproj @@ -86,6 +86,7 @@ + %(AdditionalOptions) /utf-8 $(ProjectDir)/../../include;%(AdditionalIncludeDirectories) %(AdditionalUsingDirectories) WIN32;NDEBUG;_WINDOWS;%(PreprocessorDefinitions) @@ -104,6 +105,7 @@ X64 + %(AdditionalOptions) /utf-8 $(ProjectDir)/../../include;%(AdditionalIncludeDirectories) %(AdditionalUsingDirectories) WIN32;NDEBUG;_WINDOWS;%(PreprocessorDefinitions) @@ -122,6 +124,7 @@ + %(AdditionalOptions) /utf-8 Disabled $(ProjectDir)/../../include;%(AdditionalIncludeDirectories) %(AdditionalUsingDirectories) @@ -140,6 +143,7 @@ X64 + %(AdditionalOptions) /utf-8 Disabled $(ProjectDir)/../../include;%(AdditionalIncludeDirectories) %(AdditionalUsingDirectories) @@ -154,6 +158,7 @@ + %(AdditionalOptions) /utf-8 $(TreatWarningsAsError) diff --git a/VisualC/examples/Directory.Build.props b/VisualC/examples/Directory.Build.props index fea48e06c300b..4833d3e768c5f 100644 --- a/VisualC/examples/Directory.Build.props +++ b/VisualC/examples/Directory.Build.props @@ -161,6 +161,7 @@ + %(AdditionalOptions) /utf-8 $(SolutionDir)\..\include;%(AdditionalIncludeDirectories) diff --git a/VisualC/tests/checkkeys/checkkeys.vcxproj b/VisualC/tests/checkkeys/checkkeys.vcxproj index cc263df07d9bd..901cdbbd14310 100644 --- a/VisualC/tests/checkkeys/checkkeys.vcxproj +++ b/VisualC/tests/checkkeys/checkkeys.vcxproj @@ -88,6 +88,7 @@ .\Debug/checkkeys.tlb + %(AdditionalOptions) /utf-8 Disabled $(SolutionDir)/../include;%(AdditionalIncludeDirectories) %(AdditionalUsingDirectories) @@ -114,6 +115,7 @@ .\Debug/checkkeys.tlb + %(AdditionalOptions) /utf-8 Disabled $(SolutionDir)/../include;%(AdditionalIncludeDirectories) %(AdditionalUsingDirectories) @@ -140,6 +142,7 @@ .\Release/checkkeys.tlb + %(AdditionalOptions) /utf-8 $(SolutionDir)/../include;%(AdditionalIncludeDirectories) %(AdditionalUsingDirectories) WIN32;NDEBUG;_WINDOWS;%(PreprocessorDefinitions) @@ -166,6 +169,7 @@ .\Release/checkkeys.tlb + %(AdditionalOptions) /utf-8 $(SolutionDir)/../include;%(AdditionalIncludeDirectories) %(AdditionalUsingDirectories) WIN32;NDEBUG;_WINDOWS;%(PreprocessorDefinitions) @@ -185,6 +189,7 @@ + %(AdditionalOptions) /utf-8 $(TreatWarningsAsError) diff --git a/VisualC/tests/loopwave/loopwave.vcxproj b/VisualC/tests/loopwave/loopwave.vcxproj index a5912a9a8c5a0..6ab91a82230e4 100644 --- a/VisualC/tests/loopwave/loopwave.vcxproj +++ b/VisualC/tests/loopwave/loopwave.vcxproj @@ -88,6 +88,7 @@ .\Release/loopwave.tlb + %(AdditionalOptions) /utf-8 $(SolutionDir)/../include;%(AdditionalIncludeDirectories) %(AdditionalUsingDirectories) WIN32;NDEBUG;_WINDOWS;%(PreprocessorDefinitions) @@ -114,6 +115,7 @@ .\Release/loopwave.tlb + %(AdditionalOptions) /utf-8 $(SolutionDir)/../include;%(AdditionalIncludeDirectories) %(AdditionalUsingDirectories) WIN32;NDEBUG;_WINDOWS;%(PreprocessorDefinitions) @@ -140,6 +142,7 @@ .\Debug/loopwave.tlb + %(AdditionalOptions) /utf-8 Disabled $(SolutionDir)/../include;%(AdditionalIncludeDirectories) %(AdditionalUsingDirectories) @@ -166,6 +169,7 @@ .\Debug/loopwave.tlb + %(AdditionalOptions) /utf-8 Disabled $(SolutionDir)/../include;%(AdditionalIncludeDirectories) %(AdditionalUsingDirectories) @@ -185,6 +189,7 @@ + %(AdditionalOptions) /utf-8 $(TreatWarningsAsError) diff --git a/VisualC/tests/testatomic/testatomic.vcxproj b/VisualC/tests/testatomic/testatomic.vcxproj index 5a1efef2dacf4..abe71ff916414 100644 --- a/VisualC/tests/testatomic/testatomic.vcxproj +++ b/VisualC/tests/testatomic/testatomic.vcxproj @@ -88,6 +88,7 @@ .\Debug/testatomic.tlb + %(AdditionalOptions) /utf-8 Disabled $(SolutionDir)/../include;%(AdditionalIncludeDirectories) %(AdditionalUsingDirectories) @@ -114,6 +115,7 @@ .\Debug/testatomic.tlb + %(AdditionalOptions) /utf-8 Disabled $(SolutionDir)/../include;%(AdditionalIncludeDirectories) %(AdditionalUsingDirectories) @@ -140,6 +142,7 @@ .\Release/testatomic.tlb + %(AdditionalOptions) /utf-8 $(SolutionDir)/../include;%(AdditionalIncludeDirectories) %(AdditionalUsingDirectories) WIN32;NDEBUG;_WINDOWS;%(PreprocessorDefinitions) @@ -163,6 +166,7 @@ .\Release/testatomic.tlb + %(AdditionalOptions) /utf-8 $(SolutionDir)/../include;%(AdditionalIncludeDirectories) %(AdditionalUsingDirectories) WIN32;NDEBUG;_WINDOWS;%(PreprocessorDefinitions) @@ -179,6 +183,7 @@ + %(AdditionalOptions) /utf-8 $(TreatWarningsAsError) diff --git a/VisualC/tests/testautomation/testautomation.vcxproj b/VisualC/tests/testautomation/testautomation.vcxproj index ba737643f8630..d973c8dc98ede 100644 --- a/VisualC/tests/testautomation/testautomation.vcxproj +++ b/VisualC/tests/testautomation/testautomation.vcxproj @@ -88,6 +88,7 @@ .\Debug/testautomation.tlb + %(AdditionalOptions) /utf-8 Disabled $(SolutionDir)/../include;$(SolutionDir)/../include/build_config;%(AdditionalIncludeDirectories) %(AdditionalUsingDirectories) @@ -114,6 +115,7 @@ .\Debug/testautomation.tlb + %(AdditionalOptions) /utf-8 Disabled $(SolutionDir)/../include;$(SolutionDir)/../include/build_config;%(AdditionalIncludeDirectories) %(AdditionalUsingDirectories) @@ -140,6 +142,7 @@ .\Release/testautomation.tlb + %(AdditionalOptions) /utf-8 $(SolutionDir)/../include;$(SolutionDir)/../include/build_config;%(AdditionalIncludeDirectories) %(AdditionalUsingDirectories) WIN32;NDEBUG;_WINDOWS;%(PreprocessorDefinitions) @@ -163,6 +166,7 @@ .\Release/testautomation.tlb + %(AdditionalOptions) /utf-8 $(SolutionDir)/../include;$(SolutionDir)/../include/build_config;%(AdditionalIncludeDirectories) %(AdditionalUsingDirectories) WIN32;NDEBUG;_WINDOWS;%(PreprocessorDefinitions) @@ -179,6 +183,7 @@ + %(AdditionalOptions) /utf-8 $(TreatWarningsAsError) diff --git a/VisualC/tests/testcontroller/testcontroller.vcxproj b/VisualC/tests/testcontroller/testcontroller.vcxproj index 94c8629a1a266..fbcadfcb82edd 100644 --- a/VisualC/tests/testcontroller/testcontroller.vcxproj +++ b/VisualC/tests/testcontroller/testcontroller.vcxproj @@ -88,6 +88,7 @@ .\Release/testcontroller.tlb + %(AdditionalOptions) /utf-8 $(SolutionDir)/../include;%(AdditionalIncludeDirectories) %(AdditionalUsingDirectories) WIN32;NDEBUG;_WINDOWS;%(PreprocessorDefinitions) @@ -111,6 +112,7 @@ .\Release/testcontroller.tlb + %(AdditionalOptions) /utf-8 $(SolutionDir)/../include;%(AdditionalIncludeDirectories) %(AdditionalUsingDirectories) WIN32;NDEBUG;_WINDOWS;%(PreprocessorDefinitions) @@ -134,6 +136,7 @@ .\Debug/testcontroller.tlb + %(AdditionalOptions) /utf-8 Disabled $(SolutionDir)/../include;%(AdditionalIncludeDirectories) %(AdditionalUsingDirectories) @@ -160,6 +163,7 @@ .\Debug/testcontroller.tlb + %(AdditionalOptions) /utf-8 Disabled $(SolutionDir)/../include;%(AdditionalIncludeDirectories) %(AdditionalUsingDirectories) @@ -179,6 +183,7 @@ + %(AdditionalOptions) /utf-8 $(TreatWarningsAsError) diff --git a/VisualC/tests/testdialog/testdialog.vcxproj b/VisualC/tests/testdialog/testdialog.vcxproj index ed773c472c23b..88e570f77d996 100644 --- a/VisualC/tests/testdialog/testdialog.vcxproj +++ b/VisualC/tests/testdialog/testdialog.vcxproj @@ -88,6 +88,7 @@ .\Debug/testdialog.tlb + %(AdditionalOptions) /utf-8 Disabled $(SolutionDir)/../include;%(AdditionalIncludeDirectories) %(AdditionalUsingDirectories) @@ -114,6 +115,7 @@ .\Debug/testdialog.tlb + %(AdditionalOptions) /utf-8 Disabled $(SolutionDir)/../include;%(AdditionalIncludeDirectories) %(AdditionalUsingDirectories) @@ -140,6 +142,7 @@ .\Release/testdialog.tlb + %(AdditionalOptions) /utf-8 $(SolutionDir)/../include;%(AdditionalIncludeDirectories) %(AdditionalUsingDirectories) WIN32;NDEBUG;_WINDOWS;%(PreprocessorDefinitions) @@ -163,6 +166,7 @@ .\Release/testdialog.tlb + %(AdditionalOptions) /utf-8 $(SolutionDir)/../include;%(AdditionalIncludeDirectories) %(AdditionalUsingDirectories) WIN32;NDEBUG;_WINDOWS;%(PreprocessorDefinitions) @@ -179,6 +183,7 @@ + %(AdditionalOptions) /utf-8 $(TreatWarningsAsError) diff --git a/VisualC/tests/testdraw/testdraw.vcxproj b/VisualC/tests/testdraw/testdraw.vcxproj index 5ca57bf082bc0..de8a31e221d48 100644 --- a/VisualC/tests/testdraw/testdraw.vcxproj +++ b/VisualC/tests/testdraw/testdraw.vcxproj @@ -88,6 +88,7 @@ .\Release/testdraw.tlb + %(AdditionalOptions) /utf-8 $(SolutionDir)/../include;%(AdditionalIncludeDirectories) %(AdditionalUsingDirectories) WIN32;NDEBUG;_WINDOWS;%(PreprocessorDefinitions) @@ -111,6 +112,7 @@ .\Release/testdraw.tlb + %(AdditionalOptions) /utf-8 $(SolutionDir)/../include;%(AdditionalIncludeDirectories) %(AdditionalUsingDirectories) WIN32;NDEBUG;_WINDOWS;%(PreprocessorDefinitions) @@ -134,6 +136,7 @@ .\Debug/testdraw.tlb + %(AdditionalOptions) /utf-8 Disabled $(SolutionDir)/../include;%(AdditionalIncludeDirectories) %(AdditionalUsingDirectories) @@ -160,6 +163,7 @@ .\Debug/testdraw.tlb + %(AdditionalOptions) /utf-8 Disabled $(SolutionDir)/../include;%(AdditionalIncludeDirectories) %(AdditionalUsingDirectories) @@ -179,6 +183,7 @@ + %(AdditionalOptions) /utf-8 $(TreatWarningsAsError) diff --git a/VisualC/tests/testfile/testfile.vcxproj b/VisualC/tests/testfile/testfile.vcxproj index a38880d5e3a0e..dfcd43122113f 100644 --- a/VisualC/tests/testfile/testfile.vcxproj +++ b/VisualC/tests/testfile/testfile.vcxproj @@ -88,6 +88,7 @@ .\Debug/testfile.tlb + %(AdditionalOptions) /utf-8 Disabled $(SolutionDir)/../include;%(AdditionalIncludeDirectories) %(AdditionalUsingDirectories) @@ -114,6 +115,7 @@ .\Debug/testfile.tlb + %(AdditionalOptions) /utf-8 Disabled $(SolutionDir)/../include;%(AdditionalIncludeDirectories) %(AdditionalUsingDirectories) @@ -140,6 +142,7 @@ .\Release/testfile.tlb + %(AdditionalOptions) /utf-8 $(SolutionDir)/../include;%(AdditionalIncludeDirectories) %(AdditionalUsingDirectories) WIN32;NDEBUG;_WINDOWS;%(PreprocessorDefinitions) @@ -163,6 +166,7 @@ .\Release/testfile.tlb + %(AdditionalOptions) /utf-8 $(SolutionDir)/../include;%(AdditionalIncludeDirectories) %(AdditionalUsingDirectories) WIN32;NDEBUG;_WINDOWS;%(PreprocessorDefinitions) @@ -179,6 +183,7 @@ + %(AdditionalOptions) /utf-8 $(TreatWarningsAsError) diff --git a/VisualC/tests/testgl/testgl.vcxproj b/VisualC/tests/testgl/testgl.vcxproj index b8bc234ec1faf..6c521252015fd 100644 --- a/VisualC/tests/testgl/testgl.vcxproj +++ b/VisualC/tests/testgl/testgl.vcxproj @@ -88,6 +88,7 @@ .\Debug/testgl.tlb + %(AdditionalOptions) /utf-8 Disabled $(SolutionDir)/../include;%(AdditionalIncludeDirectories) %(AdditionalUsingDirectories) @@ -115,6 +116,7 @@ .\Debug/testgl.tlb + %(AdditionalOptions) /utf-8 Disabled $(SolutionDir)/../include;%(AdditionalIncludeDirectories) %(AdditionalUsingDirectories) @@ -142,6 +144,7 @@ .\Release/testgl.tlb + %(AdditionalOptions) /utf-8 $(SolutionDir)/../include;%(AdditionalIncludeDirectories) %(AdditionalUsingDirectories) NDEBUG;WIN32;_WINDOWS;HAVE_OPENGL;%(PreprocessorDefinitions) @@ -166,6 +169,7 @@ .\Release/testgl.tlb + %(AdditionalOptions) /utf-8 $(SolutionDir)/../include;%(AdditionalIncludeDirectories) %(AdditionalUsingDirectories) NDEBUG;WIN32;_WINDOWS;HAVE_OPENGL;%(PreprocessorDefinitions) @@ -183,6 +187,7 @@ + %(AdditionalOptions) /utf-8 $(TreatWarningsAsError) diff --git a/VisualC/tests/testgles2/testgles2.vcxproj b/VisualC/tests/testgles2/testgles2.vcxproj index 13d0df290306a..728bb2cc790de 100644 --- a/VisualC/tests/testgles2/testgles2.vcxproj +++ b/VisualC/tests/testgles2/testgles2.vcxproj @@ -88,6 +88,7 @@ .\Debug/testgles2.tlb + %(AdditionalOptions) /utf-8 Disabled $(SolutionDir)/../include;%(AdditionalIncludeDirectories) _DEBUG;WIN32;_WINDOWS;HAVE_OPENGL;%(PreprocessorDefinitions) @@ -114,6 +115,7 @@ .\Debug/testgles2.tlb + %(AdditionalOptions) /utf-8 Disabled $(SolutionDir)/../include;%(AdditionalIncludeDirectories) _DEBUG;WIN32;_WINDOWS;HAVE_OPENGL;%(PreprocessorDefinitions) @@ -140,6 +142,7 @@ .\Release/testgles2.tlb + %(AdditionalOptions) /utf-8 $(SolutionDir)/../include;%(AdditionalIncludeDirectories) NDEBUG;WIN32;_WINDOWS;HAVE_OPENGL;%(PreprocessorDefinitions) MultiThreadedDLL @@ -163,6 +166,7 @@ .\Release/testgles2.tlb + %(AdditionalOptions) /utf-8 $(SolutionDir)/../include;%(AdditionalIncludeDirectories) NDEBUG;WIN32;_WINDOWS;HAVE_OPENGL;%(PreprocessorDefinitions) MultiThreadedDLL @@ -179,6 +183,7 @@ + %(AdditionalOptions) /utf-8 $(TreatWarningsAsError) diff --git a/VisualC/tests/testoverlay/testoverlay.vcxproj b/VisualC/tests/testoverlay/testoverlay.vcxproj index 80c8b03040026..6d7e2ccb0a48b 100644 --- a/VisualC/tests/testoverlay/testoverlay.vcxproj +++ b/VisualC/tests/testoverlay/testoverlay.vcxproj @@ -88,6 +88,7 @@ .\Release/testoverlay.tlb + %(AdditionalOptions) /utf-8 $(SolutionDir)/../include;%(AdditionalIncludeDirectories) %(AdditionalUsingDirectories) WIN32;NDEBUG;_WINDOWS;%(PreprocessorDefinitions) @@ -111,6 +112,7 @@ .\Release/testoverlay.tlb + %(AdditionalOptions) /utf-8 $(SolutionDir)/../include;%(AdditionalIncludeDirectories) %(AdditionalUsingDirectories) WIN32;NDEBUG;_WINDOWS;%(PreprocessorDefinitions) @@ -134,6 +136,7 @@ .\Debug/testoverlay.tlb + %(AdditionalOptions) /utf-8 Disabled $(SolutionDir)/../include;%(AdditionalIncludeDirectories) %(AdditionalUsingDirectories) @@ -160,6 +163,7 @@ .\Debug/testoverlay.tlb + %(AdditionalOptions) /utf-8 Disabled $(SolutionDir)/../include;%(AdditionalIncludeDirectories) %(AdditionalUsingDirectories) @@ -179,6 +183,7 @@ + %(AdditionalOptions) /utf-8 $(TreatWarningsAsError) diff --git a/VisualC/tests/testpen/testpen.vcxproj b/VisualC/tests/testpen/testpen.vcxproj index fdef64f234051..65888443c5eeb 100644 --- a/VisualC/tests/testpen/testpen.vcxproj +++ b/VisualC/tests/testpen/testpen.vcxproj @@ -88,6 +88,7 @@ .\Debug/testpower.tlb + %(AdditionalOptions) /utf-8 Disabled $(SolutionDir)/../include;%(AdditionalIncludeDirectories) %(AdditionalUsingDirectories) @@ -114,6 +115,7 @@ .\Debug/testpower.tlb + %(AdditionalOptions) /utf-8 Disabled $(SolutionDir)/../include;%(AdditionalIncludeDirectories) %(AdditionalUsingDirectories) @@ -140,6 +142,7 @@ .\Release/testpower.tlb + %(AdditionalOptions) /utf-8 $(SolutionDir)/../include;%(AdditionalIncludeDirectories) %(AdditionalUsingDirectories) WIN32;NDEBUG;_WINDOWS;%(PreprocessorDefinitions) @@ -163,6 +166,7 @@ .\Release/testpower.tlb + %(AdditionalOptions) /utf-8 $(SolutionDir)/../include;%(AdditionalIncludeDirectories) %(AdditionalUsingDirectories) WIN32;NDEBUG;_WINDOWS;%(PreprocessorDefinitions) @@ -179,6 +183,7 @@ + %(AdditionalOptions) /utf-8 $(TreatWarningsAsError) diff --git a/VisualC/tests/testplatform/testplatform.vcxproj b/VisualC/tests/testplatform/testplatform.vcxproj index 7752f733f78d3..af8ae0cdbc35a 100644 --- a/VisualC/tests/testplatform/testplatform.vcxproj +++ b/VisualC/tests/testplatform/testplatform.vcxproj @@ -90,6 +90,7 @@ + %(AdditionalOptions) /utf-8 Disabled $(SolutionDir)/../include;%(AdditionalIncludeDirectories) %(AdditionalUsingDirectories) @@ -119,6 +120,7 @@ + %(AdditionalOptions) /utf-8 Disabled $(SolutionDir)/../include;%(AdditionalIncludeDirectories) %(AdditionalUsingDirectories) @@ -148,6 +150,7 @@ + %(AdditionalOptions) /utf-8 $(SolutionDir)/../include;%(AdditionalIncludeDirectories) %(AdditionalUsingDirectories) WIN32;NDEBUG;_WINDOWS;%(PreprocessorDefinitions) @@ -174,6 +177,7 @@ + %(AdditionalOptions) /utf-8 $(SolutionDir)/../include;%(AdditionalIncludeDirectories) %(AdditionalUsingDirectories) WIN32;NDEBUG;_WINDOWS;%(PreprocessorDefinitions) @@ -191,6 +195,7 @@ + %(AdditionalOptions) /utf-8 $(TreatWarningsAsError) diff --git a/VisualC/tests/testpower/testpower.vcxproj b/VisualC/tests/testpower/testpower.vcxproj index 98ca2b53a2c67..cacf3621d5a6d 100644 --- a/VisualC/tests/testpower/testpower.vcxproj +++ b/VisualC/tests/testpower/testpower.vcxproj @@ -88,6 +88,7 @@ .\Debug/testpower.tlb + %(AdditionalOptions) /utf-8 Disabled $(SolutionDir)/../include;%(AdditionalIncludeDirectories) %(AdditionalUsingDirectories) @@ -114,6 +115,7 @@ .\Debug/testpower.tlb + %(AdditionalOptions) /utf-8 Disabled $(SolutionDir)/../include;%(AdditionalIncludeDirectories) %(AdditionalUsingDirectories) @@ -140,6 +142,7 @@ .\Release/testpower.tlb + %(AdditionalOptions) /utf-8 $(SolutionDir)/../include;%(AdditionalIncludeDirectories) %(AdditionalUsingDirectories) WIN32;NDEBUG;_WINDOWS;%(PreprocessorDefinitions) @@ -163,6 +166,7 @@ .\Release/testpower.tlb + %(AdditionalOptions) /utf-8 $(SolutionDir)/../include;%(AdditionalIncludeDirectories) %(AdditionalUsingDirectories) WIN32;NDEBUG;_WINDOWS;%(PreprocessorDefinitions) @@ -179,6 +183,7 @@ + %(AdditionalOptions) /utf-8 $(TreatWarningsAsError) diff --git a/VisualC/tests/testrendertarget/testrendertarget.vcxproj b/VisualC/tests/testrendertarget/testrendertarget.vcxproj index eaf719bb291aa..e59bb6ba81b76 100644 --- a/VisualC/tests/testrendertarget/testrendertarget.vcxproj +++ b/VisualC/tests/testrendertarget/testrendertarget.vcxproj @@ -88,6 +88,7 @@ .\Release/testrendertarget.tlb + %(AdditionalOptions) /utf-8 $(SolutionDir)/../include;%(AdditionalIncludeDirectories) %(AdditionalUsingDirectories) WIN32;NDEBUG;_WINDOWS;%(PreprocessorDefinitions) @@ -111,6 +112,7 @@ .\Release/testrendertarget.tlb + %(AdditionalOptions) /utf-8 $(SolutionDir)/../include;%(AdditionalIncludeDirectories) %(AdditionalUsingDirectories) WIN32;NDEBUG;_WINDOWS;%(PreprocessorDefinitions) @@ -134,6 +136,7 @@ .\Debug/testrendertarget.tlb + %(AdditionalOptions) /utf-8 Disabled $(SolutionDir)/../include;%(AdditionalIncludeDirectories) %(AdditionalUsingDirectories) @@ -160,6 +163,7 @@ .\Debug/testrendertarget.tlb + %(AdditionalOptions) /utf-8 Disabled $(SolutionDir)/../include;%(AdditionalIncludeDirectories) %(AdditionalUsingDirectories) @@ -179,6 +183,7 @@ + %(AdditionalOptions) /utf-8 $(TreatWarningsAsError) diff --git a/VisualC/tests/testrumble/testrumble.vcxproj b/VisualC/tests/testrumble/testrumble.vcxproj index c0cb1090b64ff..0ae100dc36a7e 100644 --- a/VisualC/tests/testrumble/testrumble.vcxproj +++ b/VisualC/tests/testrumble/testrumble.vcxproj @@ -88,6 +88,7 @@ .\Debug/testrumble.tlb + %(AdditionalOptions) /utf-8 Disabled $(SolutionDir)/../include;%(AdditionalIncludeDirectories) %(AdditionalUsingDirectories) @@ -114,6 +115,7 @@ .\Debug/testrumble.tlb + %(AdditionalOptions) /utf-8 Disabled $(SolutionDir)/../include;%(AdditionalIncludeDirectories) %(AdditionalUsingDirectories) @@ -140,6 +142,7 @@ .\Release/testrumble.tlb + %(AdditionalOptions) /utf-8 $(SolutionDir)/../include;%(AdditionalIncludeDirectories) %(AdditionalUsingDirectories) WIN32;NDEBUG;_WINDOWS;%(PreprocessorDefinitions) @@ -163,6 +166,7 @@ .\Release/testrumble.tlb + %(AdditionalOptions) /utf-8 $(SolutionDir)/../include;%(AdditionalIncludeDirectories) %(AdditionalUsingDirectories) WIN32;NDEBUG;_WINDOWS;%(PreprocessorDefinitions) @@ -179,6 +183,7 @@ + %(AdditionalOptions) /utf-8 $(TreatWarningsAsError) diff --git a/VisualC/tests/testscale/testscale.vcxproj b/VisualC/tests/testscale/testscale.vcxproj index 3843e57ae34aa..c8900f361bbcc 100644 --- a/VisualC/tests/testscale/testscale.vcxproj +++ b/VisualC/tests/testscale/testscale.vcxproj @@ -88,6 +88,7 @@ .\Release/testscale.tlb + %(AdditionalOptions) /utf-8 $(SolutionDir)/../include;%(AdditionalIncludeDirectories) %(AdditionalUsingDirectories) WIN32;NDEBUG;_WINDOWS;%(PreprocessorDefinitions) @@ -111,6 +112,7 @@ .\Release/testscale.tlb + %(AdditionalOptions) /utf-8 $(SolutionDir)/../include;%(AdditionalIncludeDirectories) %(AdditionalUsingDirectories) WIN32;NDEBUG;_WINDOWS;%(PreprocessorDefinitions) @@ -134,6 +136,7 @@ .\Debug/testscale.tlb + %(AdditionalOptions) /utf-8 Disabled $(SolutionDir)/../include;%(AdditionalIncludeDirectories) %(AdditionalUsingDirectories) @@ -160,6 +163,7 @@ .\Debug/testscale.tlb + %(AdditionalOptions) /utf-8 Disabled $(SolutionDir)/../include;%(AdditionalIncludeDirectories) %(AdditionalUsingDirectories) @@ -179,6 +183,7 @@ + %(AdditionalOptions) /utf-8 $(TreatWarningsAsError) diff --git a/VisualC/tests/testsensor/testsensor.vcxproj b/VisualC/tests/testsensor/testsensor.vcxproj index 3f034ad396dc6..f0a9af8ac3e5b 100644 --- a/VisualC/tests/testsensor/testsensor.vcxproj +++ b/VisualC/tests/testsensor/testsensor.vcxproj @@ -88,6 +88,7 @@ .\Debug/testsensor.tlb + %(AdditionalOptions) /utf-8 Disabled $(SolutionDir)/../include;%(AdditionalIncludeDirectories) %(AdditionalUsingDirectories) @@ -114,6 +115,7 @@ .\Debug/testsensor.tlb + %(AdditionalOptions) /utf-8 Disabled $(SolutionDir)/../include;%(AdditionalIncludeDirectories) %(AdditionalUsingDirectories) @@ -140,6 +142,7 @@ .\Release/testsensor.tlb + %(AdditionalOptions) /utf-8 $(SolutionDir)/../include;%(AdditionalIncludeDirectories) %(AdditionalUsingDirectories) WIN32;NDEBUG;_WINDOWS;%(PreprocessorDefinitions) @@ -163,6 +166,7 @@ .\Release/testsensor.tlb + %(AdditionalOptions) /utf-8 $(SolutionDir)/../include;%(AdditionalIncludeDirectories) %(AdditionalUsingDirectories) WIN32;NDEBUG;_WINDOWS;%(PreprocessorDefinitions) @@ -179,6 +183,7 @@ + %(AdditionalOptions) /utf-8 $(TreatWarningsAsError) diff --git a/VisualC/tests/testshape/testshape.vcxproj b/VisualC/tests/testshape/testshape.vcxproj index 33521f68443c5..1490483731e48 100644 --- a/VisualC/tests/testshape/testshape.vcxproj +++ b/VisualC/tests/testshape/testshape.vcxproj @@ -88,6 +88,7 @@ .\Release/testshape.tlb + %(AdditionalOptions) /utf-8 $(SolutionDir)/../include;%(AdditionalIncludeDirectories) %(AdditionalUsingDirectories) WIN32;NDEBUG;_WINDOWS;%(PreprocessorDefinitions) @@ -111,6 +112,7 @@ .\Release/testshape.tlb + %(AdditionalOptions) /utf-8 $(SolutionDir)/../include;%(AdditionalIncludeDirectories) %(AdditionalUsingDirectories) WIN32;NDEBUG;_WINDOWS;%(PreprocessorDefinitions) @@ -134,6 +136,7 @@ .\Debug/testshape.tlb + %(AdditionalOptions) /utf-8 Disabled $(SolutionDir)/../include;%(AdditionalIncludeDirectories) %(AdditionalUsingDirectories) @@ -160,6 +163,7 @@ .\Debug/testshape.tlb + %(AdditionalOptions) /utf-8 Disabled $(SolutionDir)/../include;%(AdditionalIncludeDirectories) %(AdditionalUsingDirectories) @@ -179,6 +183,7 @@ + %(AdditionalOptions) /utf-8 $(TreatWarningsAsError) diff --git a/VisualC/tests/testsprite/testsprite.vcxproj b/VisualC/tests/testsprite/testsprite.vcxproj index f53408ff57239..46473ccc9f03e 100644 --- a/VisualC/tests/testsprite/testsprite.vcxproj +++ b/VisualC/tests/testsprite/testsprite.vcxproj @@ -88,6 +88,7 @@ .\Release/testsprite.tlb + %(AdditionalOptions) /utf-8 $(SolutionDir)/../include;%(AdditionalIncludeDirectories) %(AdditionalUsingDirectories) WIN32;NDEBUG;_WINDOWS;%(PreprocessorDefinitions) @@ -111,6 +112,7 @@ .\Release/testsprite.tlb + %(AdditionalOptions) /utf-8 $(SolutionDir)/../include;%(AdditionalIncludeDirectories) %(AdditionalUsingDirectories) WIN32;NDEBUG;_WINDOWS;%(PreprocessorDefinitions) @@ -134,6 +136,7 @@ .\Debug/testsprite.tlb + %(AdditionalOptions) /utf-8 Disabled $(SolutionDir)/../include;%(AdditionalIncludeDirectories) %(AdditionalUsingDirectories) @@ -160,6 +163,7 @@ .\Debug/testsprite.tlb + %(AdditionalOptions) /utf-8 Disabled $(SolutionDir)/../include;%(AdditionalIncludeDirectories) %(AdditionalUsingDirectories) @@ -179,6 +183,7 @@ + %(AdditionalOptions) /utf-8 $(TreatWarningsAsError) diff --git a/VisualC/tests/testsurround/testsurround.vcxproj b/VisualC/tests/testsurround/testsurround.vcxproj index 657dd1f3d7468..13ded82fa4d08 100644 --- a/VisualC/tests/testsurround/testsurround.vcxproj +++ b/VisualC/tests/testsurround/testsurround.vcxproj @@ -88,6 +88,7 @@ .\Release/testsurround.tlb + %(AdditionalOptions) /utf-8 $(SolutionDir)/../include;%(AdditionalIncludeDirectories) %(AdditionalUsingDirectories) WIN32;NDEBUG;_WINDOWS;%(PreprocessorDefinitions) @@ -114,6 +115,7 @@ .\Release/testsurround.tlb + %(AdditionalOptions) /utf-8 $(SolutionDir)/../include;%(AdditionalIncludeDirectories) %(AdditionalUsingDirectories) WIN32;NDEBUG;_WINDOWS;%(PreprocessorDefinitions) @@ -140,6 +142,7 @@ .\Debug/testsurround.tlb + %(AdditionalOptions) /utf-8 Disabled $(SolutionDir)/../include;%(AdditionalIncludeDirectories) %(AdditionalUsingDirectories) @@ -166,6 +169,7 @@ .\Debug/testsurround.tlb + %(AdditionalOptions) /utf-8 Disabled $(SolutionDir)/../include;%(AdditionalIncludeDirectories) %(AdditionalUsingDirectories) @@ -185,6 +189,7 @@ + %(AdditionalOptions) /utf-8 $(TreatWarningsAsError) diff --git a/VisualC/tests/testvulkan/testvulkan.vcxproj b/VisualC/tests/testvulkan/testvulkan.vcxproj index 800aa50ff4747..0e6645b4dce0a 100644 --- a/VisualC/tests/testvulkan/testvulkan.vcxproj +++ b/VisualC/tests/testvulkan/testvulkan.vcxproj @@ -88,6 +88,7 @@ .\Debug/testvulkan.tlb + %(AdditionalOptions) /utf-8 Disabled $(SolutionDir)/../include;%(AdditionalIncludeDirectories) %(AdditionalUsingDirectories) @@ -114,6 +115,7 @@ .\Debug/testvulkan.tlb + %(AdditionalOptions) /utf-8 Disabled $(SolutionDir)/../include;%(AdditionalIncludeDirectories) %(AdditionalUsingDirectories) @@ -140,6 +142,7 @@ .\Release/testvulkan.tlb + %(AdditionalOptions) /utf-8 $(SolutionDir)/../include;%(AdditionalIncludeDirectories) %(AdditionalUsingDirectories) NDEBUG;WIN32;_WINDOWS;HAVE_OPENGL;%(PreprocessorDefinitions) @@ -163,6 +166,7 @@ .\Release/testvulkan.tlb + %(AdditionalOptions) /utf-8 $(SolutionDir)/../include;%(AdditionalIncludeDirectories) %(AdditionalUsingDirectories) NDEBUG;WIN32;_WINDOWS;HAVE_OPENGL;%(PreprocessorDefinitions) @@ -179,6 +183,7 @@ + %(AdditionalOptions) /utf-8 $(TreatWarningsAsError) diff --git a/VisualC/tests/testwm/testwm.vcxproj b/VisualC/tests/testwm/testwm.vcxproj index b16df24343c5b..48786d3404863 100644 --- a/VisualC/tests/testwm/testwm.vcxproj +++ b/VisualC/tests/testwm/testwm.vcxproj @@ -88,6 +88,7 @@ .\Debug/testwm.tlb + %(AdditionalOptions) /utf-8 Disabled $(SolutionDir)/../include;%(AdditionalIncludeDirectories) %(AdditionalUsingDirectories) @@ -114,6 +115,7 @@ .\Debug/testwm.tlb + %(AdditionalOptions) /utf-8 Disabled $(SolutionDir)/../include;%(AdditionalIncludeDirectories) %(AdditionalUsingDirectories) @@ -140,6 +142,7 @@ .\Release/testwm.tlb + %(AdditionalOptions) /utf-8 $(SolutionDir)/../include;%(AdditionalIncludeDirectories) %(AdditionalUsingDirectories) WIN32;NDEBUG;_WINDOWS;%(PreprocessorDefinitions) @@ -163,6 +166,7 @@ .\Release/testwm.tlb + %(AdditionalOptions) /utf-8 $(SolutionDir)/../include;%(AdditionalIncludeDirectories) %(AdditionalUsingDirectories) WIN32;NDEBUG;_WINDOWS;%(PreprocessorDefinitions) @@ -179,6 +183,7 @@ + %(AdditionalOptions) /utf-8 $(TreatWarningsAsError) diff --git a/VisualC/tests/testyuv/testyuv.vcxproj b/VisualC/tests/testyuv/testyuv.vcxproj index e0eefbd742f39..5adf0eee3f386 100644 --- a/VisualC/tests/testyuv/testyuv.vcxproj +++ b/VisualC/tests/testyuv/testyuv.vcxproj @@ -88,6 +88,7 @@ .\Release/testyuv.tlb + %(AdditionalOptions) /utf-8 $(SolutionDir)/../include;%(AdditionalIncludeDirectories) %(AdditionalUsingDirectories) WIN32;NDEBUG;_WINDOWS;%(PreprocessorDefinitions) @@ -111,6 +112,7 @@ .\Release/testyuv.tlb + %(AdditionalOptions) /utf-8 $(SolutionDir)/../include;%(AdditionalIncludeDirectories) %(AdditionalUsingDirectories) WIN32;NDEBUG;_WINDOWS;%(PreprocessorDefinitions) @@ -134,6 +136,7 @@ .\Debug/testyuv.tlb + %(AdditionalOptions) /utf-8 Disabled $(SolutionDir)/../include;%(AdditionalIncludeDirectories) %(AdditionalUsingDirectories) @@ -160,6 +163,7 @@ .\Debug/testyuv.tlb + %(AdditionalOptions) /utf-8 Disabled $(SolutionDir)/../include;%(AdditionalIncludeDirectories) %(AdditionalUsingDirectories) @@ -179,6 +183,7 @@ + %(AdditionalOptions) /utf-8 $(TreatWarningsAsError) From 8730f6a569ed277d7228d6af43f34510ef7f63d5 Mon Sep 17 00:00:00 2001 From: "Ryan C. Gordon" Date: Thu, 6 Feb 2025 12:40:13 -0500 Subject: [PATCH 328/340] dynapi: Don't use SDL_getenv; it might malloc before the app sets an allocator. Use platform-specific code instead, so SDL's allocator never comes into play. (cherry picked from commit d2693d4c7d55352613a12bb27399d585a4c9e2c8) --- src/dynapi/SDL_dynapi.c | 25 ++++++++++++++++++++----- 1 file changed, 20 insertions(+), 5 deletions(-) diff --git a/src/dynapi/SDL_dynapi.c b/src/dynapi/SDL_dynapi.c index 335e74407d865..a7b51af6bef08 100644 --- a/src/dynapi/SDL_dynapi.c +++ b/src/dynapi/SDL_dynapi.c @@ -33,6 +33,9 @@ #ifdef HAVE_STDIO_H #include #endif +#ifdef HAVE_STDLIB_H +#include +#endif #include #define SDL_MAIN_NOIMPL // don't drag in header-only implementation of SDL_main @@ -42,6 +45,13 @@ // These headers have system specific definitions, so aren't included above #include +#if defined(WIN32) || defined(_WIN32) || defined(SDL_PLATFORM_CYGWIN) +#ifndef WIN32_LEAN_AND_MEAN +#define WIN32_LEAN_AND_MEAN 1 +#endif +#include +#endif + /* This is the version of the dynamic API. This doesn't match the SDL version and should not change until there's been a major revamp in API/ABI. So 2.0.5 adds functions over 2.0.4? This number doesn't change; @@ -438,10 +448,6 @@ Sint32 SDL_DYNAPI_entry(Uint32 apiver, void *table, Uint32 tablesize) // Obviously we can't use SDL_LoadObject() to load SDL. :) // Also obviously, we never close the loaded library. #if defined(WIN32) || defined(_WIN32) || defined(SDL_PLATFORM_CYGWIN) -#ifndef WIN32_LEAN_AND_MEAN -#define WIN32_LEAN_AND_MEAN 1 -#endif -#include static SDL_INLINE void *get_sdlapi_entry(const char *fname, const char *sym) { HMODULE lib = LoadLibraryA(fname); @@ -503,7 +509,16 @@ extern SDL_NORETURN void SDL_ExitProcess(int exitcode); static void SDL_InitDynamicAPILocked(void) { - const char *libname = SDL_getenv_unsafe_REAL(SDL_DYNAMIC_API_ENVVAR); + // this can't use SDL_getenv_unsafe_REAL, because it might allocate memory before the app can set their allocator. +#if defined(WIN32) || defined(_WIN32) || defined(__CYGWIN__) + // We've always used LoadLibraryA for this, so this has never worked with Unicode paths on Windows. Sorry. + char envbuf[512]; // overflows will just report as environment variable being unset, but LoadLibraryA has a MAX_PATH of 260 anyhow, apparently. + const DWORD rc = GetEnvironmentVariableA(SDL_DYNAMIC_API_ENVVAR, envbuf, (DWORD) sizeof (envbuf)); + char *libname = ((rc != 0) && (rc < sizeof (envbuf))) ? envbuf : NULL; +#else + char *libname = getenv(SDL_DYNAMIC_API_ENVVAR); +#endif + SDL_DYNAPI_ENTRYFN entry = NULL; // funcs from here by default. bool use_internal = true; From a646dc89e5c4f44e8c714fa777dd73bcea84fafb Mon Sep 17 00:00:00 2001 From: Sam Lantinga Date: Thu, 6 Feb 2025 10:44:07 -0800 Subject: [PATCH 329/340] Note that SDL_GUIDToString() and SDL_StringToGUID() are thread-safe. --- include/SDL3/SDL_guid.h | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/include/SDL3/SDL_guid.h b/include/SDL3/SDL_guid.h index e2f32ffc9b337..312c42c0316ee 100644 --- a/include/SDL3/SDL_guid.h +++ b/include/SDL3/SDL_guid.h @@ -71,6 +71,8 @@ typedef struct SDL_GUID { * \param pszGUID buffer in which to write the ASCII string. * \param cbGUID the size of pszGUID, should be at least 33 bytes. * + * \threadsafety It is safe to call this function from any thread. + * * \since This function is available since SDL 3.2.0. * * \sa SDL_StringToGUID @@ -87,6 +89,8 @@ extern SDL_DECLSPEC void SDLCALL SDL_GUIDToString(SDL_GUID guid, char *pszGUID, * \param pchGUID string containing an ASCII representation of a GUID. * \returns a SDL_GUID structure. * + * \threadsafety It is safe to call this function from any thread. + * * \since This function is available since SDL 3.2.0. * * \sa SDL_GUIDToString From 80653a42c7256fb8cc2d3142e5b63501ae756c85 Mon Sep 17 00:00:00 2001 From: Petar Popovic Date: Thu, 6 Feb 2025 20:37:29 +0100 Subject: [PATCH 330/340] Remove non-ASCII character from public header SDL_hints.h --- include/SDL3/SDL_hints.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/SDL3/SDL_hints.h b/include/SDL3/SDL_hints.h index f7d5f535a6705..28ffb4677e76c 100644 --- a/include/SDL3/SDL_hints.h +++ b/include/SDL3/SDL_hints.h @@ -2349,7 +2349,7 @@ extern "C" { #define SDL_HINT_MAC_OPENGL_ASYNC_DISPATCH "SDL_MAC_OPENGL_ASYNC_DISPATCH" /** - * A variable controlling whether the Option (⌥) key on macOS should be + * A variable controlling whether the Option key on macOS should be * remapped to act as the Alt key. * * The variable can be set to the following values: From 6cb3d37a2b85d766da52d9aba7c2836bea77b329 Mon Sep 17 00:00:00 2001 From: SDL Wiki Bot Date: Thu, 6 Feb 2025 20:11:12 +0000 Subject: [PATCH 331/340] Sync SDL3 wiki -> header [ci skip] --- include/SDL3/SDL_hints.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/include/SDL3/SDL_hints.h b/include/SDL3/SDL_hints.h index 28ffb4677e76c..ba98e74f0f5a9 100644 --- a/include/SDL3/SDL_hints.h +++ b/include/SDL3/SDL_hints.h @@ -2349,8 +2349,8 @@ extern "C" { #define SDL_HINT_MAC_OPENGL_ASYNC_DISPATCH "SDL_MAC_OPENGL_ASYNC_DISPATCH" /** - * A variable controlling whether the Option key on macOS should be - * remapped to act as the Alt key. + * A variable controlling whether the Option key on macOS should be remapped + * to act as the Alt key. * * The variable can be set to the following values: * From c59ac249d283a04401677f5541b69dc5c899e962 Mon Sep 17 00:00:00 2001 From: Sam Lantinga Date: Thu, 6 Feb 2025 14:34:26 -0800 Subject: [PATCH 332/340] Revert "wayland: Don't send size events while the window is hidden" This reverts commit 0825d07a43a891350e6ae7ea02912c87eb1db952. It turns out that resizing while hidden is fine, the real problem in https://github.com/libsdl-org/sdl2-compat/issues/268 is that SDL2 did not send an initial resize event and SDL3 does, which we're fixing in a better way in sdl2-compat. --- src/video/wayland/SDL_waylandwindow.c | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/src/video/wayland/SDL_waylandwindow.c b/src/video/wayland/SDL_waylandwindow.c index 2cec73cac24f0..ebf79a2609290 100644 --- a/src/video/wayland/SDL_waylandwindow.c +++ b/src/video/wayland/SDL_waylandwindow.c @@ -441,15 +441,13 @@ static bool ConfigureWindowGeometry(SDL_Window *window) */ SetMinMaxDimensions(window); - if (data->shell_surface_status != WAYLAND_SHELL_SURFACE_STATUS_HIDDEN) { - // Unconditionally send the window and drawable size, the video core will deduplicate when required. - if (!data->scale_to_display) { - SDL_SendWindowEvent(window, SDL_EVENT_WINDOW_RESIZED, window_width, window_height); - } else { - SDL_SendWindowEvent(window, SDL_EVENT_WINDOW_RESIZED, data->current.pixel_width, data->current.pixel_height); - } - SDL_SendWindowEvent(window, SDL_EVENT_WINDOW_PIXEL_SIZE_CHANGED, data->current.pixel_width, data->current.pixel_height); + // Unconditionally send the window and drawable size, the video core will deduplicate when required. + if (!data->scale_to_display) { + SDL_SendWindowEvent(window, SDL_EVENT_WINDOW_RESIZED, window_width, window_height); + } else { + SDL_SendWindowEvent(window, SDL_EVENT_WINDOW_RESIZED, data->current.pixel_width, data->current.pixel_height); } + SDL_SendWindowEvent(window, SDL_EVENT_WINDOW_PIXEL_SIZE_CHANGED, data->current.pixel_width, data->current.pixel_height); /* Send an exposure event if the window is in the shown state and the size has changed, * even if the window is occluded, as the client needs to commit a new frame for the From ad8429f1b0bc5312ab01ade14d37c596a4f780b0 Mon Sep 17 00:00:00 2001 From: Sam Lantinga Date: Thu, 6 Feb 2025 14:25:00 -0800 Subject: [PATCH 333/340] Let the renderer always see window events These are necessary for proper operation of the renderer and shouldn't be blocked by event filters, etc. --- src/events/SDL_windowevents.c | 20 +++++++---- src/render/SDL_render.c | 63 +++++++++++++---------------------- src/render/SDL_sysrender.h | 6 ++++ 3 files changed, 42 insertions(+), 47 deletions(-) diff --git a/src/events/SDL_windowevents.c b/src/events/SDL_windowevents.c index 2258ce793c837..fe02450b2102f 100644 --- a/src/events/SDL_windowevents.c +++ b/src/events/SDL_windowevents.c @@ -24,6 +24,7 @@ #include "SDL_events_c.h" #include "SDL_mouse_c.h" +#include "../render/SDL_sysrender.h" #include "../tray/SDL_tray_utils.h" static bool SDLCALL RemoveSupercededWindowEvents(void *userdata, SDL_Event *event) @@ -183,14 +184,19 @@ bool SDL_SendWindowEvent(SDL_Window *window, SDL_EventType windowevent, int data } // Post the event, if desired - if (SDL_EventEnabled(windowevent)) { - SDL_Event event; - event.type = windowevent; - event.common.timestamp = 0; - event.window.data1 = data1; - event.window.data2 = data2; - event.window.windowID = window->id; + SDL_Event event; + event.type = windowevent; + event.common.timestamp = 0; + event.window.data1 = data1; + event.window.data2 = data2; + event.window.windowID = window->id; + + SDL_Renderer *renderer = (SDL_Renderer *)SDL_GetPointerProperty(window->props, SDL_PROP_WINDOW_RENDERER_POINTER, NULL); + if (renderer) { + SDL_RendererEventWatch(renderer, &event); + } + if (SDL_EventEnabled(windowevent)) { // Fixes queue overflow with move/resize events that aren't processed if (windowevent == SDL_EVENT_WINDOW_MOVED || windowevent == SDL_EVENT_WINDOW_RESIZED || diff --git a/src/render/SDL_render.c b/src/render/SDL_render.c index b6d6db7162d3d..4051eab5b901b 100644 --- a/src/render/SDL_render.c +++ b/src/render/SDL_render.c @@ -45,9 +45,6 @@ this should probably be removed at some point in the future. --ryan. */ #define DONT_DRAW_WHILE_HIDDEN 0 #endif -#define SDL_PROP_WINDOW_RENDERER_POINTER "SDL.internal.window.renderer" -#define SDL_PROP_TEXTURE_PARENT_POINTER "SDL.internal.texture.parent" - #define CHECK_RENDERER_MAGIC_BUT_NOT_DESTROYED_FLAG(renderer, result) \ if (!SDL_ObjectValid(renderer, SDL_OBJECT_TYPE_RENDERER)) { \ SDL_InvalidParamError("renderer"); \ @@ -821,43 +818,35 @@ const char *SDL_GetRenderDriver(int index) #endif } -static bool SDLCALL SDL_RendererEventWatch(void *userdata, SDL_Event *event) +void SDL_RendererEventWatch(SDL_Renderer *renderer, SDL_Event *event) { - SDL_Renderer *renderer = (SDL_Renderer *)userdata; + SDL_Window *window = renderer->window; - if (event->type >= SDL_EVENT_WINDOW_FIRST && event->type <= SDL_EVENT_WINDOW_LAST) { - SDL_Window *window = SDL_GetWindowFromID(event->window.windowID); - if (window == renderer->window) { - if (renderer->WindowEvent) { - renderer->WindowEvent(renderer, &event->window); - } + if (renderer->WindowEvent) { + renderer->WindowEvent(renderer, &event->window); + } - if (event->type == SDL_EVENT_WINDOW_RESIZED || - event->type == SDL_EVENT_WINDOW_PIXEL_SIZE_CHANGED || - event->type == SDL_EVENT_WINDOW_METAL_VIEW_RESIZED) { - UpdateLogicalPresentation(renderer); - } else if (event->type == SDL_EVENT_WINDOW_HIDDEN) { - renderer->hidden = true; - } else if (event->type == SDL_EVENT_WINDOW_SHOWN) { - if (!(SDL_GetWindowFlags(window) & SDL_WINDOW_MINIMIZED)) { - renderer->hidden = false; - } - } else if (event->type == SDL_EVENT_WINDOW_MINIMIZED) { - renderer->hidden = true; - } else if (event->type == SDL_EVENT_WINDOW_RESTORED || - event->type == SDL_EVENT_WINDOW_MAXIMIZED) { - if (!(SDL_GetWindowFlags(window) & SDL_WINDOW_HIDDEN)) { - renderer->hidden = false; - } - } else if (event->type == SDL_EVENT_WINDOW_DISPLAY_CHANGED) { - UpdateHDRProperties(renderer); - } + if (event->type == SDL_EVENT_WINDOW_RESIZED || + event->type == SDL_EVENT_WINDOW_PIXEL_SIZE_CHANGED || + event->type == SDL_EVENT_WINDOW_METAL_VIEW_RESIZED) { + UpdateLogicalPresentation(renderer); + } else if (event->type == SDL_EVENT_WINDOW_HIDDEN) { + renderer->hidden = true; + } else if (event->type == SDL_EVENT_WINDOW_SHOWN) { + if (!(SDL_GetWindowFlags(window) & SDL_WINDOW_MINIMIZED)) { + renderer->hidden = false; } - } else if (event->type == SDL_EVENT_WINDOW_HDR_STATE_CHANGED) { + } else if (event->type == SDL_EVENT_WINDOW_MINIMIZED) { + renderer->hidden = true; + } else if (event->type == SDL_EVENT_WINDOW_RESTORED || + event->type == SDL_EVENT_WINDOW_MAXIMIZED) { + if (!(SDL_GetWindowFlags(window) & SDL_WINDOW_HIDDEN)) { + renderer->hidden = false; + } + } else if (event->type == SDL_EVENT_WINDOW_DISPLAY_CHANGED || + event->type == SDL_EVENT_WINDOW_HDR_STATE_CHANGED) { UpdateHDRProperties(renderer); } - - return true; } bool SDL_CreateWindowAndRenderer(const char *title, int width, int height, SDL_WindowFlags window_flags, SDL_Window **window, SDL_Renderer **renderer) @@ -1115,10 +1104,6 @@ SDL_Renderer *SDL_CreateRendererWithProperties(SDL_PropertiesID props) SDL_SetRenderViewport(renderer, NULL); - if (window) { - SDL_AddEventWatch(SDL_RendererEventWatch, renderer); - } - int vsync = (int)SDL_GetNumberProperty(props, SDL_PROP_RENDERER_CREATE_PRESENT_VSYNC_NUMBER, 0); if (!SDL_SetRenderVSync(renderer, vsync)) { if (vsync == 0) { @@ -5217,8 +5202,6 @@ void SDL_DestroyRendererWithoutFreeing(SDL_Renderer *renderer) renderer->destroyed = true; - SDL_RemoveEventWatch(SDL_RendererEventWatch, renderer); - if (renderer->window) { SDL_PropertiesID props = SDL_GetWindowProperties(renderer->window); if (SDL_GetPointerProperty(props, SDL_PROP_WINDOW_RENDERER_POINTER, NULL) == renderer) { diff --git a/src/render/SDL_sysrender.h b/src/render/SDL_sysrender.h index 9c39bb1de71f4..980c8ffd146df 100644 --- a/src/render/SDL_sysrender.h +++ b/src/render/SDL_sysrender.h @@ -32,6 +32,9 @@ extern "C" { #endif +#define SDL_PROP_WINDOW_RENDERER_POINTER "SDL.internal.window.renderer" +#define SDL_PROP_TEXTURE_PARENT_POINTER "SDL.internal.texture.parent" + typedef enum SDL_TextureAddressMode { SDL_TEXTURE_ADDRESS_AUTO, @@ -339,6 +342,9 @@ extern SDL_RenderDriver GPU_RenderDriver; // Clean up any renderers at shutdown extern void SDL_QuitRender(void); +// Handle window events for a renderer +extern void SDL_RendererEventWatch(SDL_Renderer *renderer, SDL_Event *event); + // Add a supported texture format to a renderer extern bool SDL_AddSupportedTextureFormat(SDL_Renderer *renderer, SDL_PixelFormat format); From 3c6e6645fa4d7dd1e50227dc879f9e8b640636b5 Mon Sep 17 00:00:00 2001 From: SDL Wiki Bot Date: Thu, 6 Feb 2025 22:54:21 +0000 Subject: [PATCH 334/340] Sync SDL3 wiki -> header [ci skip] --- include/SDL3/SDL_gpu.h | 1 + 1 file changed, 1 insertion(+) diff --git a/include/SDL3/SDL_gpu.h b/include/SDL3/SDL_gpu.h index 2db585c6fbc15..c3a3db7fda42b 100644 --- a/include/SDL3/SDL_gpu.h +++ b/include/SDL3/SDL_gpu.h @@ -1556,6 +1556,7 @@ typedef struct SDL_GPUVertexBufferDescription * * \sa SDL_GPUVertexBufferDescription * \sa SDL_GPUVertexInputState + * \sa SDL_GPUVertexElementFormat */ typedef struct SDL_GPUVertexAttribute { From 48c00bfe6c1588e5982a7be9fe2677d280976692 Mon Sep 17 00:00:00 2001 From: Sam Lantinga Date: Thu, 6 Feb 2025 15:22:10 -0800 Subject: [PATCH 335/340] Fixed creating a window with both software and hardware renderer attached --- src/events/SDL_windowevents.c | 4 ++-- src/render/SDL_render.c | 5 +++++ src/render/SDL_sysrender.h | 3 --- src/video/SDL_sysvideo.h | 3 +++ src/video/SDL_video.c | 26 ++++++++++++++++++++++++++ src/video/SDL_video_c.h | 3 +++ 6 files changed, 39 insertions(+), 5 deletions(-) diff --git a/src/events/SDL_windowevents.c b/src/events/SDL_windowevents.c index fe02450b2102f..e0364f8ee0333 100644 --- a/src/events/SDL_windowevents.c +++ b/src/events/SDL_windowevents.c @@ -191,8 +191,8 @@ bool SDL_SendWindowEvent(SDL_Window *window, SDL_EventType windowevent, int data event.window.data2 = data2; event.window.windowID = window->id; - SDL_Renderer *renderer = (SDL_Renderer *)SDL_GetPointerProperty(window->props, SDL_PROP_WINDOW_RENDERER_POINTER, NULL); - if (renderer) { + for (int i = 0; i < window->num_renderers; ++i) { + SDL_Renderer *renderer = window->renderers[i]; SDL_RendererEventWatch(renderer, &event); } diff --git a/src/render/SDL_render.c b/src/render/SDL_render.c index 4051eab5b901b..b8e66532ef618 100644 --- a/src/render/SDL_render.c +++ b/src/render/SDL_render.c @@ -45,6 +45,9 @@ this should probably be removed at some point in the future. --ryan. */ #define DONT_DRAW_WHILE_HIDDEN 0 #endif +#define SDL_PROP_WINDOW_RENDERER_POINTER "SDL.internal.window.renderer" +#define SDL_PROP_TEXTURE_PARENT_POINTER "SDL.internal.texture.parent" + #define CHECK_RENDERER_MAGIC_BUT_NOT_DESTROYED_FLAG(renderer, result) \ if (!SDL_ObjectValid(renderer, SDL_OBJECT_TYPE_RENDERER)) { \ SDL_InvalidParamError("renderer"); \ @@ -1100,6 +1103,7 @@ SDL_Renderer *SDL_CreateRendererWithProperties(SDL_PropertiesID props) if (window) { SDL_SetPointerProperty(SDL_GetWindowProperties(window), SDL_PROP_WINDOW_RENDERER_POINTER, renderer); + SDL_AddWindowRenderer(window, renderer); } SDL_SetRenderViewport(renderer, NULL); @@ -5207,6 +5211,7 @@ void SDL_DestroyRendererWithoutFreeing(SDL_Renderer *renderer) if (SDL_GetPointerProperty(props, SDL_PROP_WINDOW_RENDERER_POINTER, NULL) == renderer) { SDL_ClearProperty(props, SDL_PROP_WINDOW_RENDERER_POINTER); } + SDL_RemoveWindowRenderer(renderer->window, renderer); } SDL_DiscardAllCommands(renderer); diff --git a/src/render/SDL_sysrender.h b/src/render/SDL_sysrender.h index 980c8ffd146df..375419a06acaf 100644 --- a/src/render/SDL_sysrender.h +++ b/src/render/SDL_sysrender.h @@ -32,9 +32,6 @@ extern "C" { #endif -#define SDL_PROP_WINDOW_RENDERER_POINTER "SDL.internal.window.renderer" -#define SDL_PROP_TEXTURE_PARENT_POINTER "SDL.internal.texture.parent" - typedef enum SDL_TextureAddressMode { SDL_TEXTURE_ADDRESS_AUTO, diff --git a/src/video/SDL_sysvideo.h b/src/video/SDL_sysvideo.h index 418b8239f168d..e043305aa06b8 100644 --- a/src/video/SDL_sysvideo.h +++ b/src/video/SDL_sysvideo.h @@ -124,6 +124,9 @@ struct SDL_Window SDL_PropertiesID props; + int num_renderers; + SDL_Renderer **renderers; + SDL_WindowData *internal; SDL_Window *prev; diff --git a/src/video/SDL_video.c b/src/video/SDL_video.c index 37fd8bb28ad00..e773969183f01 100644 --- a/src/video/SDL_video.c +++ b/src/video/SDL_video.c @@ -4132,6 +4132,31 @@ SDL_Window *SDL_GetToplevelForKeyboardFocus(void) return focus; } +bool SDL_AddWindowRenderer(SDL_Window *window, SDL_Renderer *renderer) +{ + SDL_Renderer **renderers = (SDL_Renderer **)SDL_realloc(window->renderers, (window->num_renderers + 1) * sizeof(*renderers)); + if (!renderers) { + return false; + } + + window->renderers = renderers; + window->renderers[window->num_renderers++] = renderer; + return true; +} + +void SDL_RemoveWindowRenderer(SDL_Window *window, SDL_Renderer *renderer) +{ + for (int i = 0; i < window->num_renderers; ++i) { + if (window->renderers[i] == renderer) { + if (i < (window->num_renderers - 1)) { + SDL_memmove(&window->renderers[i], &window->renderers[i + 1], (window->num_renderers - i - 1) * sizeof(window->renderers[i])); + } + --window->num_renderers; + break; + } + } +} + void SDL_DestroyWindow(SDL_Window *window) { CHECK_WINDOW_MAGIC(window,); @@ -4238,6 +4263,7 @@ void SDL_DestroyWindow(SDL_Window *window) _this->windows = window->next; } + SDL_free(window->renderers); SDL_free(window); #ifdef SDL_VIDEO_DRIVER_UIKIT diff --git a/src/video/SDL_video_c.h b/src/video/SDL_video_c.h index b3f4350a926ad..fc0843b168afe 100644 --- a/src/video/SDL_video_c.h +++ b/src/video/SDL_video_c.h @@ -63,4 +63,7 @@ extern bool SDL_SetWindowTextureVSync(struct SDL_VideoDevice *_this, SDL_Window const char *SDL_GetCSSCursorName(SDL_SystemCursor id, const char **fallback_name); #endif +extern bool SDL_AddWindowRenderer(SDL_Window *window, SDL_Renderer *renderer); +extern void SDL_RemoveWindowRenderer(SDL_Window *window, SDL_Renderer *renderer); + #endif // SDL_video_c_h_ From b5c3eab6b447111d3c7879bb547b80fb4abd9063 Mon Sep 17 00:00:00 2001 From: Sam Lantinga Date: Thu, 6 Feb 2025 16:03:43 -0800 Subject: [PATCH 336/340] Updated to version 3.2.4 for release --- CMakeLists.txt | 2 +- Xcode/SDL/Info-Framework.plist | 4 ++-- Xcode/SDL/SDL.xcodeproj/project.pbxproj | 8 ++++---- Xcode/SDL/pkg-support/SDL.info | 2 +- .../app/src/main/java/org/libsdl/app/SDLActivity.java | 2 +- include/SDL3/SDL.h | 2 +- include/SDL3/SDL_version.h | 2 +- src/core/windows/version.rc | 8 ++++---- 8 files changed, 15 insertions(+), 15 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 6859775744611..d8e56673825e6 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -5,7 +5,7 @@ if(NOT DEFINED CMAKE_BUILD_TYPE) endif() # See docs/release_checklist.md -project(SDL3 LANGUAGES C VERSION "3.2.3") +project(SDL3 LANGUAGES C VERSION "3.2.4") if(CMAKE_SOURCE_DIR STREQUAL PROJECT_SOURCE_DIR) set(SDL3_MAINPROJECT ON) diff --git a/Xcode/SDL/Info-Framework.plist b/Xcode/SDL/Info-Framework.plist index dea5be270196c..13d9c51ee13c8 100644 --- a/Xcode/SDL/Info-Framework.plist +++ b/Xcode/SDL/Info-Framework.plist @@ -19,10 +19,10 @@ CFBundlePackageType FMWK CFBundleShortVersionString - 3.2.3 + 3.2.4 CFBundleSignature SDLX CFBundleVersion - 3.2.3 + 3.2.4 diff --git a/Xcode/SDL/SDL.xcodeproj/project.pbxproj b/Xcode/SDL/SDL.xcodeproj/project.pbxproj index f0ae0f88060b1..2d9714925bae8 100644 --- a/Xcode/SDL/SDL.xcodeproj/project.pbxproj +++ b/Xcode/SDL/SDL.xcodeproj/project.pbxproj @@ -3062,7 +3062,7 @@ CLANG_ENABLE_OBJC_ARC = YES; DEPLOYMENT_POSTPROCESSING = YES; DYLIB_COMPATIBILITY_VERSION = 201.0.0; - DYLIB_CURRENT_VERSION = 201.3.0; + DYLIB_CURRENT_VERSION = 201.4.0; DYLIB_INSTALL_NAME_BASE = "@rpath"; ENABLE_STRICT_OBJC_MSGSEND = YES; GCC_ALTIVEC_EXTENSIONS = YES; @@ -3097,7 +3097,7 @@ "@loader_path/Frameworks", ); MACOSX_DEPLOYMENT_TARGET = 10.13; - MARKETING_VERSION = 3.2.3; + MARKETING_VERSION = 3.2.4; OTHER_LDFLAGS = "$(CONFIG_FRAMEWORK_LDFLAGS)"; PRODUCT_BUNDLE_IDENTIFIER = org.libsdl.SDL3; PRODUCT_NAME = SDL3; @@ -3126,7 +3126,7 @@ CLANG_ENABLE_MODULES = YES; CLANG_ENABLE_OBJC_ARC = YES; DYLIB_COMPATIBILITY_VERSION = 201.0.0; - DYLIB_CURRENT_VERSION = 201.3.0; + DYLIB_CURRENT_VERSION = 201.4.0; DYLIB_INSTALL_NAME_BASE = "@rpath"; ENABLE_STRICT_OBJC_MSGSEND = YES; ENABLE_TESTABILITY = YES; @@ -3158,7 +3158,7 @@ "@loader_path/Frameworks", ); MACOSX_DEPLOYMENT_TARGET = 10.13; - MARKETING_VERSION = 3.2.3; + MARKETING_VERSION = 3.2.4; ONLY_ACTIVE_ARCH = YES; OTHER_LDFLAGS = "$(CONFIG_FRAMEWORK_LDFLAGS)"; PRODUCT_BUNDLE_IDENTIFIER = org.libsdl.SDL3; diff --git a/Xcode/SDL/pkg-support/SDL.info b/Xcode/SDL/pkg-support/SDL.info index 39f351cf7b780..92f65851bc181 100644 --- a/Xcode/SDL/pkg-support/SDL.info +++ b/Xcode/SDL/pkg-support/SDL.info @@ -1,4 +1,4 @@ -Title SDL 3.2.3 +Title SDL 3.2.4 Version 1 Description SDL Library for macOS (http://www.libsdl.org) DefaultLocation /Library/Frameworks diff --git a/android-project/app/src/main/java/org/libsdl/app/SDLActivity.java b/android-project/app/src/main/java/org/libsdl/app/SDLActivity.java index 72f60d1dda56e..0684e0a5f8d36 100644 --- a/android-project/app/src/main/java/org/libsdl/app/SDLActivity.java +++ b/android-project/app/src/main/java/org/libsdl/app/SDLActivity.java @@ -60,7 +60,7 @@ public class SDLActivity extends Activity implements View.OnSystemUiVisibilityCh private static final String TAG = "SDL"; private static final int SDL_MAJOR_VERSION = 3; private static final int SDL_MINOR_VERSION = 2; - private static final int SDL_MICRO_VERSION = 3; + private static final int SDL_MICRO_VERSION = 4; /* // Display InputType.SOURCE/CLASS of events and devices // diff --git a/include/SDL3/SDL.h b/include/SDL3/SDL.h index a6313f3646b7e..4fd4083d30079 100644 --- a/include/SDL3/SDL.h +++ b/include/SDL3/SDL.h @@ -20,7 +20,7 @@ */ /** - * Main include header for the SDL library, version 3.2.3 + * Main include header for the SDL library, version 3.2.4 * * It is almost always best to include just this one header instead of * picking out individual headers included here. There are exceptions to diff --git a/include/SDL3/SDL_version.h b/include/SDL3/SDL_version.h index f3586e69eee7b..2f7e955a502d1 100644 --- a/include/SDL3/SDL_version.h +++ b/include/SDL3/SDL_version.h @@ -62,7 +62,7 @@ extern "C" { * * \since This macro is available since SDL 3.2.0. */ -#define SDL_MICRO_VERSION 3 +#define SDL_MICRO_VERSION 4 /** * This macro turns the version numbers into a numeric value. diff --git a/src/core/windows/version.rc b/src/core/windows/version.rc index 8bd402a657ff6..4a84a43150b76 100644 --- a/src/core/windows/version.rc +++ b/src/core/windows/version.rc @@ -9,8 +9,8 @@ LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US // VS_VERSION_INFO VERSIONINFO - FILEVERSION 3,2,3,0 - PRODUCTVERSION 3,2,3,0 + FILEVERSION 3,2,4,0 + PRODUCTVERSION 3,2,4,0 FILEFLAGSMASK 0x3fL FILEFLAGS 0x0L FILEOS 0x40004L @@ -23,12 +23,12 @@ BEGIN BEGIN VALUE "CompanyName", "\0" VALUE "FileDescription", "SDL\0" - VALUE "FileVersion", "3, 2, 3, 0\0" + VALUE "FileVersion", "3, 2, 4, 0\0" VALUE "InternalName", "SDL\0" VALUE "LegalCopyright", "Copyright (C) 2025 Sam Lantinga\0" VALUE "OriginalFilename", "SDL3.dll\0" VALUE "ProductName", "Simple DirectMedia Layer\0" - VALUE "ProductVersion", "3, 2, 3, 0\0" + VALUE "ProductVersion", "3, 2, 4, 0\0" END END BLOCK "VarFileInfo" From 982094c85c2a04e13e69c2b53851290f15cb93f3 Mon Sep 17 00:00:00 2001 From: Sam Lantinga Date: Thu, 6 Feb 2025 16:40:59 -0800 Subject: [PATCH 337/340] Updated to version 3.2.5 for development --- CMakeLists.txt | 2 +- Xcode/SDL/Info-Framework.plist | 4 ++-- Xcode/SDL/SDL.xcodeproj/project.pbxproj | 8 ++++---- Xcode/SDL/pkg-support/SDL.info | 2 +- .../app/src/main/java/org/libsdl/app/SDLActivity.java | 2 +- include/SDL3/SDL.h | 2 +- include/SDL3/SDL_version.h | 2 +- src/core/windows/version.rc | 8 ++++---- 8 files changed, 15 insertions(+), 15 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index d8e56673825e6..78f36d07b8d5a 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -5,7 +5,7 @@ if(NOT DEFINED CMAKE_BUILD_TYPE) endif() # See docs/release_checklist.md -project(SDL3 LANGUAGES C VERSION "3.2.4") +project(SDL3 LANGUAGES C VERSION "3.2.5") if(CMAKE_SOURCE_DIR STREQUAL PROJECT_SOURCE_DIR) set(SDL3_MAINPROJECT ON) diff --git a/Xcode/SDL/Info-Framework.plist b/Xcode/SDL/Info-Framework.plist index 13d9c51ee13c8..434df98de48de 100644 --- a/Xcode/SDL/Info-Framework.plist +++ b/Xcode/SDL/Info-Framework.plist @@ -19,10 +19,10 @@ CFBundlePackageType FMWK CFBundleShortVersionString - 3.2.4 + 3.2.5 CFBundleSignature SDLX CFBundleVersion - 3.2.4 + 3.2.5 diff --git a/Xcode/SDL/SDL.xcodeproj/project.pbxproj b/Xcode/SDL/SDL.xcodeproj/project.pbxproj index 2d9714925bae8..bd390d6b3683a 100644 --- a/Xcode/SDL/SDL.xcodeproj/project.pbxproj +++ b/Xcode/SDL/SDL.xcodeproj/project.pbxproj @@ -3062,7 +3062,7 @@ CLANG_ENABLE_OBJC_ARC = YES; DEPLOYMENT_POSTPROCESSING = YES; DYLIB_COMPATIBILITY_VERSION = 201.0.0; - DYLIB_CURRENT_VERSION = 201.4.0; + DYLIB_CURRENT_VERSION = 201.5.0; DYLIB_INSTALL_NAME_BASE = "@rpath"; ENABLE_STRICT_OBJC_MSGSEND = YES; GCC_ALTIVEC_EXTENSIONS = YES; @@ -3097,7 +3097,7 @@ "@loader_path/Frameworks", ); MACOSX_DEPLOYMENT_TARGET = 10.13; - MARKETING_VERSION = 3.2.4; + MARKETING_VERSION = 3.2.5; OTHER_LDFLAGS = "$(CONFIG_FRAMEWORK_LDFLAGS)"; PRODUCT_BUNDLE_IDENTIFIER = org.libsdl.SDL3; PRODUCT_NAME = SDL3; @@ -3126,7 +3126,7 @@ CLANG_ENABLE_MODULES = YES; CLANG_ENABLE_OBJC_ARC = YES; DYLIB_COMPATIBILITY_VERSION = 201.0.0; - DYLIB_CURRENT_VERSION = 201.4.0; + DYLIB_CURRENT_VERSION = 201.5.0; DYLIB_INSTALL_NAME_BASE = "@rpath"; ENABLE_STRICT_OBJC_MSGSEND = YES; ENABLE_TESTABILITY = YES; @@ -3158,7 +3158,7 @@ "@loader_path/Frameworks", ); MACOSX_DEPLOYMENT_TARGET = 10.13; - MARKETING_VERSION = 3.2.4; + MARKETING_VERSION = 3.2.5; ONLY_ACTIVE_ARCH = YES; OTHER_LDFLAGS = "$(CONFIG_FRAMEWORK_LDFLAGS)"; PRODUCT_BUNDLE_IDENTIFIER = org.libsdl.SDL3; diff --git a/Xcode/SDL/pkg-support/SDL.info b/Xcode/SDL/pkg-support/SDL.info index 92f65851bc181..1df0e1ab73750 100644 --- a/Xcode/SDL/pkg-support/SDL.info +++ b/Xcode/SDL/pkg-support/SDL.info @@ -1,4 +1,4 @@ -Title SDL 3.2.4 +Title SDL 3.2.5 Version 1 Description SDL Library for macOS (http://www.libsdl.org) DefaultLocation /Library/Frameworks diff --git a/android-project/app/src/main/java/org/libsdl/app/SDLActivity.java b/android-project/app/src/main/java/org/libsdl/app/SDLActivity.java index 0684e0a5f8d36..765d8e0150e29 100644 --- a/android-project/app/src/main/java/org/libsdl/app/SDLActivity.java +++ b/android-project/app/src/main/java/org/libsdl/app/SDLActivity.java @@ -60,7 +60,7 @@ public class SDLActivity extends Activity implements View.OnSystemUiVisibilityCh private static final String TAG = "SDL"; private static final int SDL_MAJOR_VERSION = 3; private static final int SDL_MINOR_VERSION = 2; - private static final int SDL_MICRO_VERSION = 4; + private static final int SDL_MICRO_VERSION = 5; /* // Display InputType.SOURCE/CLASS of events and devices // diff --git a/include/SDL3/SDL.h b/include/SDL3/SDL.h index 4fd4083d30079..c970b6ed2dd4b 100644 --- a/include/SDL3/SDL.h +++ b/include/SDL3/SDL.h @@ -20,7 +20,7 @@ */ /** - * Main include header for the SDL library, version 3.2.4 + * Main include header for the SDL library, version 3.2.5 * * It is almost always best to include just this one header instead of * picking out individual headers included here. There are exceptions to diff --git a/include/SDL3/SDL_version.h b/include/SDL3/SDL_version.h index 2f7e955a502d1..016d36bc1fc0f 100644 --- a/include/SDL3/SDL_version.h +++ b/include/SDL3/SDL_version.h @@ -62,7 +62,7 @@ extern "C" { * * \since This macro is available since SDL 3.2.0. */ -#define SDL_MICRO_VERSION 4 +#define SDL_MICRO_VERSION 5 /** * This macro turns the version numbers into a numeric value. diff --git a/src/core/windows/version.rc b/src/core/windows/version.rc index 4a84a43150b76..21852e36d1c67 100644 --- a/src/core/windows/version.rc +++ b/src/core/windows/version.rc @@ -9,8 +9,8 @@ LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US // VS_VERSION_INFO VERSIONINFO - FILEVERSION 3,2,4,0 - PRODUCTVERSION 3,2,4,0 + FILEVERSION 3,2,5,0 + PRODUCTVERSION 3,2,5,0 FILEFLAGSMASK 0x3fL FILEFLAGS 0x0L FILEOS 0x40004L @@ -23,12 +23,12 @@ BEGIN BEGIN VALUE "CompanyName", "\0" VALUE "FileDescription", "SDL\0" - VALUE "FileVersion", "3, 2, 4, 0\0" + VALUE "FileVersion", "3, 2, 5, 0\0" VALUE "InternalName", "SDL\0" VALUE "LegalCopyright", "Copyright (C) 2025 Sam Lantinga\0" VALUE "OriginalFilename", "SDL3.dll\0" VALUE "ProductName", "Simple DirectMedia Layer\0" - VALUE "ProductVersion", "3, 2, 4, 0\0" + VALUE "ProductVersion", "3, 2, 5, 0\0" END END BLOCK "VarFileInfo" From 7af17f874c964b9822b1fb3f78913e51d95468f6 Mon Sep 17 00:00:00 2001 From: SDL Wiki Bot Date: Fri, 7 Feb 2025 02:00:45 +0000 Subject: [PATCH 338/340] Sync SDL3 wiki -> header [ci skip] --- include/SDL3/SDL_gpu.h | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/include/SDL3/SDL_gpu.h b/include/SDL3/SDL_gpu.h index c3a3db7fda42b..49794ef060d75 100644 --- a/include/SDL3/SDL_gpu.h +++ b/include/SDL3/SDL_gpu.h @@ -1498,6 +1498,10 @@ typedef struct SDL_GPUIndirectDispatchCommand * \since This function is available since SDL 3.2.0. * * \sa SDL_CreateGPUSampler + * \sa SDL_GPUFilter + * \sa SDL_GPUSamplerMipmapMode + * \sa SDL_GPUSamplerAddressMode + * \sa SDL_GPUCompareOp */ typedef struct SDL_GPUSamplerCreateInfo { From 2ced6b09fc0ac120c3f1c15cff7022d334051fa3 Mon Sep 17 00:00:00 2001 From: ds-sloth <72112344+ds-sloth@users.noreply.github.com> Date: Tue, 28 Jan 2025 23:14:56 -0500 Subject: [PATCH 339/340] Delete src/thread/n3ds/SDL_syscond.c This PR removes the incorrect implementation of `SDL_cond` currently included with the 3DS port. Pseudocode of the incorrect implementation of `SDL_CondWait` this PR removes: * Receive an `SDL_cond` backed by a `libctru` `CondVar` and an `SDL_mutex` backed by a `libctru` `RecursiveLock`. * Want to call `libctru` function `CondVar_Wait` which expects a `CondVar` and a `LightLock` (non-recursive lock) * Do so by calling this function with the internal (inadequately protected) `LightLock` member of the `RecursiveLock` (`&mutex->lock.lock` on line 105), without updating any internal thread or lock count fields of the `RecursiveLock`. Happy to discuss or test some examples. My own use case works much better with the generic cond logic, and this seems like a safe fix to me given that the generic logic is well-tested and this seems not to be. If you like the PR I'll send another one for the SDL2 branch. --- src/thread/n3ds/SDL_syscond.c | 111 ---------------------------------- 1 file changed, 111 deletions(-) delete mode 100644 src/thread/n3ds/SDL_syscond.c diff --git a/src/thread/n3ds/SDL_syscond.c b/src/thread/n3ds/SDL_syscond.c deleted file mode 100644 index d5c4067da9a53..0000000000000 --- a/src/thread/n3ds/SDL_syscond.c +++ /dev/null @@ -1,111 +0,0 @@ -/* - Simple DirectMedia Layer - Copyright (C) 1997-2025 Sam Lantinga - - This software is provided 'as-is', without any express or implied - warranty. In no event will the authors be held liable for any damages - arising from the use of this software. - - Permission is granted to anyone to use this software for any purpose, - including commercial applications, and to alter it and redistribute it - freely, subject to the following restrictions: - - 1. The origin of this software must not be misrepresented; you must not - claim that you wrote the original software. If you use this software - in a product, an acknowledgment in the product documentation would be - appreciated but is not required. - 2. Altered source versions must be plainly marked as such, and must not be - misrepresented as being the original software. - 3. This notice may not be removed or altered from any source distribution. -*/ -#include "SDL_internal.h" - -#ifdef SDL_THREAD_N3DS - -// An implementation of condition variables using libctru's CondVar - -#include "SDL_sysmutex_c.h" - -struct SDL_Condition -{ - CondVar cond_variable; -}; - -// Create a condition variable -SDL_Condition *SDL_CreateCondition(void) -{ - SDL_Condition *cond = (SDL_Condition *)SDL_malloc(sizeof(SDL_Condition)); - if (cond) { - CondVar_Init(&cond->cond_variable); - } - return cond; -} - -// Destroy a condition variable -void SDL_DestroyCondition(SDL_Condition *cond) -{ - if (cond) { - SDL_free(cond); - } -} - -// Restart one of the threads that are waiting on the condition variable -void SDL_SignalCondition(SDL_Condition *cond) -{ - if (!cond) { - return; - } - - CondVar_Signal(&cond->cond_variable); -} - -// Restart all threads that are waiting on the condition variable -void SDL_BroadcastCondition(SDL_Condition *cond) -{ - if (!cond) { - return; - } - - CondVar_Broadcast(&cond->cond_variable); -} - -/* Wait on the condition variable for at most 'timeoutNS' nanoseconds. - The mutex must be locked before entering this function! - The mutex is unlocked during the wait, and locked again after the wait. - -Typical use: - -Thread A: - SDL_LockMutex(lock); - while ( ! condition ) { - SDL_WaitCondition(cond, lock); - } - SDL_UnlockMutex(lock); - -Thread B: - SDL_LockMutex(lock); - ... - condition = true; - ... - SDL_SignalCondition(cond); - SDL_UnlockMutex(lock); - */ -bool SDL_WaitConditionTimeoutNS(SDL_Condition *cond, SDL_Mutex *mutex, Sint64 timeoutNS) -{ - Result res; - - if (!cond || !mutex) { - return true; - } - - res = 0; - if (timeoutNS < 0) { - CondVar_Wait(&cond->cond_variable, &mutex->lock.lock); - } else { - res = CondVar_WaitTimeout(&cond->cond_variable, &mutex->lock.lock, timeoutNS); - } - - return R_SUCCEEDED(res); -} - -#endif // SDL_THREAD_N3DS From 7c12c63f63be522af2ad8e8216ea7b2786aa42a0 Mon Sep 17 00:00:00 2001 From: ds-sloth <72112344+ds-sloth@users.noreply.github.com> Date: Tue, 28 Jan 2025 23:25:15 -0500 Subject: [PATCH 340/340] Add generic SDL_syscond to N3DS threads source list --- CMakeLists.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index 78f36d07b8d5a..ae1c13f798b15 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -2887,6 +2887,7 @@ elseif(N3DS) set(SDL_THREAD_N3DS 1) sdl_glob_sources("${SDL3_SOURCE_DIR}/src/thread/n3ds/*.c") sdl_sources( + "${SDL3_SOURCE_DIR}/src/thread/generic/SDL_syscond.c" "${SDL3_SOURCE_DIR}/src/thread/generic/SDL_systls.c" "${SDL3_SOURCE_DIR}/src/thread/generic/SDL_sysrwlock.c" )