X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=source%2Fcore%2Fandroid%2Fmainthread.cpp;h=8ce484a0dee75e4a014a7440d2775c891fbe18a3;hb=c3e242c2629cbc9645258b30aaf07b7285d4372b;hp=473379bd71ce373c4e8e8829d4a00ece43ff3c57;hpb=fa82e97ed56597f2d968abdf4ebf688de4f9b618;p=libs%2Fcore.git diff --git a/source/core/android/mainthread.cpp b/source/core/android/mainthread.cpp index 473379b..8ce484a 100644 --- a/source/core/android/mainthread.cpp +++ b/source/core/android/mainthread.cpp @@ -1,4 +1,6 @@ #include +#include +#include #include #include #include @@ -31,6 +33,8 @@ void MainThread::attach_to_activity(ANativeActivity *a) activity->callbacks->onInputQueueCreated = &input_queue_created; activity->callbacks->onInputQueueDestroyed = &input_queue_destroyed; activity->instance = this; + + set_window_flags(AWINDOW_FLAG_FULLSCREEN, 0); } void MainThread::wait_for_app_created() @@ -47,6 +51,19 @@ void MainThread::resume_startup() } } +JavaVM *MainThread::get_java_vm() const +{ + if(!activity) + return 0; + + return activity->vm; +} + +void MainThread::set_window_flags(unsigned set, unsigned clear) +{ + ANativeActivity_setWindowFlags(activity, set, clear); +} + void MainThread::main() { /* I have no idea how dependable this is, but it seems to be the only way @@ -58,7 +75,12 @@ void MainThread::main() Msp::Application::run(1, argv, this, &app_created); free(appname); if(activity) + { + activity->callbacks->onDestroy = &end_process; ANativeActivity_finish(activity); + } + else + end_process(0); } void MainThread::app_created(void *data) @@ -96,5 +118,10 @@ void MainThread::input_queue_destroyed(ANativeActivity *activity, AInputQueue *q reinterpret_cast(activity->instance)->signal_input_queue_destroyed.emit(queue); } +void MainThread::end_process(ANativeActivity *) +{ + exit(0); +} + } // namespace Android } // namespace Msp