Add linux-theme-detection feature through mundy

This commit is contained in:
Héctor Ramón Jiménez 2025-09-08 09:49:11 +02:00
parent ab7eb88951
commit e92c87061d
No known key found for this signature in database
GPG key ID: 7CC46565708259A7
8 changed files with 566 additions and 50 deletions

View file

@ -326,7 +326,7 @@ pub fn window_event(
}
}
/// Converts a [`window::Level`] to a [`winit`] window level.
/// Converts a [`window::Level`] into a [`winit`] window level.
///
/// [`winit`]: https://github.com/rust-windowing/winit
pub fn window_level(level: window::Level) -> winit::window::WindowLevel {
@ -339,7 +339,7 @@ pub fn window_level(level: window::Level) -> winit::window::WindowLevel {
}
}
/// Converts a [`window::Position`] to a [`winit`] logical position for a given monitor.
/// Converts a [`window::Position`] into a [`winit`] logical position for a given monitor.
///
/// [`winit`]: https://github.com/rust-windowing/winit
pub fn position(
@ -411,7 +411,7 @@ pub fn position(
}
}
/// Converts a [`window::Mode`] to a [`winit`] fullscreen mode.
/// Converts a [`window::Mode`] into a [`winit`] fullscreen mode.
///
/// [`winit`]: https://github.com/rust-windowing/winit
pub fn fullscreen(
@ -426,7 +426,7 @@ pub fn fullscreen(
}
}
/// Converts a [`window::Mode`] to a visibility flag.
/// Converts a [`window::Mode`] into a visibility flag.
pub fn visible(mode: window::Mode) -> bool {
match mode {
window::Mode::Windowed | window::Mode::Fullscreen => true,
@ -434,7 +434,7 @@ pub fn visible(mode: window::Mode) -> bool {
}
}
/// Converts a [`winit`] fullscreen mode to a [`window::Mode`].
/// Converts a [`winit`] fullscreen mode into a [`window::Mode`].
///
/// [`winit`]: https://github.com/rust-windowing/winit
pub fn mode(mode: Option<winit::window::Fullscreen>) -> window::Mode {
@ -444,7 +444,7 @@ pub fn mode(mode: Option<winit::window::Fullscreen>) -> window::Mode {
}
}
/// Converts a [`winit`] window theme to a [`theme::Mode`].
/// Converts a [`winit`] window theme into a [`theme::Mode`].
///
/// [`winit`]: https://github.com/rust-windowing/winit
pub fn theme_mode(theme: winit::window::Theme) -> theme::Mode {
@ -454,7 +454,18 @@ pub fn theme_mode(theme: winit::window::Theme) -> theme::Mode {
}
}
/// Converts a [`mouse::Interaction`] to a [`winit`] cursor icon.
/// Converts a [`theme::Mode`] into a window theme.
///
/// [`winit`]: https://github.com/rust-windowing/winit
pub fn window_theme(mode: theme::Mode) -> Option<winit::window::Theme> {
match mode {
theme::Mode::None => None,
theme::Mode::Light => Some(winit::window::Theme::Light),
theme::Mode::Dark => Some(winit::window::Theme::Dark),
}
}
/// Converts a [`mouse::Interaction`] into a [`winit`] cursor icon.
///
/// [`winit`]: https://github.com/rust-windowing/winit
pub fn mouse_interaction(
@ -525,7 +536,7 @@ pub fn modifiers(
result
}
/// Converts a physical cursor position to a logical `Point`.
/// Converts a physical cursor position into a logical `Point`.
pub fn cursor_position(
position: winit::dpi::PhysicalPosition<f64>,
scale_factor: f32,
@ -1196,7 +1207,7 @@ pub fn icon(icon: window::Icon) -> Option<winit::window::Icon> {
winit::window::Icon::from_rgba(pixels, size.width, size.height).ok()
}
/// Convertions some [`input_method::Purpose`] to its `winit` counterpart.
/// Convertions some [`input_method::Purpose`] into its `winit` counterpart.
pub fn ime_purpose(
purpose: input_method::Purpose,
) -> winit::window::ImePurpose {