Commit Graph

9480 Commits

Author SHA1 Message Date
Ryan C. Gordon
f0cb078cfd 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
034b0758b5 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
0fe8162911 mir: Fixed typo in error messages. 2017-04-09 23:00:54 +02:00
Philipp Wiesemann
8d089ed8b6 linux: Changed two variables to be static. 2017-04-09 23:00:42 +02:00
Philipp Wiesemann
84b25e4696 ios: Fixed compiler warnings about unused variables in demo. 2017-04-09 23:00:26 +02:00
Ryan C. Gordon
598c15c2c5 android: More robust fix for screen locking in landscape (thanks, Sylvain!).
Fixes Bugzilla #3562.

From Sylvain:

"With an android landscape application, if you quickly lock, then unlock your
device, you can see sometimes a quick glitch: screen badly draws in portrait,
then it correctly displays in landscape.

Not talking of a smooth rotation, it's a drawing glitch. And you need to have
a plain lock screen, with no model nor passphrase.


I think it happens because the call to "nativeResume()" occurs sometimes too
early.

It should be done once you have *all* those three things (in any sequence):
- onWindowsFocusChanged() set to true
- onResume() called
- a valid call to onSurfaceChanged()


Currently, this is not the case: you don't need to have onResume() called.
Just need to have isPaused, (eg onPaused()).
So "isPaused" should be renamed as "isResumedCalled".
But you also need some kind of isPaused state to make sure to don't call
nativePause() twice (and deadlocks...).
There are also redundant checks to "mHasFocus" and some creation of the
initialisation thread code from onSurfaceChanged() that could me moved.

So here's this patch:
- add some states, so we have cleaner transitions.
- make sure "onResume()" is called.
- some clean up
- it also goes faster in pause state (focus changed, onPause, without requiring isSurfaceReady which does seems to be needed).


Tested on a few devices and it removes the glitch.
But I haven't tested when the activity goes back to "init" state."
2017-04-07 20:17:30 -04:00
Sam Lantinga
b19130eba6 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
fd4a5bf1c3 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
365adbb830 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
a733057f7d 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
25b0217c45 Added support for a number of game controllers, including the Nintendo Switch Pro Controller 2017-04-04 08:43:44 -07:00
Sam Lantinga
d1403ccfca 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
6bc4a0c0a5 PSP: Fixed error messages. 2017-04-02 21:33:54 +02:00
Philipp Wiesemann
b30056f1c4 Mir: Changed two internal functions to be static. 2017-04-02 21:33:42 +02:00
Philipp Wiesemann
11874a6261 Emscripten: Simplified option name in build script and README. 2017-04-02 21:33:24 +02:00
Philipp Wiesemann
9bcdd178a9 Updated generated configure script. 2017-04-02 21:33:02 +02:00
Philipp Wiesemann
2e182a3a8a Fixed typos and documentation in haptic header file. 2017-04-02 21:32:49 +02:00
Ryan C. Gordon
cb57d80bb8 Backing out broken change from previous commit. 2017-04-01 00:46:42 -04:00
Ryan C. Gordon
e14ac43f22 Intentionally breaking buildbot to test email server change. 2017-04-01 00:46:15 -04:00
Ryan C. Gordon
b8b305d875 README-hg.md: Updated main Mercurial website. 2017-04-01 00:17:15 -04:00
Ryan C. Gordon
4d9cb2c29c BUGS.txt: Changed mailing list link to discourse.libsdl.org.
I think we're solid on this? We can always back this changeset out.  :)
2017-04-01 00:05:25 -04:00
Ryan C. Gordon
299004244a android: fix wrong events when locking device in landscape (thanks, Joshua!).
"Using an application in portrait orientation, turning off the device would
dispatch SDL_APP_WILLENTERBACKGROUND, then SDL_APP_DIDENTERBACKGROUND then
lock the screen.

However, rotating the application the application to landscape, then turning
off the device would incorrectly dispatch SDL_APP_WILLENTERBACKGROUND,
SDL_APP_WILLENTERBACKGROUND, SDL_APP_WILLENTERFOREGROUND and then
SDL_APP_DIDENTERFOREGROUND before locking the screen. You can imagine how
this created trouble :)

It appears this occurs because (on this application) turning off a device
when in landscape is triggering a resize. The resize logic in SDLActivity
triggers a resume.

This patch has resolved the issue on my device:

It prevents the dispatch of (improper) FOREGROUND events when locking
the device, but we get still events when the device is turned back on
and unlocked."
2017-03-31 23:43:53 -04:00
Sam Lantinga
17813a09e8 __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
f97b4d1dde wasapi: deal with default device changes, and more robust failure recovery. 2017-03-30 16:33:47 -04:00
Ryan C. Gordon
1061fe64cf 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
63644907e9 Patched to compile on some platforms. 2017-03-29 12:04:17 -04:00
James Legg
ec49584481 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
63db7e414d Removed newlines from error messages. 2017-03-26 21:00:19 +02:00
Sam Lantinga
df012aa40d Updated axis/button mapping for Dualshock 3, for upcoming Sony driver changes 2017-03-23 13:53:09 -07:00
Philipp Wiesemann
b59c0eabed iOS: Fixed compiling template on C89 compilers. 2017-03-19 22:17:01 +01:00
Philipp Wiesemann
6142a07e06 Removed unused constant in testgesture program. 2017-03-19 22:16:37 +01:00
Philipp Wiesemann
e674aa1eb8 Updated file name in porting README. 2017-03-19 22:16:24 +01:00
Brandon Schaefer
445680706f mir: Set the max/min w/h vs just setting the window w/h 2017-03-18 13:57:57 -07:00
Sam Lantinga
d66f238377 Backed out changeset 90e5cb81c483 - testaudiocapture.c already does what we want 2017-03-16 16:45:12 -07:00
Sam Lantinga
71dad8a81e Added an audio recording test program 2017-03-15 11:39:54 -07:00
Sam Lantinga
4dddeae7c5 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
52b52e86e7 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
5def53e935 differentiate between capture / playback audio thread names 2017-03-14 07:16:56 -07: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
Sam Lantinga
abd8f65ba3 Fixed tabs to spaces 2017-03-09 15:12:19 -08:00
Sam Lantinga
5aa5988090 Added support to loopwave for hotplugging audio devices 2017-03-09 14:50:23 -08:00
Sam Lantinga
fd16cf4a66 Fixed compile error with gcc -std=c99 2017-03-06 21:25:06 -08:00
Philipp Wiesemann
3f675a01a7 Fixed warning about implicit conversion in controllermap program. 2017-03-04 23:05:47 +01:00
Philipp Wiesemann
54307c406b Mir: Fixed crash if creating default cursor failed.
Found by Cppcheck.
2017-03-04 23:05:32 +01:00
Philipp Wiesemann
343c84b28b Linux: Fixed error message. 2017-03-04 23:05:11 +01:00
Ryan C. Gordon
b17cd02507 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
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