This simplifies some things, clarifies some things, and also allows
for the possibility of RWops that offer non-blocking i/o (although
none of the current built-in ones do, intentionally, we could add this
later if we choose, or people could provide things like network socket
RWops implementations now, etc.
Fixes#6729.
On window focus, look up the pressed modifier keys via keycodes instead of scancodes to handle the case of remapped keys, as xkb remapping changes the associated keycode, not the scancode.
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"
This was still conditional on whether SDL2::SDL2-static exists, but
it's now SDL3 that matters.
Resolves: https://github.com/libsdl-org/SDL/issues/6801
Fixes: 9eb4d1f "cmake: use FindALSA.cmake to find ALSA libraries"
Signed-off-by: Simon McVittie <smcv@collabora.com>
Some of these are probably unnecessary now that Autotools (with its
optional in-tree builds) has been deleted in favour of CMake (with
mandatory out-of-tree builds), but let's be consistent.
Spotted while doing a `git grep` for other bugs of the same form as #6801.
Signed-off-by: Simon McVittie <smcv@collabora.com>
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.
* N3DS: Make Sem waits cooperative friendly.
The 3DS has a cooperative threading model. Sleeping after TryWait and
WaitTimeout avoid starving other threads. It inccurs a runtime penalty,
but it's better than having to hard reset your console to recover from
a deadlock.
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.