From 26f05ecb4d9957d70039716a134c2832e3cd4923 Mon Sep 17 00:00:00 2001 From: Sam Lantinga Date: Fri, 2 Dec 2016 02:25:12 -0800 Subject: [PATCH] Fixed missing prototypes on Android, patch from Sylvain --- include/SDL_system.h | 10 +- src/audio/android/SDL_androidaudio.c | 4 + src/audio/android/SDL_androidaudio.h | 3 + src/core/android/SDL_android.c | 168 +++++++++++++++++----- src/core/android/SDL_android.h | 7 + src/joystick/android/SDL_sysjoystick.c | 2 +- src/power/android/SDL_syspower.c | 1 + src/video/android/SDL_androidclipboard.c | 2 +- src/video/android/SDL_androidevents.c | 19 +-- src/video/android/SDL_androidgl.c | 1 + src/video/android/SDL_androidgl.h | 34 +++++ src/video/android/SDL_androidmessagebox.c | 4 +- src/video/android/SDL_androidvideo.c | 8 +- 13 files changed, 203 insertions(+), 60 deletions(-) create mode 100644 src/video/android/SDL_androidgl.h diff --git a/include/SDL_system.h b/include/SDL_system.h index 35b29c0bd..b7cbd6d53 100644 --- a/include/SDL_system.h +++ b/include/SDL_system.h @@ -96,7 +96,7 @@ extern DECLSPEC void SDLCALL SDL_iPhoneSetEventPump(SDL_bool enabled); This returns JNIEnv*, but the prototype is void* so we don't need jni.h */ -extern DECLSPEC void * SDLCALL SDL_AndroidGetJNIEnv(); +extern DECLSPEC void * SDLCALL SDL_AndroidGetJNIEnv(void); /** \brief Get the SDL Activity object for the application @@ -106,7 +106,7 @@ extern DECLSPEC void * SDLCALL SDL_AndroidGetJNIEnv(); It is the caller's responsibility to properly release it (using env->Push/PopLocalFrame or manually with env->DeleteLocalRef) */ -extern DECLSPEC void * SDLCALL SDL_AndroidGetActivity(); +extern DECLSPEC void * SDLCALL SDL_AndroidGetActivity(void); /** See the official Android developer guide for more information: @@ -121,7 +121,7 @@ extern DECLSPEC void * SDLCALL SDL_AndroidGetActivity(); This path is unique to your application and cannot be written to by other applications. */ -extern DECLSPEC const char * SDLCALL SDL_AndroidGetInternalStoragePath(); +extern DECLSPEC const char * SDLCALL SDL_AndroidGetInternalStoragePath(void); /** \brief Get the current state of external storage, a bitmask of these values: @@ -130,7 +130,7 @@ extern DECLSPEC const char * SDLCALL SDL_AndroidGetInternalStoragePath(); If external storage is currently unavailable, this will return 0. */ -extern DECLSPEC int SDLCALL SDL_AndroidGetExternalStorageState(); +extern DECLSPEC int SDLCALL SDL_AndroidGetExternalStorageState(void); /** \brief Get the path used for external storage for this application. @@ -138,7 +138,7 @@ extern DECLSPEC int SDLCALL SDL_AndroidGetExternalStorageState(); This path is unique to your application, but is public and can be written to by other applications. */ -extern DECLSPEC const char * SDLCALL SDL_AndroidGetExternalStoragePath(); +extern DECLSPEC const char * SDLCALL SDL_AndroidGetExternalStoragePath(void); #endif /* __ANDROID__ */ diff --git a/src/audio/android/SDL_androidaudio.c b/src/audio/android/SDL_androidaudio.c index 96f6d631a..3b9b80f44 100644 --- a/src/audio/android/SDL_androidaudio.c +++ b/src/audio/android/SDL_androidaudio.c @@ -215,6 +215,10 @@ void ANDROIDAUDIO_ResumeDevices(void) } } +#else + +void ANDROIDAUDIO_ResumeDevices(void) {} +void ANDROIDAUDIO_PauseDevices(void) {} #endif /* SDL_AUDIO_DRIVER_ANDROID */ diff --git a/src/audio/android/SDL_androidaudio.h b/src/audio/android/SDL_androidaudio.h index 133615302..32c7377e0 100644 --- a/src/audio/android/SDL_androidaudio.h +++ b/src/audio/android/SDL_androidaudio.h @@ -34,6 +34,9 @@ struct SDL_PrivateAudioData int resume; }; +void ANDROIDAUDIO_ResumeDevices(void); +void ANDROIDAUDIO_PauseDevices(void); + #endif /* _SDL_androidaudio_h */ /* vi: set ts=4 sw=4 expandtab: */ diff --git a/src/core/android/SDL_android.c b/src/core/android/SDL_android.c index b93b16255..b6d2b28a0 100644 --- a/src/core/android/SDL_android.c +++ b/src/core/android/SDL_android.c @@ -42,12 +42,110 @@ #include #include #include -#define LOG_TAG "SDL_android" +/* #define LOG_TAG "SDL_android" */ /* #define LOGI(...) __android_log_print(ANDROID_LOG_INFO,LOG_TAG,__VA_ARGS__) */ /* #define LOGE(...) __android_log_print(ANDROID_LOG_ERROR,LOG_TAG,__VA_ARGS__) */ #define LOGI(...) do {} while (0) #define LOGE(...) do {} while (0) + +#define SDL_JAVA_PREFIX org_libsdl_app +#define CONCAT1(prefix, class, function) CONCAT2(prefix, class, function) +#define CONCAT2(prefix, class, function) Java_ ## prefix ## _ ## class ## _ ## function +#define SDL_JAVA_INTERFACE(function) CONCAT1(SDL_JAVA_PREFIX, SDLActivity, function) +#define SDL_JAVA_INTERFACE_INPUT_CONNECTION(function) CONCAT1(SDL_JAVA_PREFIX, SDLInputConnection, function) + + +/* Java class SDLActivity */ +JNIEXPORT void JNICALL SDL_JAVA_INTERFACE(onNativeDropFile)( + JNIEnv* env, jclass jcls, + jstring filename); + +JNIEXPORT void JNICALL SDL_JAVA_INTERFACE(onNativeResize)( + JNIEnv* env, jclass jcls, + jint width, jint height, jint format, jfloat rate); + +JNIEXPORT jint JNICALL SDL_JAVA_INTERFACE(onNativePadDown)( + JNIEnv* env, jclass jcls, + jint device_id, jint keycode); + +JNIEXPORT jint JNICALL SDL_JAVA_INTERFACE(onNativePadUp)( + JNIEnv* env, jclass jcls, + jint device_id, jint keycode); + +JNIEXPORT void JNICALL SDL_JAVA_INTERFACE(onNativeJoy)( + JNIEnv* env, jclass jcls, + jint device_id, jint axis, jfloat value); + +JNIEXPORT void JNICALL SDL_JAVA_INTERFACE(onNativeHat)( + JNIEnv* env, jclass jcls, + jint device_id, jint hat_id, jint x, jint y); + +JNIEXPORT jint JNICALL SDL_JAVA_INTERFACE(nativeAddJoystick)( + JNIEnv* env, jclass jcls, + jint device_id, jstring device_name, jint is_accelerometer, + jint nbuttons, jint naxes, jint nhats, jint nballs); + +JNIEXPORT jint JNICALL SDL_JAVA_INTERFACE(nativeRemoveJoystick)( + JNIEnv* env, jclass jcls, + jint device_id); + +JNIEXPORT void JNICALL SDL_JAVA_INTERFACE(onNativeSurfaceChanged)( + JNIEnv* env, jclass jcls); + +JNIEXPORT void JNICALL SDL_JAVA_INTERFACE(onNativeSurfaceDestroyed)( + JNIEnv* env, jclass jcls); + +JNIEXPORT void JNICALL SDL_JAVA_INTERFACE(onNativeKeyDown)( + JNIEnv* env, jclass jcls, + jint keycode); + +JNIEXPORT void JNICALL SDL_JAVA_INTERFACE(onNativeKeyUp)( + JNIEnv* env, jclass jcls, + jint keycode); + +JNIEXPORT void JNICALL SDL_JAVA_INTERFACE(onNativeKeyboardFocusLost)( + JNIEnv* env, jclass jcls); + +JNIEXPORT void JNICALL SDL_JAVA_INTERFACE(onNativeTouch)( + JNIEnv* env, jclass jcls, + jint touch_device_id_in, jint pointer_finger_id_in, + jint action, jfloat x, jfloat y, jfloat p); + +JNIEXPORT void JNICALL SDL_JAVA_INTERFACE(onNativeMouse)( + JNIEnv* env, jclass jcls, + jint button, jint action, jfloat x, jfloat y); + +JNIEXPORT void JNICALL SDL_JAVA_INTERFACE(onNativeAccel)( + JNIEnv* env, jclass jcls, + jfloat x, jfloat y, jfloat z); + +JNIEXPORT void JNICALL SDL_JAVA_INTERFACE(nativeLowMemory)( + JNIEnv* env, jclass cls); + +JNIEXPORT void JNICALL SDL_JAVA_INTERFACE(nativeQuit)( + JNIEnv* env, jclass cls); + +JNIEXPORT void JNICALL SDL_JAVA_INTERFACE(nativePause)( + JNIEnv* env, jclass cls); + +JNIEXPORT void JNICALL SDL_JAVA_INTERFACE(nativeResume)( + JNIEnv* env, jclass cls); + +JNIEXPORT jstring JNICALL SDL_JAVA_INTERFACE(nativeGetHint)( + JNIEnv* env, jclass cls, + jstring name); + +/* Java class SDLInputConnection */ +JNIEXPORT void JNICALL SDL_JAVA_INTERFACE_INPUT_CONNECTION(nativeCommitText)( + JNIEnv* env, jclass cls, + jstring text, jint newCursorPosition); + +JNIEXPORT void JNICALL SDL_JAVA_INTERFACE_INPUT_CONNECTION(nativeSetComposingText)( + JNIEnv* env, jclass cls, + jstring text, jint newCursorPosition); + + /* Uncomment this to log messages entering and exiting methods in this file */ /* #define DEBUG_JNI */ @@ -153,7 +251,7 @@ JNIEXPORT void JNICALL SDL_Android_Init(JNIEnv* mEnv, jclass cls) } /* Drop file */ -JNIEXPORT void JNICALL Java_org_libsdl_app_SDLActivity_onNativeDropFile( +JNIEXPORT void JNICALL SDL_JAVA_INTERFACE(onNativeDropFile)( JNIEnv* env, jclass jcls, jstring filename) { @@ -164,7 +262,7 @@ JNIEXPORT void JNICALL Java_org_libsdl_app_SDLActivity_onNativeDropFile( } /* Resize */ -JNIEXPORT void JNICALL Java_org_libsdl_app_SDLActivity_onNativeResize( +JNIEXPORT void JNICALL SDL_JAVA_INTERFACE(onNativeResize)( JNIEnv* env, jclass jcls, jint width, jint height, jint format, jfloat rate) { @@ -172,7 +270,7 @@ JNIEXPORT void JNICALL Java_org_libsdl_app_SDLActivity_onNativeResize( } /* Paddown */ -JNIEXPORT jint JNICALL Java_org_libsdl_app_SDLActivity_onNativePadDown( +JNIEXPORT jint JNICALL SDL_JAVA_INTERFACE(onNativePadDown)( JNIEnv* env, jclass jcls, jint device_id, jint keycode) { @@ -180,15 +278,15 @@ JNIEXPORT jint JNICALL Java_org_libsdl_app_SDLActivity_onNativePadDown( } /* Padup */ -JNIEXPORT jint JNICALL Java_org_libsdl_app_SDLActivity_onNativePadUp( - JNIEnv* env, jclass jcls, - jint device_id, jint keycode) +JNIEXPORT jint JNICALL SDL_JAVA_INTERFACE(onNativePadUp)( + JNIEnv* env, jclass jcls, + jint device_id, jint keycode) { return Android_OnPadUp(device_id, keycode); } /* Joy */ -JNIEXPORT void JNICALL Java_org_libsdl_app_SDLActivity_onNativeJoy( +JNIEXPORT void JNICALL SDL_JAVA_INTERFACE(onNativeJoy)( JNIEnv* env, jclass jcls, jint device_id, jint axis, jfloat value) { @@ -196,7 +294,7 @@ JNIEXPORT void JNICALL Java_org_libsdl_app_SDLActivity_onNativeJoy( } /* POV Hat */ -JNIEXPORT void JNICALL Java_org_libsdl_app_SDLActivity_onNativeHat( +JNIEXPORT void JNICALL SDL_JAVA_INTERFACE(onNativeHat)( JNIEnv* env, jclass jcls, jint device_id, jint hat_id, jint x, jint y) { @@ -204,10 +302,10 @@ JNIEXPORT void JNICALL Java_org_libsdl_app_SDLActivity_onNativeHat( } -JNIEXPORT jint JNICALL Java_org_libsdl_app_SDLActivity_nativeAddJoystick( - JNIEnv* env, jclass jcls, - jint device_id, jstring device_name, jint is_accelerometer, - jint nbuttons, jint naxes, jint nhats, jint nballs) +JNIEXPORT jint JNICALL SDL_JAVA_INTERFACE(nativeAddJoystick)( + JNIEnv* env, jclass jcls, + jint device_id, jstring device_name, jint is_accelerometer, + jint nbuttons, jint naxes, jint nhats, jint nballs) { int retval; const char *name = (*env)->GetStringUTFChars(env, device_name, NULL); @@ -219,15 +317,16 @@ JNIEXPORT jint JNICALL Java_org_libsdl_app_SDLActivity_nativeAddJoystick( return retval; } -JNIEXPORT jint JNICALL Java_org_libsdl_app_SDLActivity_nativeRemoveJoystick( - JNIEnv* env, jclass jcls, jint device_id) +JNIEXPORT jint JNICALL SDL_JAVA_INTERFACE(nativeRemoveJoystick)( + JNIEnv* env, jclass jcls, + jint device_id) { return Android_RemoveJoystick(device_id); } /* Surface Created */ -JNIEXPORT void JNICALL Java_org_libsdl_app_SDLActivity_onNativeSurfaceChanged(JNIEnv* env, jclass jcls) +JNIEXPORT void JNICALL SDL_JAVA_INTERFACE(onNativeSurfaceChanged)(JNIEnv* env, jclass jcls) { SDL_WindowData *data; SDL_VideoDevice *_this; @@ -253,7 +352,7 @@ JNIEXPORT void JNICALL Java_org_libsdl_app_SDLActivity_onNativeSurfaceChanged(JN } /* Surface Destroyed */ -JNIEXPORT void JNICALL Java_org_libsdl_app_SDLActivity_onNativeSurfaceDestroyed(JNIEnv* env, jclass jcls) +JNIEXPORT void JNICALL SDL_JAVA_INTERFACE(onNativeSurfaceDestroyed)(JNIEnv* env, jclass jcls) { /* We have to clear the current context and destroy the egl surface here * Otherwise there's BAD_NATIVE_WINDOW errors coming from eglCreateWindowSurface on resume @@ -280,21 +379,23 @@ JNIEXPORT void JNICALL Java_org_libsdl_app_SDLActivity_onNativeSurfaceDestroyed( } /* Keydown */ -JNIEXPORT void JNICALL Java_org_libsdl_app_SDLActivity_onNativeKeyDown( - JNIEnv* env, jclass jcls, jint keycode) +JNIEXPORT void JNICALL SDL_JAVA_INTERFACE(onNativeKeyDown)( + JNIEnv* env, jclass jcls, + jint keycode) { Android_OnKeyDown(keycode); } /* Keyup */ -JNIEXPORT void JNICALL Java_org_libsdl_app_SDLActivity_onNativeKeyUp( - JNIEnv* env, jclass jcls, jint keycode) +JNIEXPORT void JNICALL SDL_JAVA_INTERFACE(onNativeKeyUp)( + JNIEnv* env, jclass jcls, + jint keycode) { Android_OnKeyUp(keycode); } /* Keyboard Focus Lost */ -JNIEXPORT void JNICALL Java_org_libsdl_app_SDLActivity_onNativeKeyboardFocusLost( +JNIEXPORT void JNICALL SDL_JAVA_INTERFACE(onNativeKeyboardFocusLost)( JNIEnv* env, jclass jcls) { /* Calling SDL_StopTextInput will take care of hiding the keyboard and cleaning up the DummyText widget */ @@ -303,7 +404,7 @@ JNIEXPORT void JNICALL Java_org_libsdl_app_SDLActivity_onNativeKeyboardFocusLost /* Touch */ -JNIEXPORT void JNICALL Java_org_libsdl_app_SDLActivity_onNativeTouch( +JNIEXPORT void JNICALL SDL_JAVA_INTERFACE(onNativeTouch)( JNIEnv* env, jclass jcls, jint touch_device_id_in, jint pointer_finger_id_in, jint action, jfloat x, jfloat y, jfloat p) @@ -312,7 +413,7 @@ JNIEXPORT void JNICALL Java_org_libsdl_app_SDLActivity_onNativeTouch( } /* Mouse */ -JNIEXPORT void JNICALL Java_org_libsdl_app_SDLActivity_onNativeMouse( +JNIEXPORT void JNICALL SDL_JAVA_INTERFACE(onNativeMouse)( JNIEnv* env, jclass jcls, jint button, jint action, jfloat x, jfloat y) { @@ -320,7 +421,7 @@ JNIEXPORT void JNICALL Java_org_libsdl_app_SDLActivity_onNativeMouse( } /* Accelerometer */ -JNIEXPORT void JNICALL Java_org_libsdl_app_SDLActivity_onNativeAccel( +JNIEXPORT void JNICALL SDL_JAVA_INTERFACE(onNativeAccel)( JNIEnv* env, jclass jcls, jfloat x, jfloat y, jfloat z) { @@ -331,14 +432,14 @@ JNIEXPORT void JNICALL Java_org_libsdl_app_SDLActivity_onNativeAccel( } /* Low memory */ -JNIEXPORT void JNICALL Java_org_libsdl_app_SDLActivity_nativeLowMemory( +JNIEXPORT void JNICALL SDL_JAVA_INTERFACE(nativeLowMemory)( JNIEnv* env, jclass cls) { SDL_SendAppEvent(SDL_APP_LOWMEMORY); } /* Quit */ -JNIEXPORT void JNICALL Java_org_libsdl_app_SDLActivity_nativeQuit( +JNIEXPORT void JNICALL SDL_JAVA_INTERFACE(nativeQuit)( JNIEnv* env, jclass cls) { /* Discard previous events. The user should have handled state storage @@ -354,7 +455,7 @@ JNIEXPORT void JNICALL Java_org_libsdl_app_SDLActivity_nativeQuit( } /* Pause */ -JNIEXPORT void JNICALL Java_org_libsdl_app_SDLActivity_nativePause( +JNIEXPORT void JNICALL SDL_JAVA_INTERFACE(nativePause)( JNIEnv* env, jclass cls) { __android_log_print(ANDROID_LOG_VERBOSE, "SDL", "nativePause()"); @@ -371,7 +472,7 @@ JNIEXPORT void JNICALL Java_org_libsdl_app_SDLActivity_nativePause( } /* Resume */ -JNIEXPORT void JNICALL Java_org_libsdl_app_SDLActivity_nativeResume( +JNIEXPORT void JNICALL SDL_JAVA_INTERFACE(nativeResume)( JNIEnv* env, jclass cls) { __android_log_print(ANDROID_LOG_VERBOSE, "SDL", "nativeResume()"); @@ -389,7 +490,7 @@ JNIEXPORT void JNICALL Java_org_libsdl_app_SDLActivity_nativeResume( } } -JNIEXPORT void JNICALL Java_org_libsdl_app_SDLInputConnection_nativeCommitText( +JNIEXPORT void JNICALL SDL_JAVA_INTERFACE_INPUT_CONNECTION(nativeCommitText)( JNIEnv* env, jclass cls, jstring text, jint newCursorPosition) { @@ -400,7 +501,7 @@ JNIEXPORT void JNICALL Java_org_libsdl_app_SDLInputConnection_nativeCommitText( (*env)->ReleaseStringUTFChars(env, text, utftext); } -JNIEXPORT void JNICALL Java_org_libsdl_app_SDLInputConnection_nativeSetComposingText( +JNIEXPORT void JNICALL SDL_JAVA_INTERFACE_INPUT_CONNECTION(nativeSetComposingText)( JNIEnv* env, jclass cls, jstring text, jint newCursorPosition) { @@ -411,7 +512,10 @@ JNIEXPORT void JNICALL Java_org_libsdl_app_SDLInputConnection_nativeSetComposing (*env)->ReleaseStringUTFChars(env, text, utftext); } -JNIEXPORT jstring JNICALL Java_org_libsdl_app_SDLActivity_nativeGetHint(JNIEnv* env, jclass cls, jstring name) { +JNIEXPORT jstring JNICALL SDL_JAVA_INTERFACE(nativeGetHint)( + JNIEnv* env, jclass cls, + jstring name) +{ const char *utfname = (*env)->GetStringUTFChars(env, name, NULL); const char *hint = SDL_GetHint(utfname); diff --git a/src/core/android/SDL_android.h b/src/core/android/SDL_android.h index cb7ff0736..a170bfc70 100644 --- a/src/core/android/SDL_android.h +++ b/src/core/android/SDL_android.h @@ -82,6 +82,13 @@ jclass Android_JNI_GetActivityClass(void); /* Generic messages */ int Android_JNI_SendMessage(int command, int param); +/* Init */ +JNIEXPORT void JNICALL SDL_Android_Init(JNIEnv* mEnv, jclass cls); + +/* MessageBox */ +#include "SDL_messagebox.h" +int Android_JNI_ShowMessageBox(const SDL_MessageBoxData *messageboxdata, int *buttonid); + /* Ends C function definitions when using C++ */ #ifdef __cplusplus /* *INDENT-OFF* */ diff --git a/src/joystick/android/SDL_sysjoystick.c b/src/joystick/android/SDL_sysjoystick.c index cbc921082..159f91cb7 100644 --- a/src/joystick/android/SDL_sysjoystick.c +++ b/src/joystick/android/SDL_sysjoystick.c @@ -167,7 +167,7 @@ keycode_to_SDL(int keycode) default: return -1; - break; + /* break; -Wunreachable-code-break */ } /* This is here in case future generations, probably with six fingers per hand, diff --git a/src/power/android/SDL_syspower.c b/src/power/android/SDL_syspower.c index 5a4b0fc14..9cc4945db 100644 --- a/src/power/android/SDL_syspower.c +++ b/src/power/android/SDL_syspower.c @@ -24,6 +24,7 @@ #if SDL_POWER_ANDROID #include "SDL_power.h" +#include "../SDL_syspower.h" #include "../../core/android/SDL_android.h" diff --git a/src/video/android/SDL_androidclipboard.c b/src/video/android/SDL_androidclipboard.c index b996e7a40..2946ed303 100644 --- a/src/video/android/SDL_androidclipboard.c +++ b/src/video/android/SDL_androidclipboard.c @@ -23,7 +23,7 @@ #if SDL_VIDEO_DRIVER_ANDROID #include "SDL_androidvideo.h" - +#include "SDL_androidclipboard.h" #include "../../core/android/SDL_android.h" int diff --git a/src/video/android/SDL_androidevents.c b/src/video/android/SDL_androidevents.c index c3cd4cc1b..0666e0083 100644 --- a/src/video/android/SDL_androidevents.c +++ b/src/video/android/SDL_androidevents.c @@ -29,19 +29,12 @@ #include "SDL_events.h" #include "SDL_androidwindow.h" +/* Can't include sysaudio "../../audio/android/SDL_androidaudio.h" + * because of THIS redefinition */ +extern void ANDROIDAUDIO_ResumeDevices(void); +extern void ANDROIDAUDIO_PauseDevices(void); -void android_egl_context_backup(); -void android_egl_context_restore(); - -#if SDL_AUDIO_DRIVER_ANDROID -void ANDROIDAUDIO_ResumeDevices(void); -void ANDROIDAUDIO_PauseDevices(void); -#else -static void ANDROIDAUDIO_ResumeDevices(void) {} -static void ANDROIDAUDIO_PauseDevices(void) {} -#endif - -void +static void android_egl_context_restore() { SDL_Event event; @@ -55,7 +48,7 @@ android_egl_context_restore() } } -void +static void android_egl_context_backup() { /* Keep a copy of the EGL Context so we can try to restore it when we resume */ diff --git a/src/video/android/SDL_androidgl.c b/src/video/android/SDL_androidgl.c index 4cfe86357..008d8c6cc 100644 --- a/src/video/android/SDL_androidgl.c +++ b/src/video/android/SDL_androidgl.c @@ -29,6 +29,7 @@ #include "SDL_androidwindow.h" #include "SDL_androidvideo.h" +#include "SDL_androidgl.h" #include "../../core/android/SDL_android.h" #include diff --git a/src/video/android/SDL_androidgl.h b/src/video/android/SDL_androidgl.h new file mode 100644 index 000000000..21d4df025 --- /dev/null +++ b/src/video/android/SDL_androidgl.h @@ -0,0 +1,34 @@ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2016 Sam Lantinga + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. +*/ +#include "../../SDL_internal.h" + +#ifndef _SDL_androidgl_h +#define _SDL_androidgl_h + +SDL_GLContext Android_GLES_CreateContext(_THIS, SDL_Window * window); +int Android_GLES_MakeCurrent(_THIS, SDL_Window * window, SDL_GLContext context); +void Android_GLES_SwapWindow(_THIS, SDL_Window * window); +int Android_GLES_LoadLibrary(_THIS, const char *path); + + +#endif /* _SDL_androidgl_h */ + +/* vi: set ts=4 sw=4 expandtab: */ diff --git a/src/video/android/SDL_androidmessagebox.c b/src/video/android/SDL_androidmessagebox.c index 61f67636a..634ac7533 100644 --- a/src/video/android/SDL_androidmessagebox.c +++ b/src/video/android/SDL_androidmessagebox.c @@ -23,12 +23,12 @@ #if SDL_VIDEO_DRIVER_ANDROID #include "SDL_messagebox.h" +#include "SDL_androidmessagebox.h" +#include "../../core/android/SDL_android.h" int Android_ShowMessageBox(const SDL_MessageBoxData *messageboxdata, int *buttonid) { - int Android_JNI_ShowMessageBox(const SDL_MessageBoxData *messageboxdata, int *buttonid); - return Android_JNI_ShowMessageBox(messageboxdata, buttonid); } diff --git a/src/video/android/SDL_androidvideo.c b/src/video/android/SDL_androidvideo.c index 178a3e691..9611017a4 100644 --- a/src/video/android/SDL_androidvideo.c +++ b/src/video/android/SDL_androidvideo.c @@ -33,6 +33,7 @@ #include "../../events/SDL_windowevents_c.h" #include "SDL_androidvideo.h" +#include "SDL_androidgl.h" #include "SDL_androidclipboard.h" #include "SDL_androidevents.h" #include "SDL_androidkeyboard.h" @@ -47,11 +48,6 @@ static int Android_VideoInit(_THIS); static void Android_VideoQuit(_THIS); #include "../SDL_egl_c.h" -/* GL functions (SDL_androidgl.c) */ -extern SDL_GLContext Android_GLES_CreateContext(_THIS, SDL_Window * window); -extern int Android_GLES_MakeCurrent(_THIS, SDL_Window * window, SDL_GLContext context); -extern void Android_GLES_SwapWindow(_THIS, SDL_Window * window); -extern int Android_GLES_LoadLibrary(_THIS, const char *path); #define Android_GLES_GetProcAddress SDL_EGL_GetProcAddress #define Android_GLES_UnloadLibrary SDL_EGL_UnloadLibrary #define Android_GLES_SetSwapInterval SDL_EGL_SetSwapInterval @@ -65,7 +61,7 @@ extern int Android_GLES_LoadLibrary(_THIS, const char *path); int Android_ScreenWidth = 0; int Android_ScreenHeight = 0; Uint32 Android_ScreenFormat = SDL_PIXELFORMAT_UNKNOWN; -int Android_ScreenRate = 0; +static int Android_ScreenRate = 0; SDL_sem *Android_PauseSem = NULL, *Android_ResumeSem = NULL;