Commit Graph

5903 Commits

Author SHA1 Message Date
Sylvain Beucler
e594a6738a emscripten: Introduce SDL_HINT_EMSCRIPTEN_ASYNCIFY
See https://github.com/emscripten-core/emscripten/issues/10746

and

https://github.com/emscripten-ports/SDL2/pull/112

Fixes Bugzilla #4997.
2020-06-27 16:25:47 -04:00
Sylvain Beucler
01af7b0254 emscripten: support pseudo-synchronous screen refresh and events update using asyncify 2020-06-27 16:22:50 -04:00
Ryan C. Gordon
3b71ebecd6 configure: Accidentally deleted a ')'
Sorry!
2020-06-27 02:38:13 -04:00
Ryan C. Gordon
e294639a6d cmake: Fix Metal detection on macOS/iOS.
Apparently the "-x objective-c" made it down to the linker, who then treats
the .o file as Objective-C source code.  Apparently the -ObjC argument does
the same thing but gets ignored by the linker.

Fixes Bugzilla #4988.
2020-06-27 02:00:58 -04:00
Ryan C. Gordon
363fd52b41 configure/cmake: Disable ARM SIMD and NEON by default.
It's buggy at the moment.
2020-06-26 23:30:59 -04:00
Ryan C. Gordon
694fea8ad8 video: Make SDL_CreateWindow use SDL_Init(SDL_INIT_VIDEO), not SDL_VideoInit.
Otherwise, the video subsystem won't deinitialize during SDL_Quit().

Fixes Bugzilla #5067.
2020-06-26 21:37:29 -04:00
Ryan C. Gordon
50fd0dd143 test: testspriteminimal wasn't calling SDL_Quit() on exit. 2020-06-26 21:35:54 -04:00
Ryan C. Gordon
1947ca7028 video: Changed SDL_VIDEO_MINIMIZE_ON_FOCUS_LOSS to default to FALSE.
Fixes Bugzilla #5106.  (and probably many others, too!)
2020-06-26 20:16:43 -04:00
Ryan C. Gordon
21482c1582 cmake: Bump minimum required CMake to 3.0.0 and mark link libraries PRIVATE.
Fixes Bugzilla #2992.
2020-06-26 20:11:32 -04:00
stfx
718e1fb8b1 cmake: Fix building with -DSDL_SENSOR=Off 2020-06-26 22:45:15 +02:00
Ryan C. Gordon
d955d63b03 cmake: Build Linux-specific files like the configure script does.
Otherwise we unconditionally compile things we shouldn't.

Fixes Bugzilla #5175.
2020-06-26 17:42:30 -04:00
Ryan C. Gordon
dd753ce7e3 cmake: Fix building with -DSDL_POWER=Off
Fixes Bugzilla #5193.
2020-06-26 15:04:57 -04:00
Sam Lantinga
ce293eed8d Fixed bug 5208 - Fix libGL loading on OpenBSD 2020-06-23 10:12:24 -07:00
Sam Lantinga
c2b8530591 Fixed bug 5209 - cpuinfo recognize OpenBSD ARM
Brad Smith

OpenBSD/arm only supports ARMv7 and and not any CPUs that do not support NEON.
2020-06-23 10:09:29 -07:00
Ozkan Sezer
4ba0a84718 core/linux/SDL_threadprio.c: fix build against older glibc versions 2020-06-22 23:24:02 +03:00
Sam Lantinga
b9f55b6d80 Fixed bug 5199 - Fix KMSDRM_CreateWindow() segfault when starting L?VE2D engine.
Manuel Alfayate Corchete

This small patch fixes the KMSDRM_CreateSurfaces() call in KMSDRM_CreateWindow(), that was segfaulting deeper into SDL internals because the windata->viddata pointer wasn't set before the KMSDRM_CreateSurfaces() call.
So that's what this small patch does.

Now, L?VE2D works perfectly well on the Raspberry Pi 3, instead of just segfaulting.
2020-06-19 10:37:14 -07:00
Sam Lantinga
56622f9c92 Fixed bug 5126 - MinGW compile error SDL_windowssensor.c
Martin Gerhardy

SDL_windowssensor.c includes InitGuid.h - but it should be initguid.h
2020-06-17 10:09:07 -07:00
James Legg
f1d5ced167 x11: Fix spurious keyboard focus events 2020-06-17 12:48:40 +01:00
Sam Lantinga
48989e2a87 Reverted comment change in previous commit 2020-06-17 08:47:27 -07:00
Sam Lantinga
a7ff6e9615 Fixed overflow in surface pitch calculation 2020-06-17 08:44:45 -07:00
stfx
efe0935904 Fix compile without DIRECTX 2020-06-15 10:31:16 +02:00
Ozkan Sezer
9db16a6557 fix permissions of some project files 2020-06-14 12:21:02 +03:00
Ozkan Sezer
163896543f fix watcom build of SDL_test_common.c 2020-06-14 12:05:56 +03:00
Sam Lantinga
7c0986fba4 Fixed bug 4938 - Suggestion: rename SDL_PIXELFORMAT_BGR888 to SDL_PIXELFORMAT_XBGR8888
Ellie

I just tripped over this: stb_image when requesting 3 channels with 8-bit actually returns them as 3 bytes per pixel with no alignment, so basically 4 pixels are 12 bytes with no padding (0...2, 3...5, 6...8, and 9...11). This I would have naively expected to be called RGB888 or BGR888, since there is no "dead" unused byte as I would expect for something called e.g. RGBX8888.

However, SDL2's SDL_PIXELFORMAT_BGR888 uses 4 bytes, same as SDL_PIXELFORMAT_BGRX8888, even though the latter appears to be a longer storage format - which it isn't, internally. It's just swapped, in byte order X, B, G, R (instead of BGRX). So why isn't the macro name also swapped, as "XBGR888" instead of just "BGR888"?

I find the formats therefore named inconsistently, and unless there is a reason for this I suggest these changes:

1. deprecate SDL_PIXELFORMAT_BGR888 in favor of a new SDL_PIXELFORMAT_XBGR8888

and

2. deprecate SDL_PIXELFORMAT_RGB888 in favor of a new SDL_PIXELFORMAT_XRGB8888
2020-06-12 10:30:46 -07:00
Ethan Lee
2aa8974f97 Add SDL_SIMDRealloc 2020-06-11 12:03:33 -04:00
Sam Lantinga
20aada0efc Fixed bug 5170 - Build fails when using Visual Studio 2017 with Windows 10 SDK 10.0.19041.0 in uwp
JackBoosY

In src/video/winrt/SDL_winrtgamebar.cpp line 55:

    virtual HRESULT STDMETHODCALLTYPE add_VisibilityChanged(
        __FIEventHandler_1_IInspectable *handler,
        Windows::Foundation::EventRegistrationToken *token) = 0;

The macro __FIEventHandler_1_IInspectable defined in windows.fondation.h(Windows10 SDK 10.0.17763.0) line 3576:
#define __FIVector_1_Windows__CFoundation__CPoint ABI::Windows::Foundation::Collections::__FIVector_1_Windows__CFoundation__CPoint_t

but no longer exists in Windows 10 SDK 10.0.19041.0.
After searching this macro in the sdk include path, I found that it was defined in many header files. But it should be replaced in windows.system.h .
2020-06-10 09:38:43 -07:00
Sam Lantinga
4d15b5b893 Fixed building with Visual Studio 2019 2020-06-10 09:36:10 -07:00
Sam Lantinga
44f50c647e Fixed bug 5171 - PollEvent impacts performance in 2.0.12
On some systems, GetClipCursor() impacts performance when called frequently, so only call it every once in a while to make sure we haven't lost our capture.
2020-06-09 21:47:41 -07:00
Sam Lantinga
511a9702fc Fixed whitespace 2020-06-09 21:43:00 -07:00
Sam Lantinga
aefe19ff08 Added support for the NACON Revolution Pro Controller 3 and the GameStop PS4 Fun Controller 2020-06-09 11:31:39 -07:00
Sam Lantinga
6f241bd520 Fixed build 2020-06-09 10:47:29 -07:00
Sam Lantinga
086be21e7a ControllerList: add support for NACON asymetric controller and Revolution 3, Hori mini wireless ps4 controller, and 2 PDP switch controllers 2020-06-09 10:47:27 -07:00
Sam Lantinga
3b76109f64 ControllerList: remove giotek controller from list - vid/pid appears to be reused in bunch of devies including ones with different fw/protocol and treating as ps4 controller breaks them. 2020-06-09 10:47:25 -07:00
Sam Lantinga
a9cfac3835 Controller: Deadzone improvements 2020-06-09 10:47:23 -07:00
Sam Lantinga
9fa8d6d0be Define constants not available on older kernels 2020-06-08 17:07:55 -07:00
Sam Lantinga
3ac24bfc1a Fixed mouse drag with an external mouse on iOS 2020-06-08 17:01:50 -07:00
Sam Lantinga
d0947c1483 Fixed exception if getManifestEnvironmentVariables() is called without a current SDL activity 2020-06-04 12:30:25 -07:00
Sam Lantinga
ff53521bc6 Fixed Bluetooth audio output on Apple TV 2020-06-04 12:26:57 -07:00
Sam Lantinga
cced5eb937 Fixed bug 5169 - Can not build current sources because of recent thread management changes
Manuel Alfayate Corchete

I'm trying to build SDL2 with threads support here in GNU/Linux, both X86 and ARM, and it does not seem to be possible ATM:


/home/manuel/src/SDLLLL/src/core/linux/SDL_threadprio.c:233:26: error: 'rtkit_max_realtime_priority' undeclared (first use in this function)
2020-06-04 09:23:18 -07:00
Sam Lantinga
958c42827c Fixed build warning 2020-06-04 09:13:49 -07:00
Sam Lantinga
49501a9860 Updated configure with changes from configure.ac 2020-06-04 09:10:49 -07:00
Sam Lantinga
22ce194b17 Make sure SDL_locale.h is included in the Xcode Framework for macOS 2020-06-03 14:58:38 -07:00
Sam Lantinga
b9d5aebb3a Make sure SDL_locale.h is included in the Xcode Framework for tvOS 2020-06-03 14:56:35 -07:00
Sam Lantinga
550b209e90 Make sure SDL_locale.h is included in the Xcode Framework 2020-06-03 14:26:37 -07:00
Ryan C. Gordon
60435712f2 video: Set window->surface NULL after freeing it.
Otherwise, when SDL_CreateWindowFramebuffer() is called again, it will return
the free'd surface instead of creating a new one.
2020-06-03 16:42:19 -04:00
Sam Lantinga
eea0b0e088 Fixed bug 5168 - Memory leak in RAWINPUT_JoystickOpen
meyraud705

Variable 'hwdata' is not freed in RAWINPUT_JoystickOpen if device->driver->OpenJoystick() fails.
2020-06-02 17:08:31 -07:00
Cameron Gutman
134362e745 Enable Xbox One HIDAPI driver on macOS
The Xbox One HIDAPI driver is required on macOS for Xbox One S Bluetooth
support since https://hg.libsdl.org/SDL/rev/10c3a10908e9
2020-04-25 19:15:51 -07:00
Sam Lantinga
ac1f174ad5 Fixed bug 5167 - Memory leak in GuessXInputDevice
meyraud705

Variable 'devices' is not freed if function GuessXInputDevice, in SDL_xinputjoystick.c, return early.
2020-06-02 17:02:37 -07:00
Sam Lantinga
06267f5028 Fixed whitespace in SDL_vulkan.h 2020-06-02 16:59:54 -07:00
Sam Lantinga
d48c97c4a4 Fixed bug 5147 - KMSDRM: SetWindowFullscreen() failing with SDL_WINDOW_FULLSCREEN_DESKTOP
Manuel Alfayate Corchete

This patch is needed so programs that do this work as expected:
1) Start in a different video mode than the mode used by the system and then...
2) Try to go fullscreen with the mode originally used by the system via SetWindowFullScreen() with the SDL_WINDOW_FULLSCREEN_DESKTOP flag.

An example would be pt2-clone in https://github.com/8bitbubsy/pt2-clone.
This program does this:

Starts with:

video.window = SDL_CreateWindow("", SDL_WINDOWPOS_CENTERED,
    SDL_WINDOWPOS_CENTERED, screenW, screenH, windowFlags);


and then, *IF* the user has configured it in fullscreen mode in its .ini, it tries to go fullscreen with the desktop mode:

SDL_SetWindowFullscreen(video.window, SDL_WINDOW_FULLSCREEN_DESKTOP);


This sequence of operations is currently failing because SDL_SetDisplayModeForDisplay() in SDL_video.c fails because display->desktop_mode is not being initialized with its correct value: SetDisplayMode() in SDL_kmsdrmvideo.c will not be able to set the mode because it detects the mode to have a driverdata of 0x0 ("if (!modedata)") and rightfully returns an error.

So, the included patch fixes this small problem, and programs that first change the video mode and then try to go fullscreen with the system video mode will now work.
The patch simply fixes an small omission, but its really needed now that dynamic video mode changing was implemented on the KMSDRM backend.
2020-06-02 16:57:20 -07:00