Commit Graph

794 Commits (4ea1a10bd2c87c566b4b2ebc590f768a2c675065)

Author SHA1 Message Date
Sam Lantinga 009b62f1c2 Be explicit about mapping the new game controller paddle buttons 2020-11-07 02:22:15 -08:00
Sam Lantinga 3a4388489a Document the Xbox One Elite paddle buttons 2020-11-06 17:06:41 -08:00
Sam Lantinga 9a446aa92e Note that SDL_CONTROLLER_BUTTON_AUX1 is sent for the PS4/PS5 touchpad button on the HIDAPI driver. 2020-11-06 13:55:51 -08:00
Sam Lantinga 3a3aaac221 Added 4 auxiliary buttons to the game controller API
Xbox Elite controllers use AUX1-AUX4 to represent the paddle buttons when using the HIDAPI driver
PS4 and PS5 controllers use AUX1 to represent the touchpad button
Nintendo Switch Pro controllers use AUX1 to represent the capture button
2020-11-06 11:30:52 -08:00
Sam Lantinga a22beef402 Moved the PS5 controller driver to a separate file, as the advanced feature protocol is very different from that of the PS4 2020-11-05 17:03:28 -08:00
Sam Lantinga 4d79f9662f Added initial support for the Sony PS5 Controller 2020-11-05 15:02:54 -08:00
Sam Lantinga e555d45331 Added SDL_JoystickHasLED
Currently, this is only supported by the PS4 HIDAPI driver.
2020-11-05 11:07:54 -08:00
Ethan Lee 83cddd2ebc Add SDL_JoystickSetLED.
Currently, this is only supported by the PS4 HIDAPI driver.
2020-04-30 11:57:29 -04:00
Ozkan Sezer 79221e85a0 SDL_stdinc.h: define _DARWIN_C_SOURCE on macOS for memset_pattern4()
hopefully fixes https://bugzilla.libsdl.org/show_bug.cgi?id=5107
2020-10-29 20:00:20 +03:00
Ozkan Sezer fbbc4ab33b os2: can build with libsamplerate support if wanted to. 2020-10-24 20:12:50 +03:00
Sylvain Becker ffb307e4dc Fixed bug 5304 - add SDL_HasSurfaceRLE() (Thanks Rene Dudfield and Dan Lawrence) 2020-10-18 09:52:56 +02:00
Sam Lantinga b8ed432c3e Added a note about Android 11 2020-10-16 12:35:30 -07:00
Ozkan Sezer 52b319fec9 minor update to os/2 config file and update.
binary (dll) output doesn't change.
2020-10-16 02:50:10 +03:00
Ozkan Sezer d27238751f os2: integrate the port into main tree. 2020-10-14 23:01:06 +03:00
Ozkan Sezer fc795f89d3 SDL_cpuinfo.h: add missing const to size parameter of SDL_SIMDRealloc()
so that the declaration matches the definition.
2020-10-13 05:20:00 +03:00
Ozkan Sezer 196cda69f2 build: fix / update sensors (windows) configuration
- SDL_config.h.in: add missing defines SDL_SENSOR_COREMOTION
  and SDL_SENSOR_WINDOWS (configure did set SDL_SENSOR_WINDOWS
  but it never went in SDL_config.h or Makefile.)
- SDL_config.h.cmake: remove duplicated SDL_SENSOR_XXX cmake
  defines.
- autofoo, cmake: check for sensorsapi.h header before enabling
  windows sensors.
2020-10-12 01:02:28 +03:00
Ozkan Sezer e58cc5fa0e minor whitespace fix 2020-10-09 03:28:30 +03:00
Ozkan Sezer 3aa418f451 SDL_video.h (SDL_DisplayEventID): remove comma at end of enumerator list 2020-10-09 02:50:15 +03:00
Sam Lantinga 76980e30f2 Added events for dynamically connecting and disconnecting displays, with an iOS implementation 2020-10-08 16:42:20 -07:00
Ryan C. Gordon 77c9d73b63 Removed SDL_AndroidOpenURL, added SDL_OpenURL.
Still needs to be wired into Xcode and Visual Studio projects.
2020-10-05 11:30:33 -04:00
Sylvain Becker dd55bfe89c Android: add helper function to open an URL/URI (see bug 2783) 2020-10-01 14:41:09 +02:00
Sylvain Becker 955f3184f9 Fixed bug 5239 - Play audio on Android while backgrounded (Thanks Superfury)
Add hint SDL_HINT_ANDROID_BLOCK_ON_PAUSE_PAUSEAUDIO not to pause audio when
the app goes to background.
(It requires SDL_ANDROID_BLOCK_ON_PAUSE as "Non blocking")
2020-09-25 10:14:42 +02:00
Sylvain Becker ebc12a2fd2 SDL_Surface refcount: destination surface keep track of surfaces
that are mapped to it and automatically invalidate them when it is freed

- refcount is kept so that an external application can still create a reference
to SDL_Surface.

- lock_data was un-used and is now renamed and used as a list keep track of the blitmap
2020-09-07 18:50:30 +02:00
Sylvain Becker 97fad04551 Fixed bug 5278 - export SDL_AndroidRequestPermission() (Thanks Huki!) 2020-09-02 19:38:03 +02:00
Sylvain Becker 965b466ee8 Fixed bug 4297 - Android StrictMode policy. Remove APK expansion support
"In the second half of 2021, new apps will be required to publish with the Android App Bundle on Google Play"
(see https://developer.android.com/guide/app-bundle)
And "Android App Bundles don't support APK expansion (*.obb) files".
2020-08-17 19:50:20 +02:00
Kai Krakow c3ecf18cc4 Linux: Add hint for disabling deadzones 2020-07-21 23:38:42 +02:00
Sam Lantinga 86517d3eda Fixed bug 5242 - KMOD_* flags unnecessarily macros; breaks OGRE
Rainer Deyke

While most of the KMOD_* flags are enums, the combination flags KMOD_CTRL, KMOD_ALT, KMOD_SHIFT and KMOD_GUI are defined as macros.  This breaks third-party code that uses these KMOD_* names for local identifiers, such as OGRE.  The correct thing to do is to make them all enums.
2020-08-10 08:42:35 -07:00
Ryan C. Gordon af71510cca assert: Implement SDL_TriggerBreakpoint for Apple ARM hardware. 2020-07-16 04:43:08 -04:00
Ryan C. Gordon 6aec6da4c3 stdinc: Let Clang static analysis see more C runtime functions.
For systems without strlcpy and strlcat, just declare them as if they exist;
the analyzer possibly still knows the details of these functions and can
utilize that in its analysis.

Most of this patch was from meyraud705 at gmail and Martin Gerhardy. Thanks!

Fixes Bugzilla #5163.
2020-06-28 17:45:07 -04:00
Sylvain Beucler e594a6738a emscripten: Introduce SDL_HINT_EMSCRIPTEN_ASYNCIFY
See https://github.com/emscripten-core/emscripten/issues/10746

and

https://github.com/emscripten-ports/SDL2/pull/112

Fixes Bugzilla #4997.
2020-06-27 16:25:47 -04:00
Ryan C. Gordon 1947ca7028 video: Changed SDL_VIDEO_MINIMIZE_ON_FOCUS_LOSS to default to FALSE.
Fixes Bugzilla #5106.  (and probably many others, too!)
2020-06-26 20:16:43 -04:00
Sam Lantinga 7c0986fba4 Fixed bug 4938 - Suggestion: rename SDL_PIXELFORMAT_BGR888 to SDL_PIXELFORMAT_XBGR8888
Ellie

I just tripped over this: stb_image when requesting 3 channels with 8-bit actually returns them as 3 bytes per pixel with no alignment, so basically 4 pixels are 12 bytes with no padding (0...2, 3...5, 6...8, and 9...11). This I would have naively expected to be called RGB888 or BGR888, since there is no "dead" unused byte as I would expect for something called e.g. RGBX8888.

However, SDL2's SDL_PIXELFORMAT_BGR888 uses 4 bytes, same as SDL_PIXELFORMAT_BGRX8888, even though the latter appears to be a longer storage format - which it isn't, internally. It's just swapped, in byte order X, B, G, R (instead of BGRX). So why isn't the macro name also swapped, as "XBGR888" instead of just "BGR888"?

I find the formats therefore named inconsistently, and unless there is a reason for this I suggest these changes:

1. deprecate SDL_PIXELFORMAT_BGR888 in favor of a new SDL_PIXELFORMAT_XBGR8888

and

2. deprecate SDL_PIXELFORMAT_RGB888 in favor of a new SDL_PIXELFORMAT_XRGB8888
2020-06-12 10:30:46 -07:00
Ethan Lee 2aa8974f97 Add SDL_SIMDRealloc 2020-06-11 12:03:33 -04:00
Sam Lantinga 06267f5028 Fixed whitespace in SDL_vulkan.h 2020-06-02 16:59:54 -07:00
Sam Lantinga 2303d92188 Fixed bug 5145 - Fix whitespace in SDL_vulkan.h
Colin Caine

Everywhere else seems to use spaces.

See patch diffed from a fresh hg checkout yesterday.
2020-05-29 16:28:56 -07:00
Sam Lantinga abd5841850 Make some changes to SDL_SetThreadPriority to try and have SDL transparently handle more of the work.
1. Comment that SDL_SetThreadPriority will make any necessary system changes when applying priority.
2. Add a hint to override SDL's default behavior for scheduler policy.
3. Modify the pthreads SDL_SetThreadPriority so that instead of just using the current thread scheduler policy it will change it to a policy that should work best for the requested priority.
4. Add hint checks in SDL_SetThreadPriority so that #3 can be overridden if desired.
5. Modify the Linux SDL_SetThreadPriority so that in the case that policy, either by SDL defaults or from the hint, is a realtime policy it uses the realtime rtkit API.
6. Prior to calling rtkit on Linux make the necessary thread state changes that rtkit requires.  Currently this is done every time as it isn't expected that SDL_SetThreadPriority will be called repeatedly for a thread.
2020-05-26 13:19:19 -07:00
Sam Lantinga eadc8693dd Fixed bug 5103 - Port fcitx support to both fcitx 4 & 5
wengxt

Due to the new major fcitx version is coming close, the existing code need to be ported to use new Fcitx dbus interface.

The new dbus interface is supported by both fcitx 4 and 5, and has a good side effect, which is that it will work with flatpak for free. Also the patch remove the dependency on fcitx header. Instead, it just hardcodes a few enum value in the code so need to handle the different header for fcitx4 or 5.
2020-05-11 14:31:04 -07:00
Ryan C. Gordon fa23e3d00b locale: Implemented SDL_GetPreferredLocales().
This was something I proposed a long time ago, Sylvain Becker did
additional work on it, then back to me.

Fixes Bugzilla #2131.
2020-05-04 02:27:29 -04:00
Sam Lantinga 65ad45340d Improvement for bug 3446 - The haptic API does not allow to select the direction axes
meyraud705

I see how the documentation is confusing. I think that the choice of the axis is an implementation detail. The documentation should state the goal of this value, so I propose this wording:

    "Use this value to play an effect on the steering wheel axis. This provides
     better compatibility across platforms and devices as SDL will guess the
     correct axis."

Value could even be renamed 'SDL_HAPTIC_STEERING_AXIS'.

For Linux, sending an effect on the X axis with a Logitech wheel works. Others brands don't have driver for Linux as far as I know.
2020-05-04 13:17:43 -07:00
Ryan C. Gordon 8601996fbc hints: Allow specifying audio device metadata.
This is only supported on PulseAudio. You can set a description when opening
your audio device that will show up in pauvcontrol, which lets you set
per-stream volume levels.

Fixes Bugzilla #4801.
2020-05-03 22:13:48 -04:00
Ryan C. Gordon 11fef299d1 hints: Fixed a doxygen comment. 2020-05-03 20:56:18 -04:00
Sam Lantinga 0f374b069b Fixed build on older Visual Studio, enable new features on newer Visual Studio 2020-04-22 15:42:32 -07:00
Sam Lantinga 116b8c17f2 Note which Windows SDK version is required for Windows Gaming Input support 2020-04-19 00:05:54 -07:00
Sam Lantinga aba2792896 Added a Windows Gaming Input joystick driver
This driver supports the Razer Atrox Arcade Stick

Some of the quirks of this driver, inherent in Windows Gaming Input:
* There will never appear to be controllers connected at startup. You must support hot-plugging in order to see these controllers.
* You can't read the state of the guide button
* You can't get controller events in the background
2020-04-18 21:41:37 -07:00
Sam Lantinga ed1d855865 Fixed bug 4299 - A recent change requires Core Bluetooth framework on iOS
Caleb Cornett

Just ran into this, and from my testing, whatever re-added the dependency is a _major_ regression. Not only is your app forced to link with CoreBluetooth, but iOS has apparently tightened up security and won't even let you _test_ your app unless it specifies the NSBluetoothAlwaysUsageDescription in an Info.plist. It doesn't even pop up an error message, it just straight up crashes.

Adding the permission isn't a good solution either, since I'd really, really rather not have my app request users' bluetooth to always be enabled, especially if the only apparent reason is for Steam Controller support.
2020-04-14 07:41:00 -07:00
Sam Lantinga e6c640f314 Enable the virtual joystick API by default 2020-04-13 08:18:16 -07:00
Sam Lantinga bd7b4f39ed Partial fix for bug 5086 - CMake builds on Windows broken by sensor support (thanks DominikD!) 2020-04-13 08:05:29 -07:00
hmk 0918903f3c render: add a hint for toggling relative scaling
Fixes Bugzilla #4811.
2019-09-30 22:54:16 +03:00
Ryan C. Gordon d292f6bd4f stdlib: Add SDL_trunc and SDL_truncf 2020-04-10 12:17:14 -04:00
Ryan C. Gordon a791689086 metal: Added some support interfaces to Apple's Metal API (thanks, Caleb!).
Caleb Cornett's comments:

"A few weeks ago, Alex added a partial Metal API to SDL2:

https://hg.libsdl.org/SDL/rev/22c8e7cd8d38

I noticed it was missing a few features that would help Metal become a
first-class citizen in SDL, so I went ahead and wrote them! Here are the new
APIs:

1. SDL_WINDOW_METAL flag for SDL_CreateWindow(). This allows the programmer
to specify that they intend to create a window for use with SDL_MetalView.
The flag is used to ensure correct usage of the API and to prevent
accidentally defaulting to OpenGL on iOS.

2. SDL_Metal_GetLayer(). This function takes a SDL_MetalView and returns a
pointer to the view's backing CAMetalLayer. This simplifies things
considerably, since in the current version of the SDL_Metal API the
programmer is required to bridge-cast a SDL_MetalView handle to an NSView or
UIView (depending on the platform) and then extract the layer from there.
SDL_Metal_GetLayer automatically handles all of that, making the operation
simple and cross-platform.

3. SDL_Metal_GetDrawableSize(). This function already exists in the current
SDL_Metal API (and is used behind-the-scenes for SDL_Vulkan_GetDrawableSize
on Apple platforms) but was not publicly exposed. My patch exposes this
function for public use. It works just like you'd expect.

Tested on macOS 10.14 and iOS 12.4."

Fixes Bugzilla #4796.
2020-04-10 00:37:35 -04:00