From 8465bf7689aaa8c01cd4046a94afbe474df587b0 Mon Sep 17 00:00:00 2001 From: amrbashir Date: Mon, 11 Nov 2024 19:12:36 +0200 Subject: [PATCH] fix(android): fix compile when `rwh_04` or `rwh_05` is active closes #1011 --- Cargo.toml | 3 +++ src/platform_impl/android/mod.rs | 4 ++-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 933559e68..3436f9996 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -29,6 +29,9 @@ targets = [ [features] default = [ "rwh_06" ] serde = [ "dep:serde", "dpi/serde" ] +rwh_04 = [ "dep:rwh_04" ] +rwh_05 = [ "dep:rwh_05" ] +rwh_06 = [ "dep:rwh_06" ] [workspace] members = [ "tao-macros" ] diff --git a/src/platform_impl/android/mod.rs b/src/platform_impl/android/mod.rs index 19d8e1b04..e489732db 100644 --- a/src/platform_impl/android/mod.rs +++ b/src/platform_impl/android/mod.rs @@ -700,7 +700,7 @@ impl Window { pub fn raw_window_handle_rwh_04(&self) -> rwh_04::RawWindowHandle { // TODO: Use main activity instead? let mut handle = rwh_04::AndroidNdkHandle::empty(); - if let Some(w) = ndk_glue::window_manager() { + if let Some(w) = ndk_glue::window_manager().as_ref() { handle.a_native_window = w.as_obj().as_raw() as *mut _; } else { panic!("Cannot get the native window, it's null and will always be null before Event::Resumed and after Event::Suspended. Make sure you only call this function between those events."); @@ -712,7 +712,7 @@ impl Window { pub fn raw_window_handle_rwh_05(&self) -> rwh_05::RawWindowHandle { // TODO: Use main activity instead? let mut handle = rwh_05::AndroidNdkWindowHandle::empty(); - if let Some(w) = ndk_glue::window_manager() { + if let Some(w) = ndk_glue::window_manager().as_ref() { handle.a_native_window = w.as_obj().as_raw() as *mut _; } else { panic!("Cannot get the native window, it's null and will always be null before Event::Resumed and after Event::Suspended. Make sure you only call this function between those events.");