Upgrade to ndk-sys 0.5.0-beta.0, ndk-0.8.0 beta.0

This commit is contained in:
Marijn Suijten
2023-06-24 00:45:43 +02:00
parent 2654c9659b
commit 499d09595b
7 changed files with 20 additions and 25 deletions
+2 -6
View File
@@ -1,8 +1,4 @@
[workspace]
members = [
"android-activity"
]
members = ["android-activity"]
exclude = [
"examples",
]
exclude = ["examples"]
+2 -2
View File
@@ -39,8 +39,8 @@ log = "0.4"
jni-sys = "0.3"
cesu8 = "1"
jni = "0.21"
ndk = "0.7"
ndk-sys = "0.4"
ndk-sys = "0.5.0-beta.0"
ndk = "0.8.0-beta.0"
ndk-context = "0.1"
android-properties = "0.2"
num_enum = "0.7"
+2 -2
View File
@@ -537,14 +537,14 @@ impl AndroidApp {
/// [`ALooper_pollAll`]: ndk::looper::ThreadLooper::poll_all
pub fn poll_events<F>(&self, timeout: Option<Duration>, callback: F)
where
F: FnMut(PollEvent),
F: FnMut(PollEvent<'_>),
{
self.inner.read().unwrap().poll_events(timeout, callback);
}
/// Creates a means to wake up the main loop while it is blocked waiting for
/// events within [`AndroidApp::poll_events()`].
pub fn create_waker(&self) -> activity_impl::AndroidAppWaker {
pub fn create_waker(&self) -> AndroidAppWaker {
self.inner.read().unwrap().create_waker()
}
+6 -7
View File
@@ -216,7 +216,7 @@ pub enum NativeThreadState {
pub struct NativeActivityState {
pub msg_read: libc::c_int,
pub msg_write: libc::c_int,
pub config: super::ConfigurationRef,
pub config: ConfigurationRef,
pub saved_state: Vec<u8>,
pub input_queue: *mut ndk_sys::AInputQueue,
pub window: Option<NativeWindow>,
@@ -343,9 +343,8 @@ impl WaitableNativeActivityState {
}
}
let saved_state = unsafe {
std::slice::from_raw_parts(saved_state_in as *const u8, saved_state_size as _)
};
let saved_state =
unsafe { std::slice::from_raw_parts(saved_state_in as *const u8, saved_state_size) };
let config = unsafe {
let config = ndk_sys::AConfiguration_new();
@@ -517,7 +516,7 @@ impl WaitableNativeActivityState {
// given via a `malloc()` allocated pointer since it will automatically
// `free()` the state after it has been converted to a buffer for the JVM.
if !guard.saved_state.is_empty() {
let saved_state_size = guard.saved_state.len() as _;
let saved_state_size = guard.saved_state.len();
let saved_state_src_ptr = guard.saved_state.as_ptr();
unsafe {
let saved_state = libc::malloc(saved_state_size);
@@ -681,7 +680,7 @@ unsafe extern "C" fn on_resume(activity: *mut ndk_sys::ANativeActivity) {
unsafe extern "C" fn on_save_instance_state(
activity: *mut ndk_sys::ANativeActivity,
out_len: *mut ndk_sys::size_t,
out_len: *mut usize,
) -> *mut libc::c_void {
abort_on_panic(|| {
log::debug!("SaveInstanceState: {:p}\n", activity);
@@ -689,7 +688,7 @@ unsafe extern "C" fn on_save_instance_state(
let mut ret = ptr::null_mut();
try_with_waitable_activity_ref(activity, |waitable_activity| {
let (state, len) = waitable_activity.request_save_state();
*out_len = len as ndk_sys::size_t;
*out_len = len;
ret = state
});
+3 -3
View File
@@ -185,14 +185,14 @@ impl AndroidAppInner {
pub fn poll_events<F>(&self, timeout: Option<Duration>, mut callback: F)
where
F: FnMut(PollEvent),
F: FnMut(PollEvent<'_>),
{
trace!("poll_events");
unsafe {
let mut fd: i32 = 0;
let mut events: i32 = 0;
let mut source: *mut core::ffi::c_void = ptr::null_mut();
let mut source: *mut c_void = ptr::null_mut();
let timeout_milliseconds = if let Some(timeout) = timeout {
timeout.as_millis() as i32
@@ -209,7 +209,7 @@ impl AndroidAppInner {
timeout_milliseconds,
&mut fd,
&mut events,
&mut source as *mut *mut core::ffi::c_void,
&mut source as *mut *mut c_void,
);
trace!("pollAll id = {id}");
match id {
+2 -2
View File
@@ -9,8 +9,8 @@ edition = "2021"
log = "0.4"
android_logger = "0.11.0"
android-activity = { path="../../android-activity", features = ["game-activity"] }
ndk-sys = "0.4"
ndk = "0.7"
ndk-sys = "0.5.0-beta.0"
ndk = "0.8.0-beta.0"
[lib]
name="main"
+3 -3
View File
@@ -9,8 +9,8 @@ edition = "2021"
log = "0.4"
android_logger = "0.11.0"
android-activity = { path="../../android-activity", features = [ "native-activity" ] }
ndk-sys = "0.4"
ndk = "0.7"
ndk-sys = "0.5.0-beta.0"
ndk = "0.8.0-beta.0"
[lib]
#name="na_mainloop"
@@ -181,4 +181,4 @@ label = "Application Name"
#port = "8080"
#path = "/rust-windowing/android-ndk-rs/tree/master/cargo-apk"
#path_prefix = "/rust-windowing/"
#mime_type = "image/jpeg"
#mime_type = "image/jpeg"