android :: NativeAppGlue :: defaultinit
# This is the interface for the standard glue code of a threaded
# application. In this model, the application's code is running
# in its own thread separate from the main thread of the process.
# It is not required that this thread be associated with the Java
# VM, although it will need to be in order to make JNI calls any
# Java objects.
extern class NativeAppGlue `{ struct android_app* `}
# We use the `userData` field of the C structure to store an handle to
# the associated App
private fun user_data: App `{ return self->userData; `}
private fun user_data=(val: App) `{
App_incr_ref(val);
self->userData = val;
`}
# Fill this in with the function to process input events. At this point
# the event has already been pre-dispatched, and it will be finished upon
# return. Return 1 if you have handled the event, 0 for any default
# dispatching.
#int32_t (*onInputEvent)(struct android_app* app, AInputEvent* event);
#fun set_input_event_handler(handler: App) `{ `}
# The ANativeActivity object instance that this app is running in.
fun ndk_native_activity: NdkNativeActivity `{ return self->activity; `}
# The current configuration the app is running in.
fun config: AConfiguration `{ return self->config; `}
# This is the last instance's saved state, as provided at creation time.
# It is NULL if there was no state. You can use this as you need; the
# memory will remain around until you call android_app_exec_cmd() for
# APP_CMD_RESUME, at which point it will be freed and savedState set to NULL.
# These variables should only be changed when processing a APP_CMD_SAVE_STATE,
# at which point they will be initialized to NULL and you can malloc your
# state and place the information here. In that case the memory will be
# freed for you later.
fun saved_state: Pointer `{ return self->savedState; `}
fun saved_state_size: Int `{ return self->savedStateSize; `}
# The ALooper associated with the app's thread.
fun looper: ALooper `{ return self->looper; `}
# When non-NULL, this is the input queue from which the app will
# receive user input events.
fun input_queue: AInputQueue `{ return self->inputQueue; `}
# When non-NULL, this is the window surface that the app can draw in.
fun window: ANativeWindow `{ return self->window; `}
# Current content rectangle of the window; this is the area where the
# window's content should be placed to be seen by the user.
#
# TODO activate when we know what to return (returns a struct not a pointer)
#fun content_self: ARect `{ return self->contentRect; `}
# Current state of the app's activity. May be either APP_CMD_START,
# APP_CMD_RESUME, APP_CMD_PAUSE, or APP_CMD_STOP; see below.
fun activity_state: Int `{ return self->activityState; `}
# This is non-zero when the application's NativeActivity is being
# destroyed and waiting for the app thread to complete.
fun destroy_requested: Bool `{ return self->destroyRequested; `}
end
lib/android/native_app_glue.nit:316,1--378,3