Upgrade to ndk 0.8, ndk-sys 0.5 + android-activity 0.5 releases

Fixes #2905.
Co-authored-by: Robert Bragg <robert@sixbynine.org>
This commit is contained in:
Marijn Suijten 2023-10-17 02:08:33 +02:00 committed by GitHub
parent 48f6582eb4
commit 9bf4493a21
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 21 additions and 11 deletions

View file

@ -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. - **Breaking** add `Event::MemoryWarning`; implemented on iOS/Android.
- On Wayland, support `Occluded` event with xdg-shell v6 - On Wayland, support `Occluded` event with xdg-shell v6
- Implement `AsFd`/`AsRawFd` for `EventLoop<T>` on X11 and Wayland. - Implement `AsFd`/`AsRawFd` for `EventLoop<T>` 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 # 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`. - **Breaking:** Bump MSRV from `1.64` to `1.65`.
- Make iOS windows usable from other threads. - Make iOS windows usable from other threads.
- Reexport `raw-window-handle` in `window` module. - 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, 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 Web, add `WindowBuilderExtWebSys::with_append()` to append the canvas element to the web page on creation.
- On Windows, add `drag_resize_window` method support. - 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)) - **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()`. - `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()` - On Windows, `RedrawRequested` is now driven by `WM_PAINT` messages which are requested via `redraw_request()`

View file

@ -45,6 +45,9 @@ wayland-csd-adwaita-notitle = ["sctk-adwaita"]
android-native-activity = ["android-activity/native-activity"] android-native-activity = ["android-activity/native-activity"]
android-game-activity = ["android-activity/game-activity"] android-game-activity = ["android-activity/game-activity"]
serde = ["dep:serde", "cursor-icon/serde", "smol_str/serde"] 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] [build-dependencies]
cfg_aliases = "0.1.1" cfg_aliases = "0.1.1"
@ -69,10 +72,9 @@ simple_logger = { version = "2.1.0", default_features = false }
softbuffer = "0.3.0" softbuffer = "0.3.0"
[target.'cfg(target_os = "android")'.dependencies] [target.'cfg(target_os = "android")'.dependencies]
# Coordinate the next winit release android-activity 0.5 release android-activity = "0.5.0"
android-activity = "=0.5.0-beta.1" ndk = "0.8.0"
ndk = "=0.8.0-beta.0" ndk-sys = "0.5.0"
ndk-sys = "=0.5.0-beta.0"
[target.'cfg(any(target_os = "ios", target_os = "macos"))'.dependencies] [target.'cfg(any(target_os = "ios", target_os = "macos"))'.dependencies]
core-foundation = "0.9.3" core-foundation = "0.9.3"

View file

@ -555,6 +555,10 @@ pub fn to_logical(key_char: Option<KeyMapChar>, keycode: Keycode) -> Key {
ThumbsUp => Key::Unidentified(native), ThumbsUp => Key::Unidentified(native),
ThumbsDown => Key::Unidentified(native), ThumbsDown => Key::Unidentified(native),
ProfileSwitch => Key::Unidentified(native), ProfileSwitch => Key::Unidentified(native),
// It's always possible that new versions of Android could introduce
// key codes we can't know about at compile time.
_ => Key::Unidentified(native),
}, },
} }
} }

View file

@ -946,10 +946,10 @@ impl Window {
#[cfg(feature = "rwh_04")] #[cfg(feature = "rwh_04")]
pub fn raw_window_handle_rwh_04(&self) -> rwh_04::RawWindowHandle { 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() { if let Some(native_window) = self.app.native_window().as_ref() {
let mut handle = rwh_04::AndroidNdkHandle::empty(); native_window.raw_window_handle()
handle.a_native_window = native_window.ptr().as_ptr() as *mut _;
rwh_04::RawWindowHandle::AndroidNdk(handle)
} else { } 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."); 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")] #[cfg(feature = "rwh_06")]
// Allow the usage of HasRawWindowHandle inside this function
#[allow(deprecated)]
pub fn raw_window_handle_rwh_06(&self) -> Result<rwh_06::RawWindowHandle, rwh_06::HandleError> { pub fn raw_window_handle_rwh_06(&self) -> Result<rwh_06::RawWindowHandle, rwh_06::HandleError> {
use rwh_06::HasRawWindowHandle;
if let Some(native_window) = self.app.native_window().as_ref() { if let Some(native_window) = self.app.native_window().as_ref() {
let handle = rwh_06::AndroidNdkWindowHandle::new(native_window.ptr().cast()); native_window.raw_window_handle()
Ok(rwh_06::RawWindowHandle::AndroidNdk(handle))
} else { } 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."); 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) Err(rwh_06::HandleError::Unavailable)