Commit Graph

1481 Commits (fe6b8f1c314e94f58db8119e40ad4e1f849fb667)

Author SHA1 Message Date
Philipp Wiesemann 90488d6c29 haiku: Added support for some values set with SDL_GL_SetAttribute(). 2017-06-17 22:30:28 +02:00
Philipp Wiesemann 6086e8d384 haiku: Fixed missing slash in path from SDL_GetPrefPath(). 2017-06-17 22:30:09 +02:00
Philipp Wiesemann 0b750cd9d5 pandora: Fixed compile error. 2017-06-16 23:30:38 +02:00
Philipp Wiesemann fa73685df8 directfb: Fixed quitting keyboard twice.
SDL_VideoQuit() already calls SDL_KeyboardQuit().
2017-06-16 23:30:30 +02:00
Philipp Wiesemann a4db3dbe64 nacl: Fixed unnecessary large input text array. 2017-06-16 23:30:13 +02:00
Sam Lantinga 9085c7b311 Get the parent of non-SDL-created windows, for completeness 2017-06-16 11:14:08 -07:00
Sam Lantinga 1b5614b3f5 Clean up parent window when destroying a window 2017-06-16 10:50:29 -07:00
Sam Lantinga 0a75192d85 Implemented SDL_WINDOW_SKIP_TASKBAR on Windows 2017-06-16 09:10:13 -07:00
Philipp Wiesemann a725efa4bc linux: Fixed using wrong constant for input text size. 2017-06-15 23:30:50 +02:00
Philipp Wiesemann 60c0f7e243 Fixed SDL_GetWindowWMInfo() returning success on three unsupported platforms. 2017-06-15 23:30:29 +02:00
Ryan C. Gordon a509719fc3 audio: Converter now checks a strict list of channels and formats we support. 2017-06-12 21:35:24 -04:00
Sam Lantinga 553b328664 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
Philipp Wiesemann 22c221f3b0 linux: Changed internal functions to be static. 2017-06-11 22:30:58 +02:00
Philipp Wiesemann 5b75e9033f directfb: Fixed comment. 2017-06-11 22:30:49 +02:00
Philipp Wiesemann fbd30c363d Fixed missing error messages for SDL_GetWindowWMInfo(). 2017-06-11 22:30:39 +02:00
Philipp Wiesemann c609d856ff directfb: Fixed crash if creating renderer.
SDL_GetWindowWMInfo() currently expects SDL to be 2.0.6 but SDL is still 2.0.5.
2017-06-11 22:30:24 +02:00
Ryan C. Gordon 3c955d0540 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
Alex Szpakowski bb100d3bab Expose display refresh rate on iOS/tvOS 10.3+. 2017-06-10 21:29:37 -03:00
Ryan C. Gordon 325330efdb jack: removed accidental copy/paste. 2017-06-09 17:37:43 -04:00
Ryan C. Gordon 58f08af46c jack: added capture support. 2017-06-09 00:47:47 -04:00
Ryan C. Gordon c39fd5777d jack: Move jack_client_t into the audio device instead a global variable. 2017-06-09 00:14:50 -04:00
Ryan C. Gordon b65e0777ce jack: Remove BROKEN_MULTI_DEVICE code. 2017-06-08 22:20:49 -04:00
Ryan C. Gordon d9039f2396 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 871d43a839 Removed unused hint includes. 2017-06-08 22:40:09 +02:00
Ryan C. Gordon 9288983682 Merged Eric Wing's overscan patch.
Fixes Bugzilla #2799.
2017-06-06 14:06:40 -04:00
Olli Kallioinen 11289b766f Android cmake build fixed to work with the official android gradle plugin 2017-06-04 21:25:57 +03:00
Ryan C. Gordon 6d661cab7b 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
Ryan C. Gordon d844487799 windows: Fix compiling of XInput code on newer MinGW installs.
Fixes Bugzilla #3609.
2017-06-06 12:35:35 -04:00
Ryan C. Gordon 599d9ba198 emscripten: listen for pointerlockchange events on the #document specifically. 2017-06-05 21:30:25 -04:00
Philipp Wiesemann 4b47fa38c3 Removed duplicate includes. 2017-06-04 23:15:47 +02:00
Philipp Wiesemann 52b7d0eb23 android: Fixed missing error message for SDL_GetBasePath(). 2017-06-04 23:15:27 +02:00
Philipp Wiesemann 248410dded Fixed SDL_GL_SetSwapInterval() returning success on two unsupported platforms. 2017-06-04 23:15:13 +02:00
Philipp Wiesemann 2113208d98 haiku: Fixed missing title bar for windows with decorations.
B_BORDERED_WINDOW_LOOK has a border but no title bar.
2017-06-03 23:00:50 +02:00
Philipp Wiesemann fc436a3a9d android: Moved internal function to new position.
It was grouped with functions for the public system header.
2017-06-03 23:00:40 +02:00
Philipp Wiesemann 63b3e06f75 Corrected names of header file guards. 2017-06-03 23:00:15 +02:00
Philipp Wiesemann 07b0df0a22 haiku: Changed internal variable to be static. 2017-06-02 22:15:37 +02:00
Philipp Wiesemann 00394996eb Fixed crash if calling SDL_CreateShapedWindow() on unsupported platforms. 2017-06-02 22:15:12 +02:00
Bastien Bouclet 545fba7886 x11: Don't send duplicate events when reconciling the keyboard state
Failing to check if a key was known to be pressed by SDL was causing
SDL_SendKeyboardKey to send duplicate key pressed events with the repeat
property set to true.

Fixes Bugzilla #3637.
2017-04-22 19:53:52 +02:00
Ryan C. Gordon b135557df9 linux: Don't crash if fcitx support is requested but unavailable.
Fixes Bugzilla #3642.
2017-05-29 02:48:51 -04:00
Ryan C. Gordon 29a047df39 Fixed whitespace code style. 2017-05-29 00:51:38 -04:00
Ryan C. Gordon 1c5f483a8a linux: removed IBus_utf8_strlen(), use SDL_utf8strlen() instead. 2017-05-29 00:51:02 -04:00
Ryan C. Gordon a1faea980c fcitx: removed incompatibly-licensed code. 2017-05-29 00:54:08 -04:00
Ryan C. Gordon d4086e4a70 stdlib: added SDL_utf8strlen(). 2017-05-29 03:01:05 -04:00
Philipp Wiesemann fc510bd798 nacl: Fixed crash if allocating memory for audio device failed. 2017-05-28 21:50:47 +02:00
Philipp Wiesemann 7c5078d8bd qnx: Removed unnecessary check for available audio devices. 2017-05-28 21:50:37 +02:00
Philipp Wiesemann 1e60ea76db qnx: Removed unnecessary call to SDL_zerop() after SDL_calloc(). 2017-05-28 21:50:27 +02:00
Philipp Wiesemann 1b9dc59918 haiku: Fixed SDL_SetClipboardText() putting random data in clipboard. 2017-05-28 21:50:11 +02:00
Ryan C. Gordon de52dc2948 haiku: Correctly set keyboard focus (thanks, Kai!).
The message sent upon the window being activated or deactivated, to trigger
the call to SDL_SetKeyboardFocus was missing a mandatory parameter. So
keyboard focus was never properly set.

Fixes Bugzilla #3658.
2017-05-28 15:36:09 -04:00
Ryan C. Gordon 643f1cb73d power: Add Linux org.freedesktop.UPower D-Bus implementation.
Fixes Bugzilla #3485.

(I think.)
2017-05-28 07:14:11 -04:00
Ryan C. Gordon b3f94acbf9 linux: Simplify D-Bus interface, remove lots of boilerplate. 2017-05-28 07:11:52 -04:00
Ryan C. Gordon 191f578b57 linux: Make system D-Bus connection available (in addition to session). 2017-05-28 07:08:10 -04:00
Ryan C. Gordon e5918acf46 wasapi: properly report init failure if on pre-Vista version of Windows.
We really should change the Init interface to return 0 on success and -1 on
error, like everything else, to avoid this sort of confusion.
2017-05-28 00:41:55 -04:00
Philipp Wiesemann 604a4b1b30 haiku: Fixed SDL_SetClipboardText() allocating too much memory and cutting text.
It allocated pointers instead of chars and passed a wrong size to SDL_strlcpy().
2017-05-27 23:30:21 +02:00
Philipp Wiesemann 3639895eac Removed unused errno includes. 2017-05-27 23:30:07 +02:00
Ryan C. Gordon 6fbde875e2 code style: wrap a single-statement if in braces. 2017-05-27 00:33:26 -04:00
Ryan C. Gordon 3fbd21ce40 windows: msgboxes should specify a parent HWND if possible (thanks, Ismael!).
This lets them be properly modal.

Fixes Bugzilla #3650.
2017-05-27 00:30:06 -04:00
Philipp Wiesemann 90ed3daa3e Changed messages about not recognized keys to include discourse link. 2017-05-26 22:45:52 +02:00
Philipp Wiesemann 759319729c emscripten: Fixed compiling on C89 compilers. 2017-05-26 22:45:40 +02:00
Philipp Wiesemann 1e13d93fea directfb: Changed internal function to be static. 2017-05-25 23:01:34 +02:00
Philipp Wiesemann 189b5851b7 android: Fixed parameter list in function definitions. 2017-05-25 23:01:16 +02:00
Philipp Wiesemann 6c0aea4270 wayland: Fixed freeing memory of SDL_malloc() with plain free(). 2017-05-25 23:00:58 +02:00
Philipp Wiesemann c66f0471e1 Removed unused internal window shape functions. 2017-05-25 23:00:43 +02:00
Ryan C. Gordon a7fc2822d4 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 6844d92c23 coreaudio: we don't need to track number of allocated audio buffers anymore.
CoreAudio takes care of iterating through the buffers and freeing them now,
so we don't have to manage this ourselves.
2017-05-24 13:28:13 -04:00
Ryan C. Gordon fc4402e5ff coreaudio: Better handling of audio buffer queue management.
We don't fill buffers just to throw them away during shutdown now, we let the
AudioQueue free its own buffers during disposal (which fixes possible warnings
getting printed to stderr by CoreAudio), and we stop the queue after running
any queued audio during shutdown, which prevents dropping the end of the
audio playback if you opened the device with an enormous sample buffer.

Fixes Bugzilla #3555.
2017-05-24 13:25:31 -04:00
Charlie Birks 126e5a1dbf Emscripten: Prevent default on arrow keys 2017-05-24 14:04:39 +01:00
Patrick Monaghan f839b209b9 Emscripten: fixed incorrect conversion of touch motion events to mouse motion events 2017-05-24 14:04:25 +01:00
Ryan C. Gordon 3fd35f6bb0 coreaudio: looks like we need more like a 10ms buffer minimum, not 50ms. 2017-05-24 01:28:03 -04:00
Ryan C. Gordon 793c788b1c coreaudio: dynamically allocate AudioQueueBuffers.
We need more than two buffers to flip between if they are small, or CoreAudio
won't make any sound; apparently it needs X milliseconds of audio queued when
it needs to play more or it drops any queued buffers. We are currently
guessing 50 milliseconds as a minimum, but there's probably a more proper
way to get the minimum time period from the system.

Fixes Bugzilla #3656.
2017-05-24 00:12:22 -04:00
Philipp Wiesemann bf8ccf08bb Removed redundant mouse clean up on quit for some platforms.
SDL_MouseQuit() already frees cursors and sets fields to NULL.
2017-05-19 23:30:59 +02:00
Ryan C. Gordon e889757bb3 assert: Better Emscripten support.
(Better than nothing, that is.)

Fixes Bugzilla #3459.
2017-05-19 14:51:03 -04:00
Ryan C. Gordon 8917f8634d assert: allow assertions to work on platforms without threads.
Partially fixes Bugzilla #3459.
2017-05-19 12:54:17 -04:00
Ryan C. Gordon 91e6054b03 wasapi: don't mark capture devices as failed for AUDCLNT_S_BUFFER_EMPTY.
Fixes Bugzilla #3633.
2017-05-19 12:40:55 -04:00
Ryan C. Gordon 02773811b3 render: GL_DestroyRender() should activate first.
Otherwise, we might destroy a different GL context's resources.
2017-05-18 21:00:11 -04:00
Ryan C. Gordon cff9e5a876 test: info now reports usable display bounds and DPI (thanks, Eric!).
Fixes Bugzilla #3652.
2017-05-18 16:29:10 -04:00
Ryan C. Gordon 81ab6c98fd Patched to compile on Windows. 2017-05-18 16:27:36 -04:00
Ryan C. Gordon 13b6d9959a wasapi: Replace tabs with strings in source code. 2017-05-18 15:46:06 -04:00
Ryan C. Gordon adabc38439 wasapi: Deal with AUDCLNT_S_BUFFER_EMPTY when flushing audio device. 2017-05-18 15:43:51 -04:00
Ryan C. Gordon 4073a6694f audio: One more callbackspec fix (thanks, Simon!). 2017-05-18 15:33:17 -04:00
Sam Lantinga 772407627b Fixed restoring a window that was maximized then minimized, then restored. 2017-05-16 17:48:57 -07:00
Sam Lantinga ccf0566ca4 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
Philipp Wiesemann df4cf79d42 directfb: Fixed compiler warnings about undefined functions. 2017-05-13 23:00:53 +02:00
Philipp Wiesemann 29222db7f6 emscripten: Fixed not removing pointer lock event callback. 2017-05-13 23:00:35 +02:00
Philipp Wiesemann cc5b4f450a emscripten: Changed internal functions to be static. 2017-05-12 23:01:17 +02:00
Philipp Wiesemann ce01128adf Fixed warnings about shadowed global variable.
Found by buildbot.
2017-05-12 23:01:04 +02:00
Philipp Wiesemann 87e0d812dd directfb: Removed duplicate comment. 2017-05-12 23:00:40 +02:00
Philipp Wiesemann 61c326e12b directfb: Fixed typo in log message. 2017-05-11 23:00:39 +02:00
Philipp Wiesemann 75c0d1ef6d directfb: Fixed compiler warnings about unused variables. 2017-05-11 23:00:21 +02:00
Ryan C. Gordon c878b59bbe audio: fixed more "spec" references that should have been "callbackspec".
This should catch all the ones for audio targets that have provided their
own audio threads.
2017-05-10 16:18:43 -04:00
Sam Lantinga 8b7ae35356 Fixed build error on Linux 2017-05-09 03:19:58 -07:00
Sam Lantinga 9ac3bb7011 Added support for mixing Qt and SDL on iOS
You should call SDL_SetMainReady(), and then customize the QIOSApplicationDelegate like this, in your application code:

/* Additional support for applications mixing Qt and SDL */
@interface QIOSApplicationDelegate : UIResponder <UIApplicationDelegate>
@end

extern "C"
{
void SDL_OnApplicationWillResignActive();
void SDL_OnApplicationDidEnterBackground();
void SDL_OnApplicationWillEnterForeground();
void SDL_OnApplicationDidBecomeActive();
}

@interface QIOSApplicationDelegate (SDL)

- (void)applicationWillResignActive:(UIApplication*)application;
- (void)applicationDidEnterBackground:(UIApplication*)application;
- (void)applicationWillEnterForeground:(UIApplication*)application;
- (void)applicationDidBecomeActive:(UIApplication*)application;

@end

@implementation QIOSApplicationDelegate (SDL)

- (void)applicationWillResignActive:(UIApplication*)application
{
    SDL_OnApplicationWillResignActive();
}

- (void)applicationDidEnterBackground:(UIApplication*)application
{
    SDL_OnApplicationDidEnterBackground();
}

- (void)applicationWillEnterForeground:(UIApplication*)application
{
    SDL_OnApplicationWillEnterForeground();
}

- (void)applicationDidBecomeActive:(UIApplication*)application
{
    SDL_OnApplicationDidBecomeActive();
}

@end // QIOSApplicationDelegate
2017-05-09 10:10:42 -07:00
Philipp Wiesemann 60f2848421 haiku: Fixed crash on quit if max number of joysticks was connected. 2017-05-07 21:02:46 +02:00
Philipp Wiesemann b7b919078f haiku: Changed internal function to be static. 2017-05-07 21:02:31 +02:00
Philipp Wiesemann 3ed2f0ca10 haiku: Fixed unlocking clipboard twice. 2017-05-07 21:02:16 +02:00
Philipp Wiesemann 4466b93141 haiku: Fixed comment. 2017-05-06 21:46:11 +02:00
Philipp Wiesemann 34747107fe mir: Fixed memory leak if system cursor id is unknown. 2017-05-06 21:46:00 +02:00
Philipp Wiesemann 34d9c5213c emscripten: Fixed return type in event callback declaration. 2017-05-06 21:45:43 +02:00
Alex Szpakowski 75fb07a6d2 iOS: Only mark interrupted audio devices as non-interrupted if AudioQueueStart is successful. 2017-05-03 18:05:29 -03:00
Ryan C. Gordon ce2998b8b9 cocoa: Don't crash on messagebox keypress without a successful SDL_Init(). 2017-05-02 21:46:28 -04:00
Ryan C. Gordon 619ab7a22d haiku: Various fixes from haikuports.
Based on patch here:

https://github.com/haikuports/haikuports/blob/master/media-libs/libsdl2/patches/libsdl2-2.0.5.patchset
2017-05-01 18:39:05 -04:00
Philipp Wiesemann 444c47a1b8 windows: Changed six internal functions to be static. 2017-04-29 22:50:35 +02:00
Sam Lantinga d7cd653737 Added Steam Controller mappings for Linux and iOS 2017-04-27 15:52:37 -07:00
Ryan C. Gordon 226541cb5b audio: another wrong struct that causes NULL pointer crash (thanks, Simon!).
Fixes Bugzilla #3632.
2017-04-26 01:43:40 -04:00
Joshua Granick 1286a7d23e windows: Add SDL_WINDOW_ALWAYS_ON_TOP support. 2017-04-20 21:31:44 -04:00
Juha Kuikka 7382cebb41 audio: Fix audio queue functions to use new spec structure.
Using the old spec structure causes the audio queueing functions to fail
due to bad callback pointers being checked.
2017-04-20 21:25:29 -04:00
Ryan C. Gordon 93a6191cdc emscripten: keep track of pointer lock losses and maybe regrab pointer later.
If an Emscripten app is in relative mouse mode and the user presses Escape
(or whatever is appropriate), then the pointer lock is broken by the browser.

This keeps track of those losses, and next time the user presses a mouse
button down on the canvas, if the app is still meant to be in relative mouse
mode, we will attempt to regrab the pointer.

This makes it much more seamless for things like first-person shooters, and
the app doesn't need any manual intervention.
2017-04-20 13:00:54 -04:00
Sam Lantinga d20d426c3a Fix crash in SDL audio thread, by Juha Kuikka
Wrong audio spec structure was populated with the internal callback, causing the audio thread to call a NULL pointer.
2017-04-18 22:17:40 -07:00
Ryan C. Gordon 1d1a0d7f03 atomic: Patched to compile on Android. 2017-04-13 15:28:56 -04:00
Ryan C. Gordon 1c9c7633d9 atomic: favor compiler intrinsics for compare-and-swap over macOS APIs.
The OSAtomicCompareAndSwap* APIs are deprecated as of macOS 10.12.
2017-04-13 13:28:52 -04:00
Ryan C. Gordon 8c00de57f6 atomic: let Clang always use atomic_load_n if available.
(Apple's Clang reports itself as GCC 4.2.1 in preprocessor macros--the final
GNU C compiler Apple shipped--as of the macOS 10.12 SDK.)
2017-04-13 13:22:23 -04:00
Philipp Wiesemann 2bf79c2e0e mir: Fixed typo in error messages. 2017-04-09 23:00:54 +02:00
Philipp Wiesemann f6eb23a617 linux: Changed two variables to be static. 2017-04-09 23:00:42 +02:00
Sam Lantinga 27023ed2b3 Added support for the Cyborg V.3 Rumble Pad and the Mad Catz FightPad PRO 2017-04-07 03:39:43 -07:00
Sam Lantinga 1eb92f6342 Implemented Linux joystick blacklist
Based on https://raw.githubusercontent.com/denilsonsa/udev-joystick-blacklist/master/generate_rules.py

This fixes a few devices that are not actually joysticks showing up as such in SDL
2017-04-06 06:30:43 -07:00
Drew Bliss a4dbf56574 Fix divide-by-zero when videodata->ime_candpgsize is zero. We're seeing this happen in Dota in the wild. 2017-04-06 13:27:51 -07:00
Drew Bliss 66555f6115 SDL - attempt to fix https://github.com/ValveSoftware/Dota-2/issues/1199 of mouse not locking in Dota. This fix is proposed by Ryan Gordon (increase timeout in X11_SetWindowGrab from 250ms to 5000ms). I'm going to integrate to source2 and ship it to dota customers. If it works, SamL will upsteam it to SDL. 2017-04-06 13:27:48 -07:00
Sam Lantinga 53f3786bc0 Added support for a number of game controllers, including the Nintendo Switch Pro Controller 2017-04-04 08:43:44 -07:00
Sam Lantinga 5789da67cf Fixed bug 1859 - No SDL_VIDEORESIZE event generated when the window manager sets the window size.
Samuel Hopkins

Just confirming that the patch from Andreas (attachment 1715 [details]) works for me under SDL 2.0.3 with xmonad.

Stas Sergeev

Confirming that the patch in this ticket fixes the full-screen switching for dosemu2 on ubuntu-16.04. Note that I am not using xmonad, so this bug appears to be generic.
2017-04-03 13:32:53 -07:00
Philipp Wiesemann 1517ba7285 PSP: Fixed error messages. 2017-04-02 21:33:54 +02:00
Philipp Wiesemann f96cdca4e7 Mir: Changed two internal functions to be static. 2017-04-02 21:33:42 +02:00
Ryan C. Gordon c57fe6d78a Backing out broken change from previous commit. 2017-04-01 00:46:42 -04:00
Ryan C. Gordon ed7f16e227 Intentionally breaking buildbot to test email server change. 2017-04-01 00:46:15 -04:00
Sam Lantinga 7891e72dca __atomic_load_n() appears to be available in GCC 5 but not GCC 4 2017-03-30 06:52:34 -07:00
Ryan C. Gordon 028716e79f wasapi: deal with default device changes, and more robust failure recovery. 2017-03-30 16:33:47 -04:00
Ryan C. Gordon c85c57a05d wasapi: Handle lost audio device endpoints.
This gracefully recovers when a device format is changed, and will switch
to the new default device if the current one is unplugged, etc.

This does not handle when a new default device is added; it only notices
if the current default goes away. That will be fixed by implementing the
stubbed-out MMNotificationClient_OnDefaultDeviceChanged() function.
2017-03-29 14:23:39 -04:00
Ryan C. Gordon f2179944cc Patched to compile on some platforms. 2017-03-29 12:04:17 -04:00
James Legg 1dc9ae5c1e Use GCC's atomic loads in SDL_AtomicGet and SDL_AtomicGetPtr
This fixes errors reported by address sanitizer, and generates simpler
code on x86 architectures.
2017-03-29 15:48:22 +01:00
Philipp Wiesemann 266816b4aa Removed newlines from error messages. 2017-03-26 21:00:19 +02:00
Sam Lantinga 00da0824f5 Updated axis/button mapping for Dualshock 3, for upcoming Sony driver changes 2017-03-23 13:53:09 -07:00
Brandon Schaefer c35f46d03c mir: Set the max/min w/h vs just setting the window w/h 2017-03-18 13:57:57 -07:00
Sam Lantinga 22161480ee Compile fix for android.
"ISO C90 forbids mixed declarations and code [-Werror=declaration-after-statement]"

Moving some variable declarations to the top of Android_SetScreenResolution()
2017-03-14 07:22:08 -07:00
Sam Lantinga 6814f5dbc0 ALSA driver improvements:
* alsa hotplug thread is low priority
* give a chance for other threads to catch up when audio playback is not progressing
* use nonblocking for alsa audio capture
  There is a bug with SDL hanging when an audio capture USB device is removed, because poll never returns
2017-03-14 07:20:14 -07:00
Sam Lantinga c4d54504fa differentiate between capture / playback audio thread names 2017-03-14 07:16:56 -07:00
Sam Lantinga 763e138903 Added an API to get the joystick instance ID before opening the device: SDL_JoystickGetDeviceInstanceID() 2017-03-09 16:09:16 -08:00
Sam Lantinga c1802ef646 Fixed compile error with gcc -std=c99 2017-03-06 21:25:06 -08:00
Philipp Wiesemann 72fdf62980 Mir: Fixed crash if creating default cursor failed.
Found by Cppcheck.
2017-03-04 23:05:32 +01:00
Philipp Wiesemann 42d02890f4 Linux: Fixed error message. 2017-03-04 23:05:11 +01:00
Ryan C. Gordon 6aa17426a6 video: Don't compile isAtLeastGL3() if we don't have OpenGL support _at all_. 2017-03-03 16:38:45 -05:00
Ryan C. Gordon ca0bf151d5 Fix some more compiler warnings on armcc. 2017-03-03 16:38:17 -05:00
Ryan C. Gordon d526b8a1e9 Some patches to make SDL compile with armcc (ARM's C compiler). 2017-03-02 13:33:04 -05:00
Brandon Schaefer 94a69443c7 mistake: Revert the files that I did not mean to commit 2017-03-01 15:05:54 -08:00
Brandon Schaefer 7bbb13ea59 * Some refactoring and bug fixes. Thanks Micha? Kuchta! 2017-03-01 14:50:59 -08:00
Ryan C. Gordon bc8778854e raspberrypi: RPI_Destroy() should free the SDL_VideoDevice and its driverdata. 2017-02-28 19:48:52 -05:00
Brandon Schaefer 5a47ee0365 mir: Get ready for Mir 1.0, clean up deprecations. Thanks Micha? Kuchta! 2017-02-27 12:20:16 -08:00
Philipp Wiesemann e5d9b25d8c Fixed comment style. 2017-02-26 21:20:39 +01:00
Ryan C. Gordon a4249b48ee Patched to compile on C89 compilers. 2017-02-26 00:56:13 -05:00
Ryan C. Gordon 3b9e4d0a6c audio: Try to keep callbacks firing at normal pace when device is lost. 2017-02-26 00:39:22 -05:00
Ryan C. Gordon 07519a6b95 Removed a bunch of unnecessary #ifdefs. 2017-02-26 00:40:04 -05:00
Ryan C. Gordon a366c35f37 audio: run the audio callback even if device was lost.
We will throw away the data anyhow, but some apps depend on the callback
firing to make progress; testmultiaudio.c, if nothing else, is an example
of this.

Capture also will now fire the callback in these conditions, offering nothing
but silence.

Apps can check SDL_GetAudioDeviceStatus() or listen for the
SDL_AUDIODEVICEREMOVED event if they want to gracefully deal with
an opened audio device that has been unexpectedly lost.
2017-02-26 00:12:33 -05:00
Ryan C. Gordon 5728cb2025 audio: Make sure the disk and dummy targets are the last ones we try to init. 2017-02-26 00:10:02 -05:00
David Ludwig b13c443cd8 WinRT: removed buildbot debug code, pending further research 2017-02-24 20:49:14 -05:00
David Ludwig f7bfa3b79e WinRT: more buildbot debug code 2017-02-24 20:19:28 -05:00
David Ludwig ecb1eb823e WinRT: added code to help debug a buildbot error 2017-02-24 19:59:57 -05:00
Sam Lantinga 71a4e8ed13 Stop CoreAudio from doing expensive audio rate conversion 2017-02-23 12:10:02 -08:00
Sam Lantinga a9762551cd Added config for the Razer Wildcat on Mac OS X 2017-02-20 11:02:35 -08:00
Philipp Wiesemann cfcec57f42 Fixed comment. 2017-02-19 21:05:09 +01:00
Sam Lantinga 9428ff19a9 Added support for the Razer Wildcat on Linux 2017-02-17 17:46:58 -08:00
Charlie Birks 0d647d35b0 Emscripten: implement custom cursors 2017-02-17 10:13:17 +00:00
Charlie Birks 33bddcfda2 Emscripten: refactor cursor handling 2017-02-17 10:13:12 +00:00
Charlie Birks 613955b4f2 Emscripten: only update pixel ratio if HiDPI is enabled 2017-02-17 10:13:07 +00:00
Ryan C. Gordon e8677a1bd2 audio: Added basic WAVE_FORMAT_EXTENSIBLE support to .wav loader.
This is just enough to get you through a file that just used the extended
header for float or int data. It doesn't handle all the other things that
you expect from this header, like 24-bit samples inside a 32-bit container
or speaker masks.
2017-02-17 02:25:37 -05:00
Ryan C. Gordon 1ed41d6d0d Patched to compile on Windows. 2017-02-14 03:12:09 -05:00
Ryan C. Gordon 6046fd4cb0 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
Ryan C. Gordon c93bca489d stdlib: Fixed crash on SDL_snprintf("%s", NULL).
Like other C runtimes, it should probably produce the string "(null)".

This bug probably only affected Windows, as most platforms use their standard
C runtime's snprintf().
2017-02-14 02:49:08 -05:00
Ryan C. Gordon d1eb2d190d thread: Don't use SetThreadDescription on WinRT right now.
Can't LoadLibrary for it, but not sure if it's actually available there yet.
2017-02-13 17:05:14 -05:00
Ryan C. Gordon 70c0400b12 windows: Try to unify all the GUID comparison code into a core helper function.
There are likely several more I missed.
2017-02-13 17:00:46 -05:00
Ryan C. Gordon e5fc93baca audio: Don't wrap bootstrap declarations in preprocessor macros.
They are harmless and ignored if we don't actually link against them. The
preprocessor checks elsewhere if they're actually used.
2017-02-13 16:59:02 -05:00
Ryan C. Gordon ad9c702f6a audio: SDL_AudioStream's *_sample_frame_size should be in bytes, not bits.
Fixes failures where SDL_AudioStreamGet() incorrectly thinks it got a partial
sample frame request.
2017-02-13 16:56:41 -05:00
Ryan C. Gordon 175f1e8f4a audio: Added a ThreadDeinit() method to match ThreadInit.
Not used by any targets at the moment, but will be shortly!
2017-02-13 16:55:00 -05:00
Sam Lantinga 886736a2c8 Fixed bug 3584 - Small stack size for audio callback thread
Walter van Niftrik

We have found that since SDL 2.0.5 the audio callback thread is created with a very small stack size. In our application this is leading to stack overflows.

We believe there is a bug at http://hg.libsdl.org/SDL/file/391fd532f79e/src/audio/SDL_audio.c#l1132, where the is_internal_thread flag appears to be inverted.
2017-02-11 16:38:16 -08:00
Sam Lantinga cf31ea1478 Fixed bug 3583 - X11 touch device can be permanently lost
Volumetric

In X11 the SDL error "Unknown touch device" can occur after which the application stops recognizing touch events. For a kiosk-type application this results in a hang as far as the user is concerned. This is reproducible on HP Z220/Z230/Z240 workstations by swapping USB cables for a while and it also occurs with no physical changes, probably due to USB device power management. A workaround is to make SDL re-enumerate the touch devices like it does at startup. A patch is attached.
2017-02-11 11:14:48 -08:00
Sam Lantinga 06ccb71bcd 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 9171f71dbe Fixed warning in Android build 2017-02-10 09:41:16 -08:00
Sam Lantinga 107c19daad Log the error returned by XAudio2Create() 2017-02-09 06:01:14 -08:00
Philipp Wiesemann 8eee82cd84 Windows: Fixed warning about unused variable.
Found by buildbot.
2017-02-03 23:30:43 +01:00
Philipp Wiesemann 33ff5bd148 Fixed typo in log message. 2017-02-03 23:30:29 +01:00
Sam Lantinga 8f78f5bb94 Fixed build on Apple TV 2017-02-02 16:56:02 -08:00
Sam Lantinga 710ae62a79 Remember XInput controllers that we've already seen, so when the raw device list changes we don't assign the old device to the new XInput userid.
This isn't perfect, but at least we won't report the same device twice.
2017-02-02 17:33:40 -08:00
Sam Lantinga da30992d47 Fixed bug 3577 - Can't set minimal size (message box appears instead) if maximal size wasn't declared (i.e. unlimited) 2017-02-02 00:41:58 -08:00
Sam Lantinga be28d7c88c Added support for the Saitek Pro Flight X-56 Rhino 2017-01-31 12:30:55 -08:00
Sam Lantinga 6717a3d38d Added support for the HOTAS Warthog throttle 2017-01-31 12:23:29 -08:00
Sam Lantinga a156b0d994 Added the HOTAS Warthog as a flight stick 2017-01-31 10:20:09 -08:00
Sam Lantinga 800a72eb17 Switch stderr output to SDL_Log() so it shows up on Windows and mobile devices 2017-01-31 10:19:56 -08:00
Sam Lantinga 52e9c42df9 Fixed Windows build 2017-01-28 14:35:35 -08:00
Sam Lantinga 869b7fe314 Fixed bug 3550 - No mouse move messages send while over the titlebar and windows edges
Matthew

Its possible to set SDL_CaptureMouse() so you continue receiving mouse input while the mouse is outside your window. This works however There is then a gap where no messages send, which is when the mouse is hovering the title bar and the window edges.
2017-01-28 11:17:10 -08:00
R?mi Verschelde c3eea703ee Use a stronger X font definition for X11_MessageBox on UTF-8
X11 seemed to be confused by the broad definition, so WEIGHT_NAME,
SLANT and SETWIDTH_NAME were defined, thus fixing the font lookup
on some systems (tested on Mageia 6 with X11 1.19.1).

Fixes bug 3571.
2017-01-28 10:54:12 +01:00
Sam Lantinga 13433c4a61 Fixed bug 3569 - GL_UpdateViewport leaves PROJECTION matrix selected
Tom Seddon

GL_ActivateRenderer may call GL_UpdateViewport, which leaves the GL_PROJECTION matrix selected. But after GL_ResetState, the GL_MODELVIEW matrix is selected, suggesting that's the intended default state.

It seems at least like these should be consistent. Presumably GL_UpdateViewport should be doing a glMatrixMode(GL_MODELVIEW) before it finishes.
2017-01-27 21:23:27 -08:00
Sam Lantinga 0090a33805 Return an error if trying to set a window minimum size larger than the maximum size, or vice versa 2017-01-27 21:16:38 -08:00
Sam Lantinga d02473682e Sorted controller entries 2017-01-27 18:06:50 -08:00
Jessica Stokes aa90b730b8 Add a mapping for Xbox Wireless Controllers running old firmware
Also updates the naming of these Xbox Wireless Controllers connected via USB (and thus the third-party Xbox Controller Driver) to match.

The Xbox Wireless Controller entries are now listed, in order, via USB, bia Bluetooh (with older firmware) and via Bluetooth (with firmware 3.1.1221.0).
2017-01-26 21:25:05 -08:00
Ryan C. Gordon 8fa9b57f75 windows: first shot at naming threads with SetThreadDescription().
This is a bleeding edge API, added to Windows 10 Anniversary Edition (build
1607, specifically).

https://msdn.microsoft.com/en-us/library/windows/desktop/mt774976(v=vs.85).aspx

Nothing supports this yet, including WinDbg, Visual Studio, minidumps, etc,
so we still need to also use the RaiseException hack. But presumably tools
will use this API as a more robust and universal way to get thread names
sooner or later, so we'll start broadcasting to it now.
2017-01-27 20:50:30 -05:00
Sam Lantinga 95ab9dc73c Added Thrustmaster Wheel FFB entry to the list of wheels 2017-01-27 06:05:50 -08:00
Sam Lantinga 3c90a52aa7 Added an API to get the type of a connected joystick 2017-01-27 05:59:58 -08:00
Misty De Meo ae5e9a319b Add gamecontrollerdb mapping for Xbox One S on Mac
This is valid for firmware version 3.1.1221.0; earlier versions of the
firmware need a different mapping (and have different GUIDs).
2017-01-25 22:24:54 -08:00
Misty De Meo ca89d9b593 Darwin: fix detection of Xbox One S controller
Firmware revision 3.1.1221.0 changes the mapping of the Xbox One S
controller in Bluetooth mode. Aside from changing the layout of
other buttons, this revision also changes the triggers to act as
Accelerator and Brake axes from the simulation controls page.

The Darwin sysjoystick code didn't previously map anything at these
axes, making it impossible to detect input on these two buttons.
2017-01-25 22:22:05 -08:00
Sam Lantinga ede5c73484 Generalized the audio resampling hint for other resampling methods in the future 2017-01-24 19:38:01 -08:00
Ryan C. Gordon 47e2f4e950 audio: libsamplerate can't resample in-place; make space for a copy if needed. 2017-01-24 20:30:48 -05:00
Ryan C. Gordon c7f9dcb6fc 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 1da3a33773 audio: Fix static analysis concerns about a dead assignment. 2017-01-24 10:09:29 -05:00
Ryan C. Gordon 8f627c1cd8 audio: Make sure SDL_AudioStream's work buffer is 16-byte aligned, for SIMD.
Note the giantic FIXME, though!
2017-01-24 00:51:33 -05:00
Ryan C. Gordon 17dcee20c1 audio: Streams now resample in-place. Removed second allocated buffer. 2017-01-24 00:17:40 -05:00
Ryan C. Gordon b5eeab779f audio: allow stereo Sint16 resampling fast path in SDL_AudioStream.
This currently favors libsamplerate over the fast path (quality over speed),
but I'm not sure that's the correct approach, as there may be surprising
changes in performance metrics depending on what packages are available on
a user's system. That being said, currently, the only thing with access to
SDL_AudioStream is an SDL audio device's thread, and it might be mostly idle
otherwise, so maybe this is generally good.
2017-01-24 00:08:24 -05:00
Ryan C. Gordon a80cb672e3 audio: Fixed off-by-one error in upsampling. 2017-01-24 00:03:36 -05:00
Ryan C. Gordon dad07f960b audio: Resampler now special-cases stereo and mono processing.
Turns out that iterating from 0 to channels-1 was a serious performance hit!

These cases now tend to match or beat the original audio resampler's speed!
2017-01-23 16:45:50 -05:00
Ryan C. Gordon 8ce6ddf125 audio: Fixed incorrect pointer in SDL_ResampleCVT_si16_c2().
Forgot to update this when we changed this to process in-place. Whoops!
2017-01-23 16:42:47 -05:00
Ryan C. Gordon ecdc6c1207 audio: Fixed copy/paste bug in float32->sint16/SSE2 scalar leftover code. 2017-01-23 12:14:28 -05:00
Ryan C. Gordon 4b8f354668 audio: Fix same bug as last commit, but for _mm_bslli_si128 vs _mm_slli_si128. 2017-01-23 12:06:10 -05:00
Ryan C. Gordon fab4501811 audio: use _mm_srli_si128 instead of _mm_bsrli_si128.
They're the same thing (one is generally a #define of the other), but some
toolchains don't offer the 'b' version.
2017-01-23 12:02:02 -05:00
Ryan C. Gordon 3594bf8eeb audio: Wired up new SSE code to build system. 2017-01-23 01:05:44 -05:00
Ryan C. Gordon 202ab30c16 audio: Special case for resampling stereo AUDIO_S16SYS audio data.
This is a fairly common case, so we avoid the conversion to/from float here.
2017-01-22 20:27:48 -05:00
Ryan C. Gordon 8855daac66 audio: Make the simple resampler operate in-place.
This allows us to avoid an extra copy, allocate less memory and reduce cache
pressure. On the downside: we have to do a lot of tapdancing to resample the
buffer in reverse when the output is growing.
2017-01-22 23:48:15 -05:00
Ryan C. Gordon 64056e81cd audio: Added SSE3 implementation of SDL_ConvertStereoToMono(). 2017-01-23 00:57:19 -05:00
Ryan C. Gordon a7f86f2fd2 audio: don't cast to double in SDL_ConvertStereoToMono().
It's expensive and (hopefully) unnecessary. If this becomes an overflow
problem, we could multiply both values by 0.5f before adding them, but let's
see if we can get by without the extra multiplication first.
2017-01-22 20:18:59 -05:00
Ryan C. Gordon 83454c821f audio: removed conditional from simple resampler's inner loop.
We never seem to overflow the source buffer now; this might have been a
leftover from a bug that was covered by Vitaly's fixes?

Removing this conditional makes the resampler 10-20% faster. Left an
assert in there for debug builds, in case this still happens.
2017-01-20 16:26:24 -05:00
Philipp Wiesemann 4f981df37f Haiku: Fixed memory leak if creating framebuffer failed. 2017-01-22 22:15:36 +01:00
Philipp Wiesemann 63e83a3127 Haiku: Removed unused variable.
Found by Cppcheck.
2017-01-21 22:01:17 +01:00
Philipp Wiesemann 800a9e84f4 Fixed compiler warning about returning a value in a void function. 2017-01-21 22:00:56 +01:00
Sam Lantinga 8fa0b0889d Added support for the 8Bitdo Zero GamePad 2017-01-20 08:13:23 -08:00
Sam Lantinga 9b99265a5e Fixed mingw64 32-bit build, which does have the correct structure definitions 2017-01-19 20:19:37 -08:00
Sam Lantinga f354024266 Removed unused variable 2017-01-18 12:19:57 -08:00
Sam Lantinga b0c5ceef7d Fixed bug 3533 - Enumeration joystick devices omitted during directinput enumeration
white.magic

The logic which decides if a device enumerated via the direct input system in the function EnumJoysticksCallback in SDL_dinputjoystick.c is processed is discarding valid joystick devices due to the assumption that devices of the type DI8DEVTYPE_SUPPLEMENTAL are not valid devices.

This change was added with 2.0.4 with this commit http://hg.libsdl.org/SDL/rev/1b9d40126645 that is linked to this bug report https://bugzilla.libsdl.org/show_bug.cgi?id=2460 which indicates that in that case devices of the type DI8DEVTYPE_SUPPLEMENTAL were not desirable as they caused a singular device to emit multiple "device added" events.

Since then there appear to have been a few fixes to handle devices that fall into various other classes in the following two commits:
http://hg.libsdl.org/SDL/rev/10ffb4787d7a and http://hg.libsdl.org/SDL/rev/6a2bbac05728

Two devices I have reports of failing to be listed when the DI8DEVTYPE_SUPPLEMENTAL type is excluded are ECS Gametric Throttle and Thrustmaster MFD Cougar.

Sam Lantinga

I verified that the OUYA controller shows up as a single device with this change, so I've reverted the change to ignore supplemental devices, leaving framework in place to easily add devices that we want to ignore.
2017-01-18 12:18:50 -08:00
Sam Lantinga dd007e3fe7 Fixed bug 3561 - Re-acquire device before playing effects if needed.
Mathieu Laurendeau

Check the result of IDirectInputEffect_SetParameters and re-acquire the device to solve concurrency issues.
2017-01-18 11:58:16 -08:00
Sam Lantinga 5cb1ca551f Fixed building with mingw32 2017-01-18 11:57:27 -08:00
Ryan C. Gordon 3e1679c885 audio: Several fixes to "simple" resampler (thanks, Vitaly!).
Fixes Bugzilla #3551.
2017-01-18 02:11:56 -05:00
Sam Lantinga 95defd6620 Use icon width * sizeof(Uint32) instead of icon pitch when copying to icon resource data 2017-01-17 21:18:31 -08:00
Ryan C. Gordon 5718293092 audio: Implemented SIMD support for audio data type converters.
This currently adds an SSE2 implementation (but it's #ifdef'd out for now,
until it's hooked up to the configure script and such).
2017-01-16 00:58:28 -05:00
Ryan C. Gordon 1e66d457d7 audio: Some fixes to the audio data type converter code.
Removed some needless things ("len / sizeof (Uint8)"), and made sure the
int32 -> float code uses doubles to avoid working with large integer values
in a 32-bit float.
2017-01-15 05:01:59 -05:00
Philipp Wiesemann 1e4820951f Fixed comments. 2017-01-14 21:36:06 +01:00
Sam Lantinga 341d1ff920 Fixed comment 2017-01-13 11:37:12 -08:00
Sam Lantinga a52d48c5ab 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 bf11cd5084 Fixed bug 3552 - Building SDL in release mode fails under VS 2017 RC
Lukasz Biel

Tried to compile SDL2 using newest version of VS.

Got:
SDL_audiocvt.obj : error LNK2019: unresolved external symbol memcpy referenced in function SDL_ResampleCVT
1>E:\Users\dotPo\Lib\SDL\VisualC\x64\Release\SDL2.dll : fatal error LNK1120: 1 unresolved externals

whole compilation process: http://pastebin.com/eWDAvBce

Steps to reproduce:
clone http://hg.libsdl.org/SDL using tortoise hg,
open SDL\VisualC\SDL.sln,
when promted if should retarget solution click ok,
select release x64 build type,
Build/Build Solution

attempt 2, using Visual Studio cmake support:
open folder SDL\
select release x64 build type,
run CMake\Build CMakeLists.txt
build fails

When switched to debug build type, buils succeeds in both cases.
VS 2017 is still beta.
2017-01-09 20:37:52 -08:00
Ryan C. Gordon 23020f92fa audio: Don't ever use libsamplerate in the SDL_AudioCVT codepath.
It causes audio pops if you're converting in chunks (and needs to
allocate/initialize/free on each convert). We'll either adjust this interface
when we break ABI for 2.1 to make this usable, or publish the SDL_AudioStream
API for those that want a streaming solution.

In the meantime, the "simple" resampler produces "good enough" audio without
pops and doesn't have to be initialized, so that'll do for now on the
SDL_AudioCVT interface.
2017-01-09 16:31:57 -05:00
Sam Lantinga ad7c26ff02 We only need the first few keymaps corresponding to the following constants:
K_NORMTAB, K_SHIFTTAB, K_ALTTAB, K_ALTSHIFTTAB

In the normal case we'll load all the keymaps from the kernel, but this reduces the size of the SDL library for the fallback case when we can't get to the tty.
2017-01-09 11:58:01 -08:00
Sam Lantinga 6d6edcb8b9 Fixed spacing 2017-01-09 11:30:29 -08:00
Sam Lantinga 4e9c9fce13 Fixed bug 3100 - SetSwapInterval should now be enabled for ANGLE/EGL
Mark Logan 2015-08-24 15:57:50 UTC
In SDL_windowsopengles.c, WIN_GLES_SetSwapInterval is as follows:

WIN_GLES_SetSwapInterval(_THIS, int interval)
{
    /* FIXME: This should call SDL_EGL_SetSwapInterval, but ANGLE has a bug that prevents this
     * from working if we do (the window contents freeze and don't swap properly). So, we ignore
     * the request for now.
     */
    SDL_Log("WARNING: Ignoring SDL_GL_SetSwapInterval call due to ANGLE bug");
    return 0;
}

With a recent version of ANGLE (early July) calling SDL_EGL_SetSwapInterval with a D3D11 backend appears to work just fine. I am working on testing this with D3D9.

--

Alex Szpakowski

I found the bug, it was fixed in 2013. https://bugs.chromium.org/p/angleproject/issues/detail?id=481

In my opinion it should be safe to unconditionally use SetSwapInterval now. Anyone who encounters the bug should update their ANGLE to a version less than 3 years old, especially since they'd be using a SDL version that's 3+ years newer than their ANGLE version.
2017-01-09 10:10:33 -08:00
Ryan C. Gordon 063c9d40d7 audio: Replaced older resamplers in SDL_AudioCVT with the new ones. 2017-01-09 06:00:58 -05:00
Ryan C. Gordon a41103b170 audio: Patched to compile if linking directly to libsamplerate. 2017-01-09 05:59:30 -05:00
Sam Lantinga e0a40fb6a9 Implemented full evdev keyboard text support
This is based on the Linux kernel driver, and has fallback mapping tables in case we aren't connected to a virtual terminal.
2017-01-09 02:54:42 -08:00
Sam Lantinga 49292705a9 Fixed bug 3545 - SDL_EVDEV_do_text_input() may be too eager to find error cases
Rob

I've ran into an issue where I successfully receive SDL_KEY[UP,DOWN] events but not SDL_TEXTINPUT or SDL_TEXTEDITING.  In my case the code in SDL_EVDEV_do_text_input() is returning early (on error) prior to calling SDL_SendKeyboardText().  I'm running on the RaspberryPi 3, without X11.

In SDL_EVDEV_do_text_input() there is a condition to check keysyms with a type value below 0xf0, then subtract 0xf0 from type.  Without understanding the purpose of this code, I disabled it, recompiled, and I'm getting correct SDL_TEXTINPUT events.  I'm going to guess that my hack/fix is going to be problematic in some other environment, but after some initial testing it looks like everything is running fine in my setup.
2017-01-08 20:03:18 -08:00
Sam Lantinga 7b66295e05 Removed console check, let the kernel decide whether muting is appropriate on this terminal.
We don't fail the init if we can't mute the terminal (we might be running from ssh, or on a system without virtual terminals, etc.)
2017-01-08 19:04:38 -08:00
Sam Lantinga c16dd74f3b Check the return value of SDL_EVDEV_Init() 2017-01-08 18:32:20 -08:00
Ryan C. Gordon 38854e0333 audio: Improvements in channel conversion code. 2017-01-08 16:18:49 -05:00
Ryan C. Gordon 35166609d5 audio: Patched to compile with libsamplerate support (again). 2017-01-08 14:28:44 -05:00
Ryan C. Gordon d005dc21d3 audio: Patched to compile with libsamplerate support. 2017-01-08 14:23:15 -05:00
Ryan C. Gordon 19e937fc2e audio: libsamplerate loading now happens once at init time. 2017-01-08 14:18:03 -05:00
Ryan C. Gordon 98cc9d10d3 Fixed coding style on a function signature. 2017-01-08 14:17:09 -05:00
Sam Lantinga 9d9e92cf46 Fixed bug 3304 - Android black screen on resume
Richard Russell

Resuming from a suspended state results in a black screen.  This only happens when using GLES 1.1 (GLES 2 resumes correctly) and when the render target has been changed using SDL_SetRenderTarget.  This problem is new in 2.0.4.

The attached test case demonstrates the issue.

Sylvain Becker has apparently found a fix as follows:

"In the opengles leaf function (in 'src/render/opengles/SDL_render_gles.c'), it appears there is a call to 'GLES_ActivateRenderer' in 'GLES_SetRenderTarget', which is not present in opengles2. When commenting out this 'GLES_ActivateRenderer', it seems to resume fine".

This appears to fix the testcase perfectly, but I don't know whether it could have any undesirable side-effects.
2017-01-08 10:41:22 -08:00
Sam Lantinga b8ab4eb9a8 SDL_evdev.c: fix building against old kernel headers (K_OFF may not be defined.) 2017-01-08 10:15:22 -08:00
Sam Lantinga 7e505b0dd3 Don't fail if we can't open the tty, this can be a legitimate use case. 2017-01-07 16:49:23 -08:00
Sam Lantinga 267c950918 Added mappings for the 8Bitdo NES30 Pro and iBuffalo SNES Controller
Also swapped the Wii U Pro controller button mappings to position instead of label, as emulators expect from XBox controllers.
2017-01-07 13:47:34 -08:00
Ryan C. Gordon 13f2e54295 x11: make the X11 target work on macOS with Xquartz. 2017-01-07 19:55:29 -05:00
Ryan C. Gordon 61a3ba303c Replaced a few single-line "//" comments. 2017-01-07 17:09:14 -05:00
Sam Lantinga e25f4e507d Really fixed blit issue for capehill 2017-01-07 16:51:48 -08:00
Sam Lantinga e9c2dcdae8 Fixed bug 3469 - Keypresses leak to the console with 2.0.5
tvc

I believe this patch should fix it, instead of looping through all the tty's and seemingly selecting the wrong one and corrupting the console I've just made SDL open /dev/tty which is the console attached to the current process anyway.
2017-01-07 10:13:04 -08:00
Sam Lantinga df25258a1e Added configure and cmake support for libsamplerate 2017-01-06 20:43:53 -08:00
Ryan C. Gordon c5825b698d audio: Don't call a NULL function pointer when clearing audio streams.
(Partially?) fixes Bugzilla #3547.
2017-01-06 21:23:51 -05:00
Ryan C. Gordon c1ac4c6835 Better fix for static analysis issue in SDL_DestroyRenderer().
Follow up fix for Bugzilla #3544.
2017-01-06 21:17:33 -05:00
Sam Lantinga cbe44f7ff1 Added support for using libsamplerate to do audio resampling 2017-01-06 02:16:26 -08:00
Sam Lantinga 37f404fb87 Fixed confusion between Ryan's new audio stream and the audio buffer we were calling stream in the callback 2017-01-06 00:47:42 -08:00
Sam Lantinga 3df77ced1e Just roll back the entire portion of the commit from a8253d439914 which caused bug 3544 until we figure out what the right static analysis fix is. 2017-01-06 00:40:22 -08:00
Ryan C. Gordon 748f46054f audio: Add an assert to make sure non-streaming audio uses good buffer sizes. 2017-01-06 03:38:14 -05:00
Sam Lantinga 356c2eadf4 Fixed bug 3544 - Memory freeing bug in SDL_DestroyRenderer/SDL_DestroyTexture
felix

Here's a snippet of SDL_DestroyRenderer from hg revision 10746:7540ff5d0e0e:

    SDL_Texture *texture = NULL;
    SDL_Texture *nexttexture = NULL;
    /* ... */
    for (texture = renderer->textures; texture; texture = nexttexture) {
        nexttexture = texture->next;
        SDL_DestroyTexture(texture);
    }

SDL_DestroyTexture removes the texture from the linked list pointed to by the renderer and ends up calling SDL_DestroyTextureInternal, which contains this:

    if (texture->native) {
        SDL_DestroyTexture(texture->native);
    }

If it happens that texture->native is an alias of nexttexture two stack frames up, SDL_DestroyRenderer will end up trying to destroy an already freed texture. I've had this very situation happen in dosemu2.

Bug introduced in revision 10650:a8253d439914, which has a somewhat ironic description of "Fixed all known static analysis bugs"...
2017-01-06 00:32:06 -08:00
Ryan C. Gordon 345c5989f1 haiku: Patched to compile. 2017-01-06 03:15:27 -05:00
Sam Lantinga 3443dc19f9 Don't do any audio conversion if none is necessary 2017-01-05 23:53:46 -08:00
Sam Lantinga 41be9756f0 Fixed bug 3546 - SDL_EVDEV_is_console() uses type of wrong size when calling ioctl
Rob

When calling ioctl(fd, KDGKBTYPE, &type) in SDL_EVDEV_is_console(), we declare type as an 'int'.  This should be a 'char'.  The subsequent syscall, and kernel code, only writes the lower byte of the word.

See: http://lxr.free-electrons.com/source/drivers/tty/vt/vt_ioctl.c?v=4.4#L399

ucval = KB_101;
ret = put_user(ucval, (char __user *)arg);

I've observed intermittent behavior related to this, and I can force an error condition by using an int initialized to 0xFFFFFFFF.  The resulting ioctl will set type to 0XFFFFFF02, and the conditional return in SDL_EVDEV_is_console() will fail.

Recommend changing to char, or masking off unused bits.
2017-01-05 23:26:13 -08:00
Ryan C. Gordon b3e8db802e audio: rename fake_stream to work_buffer.
It's more than an alternative for when the OS can't provide a DMA buffer, now.
2017-01-06 01:07:34 -05:00
Ryan C. Gordon 992124d4de audio: Fixed SDL_AudioStreamGet() function parameters.
There was a draft of this where it did audio conversion into the final buffer,
if there was enough room available past what you asked for, but that interface
got removed, so the parameters didn't make sense (and we were using the
wrong one in any case, too!).
2017-01-06 01:02:58 -05:00
Ryan C. Gordon 99fc1ef994 naclaudio: Untested attempt to migrate to SDL_AudioStream. 2017-01-06 00:56:29 -05:00
Ryan C. Gordon 115d0ce71c haikuaudio: Untested attempt to get this working with SDL_AudioStream. 2017-01-06 00:50:01 -05:00
Ryan C. Gordon 1a90c72dfc emscriptenaudio: don't get stuck in infinite loop if SDL_AudioStreamPut fails. 2017-01-06 00:49:35 -05:00
Ryan C. Gordon f07a1a5ad5 emscriptenaudio: Reworked to use SDL_AudioStream. 2017-01-05 21:31:02 -05:00
Ryan C. Gordon 3761b5f60b Fixed a few compiler warnings. 2017-01-05 20:11:19 -05:00
Ryan C. Gordon 4aa9e36983 Patched to compile on some compilers. 2017-01-05 19:45:57 -05:00
Ryan C. Gordon 30178a9b24 audio: Added SDL_AudioStream. Non-power-of-two resampling now works! 2017-01-05 19:29:38 -05:00
Ryan C. Gordon f12ab8f2b3 audio: More effort to improve and simplify audio resamplers. 2017-01-05 19:12:20 -05:00
Ryan C. Gordon 52130bde40 diskaudio: Use SDL_Log, not fprintf. 2017-01-05 19:30:45 -05:00
Sam Lantinga d024c724d1 Fixed signedness issue when blitting on a big endian platform, as reported by capehill
For example, if sR is 0 and dR is 255, we will get -255*sA casted to an unsigned value. Basically results are quite large numbers instead of the expected 0-255 range.
2017-01-05 08:16:39 -08:00
Sam Lantinga e6e6613ca4 Fixed build warning on Haiku 2017-01-05 02:53:29 -08:00
Sam Lantinga 4938c5054e 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 99e10ef506 Assume D-pad or thumbstick style axes are centered at 0 2017-01-04 07:06:48 -08:00
Sam Lantinga 26f84d7447 Added mappings for several GameCube and SNES controllers 2017-01-04 06:21:17 -08:00
Sam Lantinga d2a01b6e53 Added the NEXT SNES Controller to the list of zero-centered joysticks 2017-01-04 06:19:56 -08:00
Sam Lantinga c7780497dc Increased joystick jitter tolerance for PS3 controllers 2017-01-04 05:56:47 -08:00
Ryan C. Gordon 9d04205263 x11: deal with xrandr display size in millimeters being zero.
Xquartz on macOS reports a zero size, which leads to a division by zero here.
2017-01-04 09:33:47 -05:00
Sam Lantinga 082132a70c Fixed binding the D-pad on some Super NES style controllers
Fixed a case where partial trigger pull could be bound to another button

There is a fundamental problem not resolved by this commit:

Some controllers have axes (triggers, pedals, etc.) that don't start at zero, but we're guaranteed that if we get a value that it's correct. For these controllers, the current code works, where we take the first value we get and use that as the zero point and generate axis motion starting from that point on.

Other controllers have digital axes (D-pad) that assume a zero starting point, and the first value we get is the min or max axis value when the D-pad is moved. For these controllers, the current code thinks that the zero point is the axis value after the D-pad motion and this doesn't work.

My hypothesis is that the first class of devices is more common and that we should solve for that, and add an exception to SDL_JoystickAxesCenteredAtZero() as needed for the second class of devices.
2017-01-03 23:39:28 -08:00
Sam Lantinga d359180040 Fixed bug 3519 - SDL_GetDisplayMode fails to report mode.format when using Wayland backend
Ryan C. Gordon

Kristian says you can't do it with Wayland, and that going forward, it'll just handle whatever you throw at it anyhow.

https://twitter.com/hoegsberg/status/816148272402165761

So I say we mark it SDL_PIXELFORMAT_RGB888, which is what my X11 display currently reports, and leave it at that.
2017-01-03 00:44:05 -08:00
Ryan C. Gordon 2e2572a4f1 Added SDL_ReserveSpaceInDataQueue() to make space without copying data. 2016-12-27 23:48:43 -05:00
Sam Lantinga 18d9b23c65 Fixed bug 3539 - SDL2, missing MIR LDFLAGS
Gianfranco

Hello, this is the failure I got

https://launchpadlibrarian.net/300679206/buildlog_ubuntu-zesty-amd64.libsdl2_2.0.5+dfsg1-2ubuntu1_BUILDING.txt.gz

  LTLINK build/libSDL2.la
build/.libs/SDL_mirvideo.o: In function `MIR_InitDisplayFromOutput':
././src/video/mir/SDL_mirvideo.c:258: undefined reference to `mir_output_get_current_mode'
collect2: error: ld returned 1 exit status
2017-01-02 10:30:32 -08:00
Sam Lantinga 67ed894353 Fixed bug 3529 - SDL_EGL_UnloadLibrary is not called at all on SDL_Quit
kaisyu

In case of OpenGLES, the sequences of loading and unloading driver library should be like that:

SDL_Init
  ...
  SDL_GL_LoadLibrary
    SDL_EGL_LoadLibrary
...
SDL_Quit
  ...
  SDL_GL_UnloadLibrary
    SDL_EGL_UnloadLibrary
...


However, according to my test results, the varible '_this->gl_config.driver_loaded' does not allow 'SDL_GL_UnloadLibrary' to call 'SDL_EGL_UnloadLibrary'.
2017-01-01 19:10:36 -08:00
David Ludwig 0cfa0aa11c improved SDL_GetError() output generated by EGL code
This change attempts to report the EGL error codes generated by SDL's calls
into EGL, along with the name of the EGL function that failed.
2016-12-29 11:49:18 -05:00
Sam Lantinga 45b774e3f7 Updated copyright for 2017 2017-01-01 18:33:28 -08:00
Sam Lantinga 49225f5f04 We don't currently support blitting to < 8 bpp surfaces, return an error instead of corrupting memory in that case. 2016-12-31 18:11:19 -08:00
Sam Lantinga 2ba66d0525 Fixed bug 3535 - Misplaced comment #if/#endif closure comment
Coriiander

This notice is about a misplaced comment.

Often times when we use an #if #endif sequence, the #endif is followed by a comment to indicate what #if statement it belonged to. The SDL_xaudio2.c file contains a misplaced comment, as follows (I stripped the other comments):

#ifdef __GNUC__
#  define SDL_XAUDIO2_HAS_SDK 1
#elif defined(__WINRT__)
#  define SDL_XAUDIO2_HAS_SDK
#include "SDL_xaudio2.h"
#else
#if 0
#include <dxsdkver.h>
#if (!defined(_DXSDK_BUILD_MAJOR) || (_DXSDK_BUILD_MAJOR < 1284))
#  pragma message("Your DirectX SDK is too old. Disabling XAudio2 support.")
#else
#  define SDL_XAUDIO2_HAS_SDK 1
#endif
#endif
#endif /* 0 */



That final /* 0 */ should be moved one line up. Like this (I tabbed it out for you to make it more clear):
2016-12-31 16:21:55 -08:00
Sam Lantinga 880842cfdf Fixed bug 3531 - internal SDL_vsnprintf implementation access memory outside given buffer ranges
Tristan

The internal SDL_vsnprintf implementation accesses memory outside buffer. The bug existed also inside the format (%) processing, which was fixed with Bug 3441.

But there is still an invalid access, if we do not have any format inside the source string and the destination string is shorter than the format string. You can use any string for this test, as long it is longer than the buffer.

Example:

va_list argList;
char buffer[4];
SDL_vsnprintf(buffer, sizeof(buffer), "Testing", argList);

The bug is located on the 'else' branch of the format char test:

while (*fmt) {
  if (*fmt == '%') {
    ...
  } else {
    if (left > 1) {
      *text = *fmt;
      --left;
    }
    ++fmt;
    ++text;
  }
}
if (left > 0) {
  *text = '\0';
}

As you can see that text is always incremented, even when left is already one. When then on the last lines, *text is assigned the NULL char, the pointer is located outside bounds.
2016-12-31 16:14:51 -08:00
Sam Lantinga 7f2068daca Fixed bug 3541 - DisplayIndex out of bounds in SDL_SetWindowPosition
Intellectual Kitty

In SDL_video.c, on line #1756, in SDL_SetWindowPosition (from today's distribution, 12-31-2016, https://hg.libsdl.org/SDL/shortlog/bf19e0c84483):

        if (displayIndex > _this->num_displays) {

should be:

        if (displayIndex >= _this->num_displays) {
2016-12-31 10:30:07 -08:00
Philipp Wiesemann af26379881 Fixed crash if allocating memory for game controller failed. 2016-12-28 20:10:48 +01:00
Sam Lantinga cb8685c022 Fixed comment style 2016-12-27 02:04:38 -08:00
Sam Lantinga 6d7da0887d 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
Ryan C. Gordon 7c31636666 x11: Don't loop forever if the X server refuses a pointer grab. 2016-12-26 23:02:14 -05:00
Sam Lantinga b4e069e7f8 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
Sam Lantinga 9492492d5f Fixed bug 3516 - fix build on illumos
Sylvain

trivial patch to fix the build on illumos

 -Werror=declaration-after-statement

https://gist.github.com/wiedi/15b71456667f7aa2a7f8815663723bb3
2016-12-26 01:56:52 -08:00
Alex Szpakowski fd85f5748d Mac: back out commit 3e9b2ae41adf. It causes significant overhead on many GPUs. 2016-12-23 22:49:37 -04:00
Alex Szpakowski d719374cb9 Mac: Fix over-saturated colors on P3 displays (e.g. the 2016 MBPs). 2016-12-23 22:08:18 -04:00
Philipp Wiesemann 3e9284519a Windows: Fixed compile error. 2016-12-23 20:36:24 +01:00
Sam Lantinga 4fc0fe1f69 Removed debug print statements 2016-12-23 02:23:44 -08:00
Sam Lantinga ad26769cd7 Fixed compile errors on various platforms 2016-12-22 18:43:00 -07:00
Sam Lantinga ca019dada5 Fixed issue where the throttle and other axes on racing wheels don't start at zero and show up as immediate input when the wheel is turned for the first time. Wait until they are actually moved before generating input from them. 2016-12-22 17:33:45 -08:00
Sam Lantinga b2f6c4c1bd Fixed bus error when converting 16-bit to float for non-integral-multiple sample rates 2016-12-19 11:15:53 -08:00
Ryan C. Gordon 366c77a9f0 audio: fixed one more incorrectly-hardcoded value in the resamplers. 2016-12-18 20:17:33 -05:00
Alex Szpakowski eda74fda96 tvOS: Expose remote swipe gestures as arrow key presses (thanks oviano!) 2016-12-18 13:05:14 -04:00
Alex Szpakowski 787a54c84b iOS bug #3377: work around bugs in some third party iOS libraries (e.g. Google admob) where they assume the optional UIApplicationDelegate ?window? property always exists and will crash if it doesn?t. 2016-12-18 12:28:28 -04:00
Ryan C. Gordon f956df23bb audio: fixed arbitrary upsampling (thanks, Sylvain!).
This was a leftover of simplifying the resamplers down from autogenerated
code; I forgot to make something that the generator hardcoded into something
variable.

Fixes Bugzilla #3507.
2016-12-17 16:15:24 -05:00
Sam Lantinga b4ea63ec2c Fixed crash if there are multiple joysticks closed during the joystick update loop 2016-12-14 06:25:09 -08:00
Ryan C. Gordon f50a04009c windows: add whitespace to fix macro preprocessing issue (thanks, Sven!).
Apparently without a space here, "fastbuild -cache" breaks.
2016-12-13 00:22:42 -05:00
Sam Lantinga 85d8a79f65 Fixed updated return value for SDL_GL_SwapWindow()
Ozkan Sezer

http://hg.libsdl.org/SDL/rev/464a2676d8ab seems to have
forgotten removing the return from SDL_dynapi_procs.h, and this patch
does that. Without it, MSVC warns:
c:\sdl2\src\dynapi\SDL_dynapi_procs.h(598) : warning C4098:
'SDL_GL_SwapWindow_DEFAULT' : 'void' function returning a value
c:\sdl2\src\dynapi\SDL_dynapi_procs.h(598) : warning C4098:
'SDL_GL_SwapWindow' : 'void' function returning a value
2016-12-12 09:19:48 -08:00
Sam Lantinga e81bf12b85 Fixed edid parsing code for older gcc compilers
Ozkan Sezer

This adds the name 'ad' to two unnamed unions in edid.h
and adjusts edid-parse.c for it.  Nameless unions are not supported in
ancient gcc, which I happened to use on one of my ancient setups.
2016-12-12 09:18:42 -08:00
Sam Lantinga 8414c3d4ae Fixed ABI, don't change the return type of SDL_GL_SwapWindow() 2016-12-11 12:01:44 -08:00
Sam Lantinga 6211668e9f Fixed creating a renderer on the dummy driver on Mac OS X 2016-12-11 12:01:01 -08:00
Sam Lantinga cb5a0b0f6a Fixed crash when creating a dummy window on Mac OS X 2016-12-11 11:45:33 -08:00
David Ludwig d6bcec8f6a WinRT: build fixes
These fixes are lumped into two categories:

1. add new file, SDL_dataqueue.c, to UWP/WinRT build-inputs (via MSVC project
   files)

2. implement a temporary, hack-fix for a build error in SDL_xinputjoystick.c.
   Win32's Raw Input APIs are, unfortunately, not available for use in UWP/WinRT
   APIs.  There does appear to be a replacement API, available in the
   Windows.Devices.HumanInterfaceDevice namespace.

   This fix should be sufficient to get SDL compiling again, without affecting
   Win32 builds, however using the UWP/WinRT API (in UWP/WinRT builds) would
   almost certainly be better (for UWP/WinRT builds).

   TODO: research Windows.Devices.HumanInterfaceDevice, and use that if and as
   appropriate.
2016-12-10 15:23:17 -05:00
Sam Lantinga 454d9cb96d PP_OK isn't available in the NaCl build environment on buildbot. It's defined as 0 2016-12-09 05:19:31 -08:00
Sam Lantinga 97d05b0da8 Fixed a bunch of SwapWindow calls that needed their return value updated 2016-12-09 05:12:27 -08:00
Sam Lantinga 7a39681ea5 Fixed X11 OpenGL ES build 2016-12-09 05:04:18 -08:00
Sam Lantinga fed8cbcdb6 Fixed build for EGL platforms 2016-12-09 05:00:35 -08:00
Sam Lantinga b936a4c360 Added support for the XiaoMi Game Controller 2016-12-09 04:57:54 -08:00
Sam Lantinga 524bf3c282 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 3b18c796ed Fixed bug 3512 - Memory leak of SDL_Joystick axes_zero array
Benjamin Harris

Found with valgrind and confirmed in the 2.0.5 source code.
One-line fix in SDL_JoystickClose?
2016-12-09 01:29:52 -08:00
Sam Lantinga a525017139 Protect the game controller API the same way the joystick API is protected from multi-threaded access 2016-12-08 10:13:45 -08:00
Sam Lantinga 1b08f0c179 Added the guide button for the NVIDIA Shield Controller 2016-12-07 11:41:20 -08:00
Sam Lantinga 91491824ae Removed unneeded warning when running from Visual Studio 2016-12-07 11:02:02 -08:00
Sam Lantinga acabb5d5fd Added support for XBox One controllers on Mac OS X, using the driver at: https://github.com/360Controller/360Controller/releases 2016-12-06 14:22:28 -07:00
Ryan C. Gordon c023187548 audio: Fixed compiler warnings. 2016-12-06 12:23:17 -05:00
Ryan C. Gordon a0e003eebb Refactored the audio queueing code to a generic SDL_DataQueue interface.
This is not a public API (at the moment), but we will be needing this for
other internal things soon.
2016-12-06 02:23:54 -05:00
Ryan C. Gordon 8b960d4e0f Added SDL_VARIABLE_LENGTH_ARRAY so this #ifdef is localized to one place. 2016-12-06 02:20:58 -05:00
Sam Lantinga 264138cceb Added support for the Hori Fighting Commander 4 2016-12-03 08:39:21 -08:00
Sam Lantinga 54188c8b9e Fixed crash at startup 2016-12-03 09:59:43 -08:00
Sam Lantinga e7efcfbaa4 Added Linux mapping for the DragonRise Inc. Generic USB Joystick 2016-12-03 00:40:13 -08:00
Sam Lantinga 16074e6749 Fixed compile warning on Visual Studio 2016-12-02 22:18:05 -08:00
Sam Lantinga 4eda58ba6a 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 26f05ecb4d Fixed missing prototypes on Android, patch from Sylvain 2016-12-02 02:25:12 -08:00
Sam Lantinga 84c0780e25 Fixed bug 3305 - Fixed TextInput status when the keyboard was dismissed with the dismiss key on the iPad
Diego

I was previously unaware that rotating the device to a different orientation when the keyboard is shown causes a keyboardWillHide followed by a keyboardWillShow notification. The previous patch would then mistakenly StopTextInput when rotating. This patch fixes that by checking if the device is rotating before stopping text input.
2016-12-02 02:21:35 -08:00
Sam Lantinga a738a6fb49 Added Linux controller mapping for the Nostromo n45 Dual Analog Gamepad 2016-12-01 07:31:08 -08:00
Sam Lantinga 1b689c335c Fixed bug 3503 - osx builds don't run on 10.6 as of rev. 10651
Ozkan Sezer

With rev. 10651, i.e. http://hg.libsdl.org/SDL/rev/747a6a795b21 ,
SDL2 - OS X builds fail to run on 10.6 (my setup: i686 / 10.6.8)
because the symbol _IOPMAssertionCreateWithDescription is missing.
The SDK listing it for 10.7+ does seem correct.  Reverting r10651
and rebuilding makes it to function again.
2016-12-01 11:52:47 -08:00
Sam Lantinga 4905cd9c09 Fixed bug 3340 - SDL_BlitScaled causes access violation in some cases.
Simon Hug

The SDL_BlitScaled function runs into an access violation for specific blit coordinates and surface sizes. The attached testcase blits a 800x600 surface to a 1280x720 surface at the coordinates -640,-345 scaled to 1280x720. The blit function that moves the data then runs over and reads after the pixel data from the src surface causing an access violation.

I can't say where exactly it goes wrong, but I think it could have something to do with the rounding in SDL_UpperBlitScaled. final_src.y is 288 and final_src.h is 313. Together that's 601, which I believe is one too much, but I just don't know the code enough to make sure that's the problem.

Sylvain

I think this patch fix the issue, but maybe it's worth re-writing "SDL_UpperBlitScaled" using SDL_FRect.
2016-11-30 22:06:05 -08:00
Sam Lantinga cb8748b719 Fixed the controller mappings for the OUYA controller 2016-11-30 12:58:03 -08:00
Sam Lantinga 5fcf2577fb Added PS4 controller entries for the new Sony HID driver
https://git.kernel.org/cgit/linux/kernel/git/jikos/hid.git/log/?h=for-4.10/sony
2016-11-30 12:34:50 -08:00
Sam Lantinga 663afa911f Added support for the DS4 USB Wireless Adaptor 2016-11-30 12:25:19 -08:00
Philipp Wiesemann a7655d77d1 Fixed warning about storing an unused value.
Found by buildbot.
2016-11-30 23:31:23 +01:00
Sam Lantinga d834c08ac7 Add the controller mappings to the linked list in order 2016-11-29 22:02:37 -08:00
Sam Lantinga dd5d85a4e7 Added an API to iterate over game controller mappings 2016-11-29 06:36:57 -08:00