From 55456de5b5423bb5c898e97957c7c73c31faae0c Mon Sep 17 00:00:00 2001 From: Amr Bashir Date: Tue, 13 Jun 2023 15:48:10 +0300 Subject: [PATCH] fix(window-state): manual default implentation (#425) * fix(window-state): manual default implentation, closes #421 * Update lib.rs --- plugins/window-state/src/lib.rs | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/plugins/window-state/src/lib.rs b/plugins/window-state/src/lib.rs index f6d7a5f6..fa88be3b 100644 --- a/plugins/window-state/src/lib.rs +++ b/plugins/window-state/src/lib.rs @@ -55,7 +55,7 @@ impl Default for StateFlags { } } -#[derive(Debug, Default, Deserialize, Serialize, PartialEq)] +#[derive(Debug, Deserialize, Serialize, PartialEq)] struct WindowState { width: f64, height: f64, @@ -67,6 +67,21 @@ struct WindowState { fullscreen: bool, } +impl Default for WindowState { + fn default() -> Self { + Self { + width: Default::default(), + height: Default::default(), + x: Default::default(), + y: Default::default(), + maximized: Default::default(), + visible: true, + decorated: true, + fullscreen: Default::default(), + } + } +} + struct WindowStateCache(Arc>>); pub trait AppHandleExt { /// Saves all open windows state to disk