Commit Graph

11578 Commits

Author SHA1 Message Date
Sam Lantinga
e3e41b69a1 Revert "Check to make sure the Windows joystick device has buttons and axes"
This reverts commit 642504bc5993a6acd4d9c1d4c1314c6b1cf6e4e1.

We have SDL_HINT_JOYSTICK_ROG_CHAKRAM to ignore or allow the ROG Chakram X mouse to be used as a joystick.

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

(cherry picked from commit e5a15f94e2f1a8fbbffb25ea9932cda9679a68fd)
2023-10-22 09:24:23 -07:00
Ozkan Sezer
44d8721087 Allow building against old Linux kernels. 2023-10-19 11:14:20 +03:00
Cameron Gutman
4aab2342e9 Check for device disconnection in HIDAPI_JoystickOpen()
HIDAPI joystick drivers may call HIDAPI_JoystickDisconnected() in their
UpdateDevice() function during HIDAPI_JoystickOpen(). If they do this
today, the opened joystick will end up partially initialized (no name,
path, mapping GUID, etc.) because HIDAPI_GetDeviceByIndex() will no
longer be able to find the SDL_HIDAPI_Device for the removed joystick.

Worse still, joystick->hwdata->device becomes a dangling freed pointer
the next time HIDAPI_UpdateDeviceList() is called. This leads to a UAF
when the application or SDL calls SDL_JoystickClose() on this joystick.

Fix all this by checking if the device no longer has any associated
joysticks after calling UpdateDevice() and failing the open call if so.

(cherry picked from commit 435e7ce663b7e568086c5dc0fb1bb889e41a3ed1)
2023-10-17 22:18:52 -05:00
Sylvain
df6db90dd4 Fix sdltest_randomAsciiStringWithMaximumLength() where it requests a string a size 0
seen with: ./testautomation --seed MILAFAP2AKVP3V4G --filter sdltest_randomAsciiStringWithMaximumLength
2023-10-13 20:23:01 +02:00
Ryan C. Gordon
d8b34b0993
pulseaudio: Stop the threaded mainloop before destroying the context.
Otherwise, we might trigger an assertion in libpulse.

Reference Issue #8348.

(cherry picked from commit 10fab3a39e2bd163cc45147b6afd517501801002)
2023-10-13 09:36:06 -04:00
Ryan C. Gordon
2849ca404e
x11: Properly check for XInput2 support before using it.
This specifically fixes a crash in X11_WarpMouseInternal if XInput2 was
missing at runtime, but also cleans up a few other existing checks.

Fixes #8378.

(cherry picked from commit 82f54af6177f3d50be1db42a528027ada6ea0a20)
2023-10-11 01:09:46 -04:00
Anonymous Maarten
e417c6cffe ci: stop FreeBSD job after 30 minutes 2023-10-11 00:23:10 +02:00
Ryan C. Gordon
32587bd7de
Sync wiki -> header 2023-10-10 10:19:51 -04:00
Ozkan Sezer
b7a0ef6bdf artsaudio: revert bad arts_init return code check from commit ce5da5d. 2023-10-10 10:40:20 +03:00
Frank Praznik
7010452062 tests: Disable mouse warp test under Wayland
Wayland does not allow warping the mouse pointer, thus these tests are unreliable and should be skipped.

(cherry picked from commit 9111c5e17843155019d444159a394ee480394056)
2023-10-09 12:58:22 -04:00
Frank Praznik
e8c915dacc wayland: Try to skip the Wayland driver if not connecting to or in a Wayland session
When initializing the Wayland driver, check if the application is being started in, or trying to connect to, a Wayland session and skip to another driver if not. If neither WAYLAND_DISPLAY nor XDG_SESSION_TYPE are set, try to start anyway, and if the Wayland library is missing or no Wayland sessions are started, initialization will fail later in the process as it previously did.

This fixes the case where a Wayland session is running on a different VT, but an application wishes to run via KMSDRM on the current VT.

(cherry picked from commit 836927edf8da93ca2d3c8dddf7653113da65ce65)
2023-10-09 12:49:15 -04:00
KWottrich
25b0081367 Backport #7697 to SDL 2
Backport fixes from #8349

Include changes from #8357
2023-10-08 16:37:23 -07:00
Frank Praznik
c4a169a6fc Fix automated video tests under X11/Wayland
Backports of f30a182 and f8e8dff
2023-10-06 16:22:46 -04:00
Frank Praznik
1d8dbb2896 wayland: Unref the libdecor window when hiding
Hiding the decorations while not unreferencing the frame was a workaround for an internal libdecor use-after-free bug that was fixed some time ago. Revert to unreferencing the window when hiding to ensure that it is properly destroyed.

Reverts dd2e318
2023-10-05 20:26:06 +02:00
Anonymous Maarten
43c57e3239 triangle: don't read destination pixel when you're going to discard it anyways 2023-10-05 13:46:28 +02:00
Anonymous Maarten
2d5c05a69c blit_slow: don't read destination pixel when you're going to discard it anyways
(cherry picked from commit 4cd0c13823551cce279c9ff3d284c41c28deb3d8)
2023-10-04 19:42:46 -07:00
Anonymous Maarten
321c2f8f24 ci: disable Intel compilers 2023-10-02 09:14:29 +02:00
Frank Praznik
f9dc49c21c Fix automated tests using the dummy video driver
Manual backport of b8d9125
2023-09-30 11:21:10 -04:00
Anonymous Maarten
71b7790be8 snd_pcm_plugin_flush was removed in QNX 7.1 and later
Co-authored-by: elahav <elahav@users.noreply.github.com>
2023-09-30 16:48:51 +02:00
Anonymous Maarten
933ec9e978 cmake: add qnx support
Co-authored-by: elahav <elahav@users.noreply.github.com>
2023-09-30 16:48:51 +02:00
Anonymous Maarten
a263cc2369 Allow the use of posix_spawn() instead of vfork/execlp()
Backport of #7041

Co-authored-by: elahav <elahav@users.noreply.github.com>
2023-09-30 16:48:51 +02:00
Simon McVittie
6b5eadb10f SDLTest_CompareSurfaces: Decode pixels correctly on big-endian platforms
Previously, if acting on a surface with less than 32 bits per pixel,
this code was placing the pixel value from the surface in the first
few bytes of the Uint32 to be decoded, and unrelated data from a
subsequent pixel in the remaining bytes.

Because SDL_GetRGBA takes the bits to be decoded from the
least-significant bits of the given value, ignoring the higher-order
bits if any, this happened to be correct on little-endian platforms,
where the first few bytes store the least-significant bits of an
integer.

However, it was incorrect on big-endian, where the first few bytes are
the most-significant bits of an integer.

The previous implementation also assumed that unaligned access to a
32-bit quantity is possible, which is not the case on all CPUs (but
happens to be true on x86).

These issues were not discovered until now because
SDLTest_CompareSurfaces() is only used in testautomation, which until
recently was not being run routinely at build-time, because it contained
other assumptions that can fail in an autobuilder or CI environment.

Resolves: https://github.com/libsdl-org/SDL/issues/8315
Signed-off-by: Simon McVittie <smcv@collabora.com>
(cherry picked from commit d95d2d7051e23271db7cec43134582834fb3ac8b)
2023-09-29 06:56:50 -07:00
Sam Lantinga
9772d0512c SDL_iconv_string() defaults to UTF-8
Fixes https://github.com/libsdl-org/SDL/issues/8287

(cherry picked from commit 1375d2049d9fd17cb0d9a47a0e256a42c3188f76)
2023-09-24 17:28:06 -07:00
Sam Lantinga
27f2df2292 Check for NULL before dereferencing newly allocated memory
Fixes https://github.com/libsdl-org/SDL/issues/8289

(cherry picked from commit 70a1bc69739016884a22abe6bf86f8a5deba29ef)
2023-09-24 17:18:41 -07:00
Ozkan Sezer
834e8898b9 SDL_dbus.h: define DBUS_TIMEOUT_USE_DEFAULT if not already defined.
(cherry picked from commit c521e1286be9284d3652569fab02718d9faa4d06)
2023-09-21 01:32:50 +03:00
Ryan C. Gordon
60070d0b3d
emscripten: Restore compatibility with existing emsdk releases.
(cherry picked from commit 5008521538ffe7931ecd0d11c4a5e75a05f54b5b)
2023-09-20 14:35:51 -04:00
Jaswant Panchumarti
330d420afc
Use EM_ASM_PTR when the return value is a pointer
- closes https://github.com/libsdl-org/SDL/issues/8241

(cherry picked from commit 953b55dd6da1dd9fb937f3c67a18c5cab2988599)
2023-09-20 14:35:02 -04:00
Frank Praznik
2fcbf321fa wayland: Fix drag offer leak
The data device leave function is intended for drag offers, not selections, and the function as was previously written was a no-op.

(cherry picked from commit 52efefca0450758848859b67c14fd853e3ddcf4d)
2023-09-20 11:13:03 -04:00
Colin Kinloch
a683ce4153 linux: Add portal drag and drop 2023-09-20 11:01:49 -04:00
Ozkan Sezer
95a6f986a0 update config.guess and config.sub from mainstream 2023-09-20 14:50:56 +03:00
Sam Lantinga
37dee79b74 Fixed sensor timestamp units for third-party PS5 controllers
(cherry picked from commit a72dfa6a5fe8d8901175db852de8686b83487522)
2023-09-18 13:00:33 -07:00
Sam Lantinga
62e7049a4f Fixed error: array subscript 2 is above array bounds of ‘const Uint8[2]’
Smart compilers don't like dereferencing off the end of arrays

(cherry picked from commit f6756047a4190d9c82222e4ec378bdb14a72f8d7)
2023-09-18 12:20:22 -07:00
Sam Lantinga
fff3c2573a Fixed sensor timestamp calculation for third-party PS5 controllers
(cherry picked from commit 7059a55ccca04b75145c3d23a317fbe1eb77039e)
2023-09-18 11:58:39 -07:00
Guldoman
70a2ac2f1c x11: Always update clipboard owner
This allows utilities like clipboard managers to keep track of the
changes.

(cherry picked from commit 65aaf3a9ab9ec2be2973084060c2df5321b5acaa)
2023-09-15 05:23:02 -07:00
Max Bachmann
a8b9414697 detect fanatec steering wheels
(cherry picked from commit fd1c54a004250d844d82bb20ddfe75029585f53a)
2023-09-12 15:36:20 -07:00
Anonymous Maarten
92dc226018 cmake: make sure SDL_GetPrefPath is run before testfilesystem
60 seconds timeout ought to be sufficient.
2023-09-10 15:33:22 +02:00
Anonymous Maarten
2adebcd6cc ci: run tests in parallel 2023-09-10 15:20:34 +02:00
Ryan C. Gordon
ce32c44b54 docs: Added Emscripten filesystem notes. 2023-09-09 21:22:45 -04:00
Ryan C. Gordon
818a26f21b docs: Corrected/improved some Emscripten docs. 2023-09-09 21:22:45 -04:00
Ryan C. Gordon
5e6a851d6c docs: Fixed some Emscripten details 2023-09-09 21:22:45 -04:00
Ryan C. Gordon
f788a671e4 docs: Remove "more on this later" comment for something already covered. 2023-09-09 21:22:45 -04:00
Ryan C. Gordon
bd77b9a0ce docs: Rewrote README-emscripten.md
Fixes #6453.
2023-09-09 21:22:45 -04:00
Simon McVittie
8ad043fc38 render: Enable clipping for zero-sized rectangles
Battle for Wesnoth apparently relies on being able to disable rendering
of UI elements by setting the clip rectangle to be empty.

Resolves: https://github.com/libsdl-org/SDL/issues/6896
Fixes: 00f05dcf "render: only enable clipping when the rectangle is valid"
Signed-off-by: Simon McVittie <smcv@collabora.com>
2023-09-09 11:14:04 -07:00
Anonymous Maarten
b388f6e32d cmake: use MSVC_RUNTIME_LIBRARY to force MT 2023-09-09 19:16:31 +02:00
Ryan C. Gordon
25eca09c7e
include: Replaced old Bugzilla URL.
(cherry picked from commit fb137703537411b9aa2206351082b87aba23a843)
2023-09-07 10:53:02 -04:00
Frank Praznik
88299502b4 wayland: Ensure that the toplevel window is recreated when switching decoration modes
If a compositor tries to change the decoration mode when initially creating a window, the hidden flag might not yet be unset if the decoration mode is changed during the initial roundtrip in Wayland_ShowWindow(). As hiding the window destroys the decoration manager object, the hidden flag check is unnecessary, as the decoration configuration listener will never be entered when the window is hidden.

(cherry picked from commit 37e1fc3b5894f379f4f8253b867a76a135213a7d)
2023-09-06 14:56:16 -04:00
Makarenko Oleg
1d495351a0 Detect Simagic wheel bases as wheels (#8198)
Simagic DirectDrive wheel bases have the same vendor + product id's

(cherry picked from commit a2c1984d371e86e97bd6ffb176e835925e6afb3a)
2023-09-04 12:12:21 -07:00
Oleg
365a36386a Detect Logitech G923 Playstation as wheel
G923 have two different versions - Xbox version is already present in the wheel list, but not the PS version.

(cherry picked from commit 266b91d2fd2b3362d1828f8a6b58589bdaa4f75d)
2023-09-04 11:05:52 -07:00
Oleg
242b25aba4 Detect Logitech PRO Racing Wheel for Xbox (PC mode) as wheel
Logitech PRO Racing Wheel have two different versions - for Playstation and Xbox. Vendor + Product ID for Playstation version already present in SDL sources, but not an Xbox version

(cherry picked from commit cde67ea49ad812088bd5c8cfd67ef090ac1c1d86)
2023-09-04 11:01:52 -07:00
Jeremy Demeule
aa7ba62978 metal: Add hint to select low power device instead of the default one (#8182)
On some system like MacBook Pro Intel with AMD card, asking for the default device will always return the AMD GPU.
This is not an issue for 99% of the case when the renderer context is here to provide the maximum performance level like for game.
However, for video application using GPU for 1 quad and 1 texture, using the discrete GPU for that lead to an important power consumption (4 to 8W), heat increase, and fan noise.
With this patch, I successfully amend ffplay to only use the integrated GPU (i.e. the Intel one), instead of the discrete GPU (i.e. the AMD one).
2023-08-31 01:55:18 -07:00