Commit graph

11847 commits

Author SHA1 Message Date
Charlie Birks
50b7f5fe78 Emscripten: reset fullscreen_window when leaving fullscreen
If the browser left fullscreen mode by the user pressing ESC, the next
call to SDL_SetWindowFullscreen(1) will fail as it thinks the window is
already fullscreen. (#65)
2019-01-29 12:14:33 +00:00
Sylvain Becker
bf51d0cd3f Fixed bug 4024 - GameController error "Unexpected controller element"
If mapping string is terminated with a comma, there is no more values to parse.
2019-01-21 23:41:43 +01:00
Sylvain Becker
a5b10978a6 Revert SDL_gamecontrollerdb.h and sort_controllers.py from bug 4024 2019-01-21 20:49:08 +01:00
Sylvain Becker
5c25e0c158 Fixed bug 3827 - issue with MapRGB, palette and colorkey
For palette surface, SDL_MapRGB() returns different values whether colorkey is
set or not.
2019-01-21 19:53:06 +01:00
Sylvain Becker
fc8c0ac5b0 Fixed bug 3827 - issue with MapRGB, palette and colorkey
For a palettized surface, prevent SDL_MapRGB() value to change whether colorkey is set or not.
2019-01-21 18:45:15 +01:00
Sam Lantinga
91cad4e8ea Fixed compiler warning 2019-01-20 13:53:16 -08:00
Sylvain Becker
a0d2344c8c Android: some typos 2019-01-20 22:17:41 +01:00
Sylvain Becker
d3dec69065 Android: automatically attach to the JVM non-SDL threads
It allows a thread created with pthread_create() to access the JNI Env
2019-01-20 22:11:56 +01:00
Sam Lantinga
751d99f1fe Fixed compiler warning on Android 2019-01-20 12:02:12 -08:00
Sylvain Becker
4deb7ba850 Fixed bug 3657 - Color-key doesn't work when an alpha channel is present
When surface format is the same as renderer format, it still needs an
intermediate conversion to transform colorkey to alpha.
2019-01-19 16:47:43 +01:00
Sylvain Becker
e6cf4a7523 Android: remove duplicate code in SDLGenericMotionListener_API24
and use parent method
2019-01-17 16:30:19 +01:00
Sylvain Becker
b331b1db3e Android: remove another hard-coded constant for Samsung DeX (no op!) 2019-01-17 14:59:46 +01:00
Sylvain Becker
2e326cb656 Android: minor change in the evaluation of SOURCE_CLASS_JOYSTICK (no op!)
InputDevice.SOURCE_CLASS_* are one bit
More readable to check that the source has this class_joystick set,
compared to the other statements, where the source is gamepad or dpad.
(Clean-up from bug 3958)
2019-01-17 13:42:13 +01:00
Sylvain Becker
d446c52322 Android: remove hard-coded constant for Samsung DeX (no op!)
12290 = 0x3002 = SOURCE_MOUSE | SOURCE_TOUCHSCREEN

SOURCE_MOUSE            Constant Value: 8194 (0x00002002)
SOURCE_TOUCHSCREEN      Constant Value: 4098 (0x00001002)
SOURCE_CLASS_POINTER    Constant Value: 2    (0x00000002)

https://developer.android.com/reference/android/view/InputDevice.html
2019-01-17 12:25:19 +01:00
Sylvain Becker
39706e04b8 Android: prevent concurrency in Android_SetScreenResolution() when exiting
by checking Android_Window validity

- SDLThread: user application is exiting:
    SDL_VideoQuit() and clearing SDL_GetVideoDevice()

- ActivityThread is changing orientation/size
    surfaceChanged() > Android_SetScreenResolution() > SDL_GetVideoDevice()

- Separate function into Android_SetScreenResolution() and Android_SendResize(),
    formating, and mark Android_DeviceWidth/Heigh as static
2019-01-17 11:05:05 +01:00
Sylvain Becker
830f87f3c5 Android: also update APP_PLATFORM to android-16 in Application.mk
https://hg.libsdl.org/SDL/rev/8db358c7a09a
https://hg.libsdl.org/SDL/rev/787e86a461f5
2019-01-17 09:28:30 +01:00
Sylvain Becker
1f0f29edc1 Fixed bug 4024 - remove trailing comma of Controller mappings
because it reports an error "Unexpected controller element"
2019-01-16 14:03:35 +01:00
Sylvain Becker
dbe91b2bcc Android: add mutex protection to onNativeOrientationChanged
it's possible receive try to send an event between the check first for SDL_GetVideoDevice
and SDL_VideoQuit is called
2019-01-16 10:48:28 +01:00
Sylvain Becker
2322ef6e6b Android: move static variable isPaused/isPausing to SDL_VideoData structure
- remove unneed check to Android_Window->driverdata
- add window check into context_backup/restore
2019-01-16 10:31:51 +01:00
Sylvain Becker
089bdbc56d Android: merge SDLJoystickHandler_API12 and SDLJoystickHandler_API16 2019-01-16 09:22:20 +01:00
Sylvain Becker
3b3d2b97ca Android: remove trailing spaces 2019-01-16 09:12:31 +01:00
Sylvain Becker
0c6417e562 Android: remove old code after Android-16 has been set as minimum requirement 2019-01-16 09:11:13 +01:00
Ryan C. Gordon
f20aabe611 evdev: don't debug log on a BTN_TOUCH from a non-touch device. 2019-01-14 19:43:25 -05:00
Ryan C. Gordon
a9d310b456 evdev: Add touchscreen mouse emulation and pressure support (thanks, Zach!).
This also solves reports of this log message:

"INFO: The key you just pressed is not recognized by SDL. To help get this
fixed, please report this to the SDL forums/mailing list
<https://discourse.libsdl.org/> EVDEV KeyCode 330"

(EVDEV KeyCode 330 is BTN_TOUCH.)

Fixes Bugzilla #4147.
2019-01-14 19:36:54 -05:00
Sylvain Becker
91f11c320e Android: create Pause/ResumeSem semaphore at higher level than CreateWindow()
- If you call onPause() before CreateWindow(), SDLThread will run in infinite loop in background.

- If you call onPause() between a DestroyWindow() and a new CreateWindow(), semaphores are invalids.

SDLActivity.java: the first resume() starts the SDLThread, don't call
nativeResume() as it would post ResumeSem. And the first pause would
automatically be resumed.
2019-01-14 23:33:48 +01:00
Sylvain Becker
b3f07fa516 Android/openslES: fix Pause/ResumeDevices when openslES is not used 2019-01-14 22:56:57 +01:00
Sylvain Becker
4408f8a713 Android: minor, remove static attributes, move mIsSurfaceReady to SDLSurface 2019-01-14 21:34:12 +01:00
Sylvain Becker
5220445fe4 Android/openslES: check for non NULL variable, some intialization.
use the previous naming
2019-01-14 14:36:13 +01:00
Sylvain Becker
2aed23fd35 Android/openslES: start playing, after creating ressources 2019-01-14 14:31:06 +01:00
Sylvain Becker
17dcd9a61c Android/openslES: set audio in paused/resumed state for Android event loop
And also in "stopped" state before closing the device.
2019-01-14 12:33:29 +01:00
Sylvain Becker
86070ac5ce Android/openslES: move a few static variables to SDL_PrivateAudioData structure 2019-01-14 10:58:57 +01:00
Sylvain Becker
84ae64fd44 Android/openslES: register and use CloseDevice function. 2019-01-14 10:16:26 +01:00
Sylvain Becker
00839d99f9 Android/openslES: some space and indentation to match SDL conventions 2019-01-14 10:04:54 +01:00
Sam Lantinga
57c735236b Initial Android OpenSL ES implementation, contributed by ANTA 2019-01-12 12:18:44 -08:00
Sam Lantinga
35dbd136d9 Fixed compiler warning 2019-01-12 12:12:43 -08:00
Sam Lantinga
986d77675f Updated minimum supported Android version to API 16, to match latest NDK toolchain 2019-01-12 12:11:06 -08:00
Sylvain Becker
c8cb2daffe Fixed bug 4453 - GLES / GLES2: first white renderer clear cmd is drawn as black 2019-01-12 13:34:03 +01:00
Sylvain Becker
cba02e3cf4 Android: move and group JNIEnv helper functions 2019-01-11 21:52:43 +01:00
Sylvain Becker
3892775b87 Android: change the way JNIEnv is retrieved
- Currently, it tries to Attach the JVM first and update the thread local storage, which are two operations.
  Now, it simply gives back the JNI Env stored for the thread.

- Android_JNI_SetupThreadi() should only be used for external.
  For internal SDL thread, it's already called in RunThread() (SDL_systhread.c),
  and other thread are Java threads which don't need to be attached. i
  (even if it doesn't hurt to do it, since it's a no-op).

- JNI_OnLoad is filled with pthread_create, GetEnv, AttachCurrentThread...
  It's called for all shared libraries which may don't want this setup,
  and loading libraries can be also modified to be done from a static context,
  or with relinker. So it's not really clear how, who and what it sets up.
  => Reduce this function to the minimal
2019-01-11 21:42:52 +01:00
Sylvain Becker
e7d87ee165 Android: use the same naming for JNI env local variables 2019-01-11 15:36:16 +01:00
Sylvain Becker
a8789be213 Android: Audio thread is already setup for the JVM
In 'src/thread/pthread/SDL_systhread.c' RunThread() calls first 'Android_JNI_SetupThread()'
2019-01-11 15:33:02 +01:00
Sylvain Becker
3be9e7756c Android: use pthread_once for creating thread key 'mThreadKey' 2019-01-11 15:27:53 +01:00
Sylvain Becker
c1d7f08a05 Android: don't call Android_JNI_ThreadDestroyed() for Java SDLThread
SDLThread is a Java Thread, it's not needed to call 'Detach' from the JVM.
Clear mThreadKey, so that the pthread_create destructor is not called for this
thread.
2019-01-11 14:50:43 +01:00
Sylvain Becker
dc75ef4090 Android: fix bad merge from previous commit 2019-01-11 14:25:32 +01:00
Sylvain Becker
86da1c0d49 Android: fix prototype of Android_JNI_InitTouch 2019-01-10 21:49:00 +01:00
Sylvain Becker
f060c105cd Android: add name for Touch devices and simplification, from bug 3958 2019-01-10 21:40:57 +01:00
Sylvain Becker
cd1266e2e0 Fixed bug 3930 - Android, set thread priorities and names
SDLActivity thread priority is unchanged, by default -10 (THREAD_PRIORITY_VIDEO).

SDLAudio thread priority was -4 (SDL_SetThreadPriority was ignored) and is now -16 (THREAD_PRIORITY_AUDIO).

SDLThread thread priority was 0 (THREAD_PRIORITY_DEFAULT) and is -4 (THREAD_PRIORITY_DISPLAY).
2019-01-10 18:05:56 +01:00
Sylvain Becker
19a116fccc Android: remove deprecated PixelFormat in surfaceChanged()
Can be check by adding in build.grable:

gradle.projectsEvaluated {
    tasks.withType(JavaCompile) {
        options.compilerArgs << "-Xlint:unchecked" << "-Xlint:deprecation"
    }
}

SDLActivity.java:1691: warning: [deprecation] A_8 in PixelFormat has been deprecated
        case PixelFormat.A_8:
SDLActivity.java:1694: warning: [deprecation] LA_88 in PixelFormat has been deprecated
SDLActivity.java:1697: warning: [deprecation] L_8 in PixelFormat has been deprecated
SDLActivity.java:1700: warning: [deprecation] RGBA_4444 in PixelFormat has been deprecated
SDLActivity.java:1704: warning: [deprecation] RGBA_5551 in PixelFormat has been deprecated
SDLActivity.java:1716: warning: [deprecation] RGB_332 in PixelFormat has been deprecated
2019-01-10 16:04:52 +01:00
Sylvain Becker
9fa4956771 Android: some simplification, don't need mExitCalledFromJava 2019-01-10 15:48:43 +01:00
Sylvain Becker
f1e0772b21 Android: nativeQuit for SDLActivity thread
- destroy Android_ActivityMutex
- display any SDL error message that may have occured in this thread,
  since SDL_GetError() is thread specific, and user has no access to it.
2019-01-10 15:43:07 +01:00