From cc32bd4de09ee58c15d1b3f2cec4a79dc65dd035 Mon Sep 17 00:00:00 2001 From: Héctor Ramón Jiménez Date: Thu, 6 Jul 2023 06:41:28 +0200 Subject: Use `Size` in both `Resize` and `FetchSize` window actions --- runtime/src/window/action.rs | 17 +++++------------ 1 file changed, 5 insertions(+), 12 deletions(-) (limited to 'runtime/src/window') diff --git a/runtime/src/window/action.rs b/runtime/src/window/action.rs index 551d0a01..d0137895 100644 --- a/runtime/src/window/action.rs +++ b/runtime/src/window/action.rs @@ -1,4 +1,5 @@ use crate::core::window::{Icon, Level, Mode, UserAttention}; +use crate::core::Size; use crate::futures::MaybeSend; use std::fmt; @@ -14,14 +15,9 @@ pub enum Action { /// button was pressed immediately before this function is called. Drag, /// Resize the window. - Resize { - /// The new logical width of the window - width: u32, - /// The new logical height of the window - height: u32, - }, + Resize(Size), /// Fetch the current size of the window. - FetchSize(Box T + 'static>), + FetchSize(Box) -> T + 'static>), /// Set the window to maximized or back Maximize(bool), /// Set the window to minimized or back @@ -105,7 +101,7 @@ impl Action { match self { Self::Close => Action::Close, Self::Drag => Action::Drag, - Self::Resize { width, height } => Action::Resize { width, height }, + Self::Resize(size) => Action::Resize(size), Self::FetchSize(o) => Action::FetchSize(Box::new(move |s| f(o(s)))), Self::Maximize(maximized) => Action::Maximize(maximized), Self::Minimize(minimized) => Action::Minimize(minimized), @@ -130,10 +126,7 @@ impl fmt::Debug for Action { match self { Self::Close => write!(f, "Action::Close"), Self::Drag => write!(f, "Action::Drag"), - Self::Resize { width, height } => write!( - f, - "Action::Resize {{ widget: {width}, height: {height} }}" - ), + Self::Resize(size) => write!(f, "Action::Resize({size:?})"), Self::FetchSize(_) => write!(f, "Action::FetchSize"), Self::Maximize(maximized) => { write!(f, "Action::Maximize({maximized})") -- cgit