@@ -281,14 +281,15 @@ void android_main(struct android_app *app)
281281 // Request to end the native activity
282282 ANativeActivity_finish (app -> activity );
283283
284- // Android ALooper_pollAll () variables
284+ // Android ALooper_pollOnce () variables
285285 int pollResult = 0 ;
286286 int pollEvents = 0 ;
287287
288288 // Waiting for application events before complete finishing
289289 while (!app -> destroyRequested )
290290 {
291- while ((pollResult = ALooper_pollAll (0 , NULL , & pollEvents , (void * * )& platform .source )) >= 0 )
291+ // Poll all events until we reach return value TIMEOUT, meaning no events left to process
292+ while ((pollResult = ALooper_pollOnce (0 , NULL , & pollEvents , (void * * )& platform .source )) > ALOOPER_POLL_TIMEOUT )
292293 {
293294 if (platform .source != NULL ) platform .source -> process (app , platform .source );
294295 }
@@ -682,13 +683,13 @@ void PollInputEvents(void)
682683 CORE .Input .Keyboard .keyRepeatInFrame [i ] = 0 ;
683684 }
684685
685- // Android ALooper_pollAll () variables
686+ // Android ALooper_pollOnce () variables
686687 int pollResult = 0 ;
687688 int pollEvents = 0 ;
688689
689- // Poll Events (registered events)
690+ // Poll Events (registered events) until we reach TIMEOUT which indicates there are no events left to poll
690691 // NOTE: Activity is paused if not enabled (platform.appEnabled)
691- while ((pollResult = ALooper_pollAll (platform .appEnabled ? 0 : -1 , NULL , & pollEvents , (void * * )& platform .source )) >= 0 )
692+ while ((pollResult = ALooper_pollOnce (platform .appEnabled ? 0 : -1 , NULL , & pollEvents , (void * * )& platform .source )) > ALOOPER_POLL_TIMEOUT )
692693 {
693694 // Process this event
694695 if (platform .source != NULL ) platform .source -> process (platform .app , platform .source );
@@ -767,15 +768,15 @@ int InitPlatform(void)
767768
768769 TRACELOG (LOG_INFO , "PLATFORM: ANDROID: Initialized successfully" );
769770
770- // Android ALooper_pollAll () variables
771+ // Android ALooper_pollOnce () variables
771772 int pollResult = 0 ;
772773 int pollEvents = 0 ;
773774
774775 // Wait for window to be initialized (display and context)
775776 while (!CORE .Window .ready )
776777 {
777- // Process events loop
778- while ((pollResult = ALooper_pollAll (0 , NULL , & pollEvents , (void * * )& platform .source )) >= 0 )
778+ // Process events until we reach TIMEOUT, which indicates no more events queued.
779+ while ((pollResult = ALooper_pollOnce (0 , NULL , & pollEvents , (void * * )& platform .source )) > ALOOPER_POLL_TIMEOUT )
779780 {
780781 // Process this event
781782 if (platform .source != NULL ) platform .source -> process (platform .app , platform .source );
0 commit comments