Commit Graph

11509 Commits

Author SHA1 Message Date
Anonymous Maarten 24d145f4b6 cmake: add qnx support
Co-authored-by: elahav <elahav@users.noreply.github.com>
2023-09-30 16:53:53 +02:00
Anonymous Maarten 145ad48c0e 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:53:53 +02:00
Simon McVittie fd495bb57c 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 d95d2d7051)
(cherry picked from commit 6b5eadb10f)
2023-09-29 06:57:07 -07:00
Sam Lantinga d58fa94ee9 SDL_iconv_string() defaults to UTF-8
Fixes https://github.com/libsdl-org/SDL/issues/8287

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

(cherry picked from commit 70a1bc6973)
(cherry picked from commit 27f2df2292)
2023-09-24 17:19:03 -07:00
Ryan C. Gordon b93a8a86ab
emscripten: Restore compatibility with existing emsdk releases.
(cherry picked from commit 5008521538)
2023-09-20 14:37:56 -04:00
Jaswant Panchumarti 536f625bde
Use EM_ASM_PTR when the return value is a pointer
- closes https://github.com/libsdl-org/SDL/issues/8241

(cherry picked from commit 953b55dd6d)
2023-09-20 14:37:24 -04:00
Ozkan Sezer 1e18dc594e update config.guess and config.sub from mainstream 2023-09-20 14:50:56 +03:00
Sam Lantinga cc4973ea45 Fixed sensor timestamp units for third-party PS5 controllers
(cherry picked from commit a72dfa6a5f)
(cherry picked from commit 37dee79b74)
2023-09-18 13:00:50 -07:00
Sam Lantinga 8114bd9108 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 f6756047a4)
(cherry picked from commit 62e7049a4f)
2023-09-18 12:20:36 -07:00
Sam Lantinga 495fca1517 Fixed sensor timestamp calculation for third-party PS5 controllers
(cherry picked from commit 7059a55ccc)
(cherry picked from commit fff3c2573a)
2023-09-18 11:59:00 -07:00
Sam Clegg 7d80e20883 emscripten: Add JS library dependencies using EM_JS_DEPS macro
See https://github.com/emscripten-core/emscripten/pull/19780

(cherry picked from commit 042243471f)
2023-09-15 15:29:47 -07:00
Guldoman f3847c157a x11: Always update clipboard owner
This allows utilities like clipboard managers to keep track of the
changes.

(cherry picked from commit 65aaf3a9ab)
(cherry picked from commit 70a2ac2f1c)
2023-09-15 05:23:21 -07:00
Max Bachmann b576e29d9b detect fanatec steering wheels
(cherry picked from commit fd1c54a004)
(cherry picked from commit a8b9414697)
2023-09-12 15:36:41 -07:00
Anonymous Maarten c7ad8e5431 cmake: make sure SDL_GetPrefPath is run before testfilesystem
60 seconds timeout ought to be sufficient.
2023-09-10 15:34:29 +02:00
Anonymous Maarten 9c8ee3a154 ci: run tests in parallel 2023-09-10 15:34:29 +02:00
Simon McVittie d710e0be27 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>
(cherry picked from commit 8ad043fc38)
2023-09-09 11:14:25 -07:00
Anonymous Maarten b8d1f852db cmake: use MSVC_RUNTIME_LIBRARY to force MT 2023-09-09 19:17:36 +02:00
Makarenko Oleg e9ab663c43 Detect Simagic wheel bases as wheels (#8198)
Simagic DirectDrive wheel bases have the same vendor + product id's

(cherry picked from commit a2c1984d37)
(cherry picked from commit 1d495351a0)
2023-09-04 12:12:37 -07:00
Oleg c8d1de1a9b 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 266b91d2fd)
(cherry picked from commit 365a36386a)
2023-09-04 11:06:06 -07:00
Oleg bf8c9cd6bf 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 cde67ea49a)
(cherry picked from commit 242b25aba4)
2023-09-04 11:02:09 -07:00
Sam Lantinga 8a5ba43d00 Updated to version 2.28.3 for release 2023-09-01 11:22:07 -07:00
Jeremy Demeule c25a49c406 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).

(cherry picked from commit aa7ba62978)
2023-08-31 01:55:40 -07:00
Anonymous Maarten d46fdfa3ee wayland: add SDL_VIDEO_DRIVER_WAYLAND_DYNAMIC_EGL 2023-08-30 23:03:29 +02:00
Anonymous Maarten 787d339282 wayland: don't define SDL_VIDEO_DRIVER_WAYLAND_DYNAMIC_* macro's
They mess with #ifdef conditional in headers.
2023-08-30 22:46:53 +02:00
Sam Lantinga 874f6feab4 Fixed the report format for the Razer Wolverine V2 Pro
(cherry picked from commit 69aec8c915)
(cherry picked from commit 6ff48dddcb)
2023-08-24 11:39:15 -07:00
Sam Lantinga 1df4dce78f Accept key events from any source
This allows TV remotes to navigate SDL applications (with source HDMI)

Fixes https://github.com/libsdl-org/SDL/issues/8137
2023-08-24 10:12:04 -07:00
Sam Lantinga cc58a09c09 Updated to Android minSdkVersion 19 and targetSdkVersion 34
This is updated to meet the latest requirements for apps on the Google Play store

(cherry picked from commit 8e27a69370)
2023-08-24 08:33:04 -07:00
Sam Lantinga ae72cd57b5 Quiet spurious warning
Fixes https://github.com/libsdl-org/SDL/issues/8112

(cherry picked from commit 0b9d8e679a)
2023-08-13 13:54:45 -07:00
David CARLIER 8f858d7908 SDL_TriggerBreakppoint for riscv arch (both 32/64) version.
`ebreak` acts like int3 for x86, giving control of running process to debuggers.
(cherry picked from commit 723bcd0a8b)
2023-08-13 23:02:20 +03:00
Anonymous Maarten 5bfdb6e02f Fix overflow when doing SDL_sscanf("%hd", ...)
An overflow occured in the stdlib_sscanf test, when using msys2 clang32 toolchain.

(cherry picked from commit 342ec51131)
(cherry picked from commit 10135b2d7b)
2023-08-10 15:07:11 -07:00
Mathieu Eyraud 739d3ec189 Fix out of bound read of 'has_hat' array
(cherry picked from commit 94b3f78c44)
(cherry picked from commit f348370e1b)
2023-08-10 08:27:11 -07:00
Sam Lantinga 2319b2635b Fixed testautomation --filter pixels_allocFreePalette
Error messages are not part of the ABI, so we can't validate those.

Hand-picked from c9323f8fac
2023-08-08 11:50:00 +03:00
Sam Lantinga bda161d22b Fixed testautomation --filter pixels_allocFreeFormat
Error messages are not part of the ABI, so we can't validate those.

Technically SDL_AllocFormat() on a FOURCC format in SDL2 should fail, but SDL3 supports it and we don't expect SDL2 applications to actually do this, so skip that test.

Hand-picked from 5cf9438f88
2023-08-08 11:50:00 +03:00
Anonymous Maarten dbfd47e77d cmake: update cmake_minimum_required to avoid deprecated warning 2023-08-07 19:03:18 +02:00
Ryan C. Gordon dbb6cd02aa
include: fixed a typo in SDL_RenderGetMetalCommandEncoder docs.
(cherry picked from commit 8087c0a5d2)
2023-08-06 10:45:34 -04:00
Ozkan Sezer 841263c9d6 updated config.guess and config.sub from mainstream 2023-08-05 14:03:02 +03:00
Sam Lantinga 2ccb311cb7 Added a gamepad mapping for the G-Shark GS-GP702
Fixes https://github.com/libsdl-org/SDL/issues/8068

(cherry picked from commit 06bea1eb55)
(cherry picked from commit 2304b4e86a)
2023-08-02 14:39:09 -07:00
Sam Lantinga e0a345702d The Flydigi Vader and Apex series controllers all have the same VID, PID, and name
(cherry picked from commit 58e3084477)
(cherry picked from commit 0f753d9794)
2023-08-02 14:39:09 -07:00
Sam Lantinga 9fba36511f Removed Flydigi Vader 2 mappings
Many of the Flydigi controllers use the same VID/PID and have different mappings, so let's revisit this once we have more data.

(cherry picked from commit 5388edd549)
(cherry picked from commit 805fc29ae8)
2023-08-02 14:39:09 -07:00
Ozkan Sezer 45fb778fe5 adjusted coding style in SDL_os2_joystick.c to match rest of SDL better
(cherry picked from commit 57f3c41b97)
2023-08-02 20:40:24 +03:00
Sam Lantinga 031912c4b6 Updated to version 2.28.2 for release 2023-08-02 08:31:42 -07:00
Ozkan Sezer 348cc05b4f minor os/2 stuff merged from the bitwiseworks' fork
(cosmetics only.)
(cherry picked from commit b58557a3a6)
2023-08-02 17:10:50 +03:00
Ozkan Sezer e2e87a536c SDL_video.c: move ngage video before offscreen.
Reference issue: https://github.com/libsdl-org/SDL/pull/8069.
2023-08-02 17:00:10 +03:00
Ozkan Sezer 66d5ad19f0 SDL_video.c: move os2 video before offscreen.
as offscreen is enabled in CMakeLists.txt, we get a blanks window
otherwise.

From a patch by Silvan Scherrer, at Bitwiseworks' fork.
2023-08-02 09:26:41 -04:00
Sam Lantinga 94e945ccff Fixed build
(cherry picked from commit ebf2c49b50)
2023-08-02 01:37:24 -07:00
Sam Lantinga 3f93f56b6e Fixed duplicate key press/release events on iOS
When a hardware keyboard is attached, it can take over 100 ms for the keyboard event to generate text input. In that case we want to record that we recently received a keyboard event so we don't synthesize duplicate virtual key press/release events for the input text.

(cherry picked from commit 648de4f9b8)
(cherry picked from commit 38c63afd64)
2023-08-02 01:29:30 -07:00
Sam Lantinga ed5ef8fed4 Synchronize on-screen keyboard state with text input active state
When a hardware keyboard is attached to an iPad, you can easily trigger a set of on-screen keyboard transitions that will take place over time, and we need to track whether we're currently showing or hiding the keyboard and make sure we don't clobber the existing state during those transitions.

Testing:
* Connected a hardware keyboard to an iPad
* Launched checkkeys
* Noted the keyboard bar was active at the bottom of the screen and text input was active
* Tapped with both fingers to quickly toggle text input off and back on
* Noted the keyboard bar slid down and then back up, and text input was active
* Tapped on the keyboard bar to bring up the full on-screen keyboard and then closed it so the keyboard bar was still active, and text input was still active
* Tapped on the screen to turn text input off, noted the keyboard bar slid down
* Tapped with both fingers to quickly toggle text input on and back off
* Noted that the keyboard bar slid up and then back down, and text input was inactive
* Tapped on the screen to turn text input on, tapped on the keyboard bar to bring up the full on-screen keyboard, and text input was active
* Pressed a key on the physical keyboard, the on-screen keyboard closed, the key press and release was delivered (with no text input) and then the keyboard bar slid up, and text input was active again

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

(cherry picked from commit c3288d113e)
(cherry picked from commit 030bb7282a)
2023-08-02 01:29:30 -07:00
Sam Lantinga 39781eef09 Only pass keypresses up the responder chain when text input is active
This is another attempt to make sure we don't cause beeps from unhandled key presses while still allowing full text input functionalty.

If this isn't selective enough, we might need to go up the responder chain to see what's going to handle the event before passing it along.

Fixes https://github.com/libsdl-org/SDL/pull/6962

(cherry picked from commit a8abe612ed)
(cherry picked from commit 335e9c769a)
2023-08-02 01:29:30 -07:00
Sam Lantinga 3436124804 Revert "Stop beep when running iOS apps on ARM-based Macs"
This reverts commit bbf38bbbc3, which prevented text input from working when a hardware keyboard was connected, since key strokes don't get to the text input field.

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

(cherry picked from commit f5ea6ae18d)
(cherry picked from commit 5e9320f6b5)
2023-08-02 01:29:30 -07:00