Window flickers on startup when loading maximized state with persistence enabled (Windows 11)
- Dominant language
- Rust
- Stars
- 30.6k
- Forks
- 2.1k
- Avg merge
- 1d 9h
- Merged PRs (30d)
- 72
Description
**Describe the bug**
When using eframe/egui with persistence enabled, an app that was previously closed while maximized will briefly flicker on the next launch. The flicker appears as a very fast flash—as if a window appears and instantly closes—before the actual maximized window appears about a second later. This happens only after the window state has been persisted in maximized mode.
**To Reproduce**
1. Setup project:
**Cargo.toml** (enable persistence):
```toml
[package]
name = "MaximizePersistenceFlicker"
version = "0.1.0"
edition = "2024"
[dependencies]
egui = "0.33"
eframe = { version = "0.33", default-features = false, features = ["wgpu", "persistence"] }
wgpu = { version = "*", features = ["dx12"] }
[profile.dev.package."*"]
opt-level = 2
```
**main.rs**:
```rust
fn main() {
eframe::run_native(
"MaximizePersistenceFlicker",
Default::default(),
Box::new(move |_cc| Ok(Box::new(MaximizePersistenceFlicker))),
).unwrap();
}
struct MaximizePersistenceFlicker;
impl eframe::App for MaximizePersistenceFlicker {
fn update(&mut self, _ctx: &egui::Context, _frame: &mut eframe::Frame) {}
}
```
2. Launch once, and the program starts in windowed mode (everything is OK), maximize the window, then exit;
3. Launch again, now the (seemingly maximized) program flickers very quickly for once (visually as if a window launches but immediately crashes, so transient that no icon could be seen in the Windows task bar), and after ~1s, the window shows again maximized and settled
To examine the behavior in closer detail, you can play the following video frame by frame.
https://github.com/user-attachments/assets/efef88fd-5809-4073-8360-011e0f92510f
**Expected behavior**
**Desktop (please complete the following information):**
- OS: Windows 11
Contributor guide
Research direction
Start with the persistence-enabled configuration in Cargo.toml and the minimal reproduction in main.rs, then run it on Windows 11 and reproduce the maximized-state launch sequence. Trace the startup path for the persisted window state and compare the transient first display with the later maximized window. Done means reopening after a maximized exit no longer produces the brief flicker while persistence remains enabled.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- desktop
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 48/100