Skip to content

Commit bd64ffe

Browse files
committed
Android: Tweak ALooper_pollOnce call and update comments
1 parent 98b4a57 commit bd64ffe

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

src/glfm_android.c

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@
3636
#define GLFM_RESIZE_EVENT_MAX_WAIT_FRAMES 5
3737

3838
// If GLFM_HANDLE_BACK_BUTTON is 1, when the user presses the back button, the task is moved to the back. Otherwise,
39-
// when the user presses the back button, the activity is destroyed. On newer API levels (31) this may not be needed.
39+
// when the user presses the back button, the activity is destroyed.
4040
#define GLFM_HANDLE_BACK_BUTTON 1
4141

4242
// MARK: - Platform data (global singleton)
@@ -1596,10 +1596,11 @@ static void *glfm__mainLoop(void *param) {
15961596

15971597
// Run the main loop
15981598
while (!platformData->destroyRequested) {
1599-
int eventIdentifier;
16001599

1600+
// Poll input
1601+
int eventIdentifier;
16011602
while ((eventIdentifier = ALooper_pollOnce(platformData->animating ? 0 : -1,
1602-
NULL, NULL, NULL)) >= 0) {
1603+
NULL, NULL, NULL)) > ALOOPER_POLL_TIMEOUT) {
16031604
if (eventIdentifier == GLFMLooperIDCommand) {
16041605
uint8_t cmd = 0;
16051606
if (read(platformData->commandPipeRead, &cmd, sizeof(cmd)) == sizeof(cmd)) {
@@ -1618,6 +1619,7 @@ static void *glfm__mainLoop(void *param) {
16181619
}
16191620
}
16201621

1622+
// Render
16211623
if (platformData->animating && platformData->display) {
16221624
platformData->swapCalled = false;
16231625
glfm__drawFrame(platformData);

0 commit comments

Comments
 (0)