especially SDL_VIDEODRIVER is commonly used to use the native Wayland
backend, so I think it's a good idea to keep supporting the old name
instead of forcing users to find out that they now have to add an
underscore..
Not sure how popular SDL_AUDIODRIVER is, but with all the audio backends
that exist on Linux alone I'm sure some people use it to work around
sound issues.
Note: Doing this in the SDL_hints implementation instead of the
call-sites of SDL_GetHint(SDL_HINT_VIDEO_DRIVER) etc ensures that
1. Hint priorities work (env var overriding hint set by application with normal
priority, but not when application used SDL_HINT_OVERRIDE)
2. SDL_ResetHint() (called by user code) respects the fallback
environment variable
My simplification of the conditions for including SDL_main_impl.h
had one problem: I forgot that SDL_main_impl.h must be included
even on Android when SDL_MAIN_USE_CALLBACKS is used, because then a
SDL_main() function that makes sure the callbacks get called is needed,
and that function is implemented in SDL_main_impl.h
But OTOH, even when SDL_MAIN_USE_CALLBACKS is used, SDL_main_impl.h
should not implement a standard `int main(...)` function on Android
(because there the SDL-using native code is compiled as a library and
the entry point is in SDLActivity.java, which calls SDL_main()
in said library).
So the check for platforms that don't have *any* native main function
but just SDL_main() called from the outside should be handled in
SDL_main_impl.h, so both the normal and the callback case can avoid
generating a standard main() in the same way.
To do this, SDL_MAIN_EXPORTED is defined for platforms like Android,
where the real entry point (main() function) is outside of the code
that uses SDL, so
- SDL_main() must be visibly exported with SDL_DECLSPEC, so the outside
code can call it
- SDL_main_impl.h must not implement a "real" main() function
Another small change based on this is defining SDLMAIN_DECLSPEC
at a more general place.
If another platform like Android (where the entry point is somewhere
else entirely, possibly implemented in a different programming language)
turns up, defining SDL_MAIN_NEEDED (so the users main() is renamed
to SDL_main()) and SDL_MAIN_EXPORTED should be all that's needed on the
SDL_main.h side - and if not then at least the implementation is
cleaner and clearer now, IMHO.
fixes#11162
This replaces the internal mutex with a semaphore, so we're only using a
single synchronization primitive to implement this, and cleans up some logic
around wait timeouts.
This now matches the logic of the originally cited work, from BeOS.
Fixes#3639.
(I think.)
X11 seems to need a slight delay before warping the pointer to ensure that the window is actually fully visible on the desktop, or the pointer enter event may not be sent.
This also disables the warp focus test on XWayland, as warping the mouse cursor when outside the window on any Wayland desktop usually just doesn't work.
SDL_DelayNS() now passes through to the high precision OS delay function, and SDL_DelayPrecise() tries to busy wait to get as close as possible to the desired wait time.
Fixes https://github.com/libsdl-org/SDL/issues/11141
The addition of layoutDirection is required to prevent the forced restart due to a locale change. Also adding grammaticalGender, fontWeightAdjustment & fontScale for good measure.
The SDL_GPUColorTargetInfo structure needs to be zeroed, as otherwise we
can end up trying to create a resolve_texture which doesn't exist,
causing a rather difficult-to-debug segfault when calling
SDL_BlitGPUTexture() with a load op of SDL_GPU_LOADOP_CLEAR.