1 /* dstep -I/path/to/ndk-r9d/platforms/android-9/arch-x86/usr/include -I/path/to/ndk-r9d/toolchains/llvm-3.4/prebuilt/linux-x86/lib/clang/3.4/include /path/to/ndk-r9d/sources/android/native_app_glue/android_native_app_glue.h -o android_native_app_glue.d */
2 
3 module android.android_native_app_glue;
4 
5 import core.sys.posix.pthread;
6 import android.input, android.native_window, android.rect;
7 import android.configuration, android.looper, android.native_activity;
8 
9 version (Android):
10 extern (C):
11 @system:
12 nothrow:
13 @nogc:
14 
15 enum
16 {
17     LOOPER_ID_MAIN = 1,
18     LOOPER_ID_INPUT = 2,
19     LOOPER_ID_USER = 3
20 }
21 
22 enum
23 {
24     APP_CMD_INPUT_CHANGED,
25     APP_CMD_INIT_WINDOW,
26     APP_CMD_TERM_WINDOW,
27     APP_CMD_WINDOW_RESIZED,
28     APP_CMD_WINDOW_REDRAW_NEEDED,
29     APP_CMD_CONTENT_RECT_CHANGED,
30     APP_CMD_GAINED_FOCUS,
31     APP_CMD_LOST_FOCUS,
32     APP_CMD_CONFIG_CHANGED,
33     APP_CMD_LOW_MEMORY,
34     APP_CMD_START,
35     APP_CMD_RESUME,
36     APP_CMD_SAVE_STATE,
37     APP_CMD_PAUSE,
38     APP_CMD_STOP,
39     APP_CMD_DESTROY
40 }
41 
42 struct android_poll_source
43 {
44     int id;
45     android_app* app;
46     void function(android_app*, android_poll_source*) process;
47 }
48 
49 struct android_app
50 {
51     void* userData;
52     void function(android_app*, int) onAppCmd;
53     int function(android_app*, AInputEvent*) onInputEvent;
54     ANativeActivity* activity;
55     AConfiguration* config;
56     void* savedState;
57     size_t savedStateSize;
58     ALooper* looper;
59     AInputQueue* inputQueue;
60     ANativeWindow* window;
61     ARect contentRect;
62     int activityState;
63     int destroyRequested;
64     pthread_mutex_t mutex;
65     pthread_cond_t cond;
66     int msgread;
67     int msgwrite;
68     pthread_t thread;
69     android_poll_source cmdPollSource;
70     android_poll_source inputPollSource;
71     int running;
72     int stateSaved;
73     int destroyed;
74     int redrawNeeded;
75     AInputQueue* pendingInputQueue;
76     ANativeWindow* pendingWindow;
77     ARect pendingContentRect;
78 }
79 
80 byte android_app_read_cmd(android_app* android_app);
81 void android_app_pre_exec_cmd(android_app* android_app, byte cmd);
82 void android_app_post_exec_cmd(android_app* android_app, byte cmd);
83 void app_dummy();
84 void android_main(android_app* app);