Commit Graph

5132 Commits (8984d25bfaebbd65847e06fbddee4468561a1a9f)

Author SHA1 Message Date
Charlie Birks aacb1091df Emscripten: call emscripten_sample_gamepad_data 2019-01-29 12:19:00 +00:00
Charlie Birks 8dab9c956f Emscripten: Use set_canvas_element_size
This will be needed for supporting multiple canvases and set_canvas_size
is deprecated anyway.
2019-01-29 12:18:56 +00:00
kichikuou ed66a430c9 Emscripten: Do not consume mouseup event outside of the canvas 2019-01-29 12:14:54 +00:00
Sylvain Beucler 2838abb5b2 Emscripten: fix duplicate mousebuttonup/mousebuttondown events when touch events are disabled 2019-01-29 12:14:44 +00:00
Charlie Birks 1767d09187 Emscripten: use a fake size for external sizing check
The check would fail if the canvas happened to be the correct size
already. (#66, mentioned in #58)
2019-01-29 12:14:41 +00:00
Charlie Birks 80d690a2a0 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 82b2c849f0 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 adabfdc0c5 Revert SDL_gamecontrollerdb.h and sort_controllers.py from bug 4024 2019-01-21 20:49:08 +01:00
Sylvain Becker d984f323fc 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 2bd26b8da8 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 7b354dda76 Fixed compiler warning 2019-01-20 13:53:16 -08:00
Sylvain Becker 8ad4000ce2 Android: some typos 2019-01-20 22:17:41 +01:00
Sylvain Becker b9aa3768ac 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 61827c6d1a Fixed compiler warning on Android 2019-01-20 12:02:12 -08:00
Sylvain Becker 07548602d6 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 9d10c73853 Android: remove duplicate code in SDLGenericMotionListener_API24
and use parent method
2019-01-17 16:30:19 +01:00
Sylvain Becker 55838d8bd6 Android: remove another hard-coded constant for Samsung DeX (no op!) 2019-01-17 14:59:46 +01:00
Sylvain Becker 56f4a711e3 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 8f828a8e1b 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 e5f8801f55 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 6690a46941 Android: also update APP_PLATFORM to android-16 in Application.mk
https://hg.libsdl.org/SDL/rev/701c83eeb6e7
https://hg.libsdl.org/SDL/rev/0a69e71b715a
2019-01-17 09:28:30 +01:00
Sylvain Becker ede0fc4f4c 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 8a19ff3e2d 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 e994be5833 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 291f6006a1 Android: merge SDLJoystickHandler_API12 and SDLJoystickHandler_API16 2019-01-16 09:22:20 +01:00
Sylvain Becker a86754167c Android: remove trailing spaces 2019-01-16 09:12:31 +01:00
Sylvain Becker d86de288d4 Android: remove old code after Android-16 has been set as minimum requirement 2019-01-16 09:11:13 +01:00
Ryan C. Gordon 861a21f98b 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 2755a505a3 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 dc263450ff 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 1b24b2eca5 Android/openslES: fix Pause/ResumeDevices when openslES is not used 2019-01-14 22:56:57 +01:00
Sylvain Becker ae41831e0d Android: minor, remove static attributes, move mIsSurfaceReady to SDLSurface 2019-01-14 21:34:12 +01:00
Sylvain Becker 647b1f6a6d Android/openslES: check for non NULL variable, some intialization.
use the previous naming
2019-01-14 14:36:13 +01:00
Sylvain Becker 7b1cc441dd Android/openslES: start playing, after creating ressources 2019-01-14 14:31:06 +01:00
Sylvain Becker 955d87894b 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 59c8c7b684 Android/openslES: move a few static variables to SDL_PrivateAudioData structure 2019-01-14 10:58:57 +01:00
Sylvain Becker 5aeeaaab70 Android/openslES: register and use CloseDevice function. 2019-01-14 10:16:26 +01:00
Sylvain Becker 365fd9c602 Android/openslES: some space and indentation to match SDL conventions 2019-01-14 10:04:54 +01:00
Sam Lantinga 7dc92a7669 Initial Android OpenSL ES implementation, contributed by ANTA 2019-01-12 12:18:44 -08:00
Sam Lantinga fb8cb95fbc Fixed compiler warning 2019-01-12 12:12:43 -08:00
Sam Lantinga 390459d83e Updated minimum supported Android version to API 16, to match latest NDK toolchain 2019-01-12 12:11:06 -08:00
Sylvain Becker be991f3a78 Fixed bug 4453 - GLES / GLES2: first white renderer clear cmd is drawn as black 2019-01-12 13:34:03 +01:00
Sylvain Becker 7b42f03fd9 Android: move and group JNIEnv helper functions 2019-01-11 21:52:43 +01:00
Sylvain Becker 7f3478305f 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 dc10d96cde Android: use the same naming for JNI env local variables 2019-01-11 15:36:16 +01:00
Sylvain Becker 3cfd907df7 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 9d82f4e985 Android: use pthread_once for creating thread key 'mThreadKey' 2019-01-11 15:27:53 +01:00
Sylvain Becker 9a98e5afe1 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 42e18bd0c2 Android: fix bad merge from previous commit 2019-01-11 14:25:32 +01:00
Sylvain Becker b44a7aea8f Android: fix prototype of Android_JNI_InitTouch 2019-01-10 21:49:00 +01:00