Commit graph

11898 commits

Author SHA1 Message Date
Sam Lantinga
1bb0c43749 Temporarily disabled NEON optimizations added for bug 4365
The ABGR to ARGB blit results in an empty surface, this needs to be looked at.
2020-02-27 09:32:03 -08:00
Sam Lantinga
93c0e32357 Fixed bug 5005 - warnings in kmsdrm
Malte Kießling

At the moment i get following warnings from kmsdrm:

 * in SDL_kmsdrmvideo.c KMSDRM_DestroySurfaces is return type int, but thats never returned or checked against
 * in SDL_kmsdrmvideo.c KMSDRM_DestroySurfaces the variable viddata is not used
 * in SDL_kmsdrmopengles.c KMSDRM_GLES_LoadLibrary a cast to NativeDisplayType is missing

I attached a patch for them :)
2020-02-27 08:20:34 -08:00
Sam Lantinga
6331aebaaf Fixed bug 4987 - Can't build on MinGW a recent state (15'th February, 2020): conflicting types 2020-02-27 08:18:20 -08:00
Ryan C. Gordon
3d1b93ed7d cmake: Forgot to add this file to revision control.
Fixes Bugzilla #5003.

--HG--
extra : rebase_source : bf8f9f7b3f96ae9a7c11d634487ca83712487c27
extra : histedit_source : 05eb4076f48da86a74c93a9bb5fb3a7228624bf0
2020-02-25 14:52:03 -05:00
Sylvain Becker
233d05a1f2 Fix compilation C90 mixed declarations and code (Thanks Cameron Gutman !) 2020-02-25 06:53:51 +01:00
Sylvain Becker
9b5850bdb7 Better fix to set the palette opaque, when there is also a colorkey
(see bug 3827)
2020-02-24 21:57:03 +01:00
Sam Lantinga
ea119534c0 Don't call setPreferredOutputNumberOfChannels on iOS, it breaks audio output 2020-02-24 12:07:18 -08:00
Sam Lantinga
2a669e967a Fixed surround sound support on Apple TV 2020-02-24 10:25:57 -08:00
Sylvain Becker
0b991f8e16 Fix: set to opaque when a palette surface is converted to an alpha format. 2020-02-23 23:07:15 +01:00
Sylvain Becker
1b4134df89 Fix regression: when a palette + colorkey is converted, it needs a blend mode.
- Regression of test_1.c of bug 3827, after fix from bug 4798.
- Blending is also needed when the palette contains alpha value, but not necessarily colorkey.
- Clean up SDL_ConvertColorkeyToAlpha which doesn't seem to need 'ignore_alpha' parameter any-more.

(see bug 3827)
2020-02-23 22:38:08 +01:00
Ryan C. Gordon
3324453465 cocoa: Make sure wait for button enable can't be infinite. 2020-02-23 14:49:03 -05:00
Ryan C. Gordon
e939635f84 cocoa: Removed a debug printf that was accidentally committed. 2020-02-23 14:48:48 -05:00
Sylvain Becker
5a0ed0a7e4 Fixed bug 4999 - Palette surface always promoted to alpha (Thanks Cameron Gutman!)
MSVC Static analysis: Incorrect alpha_value check in SDL_render.c
(see also bug 4425)
2020-02-23 09:59:52 +01:00
Ryan C. Gordon
e0661f0cdf cmake: more proper sdl2-config.cmake work (thanks, Alexander!)
Fixes Bugzilla #4970.

--HG--
extra : amend_source : 58e7991ac25965c177e3f11346396f19e2ca6c5d
2020-02-21 15:52:35 -05:00
Ryan C. Gordon
4814d83a17 cmake: Backed out changeset d62544e5fa7a
This is being replaced by a different patch (see Bugzilla #4970).
2020-02-21 15:51:04 -05:00
Ryan C. Gordon
74335f35e8 cocoa: When exiting a fullscreen space, wait for window state to normalize.
A good metric of this is when the titlebar's "minimize" button is reenabled,
which doesn't happen by the time windowDidExitFullscreen triggers.

This fixes minimizing a fullscreen window on macOS.

Fixes Bugzilla #4177.

--HG--
extra : rebase_source : d3b71427a15165cd0ca0edb9bd3e74da6dd861e6
2020-02-21 14:50:09 -05:00
Sam Lantinga
ebc08484de Fixed support for third party Xbox 360 wireless controller dongle 2020-02-19 08:26:00 -08:00
Ryan C. Gordon
a3d9b5e227 dynapi: Fixed build on non-Android platforms. 2020-02-18 01:44:07 -05:00
Sam Lantinga
99068e7cfe Added Android SDK conditionals to game controller mappings
The Nintendo Switch Pro controller has a different mapping on Android 10 and newer
2020-02-17 14:15:47 -08:00
Sam Lantinga
a76493a35b Made SDL_GetAndroidSDKVersion() available for applications 2020-02-17 13:54:45 -08:00
Ryan C. Gordon
e6e4be9fc1 opengl: Backed out hg changeset 0c915d307499
This is the OpenGL line drawing fix for Bugzilla #3182, but there's some
disagreement about what the renderers should do here, so I'm backing this out
until after 2.0.12 ships, and then we'll reevaluate all the renderer backends
to decide what's correct, and make them all work the same.
2020-02-17 16:15:04 -05:00
Ryan C. Gordon
59af901bbd x11: Wait a bit in SDL_SetWindowSize() to see if window manager vetoed change.
Same idea as the fix for Bugzilla #4646.

Fixes Bugzilla #4727.

--HG--
extra : rebase_source : 4dd57085a593f68553f921ba574607c01e8c08b9
2020-02-17 16:11:18 -05:00
Ryan C. Gordon
6b6ba6d243 x11: Don't delay an extra 10ms if we were just going to break out of the loop.
--HG--
extra : rebase_source : 0c11959078675b6204e643cd859d63b6871ee79d
2020-02-17 15:02:37 -05:00
Ryan C. Gordon
e647acf78d x11: Don't wait for the window to move if it's already in the place we want it.
--HG--
extra : rebase_source : b7ad35263159d7ac5c6c005c9bb0c9dc96bb8a18
2020-02-17 15:00:02 -05:00
Sam Lantinga
2a440598ca Further improvements for bug 4128 - CMAKE: Generated target import file contains incorrect include path
Mohamed

It would be useful to be able to do either `#include "SDL2/SDL.h"` or `#include "SDL.h"`. This patch allows that and adds compatibility with other build systems. It also allows differentiating between SDL1 and SDL2.
2020-02-16 00:08:36 -08:00
Sam Lantinga
5639c05fe4 Fixed bug 4987 - Can't build on MinGW a recent state: conflicting types
Vitaly Novichkov

Recent attempt to build a recent HG state of SDL2 via AppVeyor gives the failure:

30821858/job/359gqvypi2f18nok

```
C:\projects\sdl-mixer-x\build-MinGW-w32-MinSizeRel-Win32-VB6-Binding\external\AudioCodecs\src\AudioCodecs-build\external\SDL2\src\SDL2HG\src\dynapi\SDL_dynapi_procs.h:56:29: error: conflicting types for 'SDL_CreateThread'
 SDL_DYNAPI_PROC(SDL_Thread*,SDL_CreateThread,(SDL_ThreadFunction a, const char *b, void *c),(a,b,c),return)
2020-02-15 16:39:38 -08:00
Sam Lantinga
d5b3d8d150 Added some extra permissions and features likely to be used by SDL applications 2020-02-14 18:21:58 -08:00
Cameron Cawley
952060f329 test: Improved detection of OpenGL support 2020-02-08 19:34:51 +00:00
Cameron Cawley
2b9013fd76 Improved CPU detection on ARM platforms 2020-02-04 16:46:22 +00:00
Cameron Cawley
5e683ff94c Add basic support for compiling on RISC OS 2020-02-13 20:50:47 +00:00
Cameron Cawley
6a3ddc7b5f testfilesystem: Don't exit the application if SDL_GetBasePath isn't supported 2020-02-13 22:58:04 +00:00
Sam Lantinga
6df9e0ec2f Fixed bug 4980 - Build fails for SDL_kmsdrm*.c
Malte Kießling

Since https://hg.libsdl.org/SDL/rev/045f218436fe / bug 4966 i cannot build SDL anymore. The error i get is, essentially, caused by -Werror=declaration-after-statement in SDL_kmsdrmvideo.c and SDL_kmsdrmopengles.c
2020-02-14 16:17:17 -08:00
Sam Lantinga
f862a7305c Fixed bug 4986 - Memory leak in HIDAPI_JoystickConnected
meyraud705

Memory allocated for device->joysticks on line 589 of SDL_hidapijoystick.c is never freed.

Also, use memmove because memory is overlapping.
2020-02-14 16:15:46 -08:00
Sam Lantinga
342c1f5aa3 Fixed audio not coming out of the phone speakers while recording on iOS 2020-02-14 15:19:34 -08:00
Sam Lantinga
a5da847282 Fixed re-setting the audio session category when closing an audio device 2020-02-14 14:18:12 -08:00
Ryan C. Gordon
b88ebe6a95 cmake: Add PACKAGE_VERSION and SDL2_VERSION to sdl2-config.cmake.in
Fixes Bugzilla #4970.
2020-02-14 13:37:32 -05:00
Ryan C. Gordon
5cea2bb70e x11: SDL_SetWindowPosition should try to wait for the window manager.
Wait up to 100 milliseconds, since the window manager might alter or
outright veto the window change...or not respond at all.

In a well-functioning system, though, this should help make sure
that SDL_SetWindowPosition's results match reality.

Fixes Bugzilla #4646.
2020-02-14 13:17:18 -05:00
Ryan C. Gordon
5403dbd4a5 wayland: Don't delay pending surface resize handling on Vulkan.
OpenGL apparently needs to not do any drawing between wl_egl_window_resize
and eglSwapBuffers, but Vulkan apps don't use SDL to present, so they
never call into an equivalent of SDL_GL_SwapWindow where our Wayland code
was handling pending resize work.

Fixes Bugzilla #4722.

--HG--
extra : rebase_source : 123396f1b250a880cf9f47a7fc8895538ea7272d
2020-02-14 00:58:36 -05:00
Ryan C. Gordon
9ba80451dd wayland: Don't force the window into OpenGL mode if we want Vulkan.
--HG--
extra : rebase_source : c880cfc11efe459e8a8f735889929c7c8d1fae3d
2020-02-14 01:08:21 -05:00
Sam Lantinga
a430e13434 Fixed opening audio on Android from the Steam Link shell activity 2020-02-13 16:10:52 -08:00
Sam Lantinga
bf21c9aec1 Resolved conflict and added Android_JNI_RequestPermission() 2020-02-13 10:19:05 -08:00
Sam Lantinga
d62d7ebd0c Improved fix for bug 4748 - Calling WIN_UpdateClipCursor() / WIN_UpdateClipCursorForWindows() on WIN_PumpEvents() causes beeping and choppy mouse cursor movement, right-click doesn't work 2020-02-12 12:26:27 -08:00
Ryan C. Gordon
5c22af2fa8 test: Reimplemented SDLTest_CommonUsage() to restore binary compatibility.
Fixes Bugzilla #4975.
2020-02-12 13:09:38 -05:00
Ryan C. Gordon
48148ca586 mac: Wait a bit before activating app at startup.
This is obnoxious and wrong, but the patch that activates the Dock before
activating the app fixes the _menu_ not responding on Catalina, but the
first window created by the app won't have keyboard focus without a small
delay inserted.

This obviously needs a better solution, but it gets it limping along correctly
for now.
2020-02-12 13:08:29 -05:00
Sam Lantinga
9a6fe8b14b Fixed relative mode mouse events stopping if you click on the title bar 2020-02-11 21:19:05 -08:00
Sam Lantinga
294e05087e Fixed iOS and Android build 2020-02-11 16:23:43 -08:00
Sam Lantinga
06433488e1 Implemented OpenSL-ES audio recording on Android 2020-02-11 16:14:02 -08:00
Sam Lantinga
f26e92cc2b Attempt to make version detection safe for Mac OS X < 10.10 2020-02-11 10:35:14 -08:00
Sam Lantinga
e373060c8b Workaround for bug 4822 - Broken visual output in full screen mode with OS X 10.15
sjordan

We did some investigations into a different direction which I would like to share. As mentioned previously the scaling setting in the preferences play an important role for our problem and they also hint towards an issue with point/pixel scaling factors.

We found an interesting correlation between our fail case and the behavior of [nsWindow.screen backingScaleFactor]. It turns out that whenever we encounter the fail case the scale factor is zero when we print it quickly after calling SDL_CreateWindow. After some time the value changes to a non-zero value. In the success case the scaling factor is nonzero 'immediately'. Note that we don't use that factor. We also find that the window backingScaleFactor does not show the strange behavior even in the fail case.

We have also attempted to find out whether any event triggers the transition from zero to non-zero. We found the transition happening when we call SDL_PollEvent. We can even force this to happen by explicitly adding a SDL_PollEvent at an early stage, but it will only happen if a certain amount of time elapsed, so we need to add some sleep before the call to trigger the transition at an earlier stage. All that seems to imply that the transition happens async and that SDL_PollEvent merely causes the system to update its internal state at that time.

We have also verified that the scaling setting in the preferences does NOT directly correlate to the scaling factor behavior. We find that a particular scaling setting can lead to a fail case for one resolution and a success case for another resolution. This shows that the scaling setting alone does not determine whether the problem will appear or not.

We have also verified on another Mac with 10.14 that the scaling factor is always non-zero and we always have the success case.

I have no idea how to interpret this initial-zero behavior and haven't found any usable information on the screen backing scale factor. It seems as 10.15 does some stuff more async than before and maybe the problem could be caused by unfortunate timings. I would be very interested to hear your opinion about that.

...

Finally we found the cause of all our problems: it's the origin hack in Cocoa_SetWindowFullscreen:

        /* Hack to fix origin on Mac OS X 10.4 */
        NSRect screenRect = [[nswindow screen] frame];
        if (screenRect.size.height >= 1.0f) {
            rect.origin.y += (screenRect.size.height - rect.size.height);
        }

If we comment this one out our game and testdraw2 do behave correctly.

It turns out that if a window is not fully contained in the screen, it's screen property becomes zero and therefore we saw a zero when printing the backing scale factor (although it's not clear why it became nonzero later).

We suggest to add a runtime check which skips this code for 10.15 (or possibly earlier if you happen to know that the hack is not needed for certain older versions).

More info: consider the line

NSRect screenRect = [[nswindow screen] frame];

in Cocoa_SetWindowFullscreen. We found that this rect has the dimensions of the desktop
on our OS X 10.15 setup. This is true both for the success case and the fail case. It seems as the success case is actually a fail case in disguise.

On the other Mac with OS X 10.14 the same rect has the dimension of the newly created screen. This is what I would expect, because at that time the window has already been created successfully and there should be a newly created screen associated to the window.

What are the cases in which the whole origin conversion code for the fullscreen case is supposed to have a non-trivial result?

Today we found that if we print the dimensions of [nswindow screen] later, then we find them to be correct. So the conclusion seems to be that OS X 10.15 does indeed do the window/screen setup more async than before and that the origin correction code uses the [nswindow screen] at a time where the window/screen setup isn't finalized yet.
2020-02-11 10:21:31 -08:00
Sam Lantinga
b886d3e04d Fixed bug 4748 - Calling WIN_UpdateClipCursor() / WIN_UpdateClipCursorForWindows() on WIN_PumpEvents() causes beeping and choppy mouse cursor movement, right-click doesn't work
The problem here was calling ClipCursor() continuously in a tight loop. Fixed by only calling ClipCursor() if the clip area needs to be updated.
2020-02-11 10:08:22 -08:00