From 805249e27e96f4d56112db866d95aaa024431eae Mon Sep 17 00:00:00 2001 From: Arthur Kaukal Valladares Date: Tue, 26 Oct 2021 14:28:28 -0700 Subject: [PATCH] Android: `Window::config` now initially returns accurate data. (#2021) Initialize Android's static 'CONFIG' from NativeActivity's Asset Manager --- CHANGELOG.md | 2 ++ src/platform_impl/android/mod.rs | 4 +++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 1e6012c2..fadcb32a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,7 @@ # Unreleased +- On Android, fixed `WindowExtAndroid::config` initially returning an empty `Configuration`. +- On Android, fixed `Window::scale_factor` and `MonitorHandle::scale_factor` initially always returning 1.0. - On X11, select an appropriate visual for transparency if is requested - On Wayland and X11, fix diagonal window resize cursor orientation. - On macOS, drop the event callback before exiting. diff --git a/src/platform_impl/android/mod.rs b/src/platform_impl/android/mod.rs index 725e41c4..94a78c62 100644 --- a/src/platform_impl/android/mod.rs +++ b/src/platform_impl/android/mod.rs @@ -19,7 +19,9 @@ use std::{ }; lazy_static! { - static ref CONFIG: RwLock = RwLock::new(Configuration::new()); + static ref CONFIG: RwLock = RwLock::new(Configuration::from_asset_manager( + &ndk_glue::native_activity().asset_manager() + )); // If this is `Some()` a `Poll::Wake` is considered an `EventSource::Internal` with the event // contained in the `Option`. The event is moved outside of the `Option` replacing it with a // `None`.