Skip to content

Commit 05f4fa7

Browse files
authored
Merge branch 'libsdl-org:main' into main
2 parents 35ea914 + a314a58 commit 05f4fa7

File tree

7 files changed

+41
-23
lines changed

7 files changed

+41
-23
lines changed

.wikiheaders-options

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ manpagesymbolfilterregex = \A[US]int\d+\Z
2525
headercategoryeval = s/\ASDL_test_?.*?\.h\Z//; s/\ASDL_?(.*?)\.h\Z/$1/; ucfirst();
2626

2727
quickrefenabled = 1
28-
quickrefcategoryorder = Init,Hints,Error,Version,Properties,Log,Video,Events,Keyboard,Mouse,Touch,Gamepad,Joystick,Haptic,Audio,Time,Timer,Render,SharedObject,Thread,Mutex,Atomic,Filesystem,IOStream,AsyncIO,Storage,Pixels,Surface,Blendmode,Rect,Camera,Clipboard,Dialog,GPU,Messagebox,Vulkan,Metal,Platform,Power,Sensor,Process,Bits,Endian,Assert,CPUInfo,Intrinsics,Locale,System,Misc,GUID,Main,Stdinc
28+
quickrefcategoryorder = Init,Hints,Error,Version,Properties,Log,Video,Events,Keyboard,Mouse,Touch,Gamepad,Joystick,Haptic,Audio,Time,Timer,Render,SharedObject,Thread,Mutex,Atomic,Filesystem,IOStream,AsyncIO,Storage,Pixels,Surface,Blendmode,Rect,Camera,Clipboard,Dialog,Tray,Messagebox,GPU,Vulkan,Metal,Platform,Power,Sensor,Process,Bits,Endian,Assert,CPUInfo,Intrinsics,Locale,System,Misc,GUID,Main,Stdinc
2929
quickreftitle = SDL3 API Quick Reference
3030
quickrefurl = https://libsdl.org/
3131
quickrefdesc = The latest version of this document can be found at https://wiki.libsdl.org/SDL3/QuickReference

build-scripts/wikiheaders.pl

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -825,21 +825,23 @@ sub print_big_ascii_string {
825825
die("Don't have a big ascii entry for '$ch'!\n") if not defined $rowsref;
826826
my $row = @$rowsref[$rownum];
827827

828+
my $outstr = '';
828829
if ($lowascii) {
829830
my @x = split //, $row;
830831
foreach (@x) {
831-
my $v = ($_ eq "\x{2588}") ? 'X' : ' ';
832-
print $fh $v;
832+
$outstr .= ($_ eq "\x{2588}") ? 'X' : ' ';
833833
}
834834
} else {
835-
print $fh $row;
835+
$outstr = $row;
836836
}
837837

838838
$charidx++;
839-
840-
if ($charidx < $charcount) {
841-
print $fh " ";
839+
if ($charidx == $charcount) {
840+
$outstr =~ s/\s*\Z//; # dump extra spaces at the end of the line.
841+
} else {
842+
$outstr .= ' '; # space between glyphs.
842843
}
844+
print $fh $outstr;
843845
}
844846
print $fh "\n";
845847
}

include/SDL3/SDL_log.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -206,6 +206,9 @@ extern SDL_DECLSPEC void SDLCALL SDL_ResetLogPriorities(void);
206206
* SDL_LOG_PRIORITY_WARN and higher have a prefix showing their priority, e.g.
207207
* "WARNING: ".
208208
*
209+
* This function makes a copy of its string argument, **prefix**, so it is not
210+
* necessary to keep the value of **prefix** alive after the call returns.
211+
*
209212
* \param priority the SDL_LogPriority to modify.
210213
* \param prefix the prefix to use for that log priority, or NULL to use no
211214
* prefix.

include/SDL3/SDL_surface.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,8 @@
3232
* There is also a simple .bmp loader, SDL_LoadBMP(). SDL itself does not
3333
* provide loaders for various other file formats, but there are several
3434
* excellent external libraries that do, including its own satellite library,
35-
* SDL_image:
35+
* [SDL_image](https://wiki.libsdl.org/SDL3_image)
36+
* :
3637
*
3738
* https://github.com/libsdl-org/SDL_image
3839
*/

src/audio/SDL_audio.c

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1767,13 +1767,18 @@ static bool OpenPhysicalAudioDevice(SDL_AudioDevice *device, const SDL_AudioSpec
17671767
SDL_copyp(&spec, inspec ? inspec : &device->default_spec);
17681768
PrepareAudioFormat(device->recording, &spec);
17691769

1770-
/* We allow the device format to change if it's better than the current settings (by various definitions of "better"). This prevents
1771-
something low quality, like an old game using S8/8000Hz audio, from ruining a music thing playing at CD quality that tries to open later.
1772-
(or some VoIP library that opens for mono output ruining your surround-sound game because it got there first).
1770+
/* We impose a simple minimum on device formats. This prevents something low quality, like an old game using S8/8000Hz audio,
1771+
from ruining a music thing playing at CD quality that tries to open later, or some VoIP library that opens for mono output
1772+
ruining your surround-sound game because it got there first.
17731773
These are just requests! The backend may change any of these values during OpenDevice method! */
1774-
device->spec.format = (SDL_AUDIO_BITSIZE(device->default_spec.format) >= SDL_AUDIO_BITSIZE(spec.format)) ? device->default_spec.format : spec.format;
1775-
device->spec.freq = SDL_max(device->default_spec.freq, spec.freq);
1776-
device->spec.channels = SDL_max(device->default_spec.channels, spec.channels);
1774+
1775+
const SDL_AudioFormat minimum_format = device->recording ? DEFAULT_AUDIO_RECORDING_FORMAT : DEFAULT_AUDIO_PLAYBACK_FORMAT;
1776+
const int minimum_channels = device->recording ? DEFAULT_AUDIO_RECORDING_CHANNELS : DEFAULT_AUDIO_PLAYBACK_CHANNELS;
1777+
const int minimum_freq = device->recording ? DEFAULT_AUDIO_RECORDING_FREQUENCY : DEFAULT_AUDIO_PLAYBACK_FREQUENCY;
1778+
1779+
device->spec.format = (SDL_AUDIO_BITSIZE(minimum_format) >= SDL_AUDIO_BITSIZE(spec.format)) ? minimum_format : spec.format;
1780+
device->spec.channels = SDL_max(minimum_channels, spec.channels);
1781+
device->spec.freq = SDL_max(minimum_freq, spec.freq);
17771782
device->sample_frames = SDL_GetDefaultSampleFramesFromFreq(device->spec.freq);
17781783
SDL_UpdatedAudioDeviceFormat(device); // start this off sane.
17791784

src/audio/pulseaudio/SDL_pulseaudio.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -672,7 +672,8 @@ static bool PULSEAUDIO_OpenDevice(SDL_AudioDevice *device)
672672
paspec.rate = device->spec.freq;
673673

674674
// Reduced prebuffering compared to the defaults.
675-
paattr.fragsize = device->buffer_size; // despite the name, this is only used for recording devices, according to PulseAudio docs!
675+
676+
paattr.fragsize = device->buffer_size * 2; // despite the name, this is only used for recording devices, according to PulseAudio docs! (times 2 because we want _more_ than our buffer size sent from the server at a time, which helps some drivers).
676677
paattr.tlength = device->buffer_size;
677678
paattr.prebuf = -1;
678679
paattr.maxlength = -1;

src/video/x11/SDL_x11pen.c

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -283,14 +283,16 @@ static X11_PenHandle *X11_MaybeAddPen(SDL_VideoDevice *_this, const XIDeviceInfo
283283

284284
X11_PenHandle *X11_MaybeAddPenByDeviceID(SDL_VideoDevice *_this, int deviceid)
285285
{
286-
SDL_VideoData *data = _this->internal;
287-
int num_device_info = 0;
288-
XIDeviceInfo *device_info = X11_XIQueryDevice(data->display, deviceid, &num_device_info);
289-
if (device_info) {
290-
SDL_assert(num_device_info == 1);
291-
X11_PenHandle *handle = X11_MaybeAddPen(_this, device_info);
292-
X11_XIFreeDeviceInfo(device_info);
293-
return handle;
286+
if (X11_Xinput2IsInitialized()) {
287+
SDL_VideoData *data = _this->internal;
288+
int num_device_info = 0;
289+
XIDeviceInfo *device_info = X11_XIQueryDevice(data->display, deviceid, &num_device_info);
290+
if (device_info) {
291+
SDL_assert(num_device_info == 1);
292+
X11_PenHandle *handle = X11_MaybeAddPen(_this, device_info);
293+
X11_XIFreeDeviceInfo(device_info);
294+
return handle;
295+
}
294296
}
295297
return NULL;
296298
}
@@ -306,6 +308,10 @@ void X11_RemovePenByDeviceID(int deviceid)
306308

307309
void X11_InitPen(SDL_VideoDevice *_this)
308310
{
311+
if (!X11_Xinput2IsInitialized()) {
312+
return; // we need XIQueryDevice() for this.
313+
}
314+
309315
SDL_VideoData *data = _this->internal;
310316

311317
#define LOOKUP_PEN_ATOM(X) X11_XInternAtom(data->display, X, False)

0 commit comments

Comments
 (0)