Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Replace deprecated Android function ALooper_pollAll #4275

Merged
merged 1 commit into from
Aug 23, 2024

Conversation

Mercotui
Copy link
Contributor

@Mercotui Mercotui commented Aug 23, 2024

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:

Like ALooper_pollOnce(), but performs all pending callbacks until all data has been consumed or a file descriptor is available with no callback.

And then the documentation for ALooper_pollOnce claims:

Returns ALOOPER_POLL_TIMEOUT if there was no data before the given timeout expired.

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.

@raysan5 raysan5 merged commit 3079c69 into raysan5:master Aug 23, 2024
@raysan5
Copy link
Owner

raysan5 commented Aug 23, 2024

@Mercotui Thanks! It looks good to me! 😄

@Mercotui Mercotui deleted the fix/android-alooper-pollall branch August 25, 2024 23:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[rcore][android] ALooper_pollAll has been deprecated on Android NDK Version 27
2 participants