Android: Added basic drop file support (thanks, "noxalus"!).

This lets SDL-based apps respond to "Open With" commands properly, as they
can now obtain the requested path via a standard SDL dropfile event.

This is only checked on startup, so apps don't get drop events at any other
time, even if Android supports that, but this is still a definite
improvement.

Fixes Bugzilla #2762.
This commit is contained in:
Ryan C. Gordon 2015-05-26 20:36:45 -04:00
parent d4f288f080
commit ca08bb0d98
2 changed files with 22 additions and 0 deletions

View file

@ -141,6 +141,16 @@ JNIEXPORT void JNICALL SDL_Android_Init(JNIEnv* mEnv, jclass cls)
__android_log_print(ANDROID_LOG_INFO, "SDL", "SDL_Android_Init() finished!");
}
/* Drop file */
void Java_org_libsdl_app_SDLActivity_onNativeDropFile(
JNIEnv* env, jclass jcls,
jstring filename)
{
const char *path = (*env)->GetStringUTFChars(env, filename, NULL);
SDL_SendDropFile(path);
(*env)->ReleaseStringUTFChars(env, filename, path);
}
/* Resize */
JNIEXPORT void JNICALL Java_org_libsdl_app_SDLActivity_onNativeResize(
JNIEnv* env, jclass jcls,