Replace deprecated Android function ALooper_pollAll #4275
Merged
+9
−8
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This MR should close #4166
This is my best effort replacement of the ALooperPollAll function that was deleted in ndk-r27.
To be clear, I have exactly zero experience with this API and the NDK,
and barely any experience with android in general.
But I'll explain my reasoning for these changes:
The documentation for ALooperPollAll claims:
And then the documentation for ALooper_pollOnce claims:
So it seems reasonable to me to just call ALooper_pollOnce until we get
TIMEOUT
, which means no events left to process.I have tested these changes by compiling and running the Gestures example,
raylib/examples/core/core_input_gestures.c
. This seemed to work well on my phone.Noting my lack of experience in this area, I really welcome feedback on how to improve and/or verify these changes.