Commit graph

10190 commits

Author SHA1 Message Date
Ryan C. Gordon d6e939ddb5 coreaudio: Don't crash on shutdown in a race condition.
Fixed #6159.
(cherry picked from commit 411582c710)
2022-09-28 17:01:50 +03:00
Ryan C. Gordon 128c34b839 cocoa: Fix new windows setting SDL_WINDOW_BORDERLESS flag incorrectly.
Fixes #6172.
(cherry picked from commit 57b20e7b9e)
2022-09-27 21:33:40 +03:00
Anonymous Maarten a1026d6368 cmake: use check_symbol_exists to check dlopen + need for dl library
(cherry-picked from commit bfecd78159)
2022-09-27 17:01:01 +03:00
Ozkan Sezer d8b2a165af autotools: revised and silenced esound detection a bit.
(cherry-picked from commit 6b75a592a4)
2022-09-27 17:01:01 +03:00
Simon McVittie 4657d8be0d autotools: Require GNU sort
find_lib() uses sort -V, which is a GNU extension. Users of non-GNU
operating systems should either install GNU coreutils (assumed to
provide a gsort executable), or use the CMake build system.

Resolves: https://github.com/libsdl-org/SDL/issues/6106
Signed-off-by: Simon McVittie <smcv@collabora.com>
(cherry-picked from commit 732e1530e3)
2022-09-27 17:01:01 +03:00
Anonymous Maarten c7950bf0c6 cmake: only add -Wl,--undefined=WinMain when building an executable
(cherry-picked from commit 653e433c08)
2022-09-27 14:37:55 +03:00
Sylvain 0f2503cf8a Fixed bug #6287 - SDL_FillRect failed for SDL_Surface with BitsPerPixel == 4
(cherry-picked from commit d71df6448b)
2022-09-27 14:22:32 +03:00
Ozkan Sezer 6ba5f08e5d add missing quotes to the fallback CHECK_OBJC_SOURCE_COMPILES macro
Closes:  https://github.com/libsdl-org/SDL/issues/6268 .
(cherry picked from commit 098a7a043e)
2022-09-21 10:37:40 +03:00
Ozkan Sezer 7bf4ca60f6 autotools: stop using AC_FUNC_MEMCMP and AC_FUNC_STRTOD
Closes:  https://github.com/libsdl-org/SDL/issues/6266 .
(cherry picked from commit db225dec41)
2022-09-20 21:39:10 +03:00
Anonymous Maarten 4d78a6fad4 cmake: only add -Wl,--undefined=WinMain when building an executable
(cherry picked from commit 3b20e0ecef)
2022-09-19 05:02:04 +03:00
Cameron Cawley 59e04dcc0b Fix SDL_PIXELFORMAT_INDEX1LSB test case 2022-09-18 01:29:56 +03:00
Cameron Cawley fa239a2192 Fix incorrect return value in X11_GetPixelFormatFromVisualInfo 2022-09-18 01:29:56 +03:00
Ozkan Sezer 45362dfe31 SDL_windows.h: guard WIN32_LEAN_AND_MEAN and STRICT macro defines.
also define them as 1, instead of empty.
Reference issue: https://github.com/libsdl-org/SDL/issues/6239
(cherry picked from commit 339f7a2f6b)
2022-09-17 17:40:10 +03:00
Ozkan Sezer 0df4d123db SDL_offscreenwindow.c: swap include order of SDL_egl_c.h/SDL_sysvideo.h
Fixes redefinition warnings from windows builds.
Reference issue: https://github.com/libsdl-org/SDL/issues/6239
(cherry picked from commit d86cb8ec9e)
2022-09-17 17:40:07 +03:00
Sam Lantinga ffcf32b4ff Fixed building with libusb not dynamicaly loaded
(cherry-picked from commit 3f89d1704d)
(cherry-picked from commit 4ebf34857a)
(cherry-picked from commit 5767dc710e)
(cherry-picked from commit 9d77945d36)
(cherry-picked from commit 2847696338)
2022-09-12 23:55:56 +03:00
Sam Lantinga 531ddf5eb5 Fixed macOS framework detection in sdl2.m4
Fixes https://github.com/libsdl-org/SDL/issues/6141
(cherry picked from commit 3d516b841a)
2022-09-12 23:28:28 +03:00
Sam Lantinga abac672a2d Fixed crash if there are no devices available
(cherry picked from commit 679582e702)
2022-09-12 21:33:50 +03:00
Ozkan Sezer 782862b95c apply commit d0a3570300 to cmake side too.
(cherry-picked from commit 5b2884cb02)
2022-09-12 20:37:56 +03:00
Ozkan Sezer 525e201728 regenerated configure script.
(cherry-picked from commit d936499670)
2022-09-12 20:37:56 +03:00
Sam James 0680314c2a configure.ac: fix configure tests broken with Clang 15 (implicit function declarations)
Clang 15 makes implicit function declarations fatal by default which
leads to some configure tests silently failing/returning
the wrong result.

Signed-off-by: Sam James <sam@gentoo.org>
(cherry-picked from commit d0a3570300)
2022-09-12 20:37:56 +03:00
Ozkan Sezer 7be77f0b3d Fix https://github.com/libsdl-org/SDL/issues/6191
(cherry picked from commit 5ffede35d9)
2022-09-06 19:56:55 +03:00
Cameron Cawley e70db38d60 Fix compatibility with Windows XP
(cherry picked from commit 10e1ef00e2)
2022-09-06 17:10:00 +03:00
Anonymous Maarten 08e8824372 cmake: fix location of SDL2::SDL2test imported library 2022-09-05 21:54:48 +02:00
Gleb Mazovetskiy b6661c016b CMake: Make SDL_SHARED/STATIC/TEST options
This makes it easier to set these options when SDL is used as a subprojects.
Since CMake v3.13+, one can simply `set(SDL_TEST OFF)` before include the SDL2 subproject because options do not override existing variables. (https://cmake.org/cmake/help/latest/policy/CMP0077.html#policy:CMP0077)
This is also true for `set(CACHE)` commands but only in CMake v3.21+ (https://cmake.org/cmake/help/latest/policy/CMP0126.html).
2022-09-04 13:59:43 +02:00
Anonymous Maarten 62302d08f1 cmake: always create SDL2::SDL2main target in autotools' cmake config script 2022-08-24 06:41:20 -07:00
Anonymous Maarten b19e2f1e56 cmake: create SDL2::SDL2main target in Apple framework official release 2022-08-24 06:41:20 -07:00
Oleg Derevenetz ac44b22a24 Use __ARM_ARCH instead of __ARM_ARCH__ 2022-08-22 18:22:03 -07:00
slime 84004d1e47 cocoa: change Shape data to use ObjC objects instead of C structs.
Fixes #6089
2022-08-21 15:36:34 -07:00
Anonymous Maarten 329794daf3 cmake: add library directories & pthread to imported targets of sdl2-config.cmake
This fixes linking to SDL2::SDL2-static on systems where external libraries such as X11 are not in a standard location.
Pthread also needs special care.
2022-08-20 19:17:37 -07:00
Sam Lantinga 3739dda6bd Fixed minimized window detection when handling WM_WINDOWPOSCHANGED
When minimizing a window, we get this sequence of events:
WM_WINDOWPOSCHANGING
WM_GETMINMAXINFO
WM_NCCALCSIZE
WM_WINDOWPOSCHANGED - IsIconic() is true
WM_MOVE
WM_SIZE - SDL sees minimized state here

When restoring a window, we get this sequence of events:
WM_WINDOWPOSCHANGING
WM_GETMINMAXINFO
WM_NCCALCSIZE
WM_NCPAINT
WM_ERASEBKGND
WM_WINDOWPOSCHANGED - IsIconic() is false
WM_MOVE
WM_SIZE - SDL sees restored state here

On Windows 10 a minimized window has a non-empty client rect, so we were delivering a minimized size before SDL knows that the window is minimized, and then ignoring the restored size when handling the restore message.

The fix is to use IsIconic() which returns the correct window state when WM_WINDOWPOSCHANGED is actually delivered.
2022-08-19 17:40:30 -07:00
Sam Lantinga 8c9beb0c87 Updated to version Updated to version 2.24.0 for release 2022-08-19 08:44:09 -07:00
Sam Lantinga 6e007c36e7 Add null termination to Wayland_data_source_get_data() if requested
Fixes https://github.com/libsdl-org/SDL/issues/6083
2022-08-18 19:05:55 -07:00
Sam Lantinga 948dbe7d3f Don't include the null terminator in Wayland clipboard text
Fixes https://github.com/libsdl-org/SDL/issues/6083
2022-08-18 16:24:20 -07:00
Sam Lantinga f6b81125b3 Always define SDL_COMPILE_TIME_ASSERT as static_assert() in C++
Apparently some versions of gcc will define __STDC_VERSION__ even when compiling in C++ mode.

Fixes https://github.com/libsdl-org/SDL/issues/6078
2022-08-18 16:06:42 -07:00
Frank Praznik 3bae2d57da wayland: Set the libdecor app ID after visibility calls
Set the frame app ID after toggling visibility or the name displayed in window manager task switchers may not display correctly.
2022-08-18 10:58:32 -07:00
Ryan C. Gordon 51be30f3cd
emscripten-buildbot.sh: force -s USE_SDL=0
This avoids using Emscripten-provided SDL headers from its own
sysroot instead of the headers in our own include directory!

Reference https://github.com/emscripten-core/emscripten/discussions/17647
2022-08-17 21:39:59 -04:00
Sam Lantinga 8acb4e45b3 Fixed interactions between mouse capture and grab on X11
Fixes https://github.com/libsdl-org/SDL/issues/6072
2022-08-17 14:26:34 -07:00
Frank Praznik 7da74eb5be wayland: Never commit with an undefined window title
If libdecor performs a commit with the frame title being undefined, a crash can occur within the library or its plugins. Always ensure that the title is set to a valid string to avoid this.
2022-08-17 12:40:16 -07:00
Cameron Gutman 99e9156ff5 testgles2: Fix typo in help text 2022-08-16 20:38:55 -07:00
Cameron Cawley 09b6956dcc opengl: Support NV12 textures on GPUs with only 2 texture units 2022-08-16 07:30:13 -07:00
Cameron Cawley 2fcd8f889c Handle SDL_PIXELFORMAT_EXTERNAL_OES in SDL_GetPixelFormatName() 2022-08-16 07:29:45 -07:00
Cameron Gutman 222f1a2693 testgles2: Add --threaded option to use a render thread per window
This is helpful for reproducing bugs like #6056
2022-08-16 07:29:07 -07:00
Sam Lantinga 9670d2bb9e Make sure we hold the joystick lock when disconnecting a HIDAPI joystick
This prevents crashes when calling SDL joystick API functions from a different thread while disconnection is happening.

See https://github.com/libsdl-org/SDL/issues/6063 for a more thorough review of joystick locking.
2022-08-15 17:28:50 -07:00
Ryan C. Gordon 26948f01a3 cocoa: Make SDL_MinimizeWindow() work with borderless windows.
Fixes #6046.
2022-08-15 20:09:09 -04:00
Frank Praznik 650612fdcb wayland: Eliminate excessive calls to SetFullscreen
Eliminate excessive calls to SetFullscreen by removing the calls in the libdecor and xdg-toplevel config callbacks.

These calls were being made there in case something explicitly called the window minimization function from within SDL, which unsets fullscreen, and as minimizing a window in Wayland is just a suggestion to the compositor and doesn't actually change the window state or communicate anything back to the application, it was necessary to call SetFullscreen in every call to the config functions just in case something minimized a window via SDL_MinimizeWindow() and later needed to restore it.  GNOME in particular had issues when fullscreen set/unset operations were being hammered, leading to overlapping acks and commits when switching to fullscreen.

With the new video system flag to disable unsetting fullscreen when minimizing a window, these calls in the configuration functions are no longer needed and can be removed. This significantly reduces calls to the SetFullscreen() function, reverts #6044 while fixing the issue, and fixes a similar problem when hiding and showing a window initially created with fullscreen flags.
2022-08-15 11:16:20 -07:00
Frank Praznik cc9cc2028d video: Add video device quirk flags and apply them to the video subsystem
Add quirk flags to the video device struct and add flags to allow video backend drivers to disable mode switching and disable unsetting the fullscreen mode when minimizing a window. As certain platforms can have multiple video backends compiled in at once, #ifdefs, as used by other platforms, aren't suitable as different backends on the same platform may not need the same quirks.

This replaces the formerly dedicated 'disable_display_mode_switching' boolean as additional quirks are needed by the Wayland backend.  Helper functions have also been added to simplify reading the flag states.
2022-08-15 11:16:20 -07:00
Sam Lantinga 0cc8dfdb58 Added SDL_system.h for the declaration of SDL_iPhoneSetAnimationCallback() and SDL_iPhoneSetEventPump() 2022-08-15 07:44:56 -07:00
Mathieu Eyraud c6c688ab01 Add SDL_JOYBATTERYUPDATED event to SDL_JoystickEventState() 2022-08-14 07:00:12 -07:00
Frank Praznik b72cf207fb core: linux: Don't cache the RealtimeKit D-Bus connection
If the D-Bus subsystem is shutdown and restarted mid-execution, the cached connection will be invalid. Fetch it each time that it is used to ensure that the connection is always from the current context.
2022-08-14 06:59:18 -07:00
Francisco Javier Trujillo Mata 7d5ccae22d Fix memory leak when destroying texture 2022-08-14 08:13:37 -04:00