From 44e47fe98b27066d1b38cf9d91b5e0cb10c7cf27 Mon Sep 17 00:00:00 2001 From: Tony <68118705+Legend-Master@users.noreply.github.com> Date: Tue, 30 Apr 2024 00:33:33 +0800 Subject: [PATCH] fix(window-state): restore window state for stubbed zerord state (#1259) * Restore window state for default state * Add change file --- .changes/restore-default-window-state.md | 5 +++++ plugins/window-state/src/lib.rs | 10 ++++------ 2 files changed, 9 insertions(+), 6 deletions(-) create mode 100644 .changes/restore-default-window-state.md diff --git a/.changes/restore-default-window-state.md b/.changes/restore-default-window-state.md new file mode 100644 index 00000000..d0a954db --- /dev/null +++ b/.changes/restore-default-window-state.md @@ -0,0 +1,5 @@ +--- +"window-state": patch +--- + +Fix `restore_window` doesn't work with `skip_initial_state` when no previous cache was found diff --git a/plugins/window-state/src/lib.rs b/plugins/window-state/src/lib.rs index 7235a93a..75798a8f 100644 --- a/plugins/window-state/src/lib.rs +++ b/plugins/window-state/src/lib.rs @@ -148,12 +148,10 @@ impl WindowExt for Window { let mut should_show = true; - if let Some(state) = c.get(self.label()) { - // avoid restoring the default zeroed state - if *state == WindowState::default() { - return Ok(()); - } - + if let Some(state) = c + .get(self.label()) + .filter(|state| state != &&WindowState::default()) + { if flags.contains(StateFlags::DECORATIONS) { self.set_decorations(state.decorated)?; }