Commit Graph

6618 Commits

Author SHA1 Message Date
Philipp Wiesemann
badb73ca32 nacl: Fixed unnecessary large input text array. 2017-06-16 23:30:13 +02:00
Sam Lantinga
99af53f7fe Get the parent of non-SDL-created windows, for completeness 2017-06-16 11:14:08 -07:00
Sam Lantinga
6df366b7fb Clean up parent window when destroying a window 2017-06-16 10:50:29 -07:00
Sam Lantinga
9191d9a72f Implemented SDL_WINDOW_SKIP_TASKBAR on Windows 2017-06-16 09:10:13 -07:00
Philipp Wiesemann
c50e110b12 linux: Fixed using wrong constant for input text size. 2017-06-15 23:30:50 +02:00
Philipp Wiesemann
dd5a8431b5 Fixed SDL_GetWindowWMInfo() returning success on three unsupported platforms. 2017-06-15 23:30:29 +02:00
Ryan C. Gordon
d8d586ba1a audio: Converter now checks a strict list of channels and formats we support. 2017-06-12 21:35:24 -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
Philipp Wiesemann
2c6817ba86 linux: Changed internal functions to be static. 2017-06-11 22:30:58 +02:00
Philipp Wiesemann
efccae33b5 directfb: Fixed comment. 2017-06-11 22:30:49 +02:00
Philipp Wiesemann
939c15d5ec Fixed missing error messages for SDL_GetWindowWMInfo(). 2017-06-11 22:30:39 +02:00
Philipp Wiesemann
1978e72f60 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
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
Alex Szpakowski
ce6b0c64a1 Expose display refresh rate on iOS/tvOS 10.3+. 2017-06-10 21:29:37 -03:00
Ryan C. Gordon
836a1618d0 jack: removed accidental copy/paste. 2017-06-09 17:37:43 -04:00
Ryan C. Gordon
455e5a6342 jack: added capture support. 2017-06-09 00:47:47 -04:00
Ryan C. Gordon
edd657177c jack: Move jack_client_t into the audio device instead a global variable. 2017-06-09 00:14:50 -04:00
Ryan C. Gordon
50e33490b6 jack: Remove BROKEN_MULTI_DEVICE code. 2017-06-08 22:20:49 -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
ffeb3167b2 Removed unused hint includes. 2017-06-08 22:40:09 +02:00
Ryan C. Gordon
c45b811c7c Merged Eric Wing's overscan patch.
Fixes Bugzilla #2799.
2017-06-06 14:06:40 -04:00
Olli Kallioinen
6232ffccc0 Android cmake build fixed to work with the official android gradle plugin 2017-06-04 21:25:57 +03: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
Ryan C. Gordon
5fba522e19 windows: Fix compiling of XInput code on newer MinGW installs.
Fixes Bugzilla #3609.
2017-06-06 12:35:35 -04:00
Ryan C. Gordon
1e5ac2ce81 emscripten: listen for pointerlockchange events on the #document specifically. 2017-06-05 21:30:25 -04:00
Philipp Wiesemann
9a39e8d796 Removed duplicate includes. 2017-06-04 23:15:47 +02:00
Philipp Wiesemann
234821d788 android: Fixed missing error message for SDL_GetBasePath(). 2017-06-04 23:15:27 +02:00
Philipp Wiesemann
909958519c Fixed SDL_GL_SetSwapInterval() returning success on two unsupported platforms. 2017-06-04 23:15:13 +02:00
Philipp Wiesemann
fd59f414f3 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
0d7449e961 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
7b4f8688ad Corrected names of header file guards. 2017-06-03 23:00:15 +02:00
Philipp Wiesemann
99b87da8cf haiku: Changed internal variable to be static. 2017-06-02 22:15:37 +02:00
Philipp Wiesemann
a4aa084df6 Fixed crash if calling SDL_CreateShapedWindow() on unsupported platforms. 2017-06-02 22:15:12 +02:00
Bastien Bouclet
85142064d5 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
e983ea316f 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
23b242bba7 Fixed whitespace code style. 2017-05-29 00:51:38 -04:00
Ryan C. Gordon
b2e7bb2eeb linux: removed IBus_utf8_strlen(), use SDL_utf8strlen() instead. 2017-05-29 00:51:02 -04:00
Ryan C. Gordon
f9c6be1a9c fcitx: removed incompatibly-licensed code. 2017-05-29 00:54:08 -04:00
Ryan C. Gordon
bf09ce5fce stdlib: added SDL_utf8strlen(). 2017-05-29 03:01:05 -04:00
Philipp Wiesemann
ef90c17686 nacl: Fixed crash if allocating memory for audio device failed. 2017-05-28 21:50:47 +02:00
Philipp Wiesemann
22e6082d39 qnx: Removed unnecessary check for available audio devices. 2017-05-28 21:50:37 +02:00
Philipp Wiesemann
ec1c016ea0 qnx: Removed unnecessary call to SDL_zerop() after SDL_calloc(). 2017-05-28 21:50:27 +02:00
Philipp Wiesemann
c5ca51cc03 haiku: Fixed SDL_SetClipboardText() putting random data in clipboard. 2017-05-28 21:50:11 +02:00
Ryan C. Gordon
451ca211fc 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
ea55b8c4f2 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
5435a621d1 linux: Simplify D-Bus interface, remove lots of boilerplate. 2017-05-28 07:11:52 -04:00
Ryan C. Gordon
77b469666b linux: Make system D-Bus connection available (in addition to session). 2017-05-28 07:08:10 -04:00
Ryan C. Gordon
a60238d3e0 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
ee5bfb1b02 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
28aebb4bb8 Removed unused errno includes. 2017-05-27 23:30:07 +02:00
Ryan C. Gordon
6abcd8c63b code style: wrap a single-statement if in braces. 2017-05-27 00:33:26 -04:00
Ryan C. Gordon
d0044c7009 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
510feea5ac Changed messages about not recognized keys to include discourse link. 2017-05-26 22:45:52 +02:00
Philipp Wiesemann
a632226fbe emscripten: Fixed compiling on C89 compilers. 2017-05-26 22:45:40 +02:00
Philipp Wiesemann
c1a9b5c41f directfb: Changed internal function to be static. 2017-05-25 23:01:34 +02:00
Philipp Wiesemann
a9e988ba80 android: Fixed parameter list in function definitions. 2017-05-25 23:01:16 +02:00
Philipp Wiesemann
ccb23bd165 wayland: Fixed freeing memory of SDL_malloc() with plain free(). 2017-05-25 23:00:58 +02:00
Philipp Wiesemann
4baafc70a6 Removed unused internal window shape functions. 2017-05-25 23:00:43 +02: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
11c7c95872 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
1e0aa57252 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
e89a7de6ee Emscripten: Prevent default on arrow keys 2017-05-24 14:04:39 +01:00
Patrick Monaghan
785333b484 Emscripten: fixed incorrect conversion of touch motion events to mouse motion events 2017-05-24 14:04:25 +01:00
Ryan C. Gordon
3814517cb2 coreaudio: looks like we need more like a 10ms buffer minimum, not 50ms. 2017-05-24 01:28:03 -04:00
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
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
252c9e0637 assert: Better Emscripten support.
(Better than nothing, that is.)

Fixes Bugzilla #3459.
2017-05-19 14:51:03 -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
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
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
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
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