Commit Graph

11827 Commits

Author SHA1 Message Date
Sam Lantinga
aa683df865 Added SDL_hidapi_rumble.c to the Visual Studio project 2020-02-04 15:35:01 -08:00
David Ludwig
b3e4238fc1 FIX for SDL-4927: CFRetain+CFRelease a game controller's IOKit object
This fixes a crash whereby SDL could crash on macOS/Darwin, if and when a
USB game controller gets unplugged.  SDL was not retaining a reference
to the controller's OS/IOKit-provided 'device object', and was capable
of trying to use it, after a device was hot-unplugged.
2020-01-30 18:03:34 -05:00
Sam Lantinga
9b1473c1a7 Added missing files from previous commit 2020-02-04 15:27:25 -08:00
Sam Lantinga
b2cb683292 Fixed long delay on main thread caused by blocking rumble writes in HIDAPI drivers
There is now a thread that handles all HIDAPI rumble requests and a lock that guarantees that we're not reading and writing the device at the same time.
2020-02-04 15:26:56 -08:00
Sam Lantinga
dc16de3fd4 Moved rumble expiration to the main joystick handling level, and prevent sending the driver layer duplicate rumble requests. 2020-02-04 12:48:53 -08:00
Sjoerd Simons
6bc81bee03 Correct joystick hat indexes on linux
The index and indices were swapped; Which is fine as long as there are
no gaps in the ABS_HAT* event availability but otherwise things do get confused.

Signed-off-by: Sjoerd Simons <sjoerd.simons@collabora.co.uk>
2020-02-04 07:23:44 -08:00
Sam Lantinga
8968393dbe Fixed bug 4965 - Update the .hgignore file
Cameron Cawley

This adds a number of files used by the build systems to the .hgignore file. Most of them are for CMake, but there are other additions as well.
2020-02-03 16:38:07 -08:00
Sam Lantinga
f149674214 Fixed bug 4758 - hgignore clion build artifacts
Malte

clion builds into cmake-build-debug, cmake-build-release etc. by default. Also, it creates the .idea forlder in wich it places some (mostly local) config.

Since SDL is perfectly buildable from within the IDE, i think it'd be nice to have the build and ide artifacts ignored by hg.
2020-02-03 16:34:33 -08:00
Sam Lantinga
965fd0bd46 Fixed bug 4833 - Use EGL for X11?
Martin Fiedler

To be precise, this is about *desktop OpenGL* on X11. For OpenGL ES, EGL is already used (as it's the only way to get an OpenGL ES context), as Sylvain noted above.

To shine some light on why this is needed:
In 99% of all cases, using GLX on X11 is fine, even though it's effectively deprecated in favor of EGL [1]. However, there's at least one use case that *requires* the OpenGL context being created with EGL instead of GLX, and that's DRM_PRIME interoperability: The function glEGLImageTargetTexture2DOES simply doesn't work with GLX. (Currently, Mesa actually crashes when trying that.)
Some example code:
https://gist.github.com/kajott/d1b29c613be30893c855621edd1f212e
Runs on Intel and open-source AMD drivers just fine (others unconfirmed), but with #define USE_EGL 0 (i.e. forcing it to GLX), it crashes. The same happens when using SDL for window and context creation.

The good news is that most of the pieces for EGL support on X11 are already in place: SDL_egl.c is pretty complete (and used for desktop OpenGL on Wayland, for example), and SDL_x11opengl.c has the aforementioned OpenGL-ES-on-EGL support. However, when it comes to desktop OpenGL, it's hardcoded to fall back to GLX.

I'm not advocating to make EGL the default for desktop OpenGL on X11; don't fix what ain't broken. But something like an SDL_HINT_VIDEO_X11_FORCE_EGL would be very appreciated to make use cases like the above work with SDL.


[1] source: Eric Anholt, major Linux graphics stack developer, 7 years ago already - see last paragraph of https://www.phoronix.com/scan.php?page=news_item&px=MTE3MTI
2020-02-03 08:06:52 -08:00
Sam Lantinga
26dbac177b Fixed bug 4917 - Wayland: handle discrete pointer axis events
Luis Caceres

The current handling of Wayland mouse pointer events only handles wl_pointer.axis events, which, according to the Wayland documentation, deal with mouse wheel scroll events on a continuous scale. While this is reasonable for some input sources (e.g. touchpad two-finger scrolling), it is not for mouse wheel clicks which generate wl_pointer.axis events with large deltas.

This patch adds handling for wl_pointer.axis_discrete and wl_pointer.frame events and prefers to report SDL_MouseWheelEvent in discrete units if they are available. This means that for mouse wheel scrolling we count in clicks, but for touchpad two-finger scrolling we still use whatever units Wayland uses. This behaviour is closer to that of the X11 backend.

Since these events are only available since version 5 of the wl_seat interface, this patch also checks for this and falls back to the previous behaviour if its not available. I also had to add definitions for some of the pointer and keyboard events specified in versions 2-5 but these are just stubs and do nothing.
2020-02-03 00:57:12 -08:00
Sam Lantinga
1910ab71cf Fixed the hidapi Info.plist for submission to the Apple App Store 2020-02-03 00:51:35 -08:00
Sam Lantinga
e12ce6595d Fixed build warnings on Android 2020-02-01 09:23:04 -08:00
Sam Lantinga
7e29ce8a83 Map the right pad on the Steam Controller to the right stick in the game controller API 2020-01-31 14:09:23 -08:00
Sam Lantinga
4032a536a4 Build the hidapi framework and weak link it on Mac OS X 2020-01-31 13:09:20 -08:00
Sam Lantinga
d117d8d0d2 Weak link the hidapi framework on iOS and tvOS 2020-01-31 10:45:04 -08:00
Sam Lantinga
2cf2cfd5b0 Build hidapi as a framework on iOS, so it can be linked by the application as well. 2020-01-30 16:02:56 -08:00
Sam Lantinga
92a995cd60 Fixed build 2020-01-30 14:58:41 -08:00
Sam Lantinga
2fb9f8c6d0 More Xcode project improvements 2020-01-30 14:53:18 -08:00
Sam Lantinga
01bb0ffd96 Export SDL functions for iOS application delegates 2020-01-30 14:51:33 -08:00
Ryan C. Gordon
d138359494 test: Common framework now accepts --usable-bounds command line argument. 2020-01-30 13:47:48 -05:00
Ryan C. Gordon
603bc60ce2 test: change path in a comment from '\\' to '/' char. Nothing serious here. 2020-01-30 13:47:19 -05:00
Sam Lantinga
0114409a5a Added missing file from previous commit 2020-01-29 20:09:59 -08:00
Sam Lantinga
3878b30d51 Added a unified Xcode project for macOS, iOS and tvOS 2020-01-29 20:09:18 -08:00
Sam Lantinga
0b19bdcd31 Fixed compiler warning 2020-01-29 20:09:16 -08:00
Sam Lantinga
7bcfb1bcfb Added SDL_hidapi_steam.c to the iOS and tvOS dylib build targets 2020-01-29 20:09:14 -08:00
Sam Lantinga
6e060358b8 There are lots of unused macros in the Steam controller code 2020-01-29 20:09:12 -08:00
Sam Lantinga
5c64f44a9f Added support for the Steam Controller on mobile devices 2020-01-29 20:09:11 -08:00
Sam Lantinga
4946ec1ef4 Miscellaneous pending fixes 2020-01-29 20:09:08 -08:00
Sam Lantinga
706579f0c6 Fixed member order to make more sense 2020-01-28 21:41:13 -08:00
Sam Lantinga
e24a78ff3d Fixed wired PS4 controller support on Android 2020-01-28 17:11:17 -08:00
Ryan C. Gordon
2e0e4c66d3 x11: Use XSync when changing window position instead of XFlush.
Attempt to fix regression in Bugzilla #4646.
2020-01-28 13:51:24 -05:00
Ryan C. Gordon
a928dfb170 cocoa: Fix command line apps' menu bar not working on macOS Catalina.
Fixes Bugzilla #4937.
2020-01-27 17:15:12 -05:00
Ryan C. Gordon
895dbc38e2 darwin: Don't pass NULL device refs to IOHIDDeviceGetValue().
Possibly fixes Bugzilla #4961.
2020-01-27 15:44:48 -05:00
Ryan C. Gordon
c85a100cd1 video: Added a hint to override the display's usable bounds. 2020-01-27 10:58:30 -05:00
Sam Lantinga
e332b6d728 Fixed bug 4898 - No rumble because of integer overflow in SDL_JoystickRumble
meyraud705

Switch hidapi and xinput also need to check for overflow, attached a patch for them.
2020-01-26 12:48:35 -08:00
Sam Lantinga
653bb0c793 Don't enumerate devices we can't open 2020-01-26 12:40:32 -08:00
Sam Lantinga
ee44fcea94 Fixed disabling the Xbox 360 wireless HIDAPI driver 2020-01-26 10:32:39 -08:00
Sam Lantinga
80279fb512 Always release devices in onPause in case we're going to be force stopped, and for consistency with interacting with other activities that might use the controller 2020-01-26 00:37:48 -08:00
Sam Lantinga
4addbff471 Fixed compiler warnings 2020-01-23 22:24:24 -08:00
Sam Lantinga
3e419c8c9f Fixed mapping for both versions of the Xbox One Elite Series 2 controller firmware connecting over Bluetooth 2020-01-23 12:53:43 -08:00
Sam Lantinga
c972e7c75e Added mapping for the Xbox One controller connected via the wireless dongle using xow 2020-01-23 12:53:41 -08:00
Sam Lantinga
3d12f83be5 Turn off rumble on drivers which don't respect the replay.length value 2020-01-23 12:53:39 -08:00
Sam Lantinga
dbd5926a65 SDL_LEAN_AND_MEAN defaults off 2020-01-23 01:03:23 -08:00
Sam Lantinga
698cde1a8b Added a single SDL_LEAN_AND_MEAN define to turn on minimal SDL builds
Protected more code with #ifdefs to reduce the size of minimal shared library builds
2020-01-23 01:00:52 -08:00
Sam Lantinga
7389baad7b Fixed compile warning 2020-01-23 00:32:34 -08:00
Sam Lantinga
a58e34f4f6 Added support for the paddles on the Xbox One Elite Series 1 controller 2020-01-22 11:28:35 -08:00
Sylvain Becker
0f4b8e30b8 Documentation of the footprint #defines 2020-01-22 15:23:44 +01:00
Ryan C. Gordon
52fbd467f2 audio: Fixed a '//' style comment. 2020-01-21 17:40:16 -05:00
Ryan C. Gordon
c8b33b868e audio: Calculate a legitimate SDL_AudioSpec::silence in SDL_LoadWAV_RW(). 2020-01-21 15:49:37 -05:00
Sylvain Becker
4d9985406a Add #define SDL_HAVE_BLIT_N_RGB565 to compile out RGB565 LUT 2020-01-21 22:06:09 +01:00