diff options
author | 2024-02-22 17:13:12 +1300 | |
---|---|---|
committer | 2024-02-22 09:16:05 +0100 | |
commit | 59885e9a363dd73b3a3e8dd125decf0e34130c59 (patch) | |
tree | 01eb049c55c514d5455cd8569a0fb4360adb6146 /runtime/src/window/action.rs | |
parent | 6c00e615b9fb7618c710a3f5d920d00e6b8a258c (diff) | |
download | iced-59885e9a363dd73b3a3e8dd125decf0e34130c59.tar.gz iced-59885e9a363dd73b3a3e8dd125decf0e34130c59.tar.bz2 iced-59885e9a363dd73b3a3e8dd125decf0e34130c59.zip |
Add `fetch_location` command to `window` module
Diffstat (limited to 'runtime/src/window/action.rs')
-rw-r--r-- | runtime/src/window/action.rs | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/runtime/src/window/action.rs b/runtime/src/window/action.rs index 9bfc2b62..39eb1008 100644 --- a/runtime/src/window/action.rs +++ b/runtime/src/window/action.rs @@ -42,6 +42,8 @@ pub enum Action<T> { /// /// Unsupported on Wayland. Move(Id, Point), + /// Fetch the current logical coordinates of the window. + FetchLocation(Id, Box<dyn FnOnce(Option<Point>) -> T + 'static>), /// Change the [`Mode`] of the window. ChangeMode(Id, Mode), /// Fetch the current [`Mode`] of the window. @@ -135,6 +137,9 @@ impl<T> Action<T> { } Self::Minimize(id, minimized) => Action::Minimize(id, minimized), Self::Move(id, position) => Action::Move(id, position), + Self::FetchLocation(id, o) => { + Action::FetchLocation(id, Box::new(move |s| f(o(s)))) + } Self::ChangeMode(id, mode) => Action::ChangeMode(id, mode), Self::FetchMode(id, o) => { Action::FetchMode(id, Box::new(move |s| f(o(s)))) @@ -189,6 +194,9 @@ impl<T> fmt::Debug for Action<T> { Self::Move(id, position) => { write!(f, "Action::Move({id:?}, {position})") } + Self::FetchLocation(id, _) => { + write!(f, "Action::FetchLocation({id:?})") + } Self::ChangeMode(id, mode) => { write!(f, "Action::SetMode({id:?}, {mode:?})") } |