Add window and input management signals for Android
[libs/core.git] / source / core / android / mainthread.h
index 9d139bc5863f5c0e4a0adac443b969f02eac3ea1..03303523748a1f96553254875c775a346414df6a 100644 (file)
@@ -2,6 +2,8 @@
 #define MSP_CORE_ANDROID_MAINTHREAD_H_
 
 #include <android/native_activity.h>
+#include <sigc++/signal.h>
+#include "mutex.h"
 #include "thread.h"
 
 namespace Msp {
@@ -9,14 +11,34 @@ namespace Android {
 
 class MainThread: public Thread
 {
+public:
+       sigc::signal<void, ANativeWindow *> signal_native_window_created;
+       sigc::signal<void, ANativeWindow *> signal_native_window_resized;
+       sigc::signal<void, ANativeWindow *> signal_native_window_destroyed;
+       sigc::signal<void, AInputQueue *> signal_input_queue_created;
+       sigc::signal<void, AInputQueue *> signal_input_queue_destroyed;
+
 private:
        ANativeActivity *activity;
+       bool starting_up;
+       Mutex startup_mutex;
 
 public:
        MainThread(ANativeActivity *);
 
+       bool is_starting_up() const { return starting_up; }
+       void wait_for_app_created();
+       void resume_startup();
+
 private:
        virtual void main();
+
+       static void app_created(void *);
+       static void native_window_created(ANativeActivity *, ANativeWindow *);
+       static void native_window_resized(ANativeActivity *, ANativeWindow *);
+       static void native_window_destroyed(ANativeActivity *, ANativeWindow *);
+       static void input_queue_created(ANativeActivity *, AInputQueue *);
+       static void input_queue_destroyed(ANativeActivity *, AInputQueue *);
 };
 
 } // namespace Android