Commit Graph
100 Commits
Author SHA1 Message Date
Sam Lantinga 8dedf44929 Fixed warning: initialization of pointer of type 'VkSampler' (aka 'struct VkSampler_T *') to null from a constant boolean expression
Fixes https://github.com/libsdl-org/SDL/issues/13628
2025-08-03 07:24:51 -07:00
Sam Lantinga 8796f0a8ed SDL_gtk: Prevent loading GTK-3 if a different version of GTK is already loaded
- gtk_init_check claims it will not terminate the program on failure, however this is does
  not apply to the internal check it performs to see whether another GTK library is already
  loaded, the detection of which triggers a g_error which glib treats as fatal.

- gtk_progress_get_type and gtk_misc_get_type are checked to match the checks done
  by _gtk_module_has_mixed_deps.

- Clean up gtk/gdk loading. There are no library fallbacks so the one option available can
  be loaded rather than iterating through a list of one item.
2025-08-01 17:44:22 -07:00
Sam Lantinga 2989d0c420 Fixed build 2025-07-31 10:18:05 -07:00
Sam Lantinga 88cbe85fe2 Added missing files 2025-07-31 08:57:59 -07:00
Sam Lantinga 26c41f3f9a Fix Android build
- Android defines SDL_PLATFORM_UNIX but does not compile core/unix sources
  so add checks for SDL_PLATFORM_ANDROID where SDL_gtk is used.

- Fix missing void parameter list in SDL_Gtk_EnterContext.

- Remove unneeded SDL_gtk.h include in SDL_events.c
2025-07-31 08:49:40 -07:00
Sam Lantinga bf7b4d4a9e x11: Add GTK signal handler for gtk-xft-dpi and reader in GetGlobalContentScale
- This is to support dynamic updates of content scale when running in XWayland. The GTK signal is
  preferred over the XSettings watcher and Xrm database if supported as it will trigger and update
  for both native X11 and XWayland on changes to Xft.dpi.
2025-07-31 08:49:36 -07:00
Sam Lantinga 3c369aa8b4 unix: Refactor GTK bindings from SDL_tray to separate SDL_gtk module to allow shared usage
- SDL creates and requires usage of a specific glib context. This context is set as the global
  glib context with SDL_Gtk_EnterContext and the previous context is restored with
  SDL_Gtk_ExitContext.

- To avoid changing the behavior of SDL_tray, which is the only consumer of SDL_gtk currently,
  the SDL_UpdateTray function now unconditionally runs a single glib frame iteration and is
  responsible for dispatching glib events for all consumers in SDL_PumpEvents.

- Cleaned up some error handling in SDL_tray.
2025-07-31 08:49:31 -07:00
Sam Lantinga c663b6ec1f Don't leave garbage in output parameters 2025-07-29 20:48:56 -07:00
Sam Lantinga 25cf1a569c Map GameCube controller trigger clicks as misc3 and misc4
This is for consistency with the GC Ultimate controller and allows binding in Steam
2025-07-28 13:11:07 -07:00
Sam Lantinga 72b7fd10b4 Fixed warning: 'break' will never be executed 2025-07-25 16:20:44 -07:00
Sam Lantinga 970234d62d Fixed documentation for aligned structure members 2025-07-25 13:33:49 -07:00
Sam Lantinga e5d57d8ad6 Fixed building with GameInput v1.0 2025-07-24 10:52:09 -07:00
Sam Lantinga 0ee0fe1572 Fixed building with GameInput v1.0 2025-07-24 10:42:28 -07:00
Sam Lantinga 66dad9c21f Added Steam Virtual Gamepad support to the GameInput driver 2025-07-24 10:36:09 -07:00
Sam Lantinga 6babade758 Fixed double SDL_EVENT_GAMEPAD_ADDED for controllers with automatic gamepad mappings 2025-07-24 10:36:09 -07:00
Sam Lantinga 3fdd15adaa Fixed double-release of GameInput at shutdown 2025-07-24 10:36:09 -07:00
Sam Lantinga fc19ae343c Updated SDL_IsJoystickSInputController() to match style in file 2025-07-21 11:38:54 -07:00
Sam Lantinga 86200d1203 Fixed clamp texture address mode in software renderer 2025-07-21 10:20:16 -07:00
Sam Lantinga ad52ebf985 Fixed build 2025-07-17 20:56:41 -07:00
Sam Lantinga e70ecb37c1 Implement the D-pad as a hat for SInput controllers
This lets games that use the joystick API handle the D-pad the same way as other controllers
2025-07-17 20:51:29 -07:00
Sam Lantinga 8f79a6185a Fixed the mapping for the GC Ultimate controller 2025-07-17 19:32:46 -07:00
Sam Lantinga de20b731f2 Removed unnecessary cast 2025-07-17 19:32:29 -07:00
Sam Lantinga ada44eaa10 testcontroller: reverted GameInput test code 2025-07-17 18:41:43 -07:00
Sam Lantinga 3b9db3dd62 Added support for Windows GameInput 2.0 2025-07-17 15:38:39 -07:00
Sam Lantinga 855d28e97a Fixed crash if a clipboard event was sent with video uninitialized
This can happen if you're using SDL on Android without using the video subsystem.
2025-07-17 08:47:32 -07:00
Sam Lantinga 7510a67159 Fixed typo
Fixes https://github.com/libsdl-org/SDL/issues/13373
2025-07-16 19:31:10 -07:00
Sam Lantinga a53eb5221b Added support for the PDP REALMz Wireless Controller for Switch 2025-07-15 17:41:54 -07:00
Sam Lantinga 1b65f25465 testcontroller: use the correct label for face buttons 2025-07-15 15:52:40 -07:00
Sam Lantinga 08e3758e3f Added paddle bindings for the 8BitDo Pro 3 controller 2025-07-15 10:15:52 -07:00
Sam Lantinga d53fcab609 Reordered the 8BitDo Pro 3 controller 2025-07-15 10:09:06 -07:00
Sam Lantinga 277f91c317 Removed the Mayflash GameCube adapter from the PS3 controller list 2025-07-14 11:30:15 -07:00
Sam Lantinga 92e8224d32 Fixed build 2025-07-11 13:05:37 -07:00
Sam Lantinga 0b2e389ee3 Fixed long delay when enumerating the Razer Huntsman keyboard
Fixes https://github.com/libsdl-org/SDL/issues/13236
2025-07-11 12:34:14 -07:00
Sam Lantinga 937e8d55a4 Set hwndTarget to NULL when unregistering raw input
Fixes https://github.com/libsdl-org/SDL/issues/13335
2025-07-11 12:14:36 -07:00
Sam Lantinga f199aafaeb Fixed long delay when enumerating the Razer Huntsman keyboard
Fixes https://github.com/libsdl-org/SDL/issues/13236
2025-07-11 11:55:46 -07:00
Sam Lantinga afa27243df Ignore sensor delta values that look like they're out of range 2025-06-26 11:10:21 -07:00
Sam Lantinga 8d5bf053f7 Fixed detecting 8BitDo sensor timestamp on older firmware
Also updated the reported sensor rate over USB for new firmware
2025-06-26 10:47:35 -07:00
Sam Lantinga f40bf44928 Removed unnecessary include 2025-06-25 18:50:28 -07:00
Sam Lantinga 727b4924c8 Update the viewport when logical presentation changes
Fixes https://github.com/libsdl-org/SDL/issues/13256
2025-06-25 09:58:30 -07:00
Sam Lantinga 9ed83e71f6 Fixed memory leaks in KMSDRM property handling
Also cleaned up the code for consistency so it's easy to see memory leaks here.
2025-06-22 21:33:52 -07:00
Sam Lantinga aa4f916b71 Renamed SDL_PROP_AUDIOSTREAM_KEEP_ON_SHUTDOWN_BOOLEAN to SDL_PROP_AUDIOSTREAM_AUTO_CLEANUP_BOOLEAN 2025-06-22 21:17:06 -07:00
Sam Lantinga 038a3806eb Fixed Nintendo Switch Pro thumbstick calibration
Fixes https://github.com/libsdl-org/SDL/issues/13246
2025-06-21 19:55:05 -07:00
Sam Lantinga e6c2649afc Updated testffmpeg for ffmpeg 7.1 2025-06-21 08:48:40 -07:00
Sam Lantinga 7d9fd48557 alsa: recover from snd_pcm_avail() returning -EPIPE 2025-06-20 16:33:30 -07:00
Sam Lantinga e68f5ca99a alsa: use udev if available instead of a hotplug thread
This makes detecting audio device changes more responsive.
2025-06-20 19:19:31 -04:00
Sam Lantinga 051ce0ff89 alsa: fixed disconnecting the microphone when opened
Some devices take some time for data to become available, so we'll keep waiting as long as necessary for them to provide data.
2025-06-20 19:19:31 -04:00
Sam Lantinga c19ad189dc Clarify that SDL_GetAudioStreamDevice() returns the logical device. 2025-06-20 14:01:16 -07:00
Sam Lantinga 7882e60f0e Don't log an error for disconnected audio devices 2025-06-20 11:05:08 -07:00
Sam Lantinga d7939abf42 Use consistent style for pointer declarations and casts 2025-06-18 10:03:44 -07:00
Sam Lantinga efed3c63b3 Added support for an alternate version of the Vader 4 Pro 2025-06-17 10:02:10 -07:00
Sam Lantinga d6bae53341 Added support for an alternate version of the Vader 4 Pro 2025-06-17 08:07:12 -07:00
Sam Lantinga f62c982bcf Reverted Accelerometer and Gyro displays to throttled display (10hz)
Also made accelerometer threshold for drift calibration more lenient for very noisy accelerometers.

The testcontroller tool could eventually be used to come up with a better way to profile an IMU's "stationary" noise so that this threshold can be as tight as necessary for the sake of automatic drift calibration.

(thanks @HilariousCow!)
2025-06-16 11:14:22 -07:00
Sam Lantinga b833c618a9 Improved reliability detecting FlyDigi Vader controllers 2025-06-16 11:07:50 -07:00
Sam Lantinga e18a6313de Added gyro support for the Flydigi Vader 3 Pro controller 2025-06-12 09:10:07 -07:00
Sam Lantinga 5826966873 Fixed replacing existing specific gamepad mappings
If the first mapping we see doesn't have a CRC, continue looking for another exact CRC match.

Fixes testautomation --filter TestVirtualJoystick
2025-06-06 09:53:15 -07:00
Sam Lantinga f90a21483c Added support for the ZEROPLUS P4 Wired Gamepad 2025-06-06 09:25:36 -07:00
Sam Lantinga 638acdc02a Remove the CRC from automatically generated gamepad mappings
Fixes https://github.com/libsdl-org/SDL/issues/13127
2025-06-06 09:22:14 -07:00
Sam Lantinga 27464ffb08 Clarify that icon and cursor alternate images are added with SDL_AddSurfaceAlternateImage() 2025-06-05 09:00:49 -07:00
Sam Lantinga 6622f4e1ea Added support for the NACON Revolution X Unlimited controller on macOS
This adds support for the controller in Bluetooth mode.

Fixes https://github.com/libsdl-org/SDL/issues/13143
2025-06-03 15:05:11 -07:00
Sam Lantinga 7457857304 Fixed input from the MayFlash GameCube adapter with version 7 firmware 2025-06-03 11:13:43 -07:00
Sam Lantinga cf6c42e6e6 Use HEAPU8.set rather than Module.HEAPU8.set (thanks @sbc100!)
The Module object is the external interface to the application, internal symbols like HEAPU8 don't need to be exported to be used and usage should not be prefixed with Module.

Fixes https://github.com/libsdl-org/SDL/issues/13156
Closes https://github.com/libsdl-org/SDL/pull/13157
2025-06-02 09:47:26 -07:00
Sam Lantinga 4b0f48c4cf Mark gamepads as invalid if they can't be opened
Fixes https://github.com/libsdl-org/SDL/issues/13129
2025-06-02 09:21:13 -07:00
Sam Lantinga fc1c0618de kmsdrm: fixed creating GBM surfaces on NVIDIA cards 2025-05-29 11:20:24 -07:00
Sam Lantinga 885e611f3c Added macros to push/pop error messages while cleaning up 2025-05-29 10:53:46 -07:00
Sam Lantinga 61d105247e Fixed typos 2025-05-29 10:53:30 -07:00
Sam Lantinga 7db0ac7380 Updated SDL_StretchSurface() documentation
Fixes https://github.com/libsdl-org/SDL/issues/13135
2025-05-29 09:09:04 -07:00
Sam Lantinga 737b9e117d Removed obsolete documentation 2025-05-28 15:57:04 -07:00
Sam Lantinga d2be547642 Removed spurious parentheses 2025-05-28 13:28:12 -07:00
Sam Lantinga 36936cbf37 Set the serial number to the Bluetooth MAC address for 8BitDo controllers 2025-05-28 12:18:27 -07:00
Sam Lantinga aa870d511e Disable SDL_HINT_JOYSTICK_RAWINPUT by default
Windows can get in a state when it stops reporting raw input events for game controllers until reboot.

The downside of this change is that we lose support for trigger rumble and are limited to 4 controllers again, but if that's important for your application you can use SDL_SetHint(SDL_HINT_JOYSTICK_RAWINPUT, true) to enable this functionality.

Fixes https://github.com/libsdl-org/SDL/issues/13047
2025-05-27 09:51:48 -07:00
Sam Lantinga 8a2e2e75d1 Simplified loop logic 2025-05-27 08:47:32 -07:00
Sam Lantinga 1f6b5c681d Set the initial axis values for HIDAPI and XInput controllers
Fixes https://github.com/libsdl-org/SDL/issues/13020
2025-05-23 12:09:39 -07:00
Sam Lantinga c9cf4c42e0 Improved HIDAPI support for Flydigi controllers 2025-05-22 15:36:38 -07:00
Sam Lantinga 6f994cc7a8 Fixed macOS build 2025-05-22 10:18:14 -07:00
Sam Lantinga 264eb8d440 Fixed the Bluetooth flag for the combined Joy-Con controller 2025-05-21 13:30:00 -07:00
Sam Lantinga 992e4c59bd Fixed rare crash trying to interrupt SDL_WaitEvent()
Fixes https://github.com/libsdl-org/SDL/issues/12797
2025-05-19 14:15:44 -07:00
Sam Lantinga 25f2376e79 Fixed touch not being delivered as mouse events by default on Vita
Closes https://github.com/libsdl-org/SDL/pull/13070
2025-05-19 08:32:23 -07:00
Sam Lantinga db154c8b9b Added HIDAPI mapping for the 8BitDo SF30 Pro 2025-05-14 10:18:51 -07:00
Sam Lantinga ec685e87fd Clarify logic in UpdateLogicalPresentation() 2025-05-14 10:12:41 -07:00
Sam Lantinga cd95152b2c Fixed crash if out of memory in the Vulkan GPU driver 2025-05-13 09:07:15 -07:00
Sam Lantinga 87fe9ef79b Fixed crash if WGI isn't correlated in RAWINPUT_JoystickRumble() 2025-05-08 15:38:32 -07:00
Sam Lantinga 29d2116495 Define illegal_instruction() when it will be actually used 2025-05-08 11:51:35 -07:00
Sam Lantinga 2aa0957081 Fixed 8BitDo Ultimate 2 Wireless controller on macOS
When connected for the first time over Bluetooth on macOS, the first few reads return 0, so retry a few times in that case.
2025-05-08 10:48:02 -07:00
Sam Lantinga 8690a9ab54 Prefer the HIDAPI driver for 8BitDo controllers on macOS
The HIDAPI driver supports accelerometer, gyro, and rumble.
2025-05-08 10:08:08 -07:00
Sam Lantinga 2b57d58f7d Added GCController mapping for the 8BitDo SN30 Pro on macOS 2025-05-08 09:57:10 -07:00
Sam Lantinga d157600d3d Added GCController mapping for the 8BitDo Pro 2 on macOS
Fixes https://github.com/libsdl-org/SDL/issues/12987
2025-05-08 09:49:10 -07:00
Sam Lantinga 5bee85408c Cleanup 8BitDo HIDAPI support for SF30 Pro and SN30 Pro
This sets the correct number of buttons for older controllers, and adds parsing for older firmware USB reports
2025-05-07 12:11:27 -07:00
Sam Lantinga ca47dc59a9 Fixed building with the OpenVR video driver 2025-05-06 16:14:22 -07:00
Sam Lantinga 195ad85ba4 Fixed typo 2025-05-06 16:08:03 -07:00
Sam Lantinga d357aa29a3 Fixed initializing the OpenVR driver 2025-05-05 15:52:28 -07:00
Sam Lantinga f8c77908ad Use motor sequence ID 0 in the HIDAPI GIP driver
Using a 0 sequence number is always allowed and avoids having to synchronize sequence numbers with the controller (and potentially confusing other things talking to the controller)

Also fixes occasional long running rumble at controller connection.
2025-05-05 15:06:54 -07:00
Sam Lantinga ab12b7cbba Added support for the share button on the GameSir-K1 FLUX controller 2025-05-02 10:15:16 -07:00
Sam Lantinga 1e6a25324c Added support for the PowerA Battle Dragon Advanced Wireless Controller 2025-05-02 10:01:13 -07:00
Sam Lantinga caf269ce00 Added a link to the GIP documentation 2025-05-01 21:35:10 -07:00
Sam Lantinga 34c045aa39 Fixed paddles on the Xbox Elite controller using the GIP driver 2025-05-01 21:35:10 -07:00
Sam Lantinga ae251a05be Fixed warning: no previous prototype for function 'GIP_ParseMetadata' 2025-05-01 15:39:49 -07:00
Sam Lantinga 48dfc03a87 Added the gamepad hint SDL_GAMECONTROLLER_USE_GAMECUBE_LABELS
This is for internal use to signal that a mapping uses positional GameCube buttons. It's set so we know whether a mapping uses the older style labeled buttons or the newer style positional buttons. If a positional mapping is used with SDL2, then it will be ignored, since the hint is marked as defaulting true and the mapping conditional is that the hint is false.
2025-05-01 10:54:16 -07:00
Sam Lantinga 21a7bbbf14 Restore compatibility with older GameCube mappings
Restore the original button values for GameCube controllers, but swap labeled mappings to positional while loading mappings

Fixes https://github.com/libsdl-org/SDL/issues/12847
2025-05-01 10:54:16 -07:00
Sam Lantinga e3df61b070 Fixed right mouse button emulation when using a pen
Pen button 1 is typically used as right click. Pen button 2 (Wacom eraser) doesn't have a specific mapping, but we'll use middle click for now.
2025-04-30 11:07:31 -07:00
Sam Lantinga 106ccc722e Fixed missing simulated mouse events using a Wacom tablet
The low 16-bits of the message extra info is an event sequence number when using the Wacom tablet with Windows Ink disabled. The high bits of normal mouse motion when using touch input match the touch signature, 0xFF515700. The high bits of raw input mouse motion when using touch input do not match that signature, so we have to check for the touch bit in that case.

Fixes https://github.com/libsdl-org/SDL/issues/12927
2025-04-30 11:07:31 -07:00