diff --git a/android/native/jni/input_android.c b/android/native/jni/input_android.c index 1c3ca74cd9..c0a15a9b53 100644 --- a/android/native/jni/input_android.c +++ b/android/native/jni/input_android.c @@ -381,6 +381,21 @@ static void *android_input_init(void) static void android_input_poll(void *data) { (void)data; + + // Read all pending events. + int ident; + int events; + struct android_poll_source* source; + struct android_app* state = g_android.app; + + // If not animating, we will block forever waiting for events. + // If animating, we loop until all events are read, then continue + // to draw the next frame of animation. + ident= ALooper_pollAll(0, NULL, &events, (void**)&source); + + // Process this event. + if (ident && source != NULL) + source->process(state, source); } static int16_t android_input_state(void *data, const struct retro_keybind **binds, unsigned port, unsigned device, unsigned index, unsigned id) diff --git a/gfx/context/androidegl_ctx.c b/gfx/context/androidegl_ctx.c index c9adebac65..140d124688 100644 --- a/gfx/context/androidegl_ctx.c +++ b/gfx/context/androidegl_ctx.c @@ -145,37 +145,8 @@ static void gfx_ctx_check_window(bool *quit, *quit = false; *resize = false; - // Read all pending events. - int ident; - int events; - struct android_poll_source* source; - struct android_app* state = g_android.app; - - // If not animating, we will block forever waiting for events. - // If animating, we loop until all events are read, then continue - // to draw the next frame of animation. - ident=ALooper_pollAll(g_android.animating ? 0 : -1, NULL, &events, - (void**)&source); - - // Process this event. - if (source != NULL) - source->process(state, source); - - // If a sensor has data, process it now. - /* - if (ident == LOOPER_ID_USER && g_android.accelerometerSensor != NULL) - { - ASensorEvent event; - while (ASensorEventQueue_getEvents(g_android.sensorEventQueue, &event, 1) > 0) - { - RARCH_LOG("accelerometer: x=%f y=%f z=%f.\n", event.acceleration.x, - event.acceleration.y, event.acceleration.z); - } - } - */ - // Check if we are exiting. - if (state->destroyRequested != 0 || g_android.init_quit) + if (g_android.app->destroyRequested != 0 || g_android.init_quit) *quit = true; if (g_android.animating)