Skip to content

Commit 7443a14

Browse files
committed
Merge upstream SDL 3.2.18
2 parents 3ed62e5 + 68bfcb6 commit 7443a14

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

56 files changed

+731
-453
lines changed

include/SDL3/SDL.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
*/
2121

2222
/**
23-
* Main include header for the SDL library, version 3.2.16
23+
* Main include header for the SDL library, version 3.2.18
2424
*
2525
* It is almost always best to include just this one header instead of
2626
* picking out individual headers included here. There are exceptions to

include/SDL3/SDL_audio.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1021,7 +1021,7 @@ extern SDL_DECLSPEC void SDLCALL SDL_UnbindAudioStream(SDL_AudioStream *stream);
10211021
/**
10221022
* Query an audio stream for its currently-bound device.
10231023
*
1024-
* This reports the audio device that an audio stream is currently bound to.
1024+
* This reports the logical audio device that an audio stream is currently bound to.
10251025
*
10261026
* If not bound, or invalid, this returns zero, which is not a valid device
10271027
* ID.

include/SDL3/SDL_endian.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -486,7 +486,7 @@ SDL_FORCE_INLINE Uint32 SDL_Swap32(Uint32 x) { return x_but_byteswapped; }
486486
*
487487
* \since This function is available since SDL 3.2.0.
488488
*/
489-
SDL_FORCE_INLINE Uint32 SDL_Swap64(Uint64 x) { return x_but_byteswapped; }
489+
SDL_FORCE_INLINE Uint64 SDL_Swap64(Uint64 x) { return x_but_byteswapped; }
490490

491491
/**
492492
* Swap a 16-bit value from littleendian to native byte order.

include/SDL3/SDL_version.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ extern "C" {
6262
*
6363
* \since This macro is available since SDL 3.2.0.
6464
*/
65-
#define SDL_MICRO_VERSION 16
65+
#define SDL_MICRO_VERSION 18
6666

6767
/**
6868
* This macro turns the version numbers into a numeric value.

include/SDL3/SDL_video.h

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1167,6 +1167,15 @@ extern SDL_DECLSPEC SDL_Window * SDLCALL SDL_CreateWindow(const char *title, int
11671167
* Popup windows implicitly do not have a border/decorations and do not appear
11681168
* on the taskbar/dock or in lists of windows such as alt-tab menus.
11691169
*
1170+
* By default, popup window positions will automatically be constrained to keep
1171+
* the entire window within display bounds. This can be overridden with the
1172+
* `SDL_PROP_WINDOW_CREATE_CONSTRAIN_POPUP_BOOLEAN` property.
1173+
*
1174+
* By default, popup menus will automatically grab keyboard focus from the parent
1175+
* when shown. This behavior can be overridden by setting the `SDL_WINDOW_NOT_FOCUSABLE`
1176+
* flag, setting the `SDL_PROP_WINDOW_CREATE_FOCUSABLE_BOOLEAN` property to false, or
1177+
* toggling it after creation via the `SDL_SetWindowFocusable()` function.
1178+
*
11701179
* If a parent window is hidden or destroyed, any child popup windows will be
11711180
* recursively hidden or destroyed as well. Child popup windows not explicitly
11721181
* hidden will be restored when the parent is shown.
@@ -1207,6 +1216,9 @@ extern SDL_DECLSPEC SDL_Window * SDLCALL SDL_CreatePopupWindow(SDL_Window *paren
12071216
* be always on top
12081217
* - `SDL_PROP_WINDOW_CREATE_BORDERLESS_BOOLEAN`: true if the window has no
12091218
* window decoration
1219+
* - `SDL_PROP_WINDOW_CREATE_CONSTRAIN_POPUP_BOOLEAN`: true if the "tooltip" and
1220+
* "menu" window types should be automatically constrained to be entirely within
1221+
* display bounds (default), false if no constraints on the position are desired.
12101222
* - `SDL_PROP_WINDOW_CREATE_EXTERNAL_GRAPHICS_CONTEXT_BOOLEAN`: true if the
12111223
* window will be used with an externally managed graphics context.
12121224
* - `SDL_PROP_WINDOW_CREATE_FOCUSABLE_BOOLEAN`: true if the window should
@@ -1321,6 +1333,7 @@ extern SDL_DECLSPEC SDL_Window * SDLCALL SDL_CreateWindowWithProperties(SDL_Prop
13211333

13221334
#define SDL_PROP_WINDOW_CREATE_ALWAYS_ON_TOP_BOOLEAN "SDL.window.create.always_on_top"
13231335
#define SDL_PROP_WINDOW_CREATE_BORDERLESS_BOOLEAN "SDL.window.create.borderless"
1336+
#define SDL_PROP_WINDOW_CREATE_CONSTRAIN_POPUP_BOOLEAN "SDL.window.create.constrain_popup"
13241337
#define SDL_PROP_WINDOW_CREATE_FOCUSABLE_BOOLEAN "SDL.window.create.focusable"
13251338
#define SDL_PROP_WINDOW_CREATE_EXTERNAL_GRAPHICS_CONTEXT_BOOLEAN "SDL.window.create.external_graphics_context"
13261339
#define SDL_PROP_WINDOW_CREATE_FLAGS_NUMBER "SDL.window.create.flags"

include/SDL3/SDL_vulkan.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -51,14 +51,14 @@
5151
extern "C" {
5252
#endif
5353

54-
/* Avoid including vulkan.h, don't define VkInstance if it's already included */
55-
#ifdef VULKAN_H_
54+
/* Avoid including vulkan_core.h, don't define VkInstance if it's already included */
55+
#ifdef VULKAN_CORE_H_
5656
#define NO_SDL_VULKAN_TYPEDEFS
5757
#endif
5858
#ifndef NO_SDL_VULKAN_TYPEDEFS
5959
#define VK_DEFINE_HANDLE(object) typedef struct object##_T* object;
6060

61-
#if defined(__LP64__) || defined(_WIN64) || defined(__x86_64__) || defined(_M_X64) || defined(__ia64) || defined (_M_IA64) || defined(__aarch64__) || defined(__powerpc64__)
61+
#if defined(__LP64__) || defined(_WIN64) || (defined(__x86_64__) && !defined(__ILP32__)) || defined(_M_X64) || defined(__ia64) || defined (_M_IA64) || defined(__aarch64__) || defined(__powerpc64__) || (defined(__riscv) && __riscv_xlen == 64)
6262
#define VK_DEFINE_NON_DISPATCHABLE_HANDLE(object) typedef struct object##_T *object;
6363
#else
6464
#define VK_DEFINE_NON_DISPATCHABLE_HANDLE(object) typedef uint64_t object;

src/SDL.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@
6565

6666
// Initialization/Cleanup routines
6767
#include "timer/SDL_timer_c.h"
68-
#ifdef SDL_VIDEO_DRIVER_WINDOWS
68+
#ifdef SDL_PLATFORM_WINDOWS
6969
extern bool SDL_HelperWindowCreate(void);
7070
extern void SDL_HelperWindowDestroy(void);
7171
#endif
@@ -317,7 +317,7 @@ bool SDL_InitSubSystem(SDL_InitFlags flags)
317317
SDL_DBus_Init();
318318
#endif
319319

320-
#ifdef SDL_VIDEO_DRIVER_WINDOWS
320+
#ifdef SDL_PLATFORM_WINDOWS
321321
if (flags & (SDL_INIT_HAPTIC | SDL_INIT_JOYSTICK)) {
322322
if (!SDL_HelperWindowCreate()) {
323323
goto quit_and_error;
@@ -653,7 +653,7 @@ void SDL_Quit(void)
653653
SDL_bInMainQuit = true;
654654

655655
// Quit all subsystems
656-
#ifdef SDL_VIDEO_DRIVER_WINDOWS
656+
#ifdef SDL_PLATFORM_WINDOWS
657657
SDL_HelperWindowDestroy();
658658
#endif
659659
SDL_QuitSubSystem(SDL_INIT_EVERYTHING);

src/audio/SDL_audio.c

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1391,6 +1391,7 @@ static int SDLCALL RecordingAudioThread(void *devicep) // thread entry point
13911391
typedef struct CountAudioDevicesData
13921392
{
13931393
int devs_seen;
1394+
int devs_skipped;
13941395
const int num_devices;
13951396
SDL_AudioDeviceID *result;
13961397
const bool recording;
@@ -1406,7 +1407,13 @@ static bool SDLCALL CountAudioDevices(void *userdata, const SDL_HashTable *table
14061407
const bool isphysical = !!(devid & (1<<1));
14071408
if (isphysical && (devid_recording == data->recording)) {
14081409
SDL_assert(data->devs_seen < data->num_devices);
1409-
data->result[data->devs_seen++] = devid;
1410+
SDL_AudioDevice *device = (SDL_AudioDevice *) value; // this is normally risky, but we hold the device_hash_lock here.
1411+
const bool zombie = SDL_GetAtomicInt(&device->zombie) != 0;
1412+
if (zombie) {
1413+
data->devs_skipped++;
1414+
} else {
1415+
data->result[data->devs_seen++] = devid;
1416+
}
14101417
}
14111418
return true; // keep iterating.
14121419
}
@@ -1422,10 +1429,11 @@ static SDL_AudioDeviceID *GetAudioDevices(int *count, bool recording)
14221429
num_devices = SDL_GetAtomicInt(recording ? &current_audio.recording_device_count : &current_audio.playback_device_count);
14231430
result = (SDL_AudioDeviceID *) SDL_malloc((num_devices + 1) * sizeof (SDL_AudioDeviceID));
14241431
if (result) {
1425-
CountAudioDevicesData data = { 0, num_devices, result, recording };
1432+
CountAudioDevicesData data = { 0, 0, num_devices, result, recording };
14261433
SDL_IterateHashTable(current_audio.device_hash, CountAudioDevices, &data);
1427-
SDL_assert(data.devs_seen == num_devices);
1428-
result[data.devs_seen] = 0; // null-terminated.
1434+
SDL_assert((data.devs_seen + data.devs_skipped) == num_devices);
1435+
num_devices = data.devs_seen; // might be less if we skipped any.
1436+
result[num_devices] = 0; // null-terminated.
14291437
}
14301438
}
14311439
SDL_UnlockRWLock(current_audio.device_hash_lock);
@@ -1567,7 +1575,9 @@ int *SDL_GetAudioDeviceChannelMap(SDL_AudioDeviceID devid, int *count)
15671575
SDL_AudioDevice *device = ObtainPhysicalAudioDeviceDefaultAllowed(devid);
15681576
if (device) {
15691577
channels = device->spec.channels;
1570-
result = SDL_ChannelMapDup(device->chmap, channels);
1578+
if (channels > 0 && device->chmap) {
1579+
result = SDL_ChannelMapDup(device->chmap, channels);
1580+
}
15711581
}
15721582
ReleaseAudioDevice(device);
15731583

src/audio/alsa/SDL_alsa_audio.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1156,7 +1156,7 @@ static bool ALSA_OpenDevice(SDL_AudioDevice *device)
11561156
#if SDL_ALSA_DEBUG
11571157
snd_pcm_uframes_t bufsize;
11581158
ALSA_snd_pcm_hw_params_get_buffer_size(cfg_ctx.hwparams, &bufsize);
1159-
SDL_LogError(SDL_LOG_CATEGORY_AUDIO,
1159+
SDL_LogDebug(SDL_LOG_CATEGORY_AUDIO,
11601160
"ALSA: period size = %ld, periods = %u, buffer size = %lu",
11611161
cfg_ctx.persize, cfg_ctx.periods, bufsize);
11621162
#endif

src/audio/directsound/SDL_directsound.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -206,7 +206,7 @@ static void DSOUND_DetectDevices(SDL_AudioDevice **default_playback, SDL_AudioDe
206206
{
207207
#ifdef HAVE_MMDEVICEAPI_H
208208
if (SupportsIMMDevice) {
209-
SDL_IMMDevice_EnumerateEndpoints(default_playback, default_recording);
209+
SDL_IMMDevice_EnumerateEndpoints(default_playback, default_recording, SDL_AUDIO_UNKNOWN);
210210
} else
211211
#endif
212212
{

0 commit comments

Comments
 (0)