Use memfd_create() to allocate the temporary SHM backing file in memory, and set the size with posix_fallocate(), which will return an error on insufficient space vs ftruncate(), which will silently succeed and allow a SIGBUS error to occur if the unbacked memory is accessed.
Additionally, make the legacy path more robust by unlinking the temp file, so it won't persist after close, and unmapping the shared memory buffer.
(cherry picked from commit 9bdb992925)
(cherry picked from commit d3c89bb479)
This broke support for the Hori Fighting Stick EX2, which gets a good mapping if the automatic mapping is allowed to create one.
If the original controller needs a mapping, it should be added with a crc, since that VID/PID combination is used by several HORI controllers.
(cherry picked from commit d79f865251)
(cherry picked from commit e54774faca)
In particular this affects the doomsday game engine if no joystick or
gamepad is attached.
(cherry picked from commit 0dfdf1f3f2)
[smcv: Also included minor adjustment from https://github.com/libsdl-org/SDL/pull/9233]
(cherry picked from commit cd197be53b)
We either need to explicitly test using the sRGB colorspace or update the tests for HDR10 color conversion. We'll just disable them for now, as these formats aren't commonly used in games.
(cherry picked from commit f9c57e16b0)
The function calls strcmp internally without checking for a null string parameter, and calling strcmp with a null parameter is undefined behavior.
(cherry picked from commit f24216c2ba)
- Move legacy name choice to a separate function, so we can `return` a
string in one line instead of assign a variable and `break` for each item.
- Have the case statement cover SDL_NUM_SYSTEM_CURSORS, and not `default`, so
compiler will (maybe) warn us if an enum value is added but not included here.
- Only choose a legacy name if necessary.
(cherry picked from commit 827917ea60)
These previously mapped SIZEALL to "move", but "move" is not guaranteed
to be a four-pointed arrow: according to the CSS spec, it's actually
intended to be a drag-and-drop cursor, analogous to "alias" and "copy".
Map it to "all-scroll" instead, as in Wayland: while this is *also* not
semantically guaranteed to be a four-pointed arrow, it is at least
*suggested* to make it a four-pointed arrow.
Signed-off-by: Simon McVittie <smcv@collabora.com>
(cherry picked from commit aa6c390bbd)
SDL3's Wayland code already uses the CSS names exclusively with no
fallback, but since SDL2 has historically used the older names, keeping
them as a fallback makes sense if the CSS names don't work out.
[smcv: Added commit message]
Tested-by: Simon McVittie <smcv@collabora.com>
(cherry picked from commit 67827c0b00)
The "left_ptr" name is an X11 thing, and there's no guarantee that
Wayland cursor themes contain it. In particular, GNOME's Adwaita theme
as of version 46.beta only contains the CSS/freedesktop names.
To test, either move one of the known cursors out of the way, or edit
the switch statement above to use a wrong name for one of them.
Signed-off-by: Simon McVittie <smcv@collabora.com>
(cherry picked from commit e2535ba547)
Apparently this is necessary on the latest Gnome to get properly themed
cursors, vs ancient X11 standard cursors, as Gnome has dropped the old
theme names that XCreateFontCursor eventually expected to find.
Fixes#8939.
(cherry picked from commit cb9565354c)
They aren't used for anything, and cause problems if the video core tries to free them.
Manual backport of f9ba0e1
(cherry picked from commit 699cec1a8d)
- Timeout < 0 was not handled properly
- Return value for success is WAIT_OBJECT_0 + nCount, not positive value
(cherry picked from commit 69f2bd151e)
(cherry picked from commit 4ae87e215e)
mingw-w64 has added this from Proton (which added this from SDL), so we need to re-define it as a local symbol to avoid conflicting with mingw-w64 headers.
Fixes https://github.com/libsdl-org/SDL/issues/9031
(cherry picked from commit b7c61569f8)
(cherry picked from commit 93d7b6e50c)
Add missing guards around use of physicalInputProfile.
Add explicit import of Foundation which seems to be needed on some
systems to get the NSArray definition.
Add __unsafe_unretained to ObjC types in struct so the compiler doesn't
complain about that not being allowed with ARC.
Closes: #8979
(cherry picked from commit e0158f68e4)
(cherry picked from commit c53c351921)
(re)Fixes #6598
We need to remember to apply this again once we update from upstream headers.
(cherry picked from commit e67e0c5d55)
(cherry picked from commit fc787a41dc)
These originally checked for expected ± EPSILON as logged, but since
commit 880c6939 they check for expected ± max_err, where max_err may
need to be greater than EPSILON for very large expected results like
the ones in exp_regularCases().
Also, EPSILON is so small that the default precision of the %f format
(6 decimal places) would never actually have shown its effect, so log
it in scientific notation instead.
Fixes: 880c6939 "testautomation_math: do relative comparison + more precise correct trigonometric values"
Signed-off-by: Simon McVittie <smcv@collabora.com>
(cherry picked from commit 58907d2c27)
While looking at the other tests in this file, I noticed that instead
of checking for a result in the range of expected ± FLT_EPSILON as I
would have expected, these tests would accept any result strictly less
than expected + FLT_EPSILON, for example a wrong result that is very
large and negative. This is presumably not what was intended, so add
the SDL_fabs() that I assume was meant to be here.
Fixes: 474c8d00 "testautomation: don't do float equality tests"
Signed-off-by: Simon McVittie <smcv@collabora.com>
(cherry picked from commit a7bd18c0d5)
In the Steam Runtime 1 'scout' environment, when compiling for i386
using the default gcc-4.6, Exp(34.125) matches the desired value to the
precision shown in the log (6 decimal places) but is not an exact match
for the desired value.
Signed-off-by: Simon McVittie <smcv@collabora.com>
(cherry picked from commit f73abd49c3)
When Windows DPI scaling is enabled, the warp coordinates will be modified, so make sure we send exactly the coordinates that the warp attempted.
Fixes https://github.com/libsdl-org/SDL/issues/8940
(cherry picked from commit 8ce6fb2513)