Also fixed warning C6239: (<non-zero constant> && <expression>) always evaluates to the result of <expression>. Did you intend to use the bitwise-and operator?
At the earliest place, immediatly after driverdata is set.
(Doing it in SDL_render.c, after creation, would be too late, because there're renderers that already use/change those values in the CreateRender() function).
This means the allocator's caller doesn't need to use SDL_OutOfMemory directly
if the allocation fails.
This applies to the usual allocators: SDL_malloc, SDL_calloc, SDL_realloc
(all of these regardless of if the app supplied a custom allocator or we're
using system malloc() or an internal copy of dlmalloc under the hood),
SDL_aligned_alloc, SDL_small_alloc, SDL_strdup, SDL_asprintf, SDL_wcsdup...
probably others. If it returns something you can pass to SDL_free, it should
work.
The caller might still need to use SDL_OutOfMemory if something that wasn't
SDL allocated the memory: operator new in C++ code, Objective-C's alloc
message, win32 GlobalAlloc, etc.
Fixes#8642.
Now it returns an array and optional count, to match other SDL3 APIs.
SDL_GetTouchName() was replaced with a function that takes an instance ID
instead of an index, too.
This uses the same `SDL_VerbNoun` format as the rest of SDL3, and also
adds stronger effort to invalidate cached state in the backend, so cooperation
improves with apps that are using lowlevel rendering APIs directly.
Fixes#367.
Old implementation with `MapVirtualKey(..., MAPVK_VK_TO_CHAR) & 0x7FFFF` simply returned `A`..`Z` for VK_A..VK_Z and
completely useless <U+0002 START OF TEXT> (`WCH_LGTR 0xF002` without high-order bit) in case of ligature.
See https://kbdlayout.info/features/ligatures for a list of affected keyboard layouts.
More info on `MAPVK_VK_TO_CHAR`: https://stackoverflow.com/a/72464584/1795050
xinput2_device_is_pen() was testing against default-zero values
in the X11 Atom cache on at least the first round of
detections, leading to imprecise detection.
The patch fixes two aspects of initialisation:
1. Ensure that the selector cache is always initialised in
xinput2_device_is_pen().
2. Ensure that all X11 Atoms used in SDL_x11pen.c are instantiated if
missing. This ensures that they are never None and avoids potential
failures to detect hot-plugged tablet devices.
Acknowledgements: @tilman3 for narrowing down the issue and an
initial fix
Otherwise, a massive line might generate gigabytes worth of points to render,
which the backend would simply throw away anyhow.
Fixes#8113.
(cherry picked from commit 4339647d90)
Mesa and Nvidia handle it differently, and one or the other may fix their
implementation in the future, so test which way it works at runtime.
Reference Issue #8004.