Update SDL3 from 3.2.4 to 3.2.20

This commit is contained in:
Sven Balzer
2025-08-27 21:24:05 +02:00
parent 6283160467
commit ad651462df
332 changed files with 20334 additions and 4852 deletions
+23 -2
View File
@@ -63,6 +63,8 @@ SDL_AppResult SDL_AppEvent(void *appstate, SDL_Event *event)
if (event->key.key == SDLK_C && event->key.mod & SDL_KMOD_CTRL) {
SDL_SetClipboardData(ClipboardDataCallback, NULL, NULL, mime_types, SDL_arraysize(mime_types));
break;
} else if (event->key.key == SDLK_P && event->key.mod & SDL_KMOD_CTRL) {
SDL_SetPrimarySelectionText("SDL Primary Selection Text!");
}
break;
@@ -99,6 +101,15 @@ static float PrintClipboardText(float x, float y, const char *mime_type)
return 0.0f;
}
static float PrintPrimarySelectionText(float x, float y)
{
if (SDL_HasPrimarySelectionText()) {
SDL_RenderDebugText(renderer, x, y, SDL_GetPrimarySelectionText());
return SDL_DEBUG_TEXT_FONT_CHARACTER_SIZE + 2.0f;
}
return 0.0f;
}
static float PrintClipboardImage(float x, float y, const char *mime_type)
{
/* We don't actually need to read this data each frame, but this is a simple example */
@@ -134,7 +145,7 @@ static float PrintClipboardImage(float x, float y, const char *mime_type)
return 0.0f;
}
static void PrintClipboardContents(float x, float y)
static float PrintClipboardContents(float x, float y)
{
char **clipboard_mime_types = SDL_GetClipboardMimeTypes(NULL);
if (clipboard_mime_types) {
@@ -152,6 +163,8 @@ static void PrintClipboardContents(float x, float y)
}
SDL_free(clipboard_mime_types);
}
return y;
}
SDL_AppResult SDL_AppIterate(void *appstate)
@@ -164,10 +177,18 @@ SDL_AppResult SDL_AppIterate(void *appstate)
float y = 4.0f;
SDL_RenderDebugText(renderer, x, y, "Press Ctrl+C to copy content to the clipboard");
y += SDL_DEBUG_TEXT_FONT_CHARACTER_SIZE * 2;
SDL_RenderDebugText(renderer, x, y, "Press Ctrl+P to set the primary selection text");
y += SDL_DEBUG_TEXT_FONT_CHARACTER_SIZE * 2;
SDL_RenderDebugText(renderer, x, y, "Clipboard contents:");
x += SDL_DEBUG_TEXT_FONT_CHARACTER_SIZE * 2;
y += SDL_DEBUG_TEXT_FONT_CHARACTER_SIZE + 2;
PrintClipboardContents(x, y);
y = PrintClipboardContents(x, y);
if (SDL_HasPrimarySelectionText()) {
x = 4.0f;
SDL_RenderDebugText(renderer, x, y, "Primary selection text contents:");
y += SDL_DEBUG_TEXT_FONT_CHARACTER_SIZE + 2;
PrintPrimarySelectionText(x + SDL_DEBUG_TEXT_FONT_CHARACTER_SIZE * 2, y);
}
SDL_RenderPresent(renderer);