From b394c84b37eacb266d45663d5d6626f1b616af7e Mon Sep 17 00:00:00 2001 From: Yiğit Özdemir Date: Thu, 22 Jun 2023 18:28:32 +0300 Subject: Add FetchSize command - apply the changes discussed at #water-cooler --- runtime/src/window/action.rs | 18 +++--------------- 1 file changed, 3 insertions(+), 15 deletions(-) (limited to 'runtime') diff --git a/runtime/src/window/action.rs b/runtime/src/window/action.rs index 4ea9d474..551d0a01 100644 --- a/runtime/src/window/action.rs +++ b/runtime/src/window/action.rs @@ -1,7 +1,3 @@ - - -use iced_core::window::SizeType; - use crate::core::window::{Icon, Level, Mode, UserAttention}; use crate::futures::MaybeSend; @@ -25,12 +21,7 @@ pub enum Action { height: u32, }, /// Fetch the current size of the window. - FetchSize { - /// Which size to fetch - size_type: SizeType, - /// Callback function - callback: Box T + 'static>, - }, + FetchSize(Box T + 'static>), /// Set the window to maximized or back Maximize(bool), /// Set the window to minimized or back @@ -115,10 +106,7 @@ impl Action { Self::Close => Action::Close, Self::Drag => Action::Drag, Self::Resize { width, height } => Action::Resize { width, height }, - Self::FetchSize { size_type, callback } => Action::FetchSize { - size_type: size_type, - callback: Box::new(move |s| f(callback(s))), - }, + Self::FetchSize(o) => Action::FetchSize(Box::new(move |s| f(o(s)))), Self::Maximize(maximized) => Action::Maximize(maximized), Self::Minimize(minimized) => Action::Minimize(minimized), Self::Move { x, y } => Action::Move { x, y }, @@ -146,7 +134,7 @@ impl fmt::Debug for Action { f, "Action::Resize {{ widget: {width}, height: {height} }}" ), - Self::FetchSize { size_type, .. } => write!(f, "Action::FetchSize {{ size_type: {size_type:?} }}"), + Self::FetchSize(_) => write!(f, "Action::FetchSize"), Self::Maximize(maximized) => { write!(f, "Action::Maximize({maximized})") } -- cgit