Add WindowBuilder::with_active

Co-authored-by: Kirill Chibisov <contact@kchibisov.com>
This commit is contained in:
Amr Bashir 2023-01-27 07:08:29 +02:00 committed by GitHub
parent 930df0ec45
commit b457329003
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
9 changed files with 60 additions and 5 deletions

View file

@ -139,6 +139,7 @@ pub(crate) struct WindowAttributes {
pub content_protected: bool,
pub window_level: WindowLevel,
pub parent_window: Option<RawWindowHandle>,
pub active: bool,
}
impl Default for WindowAttributes {
@ -163,6 +164,7 @@ impl Default for WindowAttributes {
resize_increments: None,
content_protected: false,
parent_window: None,
active: true,
}
}
}
@ -405,6 +407,22 @@ impl WindowBuilder {
self
}
/// Whether the window will be initially focused or not.
///
/// The window should be assumed as not focused by default
/// following by the [`WindowEvent::Focused`].
///
/// ## Platform-specific:
///
/// **Android / iOS / X11 / Wayland / Orbital:** Unsupported.
///
/// [`WindowEvent::Focused`]: crate::event::WindowEvent::Focused.
#[inline]
pub fn with_active(mut self, active: bool) -> WindowBuilder {
self.window.active = active;
self
}
/// Build window with parent window.
///
/// The default is `None`.