From d6454b5d0ca4c3812d1614805de1094638153df1 Mon Sep 17 00:00:00 2001 From: Héctor Ramón Jiménez Date: Thu, 22 Feb 2024 09:19:51 +0100 Subject: Rename `fetch_location` to `fetch_position` --- runtime/src/window.rs | 16 ++++++++-------- runtime/src/window/action.rs | 16 ++++++++-------- 2 files changed, 16 insertions(+), 16 deletions(-) (limited to 'runtime') diff --git a/runtime/src/window.rs b/runtime/src/window.rs index c5acfddc..24171e3e 100644 --- a/runtime/src/window.rs +++ b/runtime/src/window.rs @@ -101,22 +101,22 @@ pub fn minimize(id: Id, minimized: bool) -> Command { Command::single(command::Action::Window(Action::Minimize(id, minimized))) } -/// Moves the window to the given logical coordinates. -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( +/// Fetches the current window position in logical coordinates. +pub fn fetch_position( id: Id, f: impl FnOnce(Option) -> Message + 'static, ) -> Command { - Command::single(command::Action::Window(Action::FetchLocation( + Command::single(command::Action::Window(Action::FetchPosition( id, Box::new(f), ))) } +/// Moves the window to the given logical coordinates. +pub fn move_to(id: Id, position: Point) -> Command { + Command::single(command::Action::Window(Action::Move(id, position))) +} + /// Changes the [`Mode`] of the window. pub fn change_mode(id: Id, mode: Mode) -> Command { Command::single(command::Action::Window(Action::ChangeMode(id, mode))) diff --git a/runtime/src/window/action.rs b/runtime/src/window/action.rs index 39eb1008..e44ff5a6 100644 --- a/runtime/src/window/action.rs +++ b/runtime/src/window/action.rs @@ -38,12 +38,12 @@ pub enum Action { FetchMinimized(Id, Box) -> T + 'static>), /// Set the window to minimized or back Minimize(Id, bool), + /// Fetch the current logical coordinates of the window. + FetchPosition(Id, Box) -> T + 'static>), /// Move the window to the given logical coordinates. /// /// Unsupported on Wayland. Move(Id, Point), - /// Fetch the current logical coordinates of the window. - FetchLocation(Id, Box) -> T + 'static>), /// Change the [`Mode`] of the window. ChangeMode(Id, Mode), /// Fetch the current [`Mode`] of the window. @@ -136,10 +136,10 @@ impl Action { Action::FetchMinimized(id, Box::new(move |s| f(o(s)))) } 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::FetchPosition(id, o) => { + Action::FetchPosition(id, Box::new(move |s| f(o(s)))) } + Self::Move(id, position) => Action::Move(id, position), Self::ChangeMode(id, mode) => Action::ChangeMode(id, mode), Self::FetchMode(id, o) => { Action::FetchMode(id, Box::new(move |s| f(o(s)))) @@ -191,12 +191,12 @@ impl fmt::Debug for Action { Self::Minimize(id, minimized) => { write!(f, "Action::Minimize({id:?}, {minimized}") } + Self::FetchPosition(id, _) => { + write!(f, "Action::FetchPosition({id:?})") + } 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:?})") } -- cgit