Add ActiveEventLoop::system_theme()

This also fixes macOS returning `None` in `Window::theme()` if no theme
override is set, instead it now returns the system theme.

MacOS and Wayland were the only ones working correctly according to the
documentation, which was an oversight. The documentation was "fixed"
now.

Fixes #3837.
This commit is contained in:
daxpedda 2024-08-05 20:51:38 +02:00 committed by GitHub
parent 54ff9c3bb5
commit 15b79b18e1
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
12 changed files with 82 additions and 20 deletions

View file

@ -1367,14 +1367,14 @@ impl Window {
self.window.maybe_queue_on_main(move |w| w.set_theme(theme))
}
/// Returns the current window theme override.
/// Returns the current window theme.
///
/// Returns `None` if the current theme is set as the system default, or if it cannot be
/// determined on the current platform.
/// Returns `None` if it cannot be determined on the current platform.
///
/// ## Platform-specific
///
/// - **iOS / Android / Wayland / x11 / Orbital:** Unsupported, returns `None`.
/// - **iOS / Android / x11 / Orbital:** Unsupported.
/// - **Wayland:** Only returns theme overrides.
#[inline]
pub fn theme(&self) -> Option<Theme> {
let _span = tracing::debug_span!("winit::Window::theme",).entered();