(Android) Move polling for events into Android input driver instead

of EGL context check_window function
This commit is contained in:
twinaphex 2012-10-30 06:20:49 +01:00
parent c2f49f1c53
commit 1ff6175bd2
2 changed files with 16 additions and 30 deletions

View File

@ -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)

View File

@ -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)