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

add android NDK event loop #1556

Merged
merged 3 commits into from
May 6, 2020
Merged

Conversation

JasperDeSutter
Copy link
Contributor

@JasperDeSutter JasperDeSutter commented May 3, 2020

  • Tested on all platforms changed
  • Compilation warnings were addressed
  • cargo fmt has been run on this branch
  • cargo doc builds successfully
  • Added an entry to CHANGELOG.md if knowledge of this change could be valuable to users
  • Updated documentation to reflect any user-facing changes, including notes of platform-specific behavior
  • Created or updated an example program if it would help users understand this functionality
  • Updated feature matrix, if new features were added or implemented

These are not my changes, this backports the work (goddessfreya#2) of @dvc94ch to winit master. I have no issue if they want to take over this PR.

Running an example on an android device needs a couple things, add this to Cargo.toml:

[[example]]
name = "request_redraw_threaded"
crate-type = ["cdylib"]

And add this to the example file:

#[cfg(target_os = "android")]
ndk_glue::ndk_glue!(main);

Now start the application with cargo apk run --example request_redraw_threaded

Closes #721, closes #789, closes #948 cc @katyo

@dvc94ch
Copy link
Member

dvc94ch commented May 3, 2020

Great work thanks!

@dvc94ch
Copy link
Member

dvc94ch commented May 3, 2020

@JasperDeSutter can you add the ci changes to this PR too?

Copy link
Member

@dvc94ch dvc94ch left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@dvc94ch dvc94ch requested a review from Osspial May 3, 2020 20:55
@dvc94ch dvc94ch mentioned this pull request May 3, 2020
8 tasks
@dvc94ch
Copy link
Member

dvc94ch commented May 4, 2020

@JasperDeSutter it's on my todo list to merge before end of the week, let's just give it a couple more days incase someone wants to comment.

@JasperDeSutter
Copy link
Contributor Author

Okay, sounds great!

@dvc94ch
Copy link
Member

dvc94ch commented May 5, 2020

Needs rebasing.

I'm wondering if it makes sense to add the ndk glue to all examples.

#[cfg(target_os = "android")]
ndk_glue::ndk_glue!(main);

The other issue is that android apps rely on Suspend and Resume events being emitted. So a winit application that wasn't written with android in mind won't work. But if all backends emit Suspend and Resume events a winit application written for android can work on all platforms.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

EventLoop 2.0 for Android Determining visible area on Android HiDPI not fully supported on Android
2 participants