Commit graph

11215 commits

Author SHA1 Message Date
Sam Lantinga
798c9bcfe6 sdl:
Cleans up AdjustWindowEx calls
2017-09-06 07:29:34 -07:00
Sam Lantinga
531ba2c751 You can have a borderless resizable window 2017-09-06 05:23:26 -07:00
Sam Lantinga
1dd1b3ff9c Fixed bug 3780 - GCC 7 implicit fallthrough warnings
Martin Gerhardy 2017-08-28 06:58:01 UTC

SDL_blit.h, SDL_fillrect.c and SDL_stdinc.h produces a lot of the (new) gcc-7 implicit fallthrough warnings.
2017-09-06 04:32:30 -07:00
Sam Lantinga
dd0a5a4a89 Fixed bug 3801 - HAVE_LIBSAMPLERATE_H depending on HAVE_LIBC in current SDL_config.h.in
Ozkan Sezer

HAVE_LIBSAMPLERATE_H is depending on HAVE_LIBC in current config.h.in:
it shouldn't be.  HAVE_LIBUDEV_H, HAVE_DBUS_DBUS_H, HAVE_IBUS_IBUS_H,
HAVE_FCITX_FRONTEND_H, and HAVE_ALTIVEC_H have the same situation too.
I suggest something like the following, which moves them out of the
HAVE_LIBC confinement and also moves the windows dx header stuff along
side them. (Not ideal, but a bit cleaner I think.)
2017-09-06 10:31:05 -07:00
Sam Lantinga
7a208f2d77 Fixed bug 3797 - configure check for float.h
Ozkan Sezer

Cmake checks for float.h, but configure does not:  the attached patch
adds float.h to checked headers in configury, and it adds the missing
HAVE_FLOAT_H macro to SDL_config.h.cmake and SDL_config.h.in.

In SDL_config_macosx.h and SDL_config_windows.h, defined HAVE_FLOAT_H
as 1, where I know that it's true.
2017-09-06 01:14:23 -07:00
Sam Lantinga
c91bd1e116 Fixed bug 3799 - SDL_CreateWindow fails with SDL_WINDOW_VULKAN (libvulkan.so.1 not found)
Manuel Sabogal

Android NDK defines Vulkan as libvulkan.so, not libvulkan.so.1. This is causing the program to not being able to create a window using SDL_WINDOW_VULKAN.

To fix this issue just change the line http://hg.libsdl.org/SDL/file/9e33d1be5d65/src/video/android/SDL_androidvulkan.c#l53 from "libvulkan.so.1" to "libvulkan.so"
2017-09-06 01:10:10 -07:00
Ryan C. Gordon
b8bebee815 x11: make sure SDL_GetGlobalMouseState notices mouse warping through SDL APIs. 2017-09-05 16:15:54 -04:00
Sam Lantinga
64791f9d68 Fixed bug 3273 - Fix for slow video subsystem initialization when using XRandR.
Martín Golini

I'm having a very slow initialization of the video subsystem that locks the window creation for about 500 ms ( tested in at least 4 different systems ). What i found is that X11_InitModes_XRandR is using XRRGetScreenResources, that explicitly ask to poll the hardware for changes. This is not really necessary since if the data is already available you can use XRRGetScreenResourcesCurrent.
I attached a tentative patch that fix this issue. With the patch there's no lock when the subsystem is initialized and the window creation is instant in my applications. The patch only uses XRRGetScreenResourcesCurrent in X11_InitModes_XRandR but it could be potentially used in X11_GetDisplayModes and X11_SetDisplayMode.
2017-09-05 08:24:38 -07:00
Sam Lantinga
f315493c28 Fixed typos in 2.0.6 patch notes 2017-09-04 23:10:12 -07:00
Sam Lantinga
da81885d77 Added SDL_vulkan.h to the Mac OS X framework headers 2017-09-04 22:51:28 -07:00
Sam Lantinga
acf5b23fc8 Fixed compiler warning with mingw-w64 2017-09-04 22:14:57 -07:00
Sam Lantinga
c37a5014c5 Added some more big 2.0.6 changes 2017-09-04 21:16:28 -07:00
Sam Lantinga
f85bc63d6c Updated WhatsNew.txt for 2.0.6 2017-09-04 20:48:01 -07:00
Sam Lantinga
414db44519 Fixed bug 3790 - Memory leak with surfaces blitting on each other
bastien.bouclet

When creating two surfaces and blitting them onto the other, SDL's internal reference counting fails, and one of the surfaces is not freed when calling SDL_FreeSurface.

Example code :

SDL_Surface *s1 = SDL_CreateRGBSurfaceWithFormat(0, 640, 480, 32, SDL_PIXELFORMAT_ARGB8888);
SDL_Surface *s2 = SDL_CreateRGBSurfaceWithFormat(0, 640, 480, 32, SDL_PIXELFORMAT_ARGB8888);

SDL_BlitSurface(s1, NULL, s2, NULL);
SDL_BlitSurface(s2, NULL, s1, NULL);

SDL_FreeSurface(s2);
SDL_FreeSurface(s1);

With this example, s1 is not freed after calling SDL_FreeSurface, its refcount attribute is still positive.
2017-09-04 11:46:14 -07:00
David Ludwig
cf695c0c48 macOS: bug-fix for #3793, "fullscreen toggle does not maintain SDL_Renderer's logical size"
This also seems to fix the follow-up issue in bug #3719, whereby the initial fix caused the SDL window to move, after transitioning from fullscreen to windowed-mode
2017-09-03 17:33:49 -04:00
David Ludwig
f94cddec29 WinRT: listed VS 2017 optional-component requirements
--HG--
extra : rebase_source : 71b59bb9552b2d0149be76a45e450b9700d62509
2017-09-03 16:36:22 -04:00
Ryan C. Gordon
6c60625436 vulkan: Changed SDL_WINDOW_VULKAN value to match Tizen's fork. 2017-09-03 13:20:33 -04:00
Ryan C. Gordon
e01e33bd00 video: Let video targets optionally decide their default OpenGL configs.
This is necessary because the Raspberry Pi is a strange beast, that believes
it has OpenGL support (through glX?) but generally has GLES2 support.

So when using the raspberry video target, we need to force this to default
to a GLES2 context, or by default SDL_CreateWindow() will fail, deep down
when it tries to load the proper GL library.

Fixes testsprite2 (and basically everything else that wasn't testgles2) when
run on a Raspberry Pi without a X server.

Please note that other targets might also need this filled in, the Raspberry
Pi is just the most prominent and readily-available System-On-A-Chip style
thing on my desk.  :)
2017-09-02 19:35:32 -04:00
Ryan C. Gordon
b4c19f59ef sndio: Patched to compile if SIO_DEVANY isn't defined.
(It isn't in whatever Raspbian is currently shipping.)
2017-09-02 16:41:14 -04:00
Sam Lantinga
0e9e7cd616 Fixed bug 3792 - [KMS/DRM] Wrong GBM format
Romain Tisserand

Using KMS/DRM driver from WIP SDL2.0.6 on Linux/ARM SoC RockChip RK3328 (ARM Mali 450 MP2 GPU).

The current code is using GBM_BO_FORMAT_XRGB8888 as GBM buffer format specifier.

The Mali driver (it has been confirmed some other vendor implementations too) expects GBM_FORMAT_XRGB8888.

The Mesa implementation is actually handling both values as the same, but it's not implemented like this into every gbm.h vendor header.

https://github.com/ideak/mesa/blob/master/src/gbm/backends/dri/gbm_dri.c

So with stock SDL2 on my card (Mali vendor implementation), it does not work, eglCreateWindowSurface fails, and gbm_is_format_supported fails too (with the BO variant).
It runs fine with GBM_FORMAT_XRGB8888.

Here is a link of the gbm.h from Mali user-space driver :

https://github.com/rockchip-linux/libmali/blob/rockchip/include/gbm.h
2017-09-01 12:54:38 -07:00
Ryan C. Gordon
a5187f96e2 x11: Correctly restore previous GL context after sacrificial context is done. 2017-09-01 14:08:09 -04:00
Ryan C. Gordon
736a5a3ed0 x11: don't try to make a NULL GL context current when we already did that. 2017-09-01 14:00:11 -04:00
Ryan C. Gordon
bb79b54f02 x11: Clean up sacrificial GL context code.
Check for failures, restore any previously-current context.
2017-09-01 13:57:40 -04:00
Ryan C. Gordon
6364eeecf2 x11: Make a sacrificial glX context to check for extensions during init.
This is necessary because we need to see if GLES compat extensions exist.

All of this code (including ShouldUseTextureFramebuffer()) should be
revisited after 2.0.6 ships; ideally we don't make throwaway contexts if
we can avoid it...but maybe we can't. I hear Vulkan is pretty cool.

Fixes Bugzilla #3725.

--HG--
extra : amend_source : 77a9461044721501192684414d7dc757e677691f
2017-09-01 13:27:53 -04:00
Alex Szpakowski
4ae6c39788 macOS: Update controller mapping of Steelseries Stratus XL to account for reversed thumbstick y-axis values (bug #3483). 2017-08-31 22:07:28 -03:00
Alex Szpakowski
60f43da150 macOS: Fix menubar items being enabled when they shouldn't be. 2017-08-31 21:34:29 -03:00
Alex Szpakowski
b3d4bde6d0 Code style cleanup in the Cocoa and UIKit vulkan files. 2017-08-31 21:26:13 -03:00
Alex Szpakowski
ef384efe5a macOS: Prevent unwanted native fullscreen (Spaces) toggles when the window is in fullscreen or isn't resizable. Fixes bug #3691. 2017-08-31 21:13:32 -03:00
Sam Lantinga
5c173c2517 Fixed bug 3791 - SDL_bits.h: __builtin_clz is supported in gcc >= 3.4
Ozkan Sezer

__builtin_clz is supported in gcc >= 3.4. The following patchlet adjusts
SDL_bits.h for it.
2017-08-31 15:17:59 -07:00
Sam Lantinga
0dadd6b804 Update Android SDK required to API level 16
Sylvain

Some API 16 methods are used (InputDevice: getDescriptor(), getVibrator()), so we need to compile at least with SDK API 16. Hence default.properties and project.properties have been modified to use android-16.

There are also some modification to SDLActivity.java not to use getVibrator() if we run under API 16. And not to check to presence of hasVibrator() if we are under API 11.
-some hard-coded constant can be expandend.
- rename a local variable (hasVibrator to hasVibratorService)
2017-08-31 15:12:08 -07:00
Sam Lantinga
f3c99e56d3 Fixed bug 3483 - Steelseries Nimbus MFi controller reversed Y-axis analog stick
benjamin.feng

Probable underlying cause: https://bugzilla.libsdl.org/show_bug.cgi?id=3124#c5

"If you download and build the HID Calibrator sample you can see that these are totally legitimate HID devices (except for inverting the Y-axis of joysticks, which is contrary to the HID specification but does make them more compatible with games compiled expecting XBOX controllers)."
2017-08-30 23:30:24 -07:00
Sam Lantinga
3ef9b11d46 Convert tabs to spaces in game controller database entries 2017-08-30 23:02:39 -07:00
Sam Lantinga
482731c88a Fixed bug 3789 - Android : small clean up
Sylvain

Since https://hg.libsdl.org/SDL/rev/a8c29f5b679f
SDL_android_main.c is empty and then produce a warning
nativeInit does not exist and dont need to be mark undefined
2017-08-30 14:25:01 -07:00
Sam Lantinga
5330567c7e Moved haptic source files into the proper folder 2017-08-30 09:44:38 -07:00
Sam Lantinga
e25675582a Fix QNX build - prioritize system EGL headers over the Khronos ones 2017-08-30 00:40:06 -07:00
Sam Lantinga
26a66653f0 Added some missing render capability flags 2017-08-29 23:14:39 -07:00
Sam Lantinga
1b6d6467db Fixed line breaks in verbose test logging output 2017-08-29 23:12:26 -07:00
Sam Lantinga
6ba1d5eed3 Added some debug messaging for previously unhandled events 2017-08-29 22:52:17 -07:00
Sam Lantinga
78c184a3e0 The dummy video driver check is now covered by explicitly checking for cocoa above. 2017-08-29 22:24:59 -07:00
Sam Lantinga
13fe9240dd Fixed bug 3616 - SDL_GL_CreateContext fails with SDL_GL_CONTEXT_DEBUG_FLAG and ANGLE/GLES 2.0
Colin Barrett

Using the pre-built x86 devel libs from here:
https://www.libsdl.org/release/SDL2-devel-2.0.5-VC.zip

If I have:

SDL_GL_SetAttribute(SDL_GL_CONTEXT_PROFILE_MASK, SDL_GL_CONTEXT_PROFILE_ES);
SDL_GL_SetAttribute(SDL_GL_CONTEXT_MAJOR_VERSION, 2);
SDL_GL_SetAttribute(SDL_GL_CONTEXT_MINOR_VERSION, 0);
SDL_GL_SetAttribute(SDL_GL_CONTEXT_FLAGS, SDL_GL_CONTEXT_DEBUG_FLAG);

and I'm using ANGLE/(a GL driver that doesn't provide an ES2 context) such that SDL_EGL_CreateContext is called by SDL_GL_CreateContext, I get the error "Could not create EGL context (context attributes are not supported)" and no context is created.

Looking at the code in SDL_EGL_CreateContext - if gl_config.flags is non-zero, it looks like the code in the section guarded with "#ifdef EGL_KHR_create_context" should be executed - but it apparently isn't.

Is it possible this section hasn't been compiled into the pre-built libraries? If I build SDL2.dll myself using the Visual C++ solution (VS2015 Community Update 3) then the call succeeds as I expect
2017-08-29 22:04:43 -07:00
Sam Lantinga
3c1d56a2eb Fixed bug 3719 - Cocoa - Incorrect window size when leaving fullscreen
bastien.bouclet

When exiting a "fullscreen space" on OS X, windows don't go to their defined "windowed mode size", but go back to their previous size.

Steps to reproduce:
1. Create a windowed mode SDL window
2. Toggle it to fullscreen with the SDL_WINDOW_FULLSCREEN_DESKTOP flag
3. While in fullscreen, change the windowed mode size using SDL_SetWindowSize
4. Toggle the window back to windowed mode

Expected result:
- The window has the size specified during step 3.

Actual result:
- The window has the size specified when creating the window in step 1.

Attached is a minimal reproduction test case.
The attached test case works as expected on X11 and Windows.
2017-08-29 21:42:22 -07:00
Ryan C. Gordon
8f60f0a775 test: forgot to change a variable.
Fixes Bugzilla #3787.

--HG--
extra : amend_source : c7474d259e202abcde7a917242859f79e5d7d766
2017-08-29 18:25:55 -04:00
Ryan C. Gordon
9b08483ffd test: Fix for negative int that was now a size_t (thanks, Ozkan!).
Fixes Bugzilla #3787.

--HG--
extra : amend_source : 8b47684fad05b69ea4410dfb67dcac382b310914
2017-08-29 18:16:38 -04:00
Ryan C. Gordon
c4eca8c2d6 egl: Cast to size_t, in case platform's NativeDisplayType isn't a pointer.
(fixes compiler warnings on QNX.)
2017-08-29 16:30:49 -04:00
Ryan C. Gordon
e088b11c8a A few more compiler warnings fixed. 2017-08-29 16:05:03 -04:00
Ryan C. Gordon
fca3874ab4 Fixed a bunch of compiler warnings.
--HG--
extra : rebase_source : a2c94cfaf300f4d9f5b7855489ed05c8e23de9fd
2017-08-29 15:52:49 -04:00
Sam Lantinga
03c8f2002b Updated documentation, you don't need to initialize the audio subsystem to do in-place format conversion. (Thanks Simon Hug!) 2017-08-29 09:02:04 -07:00
Sam Lantinga
51b14ba255 Fixed check for Mac OS X 10.11+ SDK (thanks Edward Rudd!) 2017-08-29 08:27:23 -07:00
Sam Lantinga
adfae6e9ba MAC_OS_X_VERSION_MAX_REQUIRED isn't actually set in recent Xcode versions 2017-08-29 02:32:53 -07:00
Sam Lantinga
a30aa1778d Removed Metal and QuartzCore frameworks which aren't needed for Vulkan support 2017-08-29 01:04:48 -07:00