From 59885e9a363dd73b3a3e8dd125decf0e34130c59 Mon Sep 17 00:00:00 2001 From: Night_Hunter Date: Thu, 22 Feb 2024 17:13:12 +1300 Subject: Add `fetch_location` command to `window` module --- runtime/src/window.rs | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'runtime/src/window.rs') diff --git a/runtime/src/window.rs b/runtime/src/window.rs index 04bcfcd8..c5acfddc 100644 --- a/runtime/src/window.rs +++ b/runtime/src/window.rs @@ -106,6 +106,17 @@ pub fn move_to(id: Id, position: Point) -> Command { Command::single(command::Action::Window(Action::Move(id, position))) } +/// Fetches the window's location in logical coordinates. +pub fn fetch_location( + id: Id, + f: impl FnOnce(Option) -> Message + 'static, +) -> Command { + Command::single(command::Action::Window(Action::FetchLocation( + id, + Box::new(f), + ))) +} + /// Changes the [`Mode`] of the window. pub fn change_mode(id: Id, mode: Mode) -> Command { Command::single(command::Action::Window(Action::ChangeMode(id, mode))) -- cgit