Fix misleading comment
[freeglut] / src / android / fg_main_android.c
index 3f973f2..597ae08 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * freeglut_main_android.c
+ * fg_main_android.c
  *
  * The Android-specific windows message processing methods.
  *
@@ -28,6 +28,7 @@
 
 #include <GL/freeglut.h>
 #include "fg_internal.h"
+#include "fg_main.h"
 
 #include <android/log.h>
 #define LOGI(...) ((void)__android_log_print(ANDROID_LOG_INFO, "FreeGLUT", __VA_ARGS__))
@@ -137,9 +138,7 @@ static unsigned char key_ascii(struct android_app* app, AInputEvent* event) {
 }
 
 /*
- * Handle a window configuration change. When no reshape
- * callback is hooked, the viewport size is updated to
- * match the new window size.
+ * Request a window resize
  */
 void fgPlatformReshapeWindow ( SFG_Window *window, int width, int height )
 {
@@ -167,7 +166,13 @@ unsigned long fgPlatformSystemTime ( void )
  */
 void fgPlatformSleepForEvents( long msec )
 {
-  /* fprintf(stderr, "fgPlatformSleepForEvents: STUB\n"); */
+    /* Android's NativeActivity relies on a Looper/ALooper object to
+       notify about events.  The Looper object is plugged on two
+       internal pipe(2)s to detect system and input events.  Sadly you
+       can only ask the Looper for an event, not just ask whether
+       there is a pending event (and process it later).  Consequently,
+       short of redesigning NativeActivity, we cannot
+       SleepForEvents. */
 }
 
 /**
@@ -217,13 +222,13 @@ int32_t handle_input(struct android_app* app, AInputEvent* event) {
     LOGI("motion %.01f,%.01f action=%d", x, y, AMotionEvent_getAction(event));
     
     /* Virtual arrows PAD */
-    // Don't interfere with existing mouse move event
+    /* Don't interfere with existing mouse move event */
     if (!touchscreen.in_mmotion) {
       struct vpad_state prev_vpad = touchscreen.vpad;
       touchscreen.vpad.left = touchscreen.vpad.right
        = touchscreen.vpad.up = touchscreen.vpad.down = false;
 
-      int32_t width = ANativeWindow_getWidth(window->Window.Handle);
+      /* int32_t width = ANativeWindow_getWidth(window->Window.Handle); */
       int32_t height = ANativeWindow_getHeight(window->Window.Handle);
       if (action == AMOTION_EVENT_ACTION_DOWN || action == AMOTION_EVENT_ACTION_MOVE) {
        if ((x > 0 && x < 100) && (y > (height - 100) && y < height))
@@ -273,7 +278,7 @@ int32_t handle_input(struct android_app* app, AInputEvent* event) {
     if (!touchscreen.vpad.on) {
       window->State.MouseX = x;
       window->State.MouseY = y;
-      LOGI("Changed mouse position: %d,%d", x, y);
+      LOGI("Changed mouse position: %f,%f", x, y);
       if (action == AMOTION_EVENT_ACTION_DOWN && FETCH_WCB(*window, Mouse)) {
        touchscreen.in_mmotion = true;
        INVOKE_WCB(*window, Mouse, (GLUT_LEFT_BUTTON, GLUT_DOWN, x, y));