Add Window::set_transparent

Provide a hint to system compositor whether the window is transparent or
not. Only implemented on macOS and Wayland for now.
This commit is contained in:
Kirill Chibisov 2023-01-15 23:39:36 +03:00 committed by GitHub
parent 6f60c7a6cc
commit 62ce14a013
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
13 changed files with 84 additions and 1 deletions

View file

@ -306,7 +306,9 @@ impl WindowBuilder {
/// Sets whether the background of the window should be transparent.
///
/// If this is `true`, writing colors with alpha values different than
/// `1.0` will produce a transparent window.
/// `1.0` will produce a transparent window. On some platforms this
/// is more of a hint for the system and you'd still have the alpha
/// buffer. To control it see [`Window::set_transparent`].
///
/// The default is `false`.
#[inline]
@ -735,6 +737,23 @@ impl Window {
self.window.set_title(title)
}
/// Change the window transparency state.
///
/// This is just a hint that may not change anything about
/// the window transparency, however doing a missmatch between
/// the content of your window and this hint may result in
/// visual artifacts.
///
/// The default value follows the [`WindowBuilder::with_transparent`].
///
/// ## Platform-specific
///
/// - **Windows / X11 / Web / iOS / Android / Orbital:** Unsupported.
#[inline]
pub fn set_transparent(&self, transparent: bool) {
self.window.set_transparent(transparent)
}
/// Modifies the window's visibility.
///
/// If `false`, this will hide the window. If `true`, this will show the window.