Commit Graph
100 Commits
Author SHA1 Message Date
Sam Lantinga 5d9b170a3d Be explicit that SDL_FLIP_HORIZONTAL_AND_VERTICAL combines horizontal and vertical flipping
Closes https://github.com/libsdl-org/SDL/pull/13821
2025-08-28 04:22:31 -07:00
Sam Lantinga 285df94623 Renamed SDL_GPURenderStateDesc to SDL_GPURenderStateCreateInfo for consistency with GPU API conventions
Fixes https://github.com/libsdl-org/SDL/issues/12817
2025-08-27 09:14:19 -07:00
Sam Lantinga da6e9bbf7c Allow building the tray subsystem without the video subsystem
Fixes https://github.com/libsdl-org/SDL/issues/13235
2025-08-27 08:15:24 -07:00
Sam Lantinga 42f634ff7a Added SDL_AddAtomicU32()
Fixes https://github.com/libsdl-org/SDL/issues/13496
2025-08-27 06:44:51 -07:00
Sam Lantinga 5291e9bbbd Minor cleanup 2025-08-26 19:28:59 -07:00
Sam Lantinga 065fdca953 Disable rumble for the Ultimate 2 Wireless Controller in dongle mode
The dongle appears to stop sending input reports with some combination of rumble patterns, easily reproduced with Forza Horizon 5. We'll disable rumble temporarily until @8BitDo can investigate.
2025-08-26 08:39:00 -07:00
Sam Lantinga 66ab91a314 Added SDL_FLIP_HORIZONTAL_AND_VERTICAL
Closes https://github.com/libsdl-org/SDL/pull/13788
2025-08-26 05:50:51 -07:00
Sam Lantinga b13416d74f Fixed relative motion having desktop mouse scale on Wayland
Fixes https://github.com/libsdl-org/SDL/issues/13753
2025-08-25 11:47:56 -07:00
Sam Lantinga 7bbbbb3a1c Fixed build 2025-08-25 09:45:39 -07:00
Sam Lantinga aab95894a6 Fixed crash if mouse functions are used after video quit 2025-08-25 08:54:43 -07:00
Sam Lantinga 5f77da3a50 x11: use raw values for relative mouse motion
Fixes https://github.com/libsdl-org/SDL/issues/13743
2025-08-14 19:30:54 -07:00
Sam Lantinga fe16c620d8 Fix crash when enumerating Steam Controllers
Closes https://github.com/libsdl-org/SDL/pull/13746
2025-08-14 14:49:04 -07:00
Sam Lantinga 2d855e12d2 Fixed style 2025-08-14 14:48:58 -07:00
Sam Lantinga 20df88a85b Fixed spacing 2025-08-14 14:44:56 -07:00
Sam Lantinga e11110400a Fixed crash when reinitializing video on X11
The keyboard keymap was left pointing at a freed keymap after X11_QuitKeyboard()
2025-08-14 13:41:40 -07:00
Sam Lantinga f934b3e066 x11: fixed creating a window when all displays are disconnected
The X server maintains the desktop, but XRandR sends disconnect notifications for all displays. In this case fall back to the generic X11 desktop as a display.
2025-08-13 19:44:13 -07:00
Sam Lantinga eeae48464e Fixed crash if X11 initialization fails 2025-08-13 19:44:13 -07:00
Sam Lantinga 4725213eef Support the "ambient" value for SDL_HINT_AUDIO_CATEGORY
Fixes https://github.com/libsdl-org/SDL/issues/13732
2025-08-12 09:54:20 -07:00
Sam Lantinga 40ec9592f1 Restored text missing during wiki sync (thanks @sezero!) 2025-08-09 22:07:14 -07:00
Sam Lantinga 6981522cd6 Revert "Support Google Play 16 KB Page Size Requirement (#13470)"
This reverts commit dc2c83c383

If you need to support the Google Play 16 kiB page size requirement, the recommendation is to use NDK r28c or newer, which automatically aligns binaries correctly.
2025-08-07 11:44:45 -07:00
Sam Lantinga 91be1b054a x11: Fix xsettings pointer not being reset in X11_QuitXsettings 2025-08-06 09:22:33 -07:00
Sam Lantinga 31ba7efa48 x11: Refactor dpi hooks, removing GTK dependency and fixing XSettings watcher
- Removed GTK signal handler in x11settings. XSettings events are now properly dispatched to X11_XsettingsNotify.
  Previously events were not being passed to xsettings-client as no SDL xsettings_window was created. Now all events
  are filtered through xsettings_client_process_event allowing it to process the external window events that are selected.
  Global content scale is updated for changes to any recognized dpi settings.

- X11_GetGlobalContent now reads the current RESOURCE_MANAGER prop off of the root window to ensure it sees the
  current value. XResourceManagerString is now only used if getting the current prop fails as it caches the current resource
  manager value per-display connection.

- Clean up some warnings in SDL_gtk.
2025-08-06 09:22:15 -07:00
Sam Lantinga aae7736ec6 Added additional examples of paddle and misc buttons (thanks @AL2009man!) 2025-08-05 12:01:31 -07:00
Sam Lantinga 293b8b9fd6 x11: Fix regression reading GNOME content scale
- Removed gtk-xft-dpi read from GetGlobalContentScale. Xrm either returns either the same value as gtk-xft-dpi or the integer
  scale value in cases where gtk-xft-dpi is 1.

- Refactor SDL_x11settings handlers to defer to GetGlobalContentScale

- GetGlobalContentScale is now exported and the XSettings and Gtk signal handlers now use it for consistency. This involves
  a bit of extra work reading from Xrm rather than the setting notification but ensures consistent handling based on signal
  origin and hints enabled.

- Hook both gtk-xft-dpi in SDL_x11settings. This should generally result in only one being called based on which is updated.
  Since both signal handlers defer to X11_GetGlobalContentScale this will cause the same content scale to be applied multiple
  times. The gtk-xft-dpi signal is now only used to trigger content scale updates when the XSettings notification does not occur.
2025-08-04 16:53:09 -07:00
Sam Lantinga 7bb045ca22 Fixed Windows build 2025-08-04 13:04:17 -07:00
Sam Lantinga 9a71e3fd50 Revert "Add SDL_IsTraySupported"
This reverts commit 47d8bdd1c3.

There are runtime reasons why creating a tray can fail, so the correct approach is not to assume that just because a platform supports a tray that trays are available. Instead, you should create a tray at application startup, for the lifetime of the application, and handle failures at that point.

Closes https://github.com/libsdl-org/SDL/pull/13632
2025-08-04 10:42:43 -07:00
Sam Lantinga bba6555bf1 Enable background input when using Microsoft GameInput 2025-08-04 10:21:58 -07:00
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