summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/drivers/Android/Fl_Android_Application.H96
-rw-r--r--src/drivers/Android/Fl_Android_Application.cxx13
-rw-r--r--src/drivers/Android/Fl_Android_Screen_Driver.cxx8
3 files changed, 20 insertions, 97 deletions
diff --git a/src/drivers/Android/Fl_Android_Application.H b/src/drivers/Android/Fl_Android_Application.H
index 69ba524c0..dbc0a4dd9 100644
--- a/src/drivers/Android/Fl_Android_Application.H
+++ b/src/drivers/Android/Fl_Android_Application.H
@@ -133,105 +133,25 @@ public:
LOOPER_ID_USER = 3,
};
+ /**
+ * @see android.H Fl_Android_Platform_Event
+ */
enum {
- /**
- * Command from main thread: the AInputQueue has changed. Upon processing
- * this command, android_app->inputQueue will be updated to the new queue
- * (or NULL).
- */
APP_CMD_INPUT_CHANGED,
-
- /**
- * Command from main thread: a new ANativeWindow is ready for use. Upon
- * receiving this command, android_app->window will contain the new window
- * surface.
- */
APP_CMD_INIT_WINDOW,
-
- /**
- * Command from main thread: the existing ANativeWindow needs to be
- * terminated. Upon receiving this command, android_app->window still
- * contains the existing window; after calling android_app_exec_cmd
- * it will be set to NULL.
- */
APP_CMD_TERM_WINDOW,
-
- /**
- * Command from main thread: the current ANativeWindow has been resized.
- * Please redraw with its new size.
- */
APP_CMD_WINDOW_RESIZED,
-
- /**
- * Command from main thread: the system needs that the current ANativeWindow
- * be redrawn. You should redraw the window before handing this to
- * android_app_exec_cmd() in order to avoid transient drawing glitches.
- */
APP_CMD_WINDOW_REDRAW_NEEDED,
-
- /**
- * Command from main thread: the content area of the window has changed,
- * such as from the soft input window being shown or hidden. You can
- * find the new content rect in android_app::contentRect.
- */
APP_CMD_CONTENT_RECT_CHANGED,
-
- /**
- * Command from main thread: the app's activity window has gained
- * input focus.
- */
APP_CMD_GAINED_FOCUS,
-
- /**
- * Command from main thread: the app's activity window has lost
- * input focus.
- */
APP_CMD_LOST_FOCUS,
-
- /**
- * Command from main thread: the current device configuration has changed.
- */
APP_CMD_CONFIG_CHANGED,
-
- /**
- * Command from main thread: the system is running low on memory.
- * Try to reduce your memory use.
- */
APP_CMD_LOW_MEMORY,
-
- /**
- * Command from main thread: the app's activity has been started.
- */
APP_CMD_START,
-
- /**
- * Command from main thread: the app's activity has been resumed.
- */
APP_CMD_RESUME,
-
- /**
- * Command from main thread: the app should generate a new saved state
- * for itself, to restore from later if needed. If you have saved state,
- * allocate it with malloc and place it in android_app.savedState with
- * the size in android_app.savedStateSize. The will be freed for you
- * later.
- */
APP_CMD_SAVE_STATE,
-
- /**
- * Command from main thread: the app's activity has been paused.
- */
APP_CMD_PAUSE,
-
- /**
- * Command from main thread: the app's activity has been stopped.
- */
APP_CMD_STOP,
-
- /**
- * Command from main thread: the app's activity is being destroyed,
- * and waiting for the app thread to clean up and exit before proceeding.
- */
APP_CMD_DESTROY,
};
@@ -264,8 +184,8 @@ public:
static inline ANativeWindow *native_window() { return pNativeWindow; }
static inline ANativeWindow_Buffer &graphics_buffer() { return pApplicationWindowBuffer; }
static int destroy_requested() { return pDestroyRequested; }
- static void set_on_app_cmd(void (*cmd)(int32_t cmd)) { pOnAppCmd = cmd; }
- static void set_on_input_event(int32_t (*cmd)(AInputEvent* event)) { pOnInputEvent = cmd; }
+ //static void set_on_app_cmd(void (*cmd)(int32_t cmd)) { pOnAppCmd = cmd; }
+ //static void set_on_input_event(int32_t (*cmd)(AInputEvent* event)) { pOnInputEvent = cmd; }
static bool copy_screen();
@@ -287,7 +207,7 @@ protected:
static void *pSavedState;
static size_t pSavedStateSize;
static ALooper *pMsgPipeLooper;
- static ALooper *pRedrawLooper;
+ //static ALooper *pRedrawLooper;
static AInputQueue *pInputQueue;
static ANativeWindow *pNativeWindow;
static ANativeWindow_Buffer pNativeWindowBuffer;
@@ -308,10 +228,10 @@ protected:
static int pRunning;
static int pStateSaved;
static int pDestroyed;
- static int pRedrawNeeded;
+ //static int pRedrawNeeded;
static AInputQueue* pPendingInputQueue;
static ANativeWindow* pPendingWindow;
- static ARect pPendingContentRect;
+ //static ARect pPendingContentRect;
};
diff --git a/src/drivers/Android/Fl_Android_Application.cxx b/src/drivers/Android/Fl_Android_Application.cxx
index 757f366da..7163fc559 100644
--- a/src/drivers/Android/Fl_Android_Application.cxx
+++ b/src/drivers/Android/Fl_Android_Application.cxx
@@ -62,9 +62,6 @@ size_t Fl_Android_Application::pSavedStateSize = 0;
// The ALooper associated with the app's thread.
ALooper* Fl_Android_Application::pMsgPipeLooper = 0;
-// The ALooper tht interrupts the main loop when FLTK requests a redraw.
-ALooper* Fl_Android_Application::pRedrawLooper = 0;
-
// When non-NULL, this is the input queue from which the app will
// receive user input events.
AInputQueue* Fl_Android_Application::pInputQueue = 0;
@@ -103,10 +100,10 @@ struct Fl_Android_Application::android_poll_source Fl_Android_Application::pInpu
int Fl_Android_Application::pRunning = 0;
int Fl_Android_Application::pStateSaved = 0;
int Fl_Android_Application::pDestroyed = 0;
-int Fl_Android_Application::pRedrawNeeded = 0;
+//int Fl_Android_Application::pRedrawNeeded = 0;
AInputQueue *Fl_Android_Application::pPendingInputQueue = 0;
ANativeWindow *Fl_Android_Application::pPendingWindow = 0;
-ARect Fl_Android_Application::pPendingContentRect = { 0 };
+//ARect Fl_Android_Application::pPendingContentRect = { 0 };
@@ -173,6 +170,8 @@ int8_t Fl_Android_Application::read_cmd()
case APP_CMD_SAVE_STATE:
free_saved_state();
break;
+ default:
+ break;
}
return cmd;
} else {
@@ -276,6 +275,10 @@ void Fl_Android_Application::pre_exec_cmd(int8_t cmd)
case APP_CMD_DESTROY:
LOGV("APP_CMD_DESTROY\n");
pDestroyRequested = 1;
+ // FIXME: see Fl::program_should_quit()
+ break;
+
+ default:
break;
}
}
diff --git a/src/drivers/Android/Fl_Android_Screen_Driver.cxx b/src/drivers/Android/Fl_Android_Screen_Driver.cxx
index f3e7ddc9c..9c2d830fd 100644
--- a/src/drivers/Android/Fl_Android_Screen_Driver.cxx
+++ b/src/drivers/Android/Fl_Android_Screen_Driver.cxx
@@ -116,10 +116,10 @@ int Fl_Android_Screen_Driver::handle_keyboard_event(AInputEvent *event)
int Fl_Android_Screen_Driver::handle_mouse_event(AInputEvent *event)
{
- Fl::e_x = Fl::e_x_root = AMotionEvent_getX(event, 0) * 600 /
- ANativeWindow_getWidth(Fl_Android_Application::native_window());
- Fl::e_y = Fl::e_y_root = AMotionEvent_getY(event, 0) * 800 /
- ANativeWindow_getHeight(Fl_Android_Application::native_window());
+ Fl::e_x = Fl::e_x_root = (int)(AMotionEvent_getX(event, 0) * 600 /
+ ANativeWindow_getWidth(Fl_Android_Application::native_window()));
+ Fl::e_y = Fl::e_y_root = (int)(AMotionEvent_getY(event, 0) * 800 /
+ ANativeWindow_getHeight(Fl_Android_Application::native_window()));
Fl::e_state = FL_BUTTON1;
Fl::e_keysym = FL_Button + 1;
if (AMotionEvent_getAction(event) == AMOTION_EVENT_ACTION_DOWN) {