Commit Graph

7582 Commits

Author SHA1 Message Date
Sam Lantinga
55b599d693 Only use a transparent cursor on Windows when connected via RDP
VMware relies on the cursor being set to NULL to optimize relative mouse motion for games.

We should also revisit whether current RDP works better with a NULL cursor or a transparent cursor.

Fixes https://github.com/libsdl-org/SDL/issues/13700

(cherry picked from commit dac6af4ba6)
2025-09-14 17:31:32 -07:00
Joshua Root
eb974470ec Guard use of @available in SDL_cocoaevents.m
Older compilers don't understand this syntax.
2025-09-07 16:46:19 -07:00
Ozkan Sezer
f0e7000f92 alsa: fix signatures of snd_pcm_info_free and snd_pcm_hw_params_get_rate
Reference issue: https://github.com/libsdl-org/SDL/issues/13845.
2025-09-02 17:02:32 +03:00
Ozkan Sezer
d2ab01b8bb openslES: really fix build.. 2025-09-01 20:38:37 +03:00
Ozkan Sezer
f5246d0181 openslES: fix build 2025-09-01 20:25:28 +03:00
Ryan C. Gordon
b8c802632b openslES: OpenSL ES on Android only supports two formats, limit to that.
(Three with the floating point extension, which we use.)

This is according to:

https://developer.android.com/ndk/guides/audio/opensl/opensl-for-android

Previously, this would accept a request for Sint8 or Sint32 and disaster
would ensue.

Fixes #13779.

(cherry picked from commit 0b2a003a35)
(cherry picked from commit 7323104f97)
2025-09-01 11:37:10 -04:00
Ozkan Sezer
7a34e14c8e SDL_hidapi.c: fix -Wundef failures due to HAVE_DRIVER_BACKEND check 2025-08-30 14:33:32 +03:00
Frank Praznik
d31d98d436 wayland: Add a sigtimedwait() implementation for OpenBSD
sigtimedwait() is an optional part of POSIX.1-2001, and OpenBSD doesn't implement it. Add a replacement implementation based on https://comp.unix.programmer.narkive.com/rEDH0sPT/sigtimedwait-implementation

(backported from commit 1049426a76)
2025-08-30 14:23:04 +03:00
Sam Lantinga
5e85a29e75 Support the "ambient" value for SDL_HINT_AUDIO_CATEGORY
Fixes https://github.com/libsdl-org/SDL/issues/13732

(cherry picked from commit 4725213eef)
2025-08-12 09:54:57 -07:00
Ryan C. Gordon
afc1d9122b 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.

(cherry picked from commit 943c4abcb4)
2025-07-29 18:21:01 -04:00
Sam Lantinga
af2279b286 Revert "Use SDL_MessageBoxFlags and SDL_MessageBoxButtonFlags appropriately"
This reverts commit 059af5265a.
2025-07-29 09:41:35 -07:00
Sam Lantinga
059af5265a Use SDL_MessageBoxFlags and SDL_MessageBoxButtonFlags appropriately
(cherry picked from commit 991d28ae37)
2025-07-29 09:38:52 -07:00
Dan Andrus
e610529e84 Check NSWindow::isVisible before sending SDL_WINDOWEVENT_RESTORED during Cocoa_WindowListener::windowDidResize 2025-07-28 14:46:55 -04:00
Boris I. Bendovsky
3c36718348 [SDL2] Implement SDL_GL_GetAttribute for SDL_GL_FLOATBUFFERS 2025-07-27 19:55:57 -07:00
Ozkan Sezer
ead4a032d3 sun audio: remove ifdefs, always include sys/audioio.h and sys/ioctl.h 2025-07-27 00:10:02 +03:00
vanfanel
34691de22b SDL2: Fill the SDL_AudioSpec in add_device() 2025-07-20 23:47:25 -04:00
vanfanel
874ca5a678 SDL2: Add missing symbol loading for SDL_GetDefaultAudioInfo() implementation on ALSA. 2025-07-17 13:08:52 -04:00
vanfanel
8d5984464e SDL2: Implement SDL_GetDefaultAudioInfo() on the ALSA backend. 2025-07-17 13:08:52 -04:00
Ryan C. Gordon
b537380065 cocoa: Patched to compile. 2025-07-10 16:27:47 -04:00
Ryan C. Gordon
b2c3e6fade cocoa: Don't use trick of briefly focusing the Dock on newer macOS releases.
On newer systems, the trick isn't necessary, and if you do it, if the user is
moving the mouse when launching the app, it'll show a hidden Dock.

Fixes #10340.

(manually backported from SDL3 from commit 279dabfc96)
2025-07-10 15:57:55 -04:00
Wouter Wijsman
309d1481a4 PSP: Truncate thread name when passing to sceKernelCreateThread 2025-07-09 17:11:32 +02:00
Mitch Cairns
e4475d1868 Fixed Nintendo Switch thumbstick calibration
(cherry picked from commit 3a6f9e01f8)
2025-06-22 15:29:12 -07:00
Sam Lantinga
6a71328638 Fixed Nintendo Switch Pro thumbstick calibration
Fixes https://github.com/libsdl-org/SDL/issues/13246

(cherry picked from commit 038a3806eb)
2025-06-21 20:06:08 -07:00
Wohlstand
6701f938f7 Vita Render: Limit the scope of cliprect to viewport
Don't allow cliprect be larger than viewport's scope
2025-06-20 13:15:57 -07:00
Wohlstand
1c09a7117a Vita: Fixed absence of clipping when viewport is set
#13034
2025-06-20 13:15:57 -07:00
ceski
9eb50a906a Read Switch controller gyro/accel sensitivity coeffs (SDL2)
These vary by controller, so using the stored values should improve the accuracy of the sensor data.
2025-06-13 12:18:12 -07:00
Ryan C. Gordon
3c08172d06 Revert "opengles2: Restore previous default texture_formats."
This reverts commit 9f7ccbe8d4.

Fixes #13109.
2025-06-01 03:21:36 -04:00
Francisco Javier Trujillo Mata
d0c2d8bc40 Fix wrong callback type
(cherry picked from commit c89357bf60)
2025-05-20 11:11:47 -07:00
Sam Lantinga
33eb167da8 Fixed rare crash trying to interrupt SDL_WaitEvent()
Fixes https://github.com/libsdl-org/SDL/issues/12797

(cherry picked from commit 992e4c59bd)
2025-05-19 14:24:26 -07:00
Joe [ReRezd]
4b4f6b3e22 Fix: GameCube controller adapter hotplug not working
SDL_PrivateJoystickAdded was called before setting the InstanceId in the adapters ctx->joysticks array.  This would eventually broadcast the SDL_EVENT_JOYSTICK_ADDED event with the new InstanceId, if your program listens for the added events and opens joysticks at that point it would always fail because there would be no matching InstanceId in the ctx->joysticks array.

(cherry picked from commit afd1e51023)
2025-05-19 08:26:25 -07:00
Sam Lantinga
2163887f29 Define illegal_instruction() when it will be actually used
(cherry picked from commit 29d2116495)
2025-05-08 12:53:33 -07:00
Sam Clegg
c0f78dee5e [emscripten] Remove reference to Module['createContext']
Backported from https://github.com/libsdl-org/SDL/pull/12970
2025-05-06 14:46:19 -07:00
A. Wilcox
17e6208c1b cpuinfo: Use auxv for AltiVec on Linux if possible
The SIGILL handler is not very reliable and can cause crashes.

Linux provides the CPU's AltiVec support status in getauxval.

(cherry picked from commit 7490471796)
2025-05-04 13:55:59 -07:00
Derek Schuff
a220e7c422 Port #12581 to SDL2
This fixes undefined behavior resulting from adding offsets to nullptr.
2025-05-01 21:36:23 -07:00
Sam Lantinga
2442c85cb8 Call IOHIDDeviceClose() if needed in hid_close() on macOS
Unregistering the input report callback marks the device as disconnected, so IOHIDDeviceClose() would never be called if the device wasn't already disconnected  when hid_close() was called.

Fixes https://github.com/libsdl-org/SDL/issues/12255
2025-04-29 11:21:26 -07:00
Sam Lantinga
5b951141d2 Revert "Don't leak device handle in macOS 10.10 or newer"
This reverts commit 5925c27efb.

Fixes https://github.com/libsdl-org/SDL/issues/12807
2025-04-29 11:07:29 -07:00
Cameron Gutman
15fd3fcdc2 events: Fix undefined behavior when disabling some event types
Shifting a signed int left by 31 is UB.
2025-04-29 00:30:41 -05:00
Sam Lantinga
45b01d16b1 Fixed reliability of initializing Switch controllers on macOS
It looks like both macOS (15.1.1) and SDL are trying to talk to the controller at the same time, which can cause interleaved replies or even locking up the controller. Waiting a bit before talking to the controller seems to take care of this.
2025-04-28 20:21:53 -07:00
Sam Lantinga
3e47181800 Default SDL_HINT_ACCELEROMETER_AS_JOYSTICK to 0 on Linux
The Linux joystick driver supports associating sensor devices with the related controller device, so enable that by default.

Fixes https://github.com/libsdl-org/SDL/issues/12043
2025-03-25 09:07:10 -07:00
Carl Åstholm
a8f0eb4c33 emscripten: Don't use legacy JS library functions for assertions
(cherry picked from commit 54f5b73333)
2025-03-20 16:36:02 -07:00
Sam Lantinga
52146cf067 Fixed raw input device GUIDs changing randomly between runs
On Windows 11, apparently HidD_GetManufacturerString() and HidD_GetProductString() can return TRUE without actually filling in any string data.

Fixes https://github.com/libsdl-org/SDL/issues/12566

(cherry picked from commit 4fc9509ab7)
2025-03-17 13:57:35 -07:00
Sam Lantinga
46a51b4298 Fixed crash if info->path is NULL
(cherry picked from commit 715301cef5)
2025-03-17 09:47:53 -07:00
Sam Lantinga
1caae3e9e4 Fixed sscanf("026", "%1x%1x%1x", &r, &g, &b)
Fixes https://github.com/libsdl-org/SDL/issues/12510

(cherry picked from commit be6ed6e9c4)
2025-03-10 15:45:31 -07:00
Neal Gompa
6be87ceb33 pipewire: Ensure that the correct struct is used for enumeration APIs
PipeWire now requires the correct struct type is used, otherwise
it will fail to compile.

Reference: 188d920733

Fixes: https://github.com/libsdl-org/SDL/issues/12224
(cherry picked from commit d35bef64e9)
2025-03-06 14:36:44 -05:00
Sam Lantinga
ab44451578 Added support for the "%n" sscanf format specifier
(cherry picked from commit 6980325310)
2025-02-25 08:07:33 -08:00
Tomasz Pakuła
0809be4ec5 [SDL2] Add SDL_HINT_JOYSTICK_HAPTIC_AXES
Allows users to overwrite the number of haptic axes defined for a given
joystick. Also supports a "wildcard" VID:PID of 0xFFFF/0xFFFF
2025-02-25 07:54:59 -08:00
Petter Reinholdtsen
24693ac285 Changed PULSEAUDIO_FlushRecording() to only flush audio present when called.
When the flushing is not able to keep up with the audio stream coming in,
it will end up flushing forever and block API clients from getting any audio.

Fixes #9706
2025-02-24 07:31:06 -08:00
Paper
6421f12d7f thread/windows: fix stack overflow in exception naming
(cherry picked from commit 1a853973ab)
2025-02-20 08:20:41 -08:00
Ozkan Sezer
ee49025f80 dynapi: use DosScanEnv() for os/2. 2025-02-20 11:50:04 +03:00
Sam Lantinga
5925c27efb Don't leak device handle in macOS 10.10 or newer
Merged upstream fix for macOS:
cdc473dfe4

In one of the early versions of macOS, when you try to close the device
with IOHIDDeviceClose() that is being physically disconnected.
Starting with some version of macOS, this crash bug was fixed,
and starting with macSO 10.15 the opposite effect took place:
in some environments crash happens if IOHIDDeviceClose() is _not_ called.

This patch is to keep a workaround for old versions of macOS,
and don't have a leak in new/tested environments.

Fixes https://github.com/libsdl-org/SDL/issues/12255
2025-02-19 16:55:03 -08:00