Commit Graph

4024 Commits (a8ac58854901c62d91e01e9d6957af1e2e02fe1d)

Author SHA1 Message Date
Sam Lantinga a8ac588549 Added SDL_GameControllerMappingForDeviceIndex() to get the mapping for a controller before it's opened 2018-03-07 13:30:40 -08:00
Sam Lantinga 9e651b6915 Try to dynamically create a default Android game controller mapping based on the buttons and axes on the controller.
Include the controller USB VID/PID in the GUID where possible, as we do on other platforms.
2018-03-06 14:51:50 -08:00
Sam Lantinga 2419d26724 Progress fixing bug 4100 - errors and warnings after changeset 11917
Ozkan Sezer 2018-03-02 20:02:37 UTC
http://hg.libsdl.org/SDL/rev/d702b0c54e52 resulted in an error and
two warnings when compiled with mingw.

1.  Error from SDL_windowstaskdialog.h:
In file included from src/video/windows/SDL_windowsmessagebox.c:29:0:
src/video/windows/SDL_windowstaskdialog.h:23:54: error: expected ')' before 'HWND'

This is fixed by removing unnecessary annotations:

2.  Warning from SDL_assert.c:
src/SDL_assert.c: In function 'SDL_ExitProcess':
src/SDL_assert.c:138:1: warning: 'noreturn' function does return

Indeed ExitProcess() is prototyped with DECLSPEC_NORETURN, but
TerminateProcess() is not.  This can be rectified by adding an
exit() call in there. Do NOTE, however, that requires building
with a libc:

3.  Warning from SDL_windowsmessagebox.c:
src/video/windows/SDL_windowsmessagebox.c: In function 'WIN_ShowMessageBox':
src/video/windows/SDL_windowsmessagebox.c:513:9: warning: 'nCancelButton' may be used uninitialized in this function

My lazy solution was manually initializing nCancelButton to 0.
2018-03-02 22:53:25 -08:00
Sam Lantinga e9b29ed007 Fixed bug 4101 - configure needs regenerating after changeset 11894 2018-03-02 22:48:15 -08:00
Sam Lantinga ac2d1f6773 Fixed setting the layer drawable size
Without this change the drawable had a size of 0 and the metal renderer asserted because the projection matrix wasn't set.
2018-03-02 12:08:18 -08:00
Ryan C. Gordon cef1c1c2ee windows: Restore patches for Task Dialogs and TerminateProcess().
2.0.8 has shipped, these can live in revision control now!
2018-03-02 14:10:25 -05:00
Sam Lantinga 003c0dce9c Use the real controller name for game controllers on iOS and Apple TV 2018-03-02 10:56:21 -08:00
Sam Lantinga 4f695bc5e5 Added tag release-2.0.8 for changeset dfbae17e87ac 2018-03-01 09:32:53 -08:00
Sam Lantinga e9fc66a038 Added patch note for Android Studio support 2018-03-01 08:26:10 -08:00
Sam Lantinga 0df7fe8404 Temporarily disabled fullscreen switching code on Android, until we can resolve bug 4096 - Enabling fullscreen on Android causes the app to toggle fullscreen mode continuously in a loop 2018-03-01 08:22:56 -08:00
Sam Lantinga eac3766698 Added a patch note for OpenGL ES support on Mac 2018-03-01 08:08:20 -08:00
Ryan C. Gordon 3537c3e7a9 Back out Task Dialog and TerminateProcess patches for 2.0.8.
These can return to revision control once we ship.
2018-02-28 10:39:41 -05:00
Ryan C. Gordon 6a1cfccef8 windows: dos2unix'd messagebox code, and (hopefully) fixed on MingW. 2018-02-28 02:14:15 -05:00
Ryan C. Gordon a749035f10 windows: Message boxes use Task Dialogs if possible (thanks, Jack!).
This lets the message box have an icon. Unless the app has opted-in to using
the v6 common controls, though, this will fall back to the usual SDL message
boxes.
2018-02-28 01:54:22 -05:00
Ryan C. Gordon 8536130aa2 assert: Use TerminateProcess() on Windows, vs ExitProcess (thanks, Jack!).
"What I have done is use TerminateProcess rather than ExitProcess.
ExitProcess will cause Microsoft's leak detection to continue, TerminateProcess
won't. It is also technically wrong to use ExitProcess in the case of aborting
the application.

Jack Powell
Twitter @jack9267"
2018-02-28 01:23:49 -05:00
Sam Lantinga 99683f7c04 Added patch note about the Vulkan Mac SDK 2018-02-26 08:39:25 -08:00
Mark Callow be6ca785e3 Support official Vulkan SDK for macOS.
This tries to load vulkan.framework or libvulkan.1.dylib before MoltenVK.framework
or libMoltenVK.dylib. In the previous version, layers would not work for applications
run-time loading the default library.
2018-02-25 23:02:09 -08:00
Sam Lantinga f9f45d0bf5 Fixed bug 4097 - Segmentation fault by SDL_CreateThreadWithStackSize
Dongsun Kim

Normal case
1. [thread 1] SDL_CreateThreadWithStackSize calls SDL_SYS_CreateThread.
2. [thread 1] If successful, it calls SDL_SemWait.
3. [thread 2] SDL_RunThread calls SDL_SYS_SetupThread, SDL_ThreadID, SDL_SemPost.
4. [thread 1] SDL_CreateThreadWithStackSize calls SDL_DestroySemaphore, SDL_free.

Crash case (Segmentation fault)
1. [thread 1] SDL_CreateThreadWithStackSize calls SDL_SYS_CreateThread.
2. [thread 1] If successful, it calls SDL_SemWait.
--> Error return due to SIGNAL(SYSTEM or Real Time) at sem_wait(pthread).
3. [thread 1] SDL_CreateThreadWithStackSize calls SDL_DestroySemaphore, SDL_free.
4. [thread 2] SDL_RunThread calls SDL_SYS_SetupThread, SDL_ThreadID, SDL_SemPost.
--> Segmentation fault at strlen or sem_post.
2018-02-25 19:51:34 -08:00
Olli Kallioinen 5cbb90da02 cmake: Set debug library name suffix per target instead of setting it globally. Don't add a suffix on android 2018-02-25 19:22:47 +02:00
Ozkan Sezer 3ea093cc85 SDL_test_fuzzer.c: fix strict aliasing warnings by using a union. 2018-02-25 10:15:00 +03:00
Sam Lantinga cbfee82dff Moved Android patch note into the Android section 2018-02-24 09:09:20 -08:00
Sam Lantinga 6cf4d0e43b Fixed bug 4092 - CMake support for building everything in the "test" directory
Eric Wasylishen

Patch to support building the tests with cmake.
Disabled by default, use: "cmake .. -DSDL_TEST=YES" to enable the tests.

Tested on macOS 10.13 with the ninja, makefile, and Xcode generators, and Windows 10 with the Visual Studio 2017 generator.
2018-02-24 08:59:58 -08:00
Sam Lantinga 849d042fa4 Fixed bug 4091 - Undefined references to Android audio functions when SDL_AUDIO_DISABLED is on
Manuel Sabogal

If SDL is compiled with the Audio subsystem disabled there are some undefined references to the functions ANDROIDAUDIO_ResumeDevices and ANDROIDAUDIO_PauseDevices in the file src/video/android/SDL_androidevents.c.
2018-02-24 08:58:22 -08:00
Sam Lantinga 8e4afb556a Added patch note for Ryan's work 2018-02-24 08:42:04 -08:00
Sam Lantinga b33dbd2769 Added missing file to tvOS build 2018-02-24 08:40:30 -08:00
Sam Lantinga 99a0c0f0e2 Fixed MinGW-w64 build 2018-02-24 08:23:44 -08:00
Sam Lantinga 5adc1b7d3e Updated documentation with API changes in SDL 2.0.8 2018-02-24 08:18:09 -08:00
Brandon Schaefer 0626486e2e Backout the vulkan change in d449dea10fc8 breaks Mir builds 2018-02-23 19:12:04 -05:00
Brandon Schaefer e17c3219d3 mir: Disable Mir by default as Mir supports Wayland clients
Also remove enabling VK support for Mir
2018-02-23 11:24:26 -05:00
Ryan C. Gordon 8891f5919f Backed out changeset 6c8521d53507
Apparently this still triggers a compiler warning, have to dig further.
2018-02-21 22:53:52 -05:00
Ryan C. Gordon fd8f12d2a1 android: apparently they fixed this header at some point. 2018-02-21 22:35:17 -05:00
Ryan C. Gordon ac309df7b4 vulkan: Possibly fix a compiler warning (-Wstrict-prototypes). 2018-02-21 22:27:09 -05:00
Ryan C. Gordon c7e4366530 wasapi: let Windows do the resampling for us if possible. 2018-02-21 21:34:06 -05:00
Ryan C. Gordon 7e1fa0ce53 wasapi: fixed typo in an assert message. 2018-02-21 21:34:35 -05:00
Ryan C. Gordon ed64d54dfd windows: added WIN_IsWindows7OrGreater(). 2018-02-21 21:36:10 -05:00
Ethan Lee 6e3d0a133c Use new XInput mapping for Win10+ (Bugzilla #3960) 2018-02-21 12:42:30 -05:00
Mark Callow 69958441be Fix high-dpi support on macOS and simplify it and iOS variant.
The detault drawableSize for a CAMetalLayer is its bounds x its scale.
So it is sufficient to set the *layer's* scale to the desired value.
2018-02-21 09:58:21 -08:00
Sam Lantinga a0687a9ccb Fixed bug 4034 - Don't include _DllMainCRTStartup() if SDL_STATIC_LIB is defined. 2018-02-21 09:40:47 -08:00
Sam Lantinga c00858bfb1 Fixed bug 4088 - Fix Metal link errors with test programs in SDLTest.xcodeproj
Eric Wasylishen

The following patch adds Metal.framework to the "link binary with libraries" section of each test program, with "status" set to "optional", which fixes link errors on all of the test programs. I'm not sure if this is a correct fix - the fact that this was necessary might indicate the static SDL2.a library has a hard dependency on Metal.framework (?) - but it gets the test programs working in Xcode again.

It also adds testyuv_cvt.c to the testoverlay2 target, fixing a link error.
2018-02-20 09:04:31 -08:00
Sam Lantinga 58f9be1257 Actually, this is needed for building with Visual Studio with both /MT and /MD.
With the previous change, I get:
1>     Creating library C:\projects\SDL\VisualC\Win32\Debug\SDL2.lib and object C:\projects\SDL\VisualC\Win32\Debug\SDL2.exp
1>LINK : error LNK2001: unresolved external symbol __DllMainCRTStartup@12
2018-02-18 09:09:56 -08:00
Sam Lantinga 3c9d33361c Fixed bug 4034 - Do we really need _DllMainCRTStartup() in every Windows build?
Andreas Falkenhahn

In src/SDL.c there is this code:

_DllMainCRTStartup(HANDLE hModule,

...

The comment says that this is needed on Watcom C for some reason but why is it included then when building with Visual C as well? Shouldn't it be only included when compiling on Watcom C then?

I'm asking because this code caused me a lot of headaches because I'm building a DLL that contains SDL and I link using /MT and the _DllMainCRTStartup() symbol obviously led to lots of trouble but it wasn't clear to me where the problem was because all I got from the linker was:

LNK2019: unresolved external symbol _main referenced in function ___tmainCRTStartup

So I had to got through each and every object to see what the culprit was. See here for the full story:
https://stackoverflow.com/questions/25067151/lnk2019-unresolved-external-symbol-main-referenced-in-function-tmaincrtstar/48177067#48177067

So if it isn't necessary on Visual C, please just leave that symbol out on Visual C so that it no longer leads to any trouble. Thanks.
2018-02-18 08:57:01 -08:00
Ryan C. Gordon 75a58303a0 pthread: fix error code checks (thanks, Andreas!).
Most pthread functions return 0 on success and non-zero on error, but those
errors might be positive or negative, so checking for return values in the
Unix style, where errors are less than zero, is a bug.

Fixes Bugzilla #4039.
2018-02-17 23:57:57 -05:00
Ryan C. Gordon 2ea4419a57 yuv: patched to compile. 2018-02-17 20:18:48 -05:00
Ryan C. Gordon 7c0c2c22a8 yuv: fixed variable declaration shadowing warnings.
Fixes Bugzilla #4062.
2018-02-17 20:10:13 -05:00
Ryan C. Gordon 97494f5374 pulseaudio: Just read/dump captured data in FlushCapture.
Apparently pa_stream_flush() doesn't work as expected:

https://lists.freedesktop.org/archives/pulseaudio-discuss/2012-April/013328.html

Fixes Bugzilla #4087.
2018-02-17 18:30:21 -05:00
Ryan C. Gordon 6867f6189f video: put a spinlock around a global linked list.
This should only contend if you're allocating or freeing surfaces from
multiple threads at once, and then just for a short time.

Fixes Bugzilla #4084.
2018-02-16 14:56:28 -05:00
Sam Lantinga 8ddebfa06e Fixed bug 4085 - X11: Allow configuring _NET_WM_BYPASS_COMPOSITOR through SDL hints
Callum McGing

This patch allows the user to disable the behaviour that blocks the compositor through a new hint: SDL_VIDEO_X11_NET_WM_BYPASS_COMPOSITOR. This allows tools or other windowed applications to behave properly under KWin.
2018-02-16 10:23:10 -08:00
Ozkan Sezer 926d803f83 bug #3739: handle %lu, %li and %ld in SDL_SetError. 2017-10-29 14:15:00 +03:00
Sam Lantinga 5abd7d16d7 Don't attempt WM_NCCALCSIZE adjustment when in fullscreen window transition 2018-02-13 22:58:20 -08:00
sezero ba0ecc6712 fix building SDL_audiotypecvt.c with gcc < 4.0 2018-02-12 10:47:00 +03:00