diff --git a/CHANGELOG.md b/CHANGELOG.md
index 8544c19..b65b33e 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -5,6 +5,15 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
+## Unreleased
+
+### Added
+
+- `WindowAttributes::delay_visible` is a new setting initializes the window
+ `visible: false` before showing it after the first successful redraw. The goal
+ is to avoid the OS drawing an empty window before the window behavior has
+ initialized. This new attribute defaults to true.
+
## v0.3.0 (2024-05-12)
### Breaking Changes
diff --git a/src/window.rs b/src/window.rs
index 89ce8ae..c5c7d53 100644
--- a/src/window.rs
+++ b/src/window.rs
@@ -149,6 +149,8 @@ pub struct WindowAttributes {
pub window_level: WindowLevel,
/// Whether the window is active or not.
pub active: bool,
+ /// When true, this window will delay honoring the `visible` attribute until after the window behavior has been initialized and redrawn a single time.
+ pub delay_visible: bool,
/// Name of the application
///
/// - `WM_CLASS` on X11
@@ -182,6 +184,7 @@ impl Default for WindowAttributes {
window_level: defaults.window_level,
active: defaults.active,
app_name: None,
+ delay_visible: true,
}
}
}
@@ -210,7 +213,7 @@ where
///
/// The only errors this funciton can return arise from
/// [`winit::window::WindowBuilder::build`].
- pub fn open(self) -> Result