Commit Graph

1560 Commits

Author SHA1 Message Date
Sam Lantinga
da2a76d220 Fixed bug 3703 - Missing media keys support on Amazon Fire TV remote control
Holger Schemel

Summary: This patch adds support for key events for the "rewind" and "fast forward" media keys on the Amazon Fire TV remote control.

How to reproduce the problem: Run Android build of SDL2 application on the Amazon Fire TV (tested with "stick" version) and log key events.

Expected behaviour: Every key pressed on the Fire TV remote control should result in a corresponding key event (pressed/released).

Observed behaviour: Of the bottom row of buttons on the Fire TV remote control, only the "play/pause" (middle) button generates a key event, while the "rewind" (left) and "fast forward" (right) buttons to not generate any event at all.

The attached patch adds support for these two missing buttons/keys.

Note 1: Some missing definitions were added for the already existing key codes SDL_SCANCODE_APP1 and SDL_SCANCODE_APP2 (to keep up the correct order of enumerations / array positions when adding the two new key codes).

Note 2: Definitions in "scancodes_linux.h" and "scancodes_xfree86.h" (to also add support for these keys on other platforms) were added without testing. However, I was unable to find corresponding definitions for these two media keys for Windows and Mac OS X.

Note 3: I have also updated the (broken) link to the USB usage page standard PDF document (comment in "include/SDL_scancode.h").
2017-07-20 10:46:38 -07:00
Sam Lantinga
32f8ba0e06 Fixed bug 3609 - Windows build fails due to conflicting types for 'XINPUT_GAMEPAD_EX'
Ozkan Sezer

(In reply to Ryan C. Gordon from comment #9)
> I've put this patch in as https://hg.libsdl.org/SDL/rev/117d4ce1390e ...can
> you verify this works on the latest MinGW?
>
> Thanks,
> --ryan.


This patch is wrong: the structure in question has nothing to do with any
gcc version in use.  I suggest reverting this adding a conigury check for
it, instead.  Something like the following should do it: (configure needs
regenerating.)
2017-07-10 18:31:28 -07:00
Ryan C. Gordon
b1e646da0f Support for QNX 7.0 (thanks, Elad!).
Fixes Bugzilla #3686.
2017-07-01 17:50:47 -04:00
Sam Lantinga
ba66a89116 Fixed bug 3668 - Overflow of SDL_AudioCVT.filters with some downmixes
Simon Hug

There's a chance that an audio conversion from many channels to a few can use more than 9 audio filters. SDL_AudioCVT has 10 SDL_AudioFilter pointers of which one has to be the terminating NULL pointer. The SDL code has no checks for this limit. If it overflows there can be stack or heap corruption or a call to 0xa.

Attached patch adds a function that checks for this limit and throws an error if it is reached. Also adds some documentation.

Test parameters that trigger this issue:
AUDIO_U16MSB with 224 channels at 46359 Hz
                 V
AUDIO_S16MSB with 6 channels at 27463 Hz

The fuzzer program I uploaded in bug 3667 has more of them.
2017-06-12 16:39:15 -07:00
Ryan C. Gordon
b10e95e1f3 syswm: prevent buffer overflow if SDL and app have different config headers.
This only affects Wayland and DirectFB, as a Unix system generally has X11
support. Other platforms also have different sizes for the C union in
question, but are likely the only target for that platform, etc.

Apps that might run on Wayland or DirectFB will need to be compiled against
new headers from an official 2.0.6 release, or be prepared to force the x11
target, or not use SDL_GetWindowWMInfo().

Fixes Bugzilla #3428.
2017-06-11 00:50:26 -04:00
Ryan C. Gordon
6b2c3286e5 Make compile-time assert error messages more clear.
Now the compiler might say this:

'SDL_compile_time_assert_mytest' declared as an array with a negative size

instead of

'SDL_dummy_mytest' declared as an array with a negative size
2017-06-10 15:38:14 -04:00
Ryan C. Gordon
c05d420351 jack: Initial shot at a JACK audio target.
http://jackaudio.org/

Fixes Bugzilla #2163.
(with several more commits following to improve this code.)
2017-06-08 13:27:58 -04:00
Philipp Wiesemann
6ca03b36ff Fixed environment variable of SDL_HINT_RENDER_LOGICAL_SIZE_MODE. 2017-06-08 22:40:21 +02:00
Ryan C. Gordon
c45b811c7c Merged Eric Wing's overscan patch.
Fixes Bugzilla #2799.
2017-06-06 14:06:40 -04:00
Ryan C. Gordon
5617065c5c windows: Change the default on SDL_HINT_WINDOWS_DISABLE_THREAD_NAMING.
It's easier for Visual Studio users that want this information to turn it on
or live without it, than it is to explain why every debugger that isn't Visual
Studio crashes out here. Eventually SetThreadDescription() will be the thing
everyone uses anyhow.

Fixes Bugzilla #3645.
(and several others).
2017-06-06 13:12:43 -04:00
Philipp Wiesemann
3b2e0bf33c Fixed comments in headers for doxygen output. 2017-06-04 23:15:39 +02:00
Ryan C. Gordon
bf09ce5fce stdlib: added SDL_utf8strlen(). 2017-05-29 03:01:05 -04:00
Ryan C. Gordon
632becceb1 audio: rename bsd target to netbsd.
Apparently this is no longer a generic BSD audio target, and hasn't been for
years, so rename it for NetBSD.
2017-05-24 19:56:59 -04:00
Ryan C. Gordon
faea0af98d assert: Check for Clang _and_ GCC, in case they ever drop compatibility. 2017-05-19 14:49:16 -04:00
Sam Lantinga
412cf5a3d8 SDL - add SDL_WINDOW_VULKAN and make Android_CreateWindow only create an EGLSurface when SDL_WINDOW_VULKAN is not present. This makes it so the ANativeWindow* can be used with vkCreateAndroidSurfaceKHR, otherwise it will fail because having both an EGLSurface and VkSurfaceKHR attached to a window is not allowed according to the Vulkan spec:
"In particular, only one VkSurfaceKHR can exist at a time for a given window. Similarly, a native window cannot be used by both a VkSurfaceKHR and EGLSurface simultaneously"

CR: SamL
2017-05-16 06:30:39 -07:00
Sam Lantinga
e137c2c887 Fixed comment typo 2017-05-05 05:10:30 -07:00
Philipp Wiesemann
2e182a3a8a Fixed typos and documentation in haptic header file. 2017-04-02 21:32:49 +02:00
Sam Lantinga
e147ccd615 Added an API to get the joystick instance ID before opening the device: SDL_JoystickGetDeviceInstanceID() 2017-03-09 16:09:16 -08:00
Ryan C. Gordon
cf875b61dd Fix some more compiler warnings on armcc. 2017-03-03 16:38:17 -05:00
Ryan C. Gordon
9ed1eef16c Some patches to make SDL compile with armcc (ARM's C compiler). 2017-03-02 13:33:04 -05:00
Brandon Schaefer
62c9848b3d mistake: Revert the files that I did not mean to commit 2017-03-01 15:05:54 -08:00
Brandon Schaefer
88dad22cdf * Some refactoring and bug fixes. Thanks Michał Kuchta! 2017-03-01 14:50:59 -08:00
Ryan C. Gordon
05df03613b audio: clarified what SDL_AudioSpec::samples is, removed note about power of 2.
These don't have to be power-of-2 sizes anymore because of SDL_AudioStream,
and the new resampler, but also, many platforms don't give you power-of-2 DMA
buffer in the first place!
2017-02-27 10:11:40 -05:00
Ryan C. Gordon
ed2ceada1a cmake: add WASAPI audio target to the build (thanks, Martin!).
Fixes Bugzilla #3588.
2017-02-23 22:38:04 -05:00
Sam Lantinga
44823377c0 Updated config headers to override the base SDL_config.h if both are included 2017-02-20 10:55:33 -08:00
Philipp Wiesemann
7ffc9b62a7 Updated library name in header file. 2017-02-19 21:05:26 +01:00
Ryan C. Gordon
9a2896195b wasapi: Initial WASAPI support, for Windows Vista and later.
This should remain binary compatible with Windows XP, as we dynamically
load anything we need and fall back to DirectSound/WinMM/XAudio2 if not
available.
2017-02-14 03:03:27 -05:00
Sam Lantinga
548c43b893 Make sure the memory barrier functions are always available, and now they are implemented on Android __ARM_ARCH_5TE__ 2017-02-10 11:21:15 -08:00
Sam Lantinga
7fc8541c0d Fixed whitespace 2017-01-31 13:30:35 -08:00
Sam Lantinga
88be409a04 Added support for the HOTAS Warthog throttle 2017-01-31 12:23:29 -08:00
Philipp Wiesemann
8f16acd9b9 Fixed compiler warning about comma at end of enum. 2017-01-30 22:20:20 +01:00
Sam Lantinga
9cff625c90 Added an API to get the type of a connected joystick 2017-01-27 05:59:58 -08:00
Sam Lantinga
0b5cd9831e Generalized the audio resampling hint for other resampling methods in the future 2017-01-24 19:38:01 -08:00
Ryan C. Gordon
937dc8706d audio: Offer a hint for libsamplerate quality/speed tradeoff.
This defaults to the internal SDL resampler, since that's the likely default
without a system-wide install of libsamplerate, but those that need more can
tweak this.
2017-01-24 15:52:22 -05:00
Ryan C. Gordon
0a8fc77425 Added a note about aligning SDL_AudioCVT data. 2017-01-24 00:55:41 -05:00
Ryan C. Gordon
3fc61a22e3 audio: Wired up new SSE code to build system. 2017-01-23 01:05:44 -05:00
Philipp Wiesemann
74758a9d74 Fixed doxygen warning and linking of function names. 2017-01-14 21:35:49 +01:00
Sam Lantinga
9fca03e6fd Fixed bugs 2570, 3145, improved OpenGL ES context support on Windows and X11
Mark Callow

The attached patch does the following for the X11 and Windows platforms, the only ones where SDL attempts to use context_create_es_profile:

- Adds SDL_HINT_OPENGL_ES_DRIVER by which the application can
  say to use the OpenGL ES driver & EGL rather than the Open GL
  driver. (For bug #2570)
- Adds code to {WIN,X11}_GL_InitExtensions to determine the maximum
  OpenGL ES version supported by the OpenGL driver (for bug #3145)
- Modifies the test that determines whether to use the OpenGL
  driver or the real OpenGL ES driver to take into account the
  hint, the requested and supported ES version and whether ES 1.X
  is being requested. (For bug #2570 & bug #3145)
- Enables the testgles2 test for __WINDOWS__ and __LINUX__ and adds
  the test to the VisualC projects.

With the fix in place I have run testdraw2, testgl and testgles2 without any issues and have run my own apps that use OpenGL, OpenGL ES 3 and OpenGL ES 1.1.
2017-01-10 08:54:33 -08:00
Sam Lantinga
4d0e3910dc Added configure and cmake support for libsamplerate 2017-01-06 20:43:53 -08:00
Sam Lantinga
1e81ac1559 Added SDL_JoystickGetAxisInitialState() to get a joystick axis' initial value.
This is useful for controller mapping programs to determine an axis' zero state
2017-01-04 10:28:07 -08:00
Sam Lantinga
d77ab77a7a Updated copyright for 2017 2017-01-01 18:33:28 -08:00
Sam Lantinga
2f75c15ee0 Added documentation for the game controller axis values 2016-12-27 09:59:36 -08:00
Sam Lantinga
bdd7e6b176 Split controller axes into positive and negative sides so each can be bound independently.
Using this a D-Pad can be mapped to a thumbstick and vice versa.
Also added support for inverted axes, improving trigger binding support
2016-12-27 01:39:07 -08:00
Sam Lantinga
7f0b81eebd Fixed bug 3517 - Compiler warnings with gcc -Wstrict-prototypes
felix

Compiling even a simple SDL2 'hello world' program with gcc -Wstrict-prototypes (GCC 6.2.1) results in warnings like:

/usr/include/SDL2/SDL_gamecontroller.h:143:1: attention : function declaration isn't a prototype [-Wstrict-prototypes]
 extern DECLSPEC int SDLCALL SDL_GameControllerNumMappings();
 ^~~~~~

It seems there is a missing 'void' between the parentheses.
2016-12-26 02:12:21 -08:00
Philipp Wiesemann
ded7e84edd Corrected header file guard comments. 2016-12-23 20:36:12 +01:00
Sam Lantinga
23ab0d83a2 Fixed ABI, don't change the return type of SDL_GL_SwapWindow() 2016-12-11 12:01:44 -08:00
Sam Lantinga
b505909719 Fixed bug 3513 - SDL_GL_SwapWindow does not return error status
Return an error code from SDL_GL_SwapWindow(), like the other SDL APIs.
2016-12-09 01:47:43 -08:00
Sam Lantinga
7bd32ecc46 Added SDL_HINT_MOUSE_NORMAL_SPEED_SCALE and SDL_HINT_MOUSE_RELATIVE_SPEED_SCALE to scale the speed of the mouse.
This currently doesn't affect absolute motion, which would need to be implemented on each windowing system so the cursor matches the reported mouse coordinates.
2016-12-02 21:01:13 -08:00
Sam Lantinga
f0ca0a5183 Fixed missing prototypes on Android, patch from Sylvain 2016-12-02 02:25:12 -08:00
Philipp Wiesemann
303fb1d18c Updated documentation in header file. 2016-11-30 23:31:36 +01:00