Commit Graph

11210 Commits

Author SHA1 Message Date
Ozkan Sezer
d47ff8ae73 SDL_thread.h: fix SDL_CreateThreadWithStackSize macro for OS/2 2022-12-27 00:14:00 +03:00
Ozkan Sezer
738442b82a SDL_thread.h: fix beginthread param of SDL_CreateThreadWithStackSize for win32
(cherry-picked from commit 29ba5f5d6426f36ee84304dc8a0e111416450aab)
2022-12-27 00:11:55 +03:00
Vincent Hamm
68073c6276 Fix SDL_CreateThreadWithStackSize not passing staacksize with win32 static api 2022-12-26 11:22:41 -08:00
Sam Lantinga
920acb75c3 editorconfig: remove trailing whitespace in source code
(cherry picked from commit 7c67213cefd0404232ef758a1dc33751e717a3f1)
2022-12-26 10:34:45 -08:00
Sam Lantinga
3dbc6a40ae render: only enable clipping when the rectangle is valid
Fixes https://github.com/libsdl-org/SDL/issues/6896

(cherry picked from commit 00f05dcf49602889733262fc810386592ff51736)
2022-12-26 10:25:23 -08:00
João Henrique
af54c82138 kmsdrm: Fix wrong check on KMSDRM_CreateWindow.
A previous cleanup commit inverted a statement that checked the return value of
a KMSDRM_CreateSurfaces call during KMSDRM_CreateWindow, which causes the video
backend to always fail despite success.

This commit restores the intended behavior.

Fixes: 3c501b963dd8 ("Clang-Tidy fixes (#6725)").
(cherry picked from commit 0187209f461b84d22fc49a03369506e06448f47f)
2022-12-23 09:29:49 -08:00
Rudolf-Walter Kiss-Szakacs
232ed540db Add SDL_HINT_WINDOWS_ENABLE_MENU_MNEMONICS. 2022-12-22 08:59:56 -08:00
Caleb Cornett
c542aef600 Fix GDK OpenGL build error 2022-12-20 23:22:55 -05:00
Caleb Cornett
abffa1194a Fix dynapi signature for SDL_GDKSuspendComplete 2022-12-20 23:17:50 -05:00
Caleb Cornett
3b3c141ff9 gdk: Add support for building with OpenGL on Xbox 2022-12-19 17:57:17 -05:00
Sam Lantinga
6969b3be3b Don't send Razer devices the Sony third-party query feature report
Some of them lock up or reset, and the vast majority of devices are not actually game controllers.

Fixes https://github.com/libsdl-org/SDL/issues/6733

(cherry picked from commit 83b29f9ce1fe6caa06769544c3b5f6c10ea97a0f)
2022-12-19 09:16:59 -08:00
Maido
311b02f0b5
Android active driver check (#6850)
Check if a driver is active before attempting to handle the devices.
Otherwise an assertion will fail.
2022-12-19 16:02:42 +01:00
Sylvain Becker
36c87d9f27
Android JAVA DetectDevices: 'is_capture' is inverted (#6845)
* Android JAVA DetectDevices: 'is_capture' is inversed
* Android Audio: adding audio device. also inverted capture, from jni side
2022-12-18 16:56:43 +01:00
Sylvain Becker
4e3fc0c1dc
Android: make Detect devices common between aaudio and android driver. (#6828)
remove VLA, dynamic alloc, check max length get using GetIntArrayRegion
2022-12-18 12:08:24 +01:00
Sam Lantinga
187708e542 Fixed compiler warning
```
 ./src/thread/pthread/SDL_syssem.c:140:12: warning: variable 'retval' is used uninitialized whenever 'while' loop exits because its condition is false [-Wsometimes-uninitialized]
    while (sem_trywait(&sem->sem) != 0) {
           ^~~~~~~~~~~~~~~~~~~~~~~~~~~
./src/thread/pthread/SDL_syssem.c:149:12: note: uninitialized use occurs here
    return retval;
           ^~~~~~
./src/thread/pthread/SDL_syssem.c:140:12: note: remove the condition if it is always true
    while (sem_trywait(&sem->sem) != 0) {
```

This was a legitimate bug, thank you clang!

Fixes https://github.com/libsdl-org/SDL/issues/6830

(cherry picked from commit b678a9802435152324e0603055e4bb190d0ae526)
2022-12-17 06:59:19 -08:00
Sam Lantinga
3b0cd44158 Fixed compiler warning
```
 ./src/joystick/SDL_joystick.c:105:12: warning: no previous extern declaration for non-static variable 'SDL_joystick_lock' [-Wmissing-variable-declarations]
SDL_mutex *SDL_joystick_lock = NULL; /* This needs to support recursive locks */
           ^
./src/joystick/SDL_joystick.c:105:1: note: declare 'static' if the variable is not intended to be used outside of this translation unit
SDL_mutex *SDL_joystick_lock = NULL; /* This needs to support recursive locks */
^
```
1 warning generated.
2022-12-17 06:51:02 -08:00
Maido
741499dea7
Android audio device selection (#6824)
Make it possible to select a specific audio device for Android
2022-12-16 16:38:57 +01:00
Sam Lantinga
a53382e460 Sorted PS4 controllers, note that the NACON Wireless Controller for PS4 actually reports as an XInput device 2022-12-15 18:00:51 -08:00
Sam Lantinga
e99b9ca9c0 Note that the NACON Daija Arcade Stick is an arcade stick 2022-12-15 17:58:29 -08:00
Sylvain
8e72be3117
testime.c: fix wrong {} in switch 2022-12-15 14:39:05 +01:00
Sam Lantinga
7a9966af9d Fixed crash in SDL_PrivateGameControllerRefreshMapping() 2022-12-14 14:24:58 -08:00
Sam Lantinga
d59caffe2c Added support for clang thread-safety analysis
The annotations have been added to SDL_mutex.h and have been made public so applications can enable this for their own code.

Clang assumes that locking and unlocking can't fail, but SDL has the concept of a NULL mutex, so the mutex functions have been changed not to report errors if a mutex hasn't been initialized. We do have mutexes that might be accessed when they are NULL, notably in the event system, so this is an important change.

This commit cleans up a bunch of rare race conditions in the joystick and game controller code so now everything should be completely protected by the joystick lock.

To test this, change the compiler to "clang -Wthread-safety -Werror=thread-safety -DSDL_THREAD_SAFETY_ANALYSIS"
2022-12-14 09:29:19 -08:00
Sylvain Becker
582fb3901a
DBus: add a reference to the connection
Fixed bug #6712
2022-12-14 17:46:52 +01:00
Sam Lantinga
c709741871 Detect display change when fullscreen desktop windows move displays
This happens when using Win+Alt+Left/Right on a resizable fullscreen desktop window on Windows

(cherry picked from commit 650e16a8245f3fb5056fc7f6b398fb88244b3477)
2022-12-12 20:28:07 -08:00
Sam Lantinga
817454cfe6 Don't try to open the Razer Huntsman Elite keyboard as a controller 2022-12-12 18:00:57 -08:00
Ryan C. Gordon
e986c7984b
wasapi: Fixed incorrect assertions.
Fixes #6795.

(cherry picked from commit 12486e144be0e7a37abd87b8bf90547a992ff66b)
2022-12-12 16:08:52 -05:00
Frank Praznik
dfd7efaf13 wayland: Set xdg surface geometry
It was previously thought that these function calls were unnecessary as the initial bug and reproduction case that necessitated their addition seemed to be fixed, but apparently there are still cases where this needs to be set explicitly. Set the xdg surface geometry at creation time and when the window size changes.

Partially reverts #6361.  This is not needed in the libdecor path, as libdecor calls this for the content surface internally.

(cherry picked from commit 90a964f132c63b07cf85e5687041d214fdea60f6)
2022-12-12 11:22:18 -08:00
Sam Lantinga
802b5ef7dc Added support for the STRIKEPAD PS4 Grip Add-on to the HIDAPI driver
(cherry picked from commit 618340bf990512247ed29a1beb38606e371d60e8)
2022-12-12 10:56:08 -08:00
Pierre Wendling
e580e087ff N3DS: Backport semaphore fixes from #6776. 2022-12-11 17:09:28 -08:00
nfarid
b79732b967
cmake: use FindALSA.cmake to find ALSA library 2022-12-11 23:23:45 +01:00
Sylvain
faa7e3cc2e
Update DYNAPI SDL_WinRTRunApp() prototype which was wrong (see #6783) 2022-12-10 19:22:27 +01:00
Sylvain
5efc9bd194
SDL_dynapi_procs: fixed SDL_UIKitRunApp prototype (see #6783) 2022-12-10 19:22:08 +01:00
Ryan C. Gordon
4bae75387a
docs: Note that you don't need to free SDL_GetDefaultCursor's results.
Reference Issue #6777.

(cherry picked from commit 16f8dfcef944019ce4474061aa06c2a1997e601e)
2022-12-09 22:09:39 -05:00
Sam Lantinga
f57776836f Fixed build 2022-12-09 10:22:18 -08:00
Sam Lantinga
569fa3f57f Added test event logging for SDL_WINDOWEVENT_ICCPROF_CHANGED and SDL_WINDOWEVENT_DISPLAY_CHANGED 2022-12-09 10:13:18 -08:00
Sam Lantinga
be3b1cff0b Added logging for SDL_DISPLAYEVENT_MOVED 2022-12-08 17:03:29 -08:00
Sam Lantinga
ab479b4961 Make sure the display list is up to date for window placement 2022-12-08 17:01:18 -08:00
Sam Lantinga
264da8c127 Added SDL_DISPLAYEVENT_MOVED to detect when display positioning changes 2022-12-08 12:46:13 -08:00
Sam Lantinga
cfc7cac3c9 Fixed memory leak when removing existing displays 2022-12-08 12:43:23 -08:00
Frank Praznik
8b74be464f wayland: Handle the Num Lock and Caps Lock modifiers via modifier events
Num Lock and Caps Lock always need to be explicitly handled by the modifier handler function, or they won't be correctly set if active at application startup, or if the lock state is changed while the application lacks focus since a key press for these keys will never be received.  In these cases, the internal SDL modifier state can end up the inverse of the actual modifier state.

(cherry picked from commit 653e484da17d773f40bff94121a23a3b38f47a0a)
2022-12-08 09:30:22 -08:00
Sam Lantinga
fc689a6cb3 Fixed build 2022-12-07 16:06:17 -08:00
Sam Lantinga
b4d547905d Use the correct name for the DualSense controllers
(cherry picked from commit 9a6bcca6b8db999217f157dab8c44bf27b0a8eb4)
2022-12-07 14:54:00 -08:00
Sam Lantinga
4ee36a9474 Added support for the DualSense Edge paddles
(cherry picked from commit 9339085593dc20b1f003f26b3c40615cf04504b0)
2022-12-07 14:48:36 -08:00
Sam Lantinga
c2b2f2a71e Clarified where the paddle locations are
(cherry picked from commit ea714956b6e6851a279d1334309dd17b6d73cadc)
2022-12-07 14:47:07 -08:00
Sam Lantinga
d1b4810542 Fixed centering the D-pad on some joysticks
Fixes https://github.com/libsdl-org/SDL/issues/6767
2022-12-05 13:36:51 -08:00
Ozkan Sezer
bcccbbd894 tests: avoid redefinition warnings for MSVC _CRT_???_NO_DEPRECATE macros 2022-12-05 00:35:32 +03:00
Ozkan Sezer
4e465f25d0 reverted const removal from SDL_NewAudioStream in commit d0bbfdbfb. 2022-12-04 12:55:15 +03:00
Max Bachmann
7ac66972b7 Detect Logitech PRO Racing Wheel as wheel
(cherry picked from commit 5650046f931e9b1d7d7f4a1867e6e1ed75a5e7c5)
2022-12-03 08:22:05 -08:00
Sylvain
3e9ae3ea64
Fix wrong clang-tidy modification. This is an integer division. Thanks @meyraud705 (see PR #6725) 2022-12-03 13:39:03 +01:00
Sylvain
0a91a793cf
Fix Conditional jump or move depends on uninitialised value(s)
eg ./testsprite2 --trackmem
2022-12-02 21:13:40 +01:00