diff --git a/CHANGELOG.md b/CHANGELOG.md index 67806fcb695..64d8398d4da 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -35,10 +35,11 @@ And please only add new entries to the top of this list, right below the `# Unre - **Breaking** add `Event::MemoryWarning`; implemented on iOS/Android. - On Wayland, support `Occluded` event with xdg-shell v6 - Implement `AsFd`/`AsRawFd` for `EventLoop` on X11 and Wayland. +- **Breaking:** Bump `ndk` version to `0.8.0`, ndk-sys to `0.5.0`, `android-activity` to `0.5.0`. # 0.29.1-beta -- **Breaking:** Bump `ndk` version to `0.8.0-beta.0`, ndk-sys to `v0.5.0-beta.0`, `android-activity` to `0.5.0-beta.1`. +- **Breaking:** Bump `ndk` version to `0.8.0-beta.0`, ndk-sys to `0.5.0-beta.0`, `android-activity` to `0.5.0-beta.1`. - **Breaking:** Bump MSRV from `1.64` to `1.65`. - Make iOS windows usable from other threads. - Reexport `raw-window-handle` in `window` module. @@ -87,7 +88,7 @@ And please only add new entries to the top of this list, right below the `# Unre - On Web, remove unnecessary `Window::is_dark_mode()`, which was replaced with `Window::theme()`. - On Web, add `WindowBuilderExtWebSys::with_append()` to append the canvas element to the web page on creation. - On Windows, add `drag_resize_window` method support. -- **Breaking** `run() ->!` has been replaced by `run() -> Result<(), EventLoopError>` for returning errors without calling `std::process::exit()` ([#2767](https://github.com/rust-windowing/winit/pull/2767)) +- **Breaking** `run() -> !` has been replaced by `run() -> Result<(), EventLoopError>` for returning errors without calling `std::process::exit()` ([#2767](https://github.com/rust-windowing/winit/pull/2767)) - **Breaking** Removed `EventLoopExtRunReturn` / `run_return` in favor of `EventLoopExtPumpEvents` / `pump_events` and `EventLoopExtRunOnDemand` / `run_ondemand` ([#2767](https://github.com/rust-windowing/winit/pull/2767)) - `RedrawRequested` is no longer guaranteed to be emitted after `MainEventsCleared`, it is now platform-specific when the event is emitted after being requested via `redraw_request()`. - On Windows, `RedrawRequested` is now driven by `WM_PAINT` messages which are requested via `redraw_request()` diff --git a/Cargo.toml b/Cargo.toml index 9ee521722e6..fcfb5da062d 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -45,6 +45,9 @@ wayland-csd-adwaita-notitle = ["sctk-adwaita"] android-native-activity = ["android-activity/native-activity"] android-game-activity = ["android-activity/game-activity"] serde = ["dep:serde", "cursor-icon/serde", "smol_str/serde"] +rwh_04 = ["dep:rwh_04", "ndk/rwh_04"] +rwh_05 = ["dep:rwh_05", "ndk/rwh_05"] +rwh_06 = ["dep:rwh_06", "ndk/rwh_06"] [build-dependencies] cfg_aliases = "0.1.1" @@ -69,10 +72,11 @@ simple_logger = { version = "2.1.0", default_features = false } softbuffer = "0.3.0" [target.'cfg(target_os = "android")'.dependencies] -# Coordinate the next winit release android-activity 0.5 release -android-activity = "=0.5.0-beta.1" -ndk = "=0.8.0-beta.0" -ndk-sys = "=0.5.0-beta.0" +# android-activity = "0.5.0" +# TODO: https://github.com/rust-mobile/android-activity/pull/128 +android-activity = { git = "https://github.com/MarijnS95/android-activity", rev = "720e5a3" } +ndk = "0.8.0" +ndk-sys = "0.5.0" [target.'cfg(any(target_os = "ios", target_os = "macos"))'.dependencies] core-foundation = "0.9.3" diff --git a/src/platform_impl/android/mod.rs b/src/platform_impl/android/mod.rs index 2c6ef65c38c..a6596ef2970 100644 --- a/src/platform_impl/android/mod.rs +++ b/src/platform_impl/android/mod.rs @@ -946,10 +946,10 @@ impl Window { #[cfg(feature = "rwh_04")] pub fn raw_window_handle_rwh_04(&self) -> rwh_04::RawWindowHandle { + use rwh_04::HasRawWindowHandle; + if let Some(native_window) = self.app.native_window().as_ref() { - let mut handle = rwh_04::AndroidNdkHandle::empty(); - handle.a_native_window = native_window.ptr().as_ptr() as *mut _; - rwh_04::RawWindowHandle::AndroidNdk(handle) + native_window.raw_window_handle() } 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."); } @@ -972,10 +972,13 @@ impl Window { } #[cfg(feature = "rwh_06")] + // Allow the usage of HasRawWindowHandle inside this function + #[allow(deprecated)] pub fn raw_window_handle_rwh_06(&self) -> Result { + use rwh_06::HasRawWindowHandle; + if let Some(native_window) = self.app.native_window().as_ref() { - let handle = rwh_06::AndroidNdkWindowHandle::new(native_window.ptr().cast()); - Ok(rwh_06::RawWindowHandle::AndroidNdk(handle)) + native_window.raw_window_handle() } else { log::error!("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."); Err(rwh_06::HandleError::Unavailable)