-
Notifications
You must be signed in to change notification settings - Fork 79
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
Postponed: Experimentally render to an Android surface #99
base: main
Are you sure you want to change the base?
Conversation
a889831
to
7b6ca43
Compare
unsafe impl raw_window_handle::HasRawWindowHandle for AndroidNativeWindow { | ||
fn raw_window_handle(&self) -> RawWindowHandle { | ||
let mut handle = AndroidNdkHandle::empty(); | ||
handle.a_native_window = unsafe { self.window.ptr().as_mut() as *mut _ as *mut _ }; | ||
RawWindowHandle::AndroidNdk(handle) | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, let me add the bindings for this one directly on ndk::NativeWindow
🎉
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
rust-mobile/ndk#274 Hopefully this simplifies things a bit for you, too :)
Whoops!
The branch disappeared because the PR - and the one adding |
Thank you! I think I'll actually wait with this until a new release is deployed :) else we can not publish to crates.io :) |
That'll take a while... :( |
Pinging back to #53, I couldn't find this PR from there :) |
libc::pipe(logpipe.as_mut_ptr()); | ||
libc::dup2(logpipe[1], libc::STDOUT_FILENO); | ||
libc::dup2(logpipe[1], libc::STDERR_FILENO); | ||
thread::spawn(move || { | ||
let tag = CStr::from_bytes_with_nul(b"MapLibreStderr\0").unwrap(); | ||
let file = File::from_raw_fd(logpipe[0]); | ||
let mut reader = BufReader::new(file); | ||
let mut buffer = String::new(); | ||
loop { | ||
buffer.clear(); | ||
if let Ok(len) = reader.read_line(&mut buffer) { | ||
if len == 0 { | ||
break; | ||
} else if let Ok(msg) = CString::new(buffer.clone()) { | ||
ndk_glue::android_log(Level::Info, tag, &msg); | ||
} | ||
} | ||
} | ||
}); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
CC rust-mobile/ndk#281, perhaps we should move this out of ndk_glue
and make it generic :)
Perhaps some unification with the android_logger
crate too.
Everything below 1-2 months is fine I think :) this poc is enough for now. It wont be usable until input is working for android |
I don't know what the cadence for But again, let me know if/when you start depending on a release and we'll see what we can do! |
Alright! So I think right now its no problem to depend on main as we have not even an unstable release. I'll continue to work on this with very low priority though as the changes are quite isolated. |
# Conflicts: # maplibre-winit/src/winit/mod.rs # maplibre/src/window.rs
91b59d0
to
5dbff6d
Compare
8c5d8ee
to
4dbd47b
Compare
Thanks @MarijnS95 for making this possible! This PR experimentally renders to a surface on android: rust-mobile/ndk#272
💻 Examples
🚨 Test instructions
✔️ PR Todo