Commit Graph

9529 Commits

Author SHA1 Message Date
Ryan C. Gordon
139f3d0491 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
7fe081e5c4 Removed unnecessary call to free() in testoverlay2 program. 2017-05-20 23:30:47 +02:00
Philipp Wiesemann
ec86349dd8 Removed unused signal includes and handler in test programs. 2017-05-20 23:30:32 +02:00
Philipp Wiesemann
2e8438e5a7 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
f06f187582 android: add screenSize to AndroidManifest's configChanges (thanks, Daniel!).
Fixes Bugzilla #3448.

"Starting with Android API 13, another configuration change must be declared
to be handled by the app if it is desired to not let the system handle
rotation itself:

https://developer.android.com/guide/topics/resources/runtime-changes.html#HandlingTheChange

This will have effect if either a developer or SDL per default will set target
API > 12. Currently it is set to 12, but this might change in the future, like
when applying this patch: https://bugzilla.libsdl.org/show_bug.cgi?id=3445

The effect of not having this change applied is that the SDL app is destroyed
upon rotation. Even when the manifest has an additional entry to e.g. always
stay in landscape mode, the onDestroy() call will happen on devices that are
portrait per default, when switching off screen due to power save. The device
will then (at least try to) rotate into portrait to show the portrait screen
lock after resume.

I believe it is safe to apply this patch even with target API still set to 12,
the additional parameter is simply ignored."
2017-05-19 15:06:05 -04:00
Ryan C. Gordon
252c9e0637 assert: Better Emscripten support.
(Better than nothing, that is.)

Fixes Bugzilla #3459.
2017-05-19 14:51:03 -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
Ryan C. Gordon
b80cea5e0f assert: allow assertions to work on platforms without threads.
Partially fixes Bugzilla #3459.
2017-05-19 12:54:17 -04:00
Ryan C. Gordon
986ec1cebb 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
7667547003 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
41307df3b9 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
df488f3bc7 Patched to compile on Windows. 2017-05-18 16:27:36 -04:00
Ryan C. Gordon
58ea188693 wasapi: Replace tabs with strings in source code. 2017-05-18 15:46:06 -04:00
Ryan C. Gordon
a93bb485cd wasapi: Deal with AUDCLNT_S_BUFFER_EMPTY when flushing audio device. 2017-05-18 15:43:51 -04:00
Ryan C. Gordon
0dd1b088c1 audio: One more callbackspec fix (thanks, Simon!). 2017-05-18 15:33:17 -04:00
Sam Lantinga
03b778fc4f Fixed restoring a window that was maximized then minimized, then restored. 2017-05-16 17:48:57 -07: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
Philipp Wiesemann
3cd9fb2270 Added missing path in porting README. 2017-05-13 23:01:04 +02:00
Philipp Wiesemann
a0b7caa6c1 directfb: Fixed compiler warnings about undefined functions. 2017-05-13 23:00:53 +02:00
Philipp Wiesemann
09f7a1740e emscripten: Fixed not removing pointer lock event callback. 2017-05-13 23:00:35 +02:00
Philipp Wiesemann
1646a146e8 emscripten: Changed internal functions to be static. 2017-05-12 23:01:17 +02:00
Philipp Wiesemann
3c0c53dcf1 Fixed warnings about shadowed global variable.
Found by buildbot.
2017-05-12 23:01:04 +02:00
Philipp Wiesemann
1818c0f207 directfb: Removed duplicate comment. 2017-05-12 23:00:40 +02:00
Philipp Wiesemann
4dcdd44d86 directfb: Fixed typo in log message. 2017-05-11 23:00:39 +02:00
Philipp Wiesemann
0aeaa020f6 directfb: Fixed compiler warnings about unused variables. 2017-05-11 23:00:21 +02:00
Ryan C. Gordon
513ca33128 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
23f4f40fa1 Fixed build error on Linux 2017-05-09 03:19:58 -07:00
Sam Lantinga
caa97b2b72 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
ea5a592da1 haiku: Fixed crash on quit if max number of joysticks was connected. 2017-05-07 21:02:46 +02:00
Philipp Wiesemann
7e34eb4c67 haiku: Changed internal function to be static. 2017-05-07 21:02:31 +02:00
Philipp Wiesemann
607ba57a45 haiku: Fixed unlocking clipboard twice. 2017-05-07 21:02:16 +02:00
Philipp Wiesemann
fadf27b0bc haiku: Fixed comment. 2017-05-06 21:46:11 +02:00
Philipp Wiesemann
1e1cf0ce21 mir: Fixed memory leak if system cursor id is unknown. 2017-05-06 21:46:00 +02:00
Philipp Wiesemann
1b843a390b emscripten: Fixed return type in event callback declaration. 2017-05-06 21:45:43 +02:00
Sam Lantinga
e137c2c887 Fixed comment typo 2017-05-05 05:10:30 -07:00
Alex Szpakowski
8e4704c2d4 iOS: Only mark interrupted audio devices as non-interrupted if AudioQueueStart is successful. 2017-05-03 18:05:29 -03:00
Ryan C. Gordon
5b8403efbe cocoa: Don't crash on messagebox keypress without a successful SDL_Init(). 2017-05-02 21:46:28 -04:00
Ryan C. Gordon
c88afd6c45 Fixed another AC_DEFINE. 2017-05-02 11:31:14 -04:00
Ryan C. Gordon
6c05862260 Fixed configure script.
The Haiku patch would define some HAVE_* things to /**/ instead of 1, breaking
the build for various things.
2017-05-02 11:16:58 -04:00
Ryan C. Gordon
4b9dbe5967 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
d101e2956f windows: Changed six internal functions to be static. 2017-04-29 22:50:35 +02:00
Philipp Wiesemann
9eb08f5ba0 Removed unused field in loopwavequeue program.
Found by Cppcheck.
2017-04-29 22:50:23 +02:00
Sam Lantinga
563a43b215 Added Steam Controller mappings for Linux and iOS 2017-04-27 15:52:37 -07:00
Ryan C. Gordon
634a894eb3 audio: another wrong struct that causes NULL pointer crash (thanks, Simon!).
Fixes Bugzilla #3632.
2017-04-26 01:43:40 -04:00
Joshua Granick
76adc80caf windows: Add SDL_WINDOW_ALWAYS_ON_TOP support. 2017-04-20 21:31:44 -04:00
Juha Kuikka
77edf4a468 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
4aba100b38 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
8ef833a85b 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
812146e9fa atomic: Patched to compile on Android. 2017-04-13 15:28:56 -04:00
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