When converting normalized coordinates to pixel coordinates, the valid range is 0 to (width or height) - 1, and the pixel coordinate of width or height is past the edge of the window.
Fixes https://github.com/libsdl-org/SDL/issues/2913
I've added an additional patch that expands on the same basic idea as the first one; it makes SDLInputConnection and DummyEdit into public classes so that they can be overridden from the Xamarin end if their functionality needs to be extended. (In my case, I need to change the type of software keyboard that's displayed.)
Fixes https://github.com/libsdl-org/SDL/issues/2785
This patch adds a new createSDLMainRunnable() method to SDLActivity.
Currently, SDL on Android expects to find SDL_main somewhere in native code. When using SDL in a Xamarin application, however, what we really want to do is write our entrypoint in managed code. The easiest way to do this is to allow subclasses of SDLActivity to provide their own Runnable to the SDL thread, as in the attached patch.
Fixes https://github.com/libsdl-org/SDL/issues/2785
This involved moving an `#ifdef` out of SDL_audio.c for thread priority,
so the default ThreadInit now does the usual stuff for non-Android platforms,
the Android platforms provide an implementatin of ThreadInit with their
side of the `#ifdef` and other platforms that implement ThreadInit
incorporated the appropriate code...which is why WASAPI is touched in here.
The Android bits compile, but have not been tested, and there was some
reworkings in the Java bits, so this might need some further fixes still.
Also renamed SDL_GetDisplayOrientation() SDL_GetDisplayCurrentOrientation()
The natural orientation of the primary display is the frame of reference for accelerometer and gyro sensor readings.
C SDLmain() thread might have started (mSDLThread.start() called)
while the SDL_Init() might not have been called yet,
and so the previous QUIT event will be discarded by SDL_Init() and app is running, not exiting.
This is reprocible by adding instrumentation code in the SDLActivity.
And hopefully, this could fix an ANR, where SDLActivity is in WAITING state (in thread.join()):
at java.lang.Thread.join (Thread.java:1519)
at org.libsdl.app.SDLActivity.onDestroy (SDLActivity.java)
while SDLThread seems to be running
This function wasn't consistently correct across platforms and devices.
If you want the UI scale factor, you can use display_scale in the structure returned by SDL_GetDesktopDisplayMode(). If you need an approximate DPI, you can multiply this value times 160 on iPhone and Android, and 96 on other platforms.
LandscapeLeft has now been set to ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE and LandscapeRight to ActivityInfo.SCREEN_ORIENTATION_REVERSE_LANDSCAPE in order to reflect the docs: https://wiki.libsdl.org/SDL2/SDL_HINT_ORIENTATIONS
Make sure the SDL java and C code match when updating SDL in a game.
Right now we're assuming that we only have to make sure release versions match. We can extend the version string with an interface version if we need more fine grained sanity checking.
Fixes https://github.com/libsdl-org/SDL/issues/1540