From 0ea4ec9abe7140e6e496c3275c68cc1802e828b7 Mon Sep 17 00:00:00 2001 From: Ivan Molodetskikh Date: Sat, 1 Feb 2020 18:30:13 +0300 Subject: [PATCH] anvil.window_map: add WindowMap::set_location --- anvil/src/window_map.rs | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/anvil/src/window_map.rs b/anvil/src/window_map.rs index 0021063..5d59831 100644 --- a/anvil/src/window_map.rs +++ b/anvil/src/window_map.rs @@ -242,4 +242,12 @@ where .find(|w| w.toplevel.equals(toplevel)) .map(|w| w.location) } + + /// Sets the location of the toplevel, if it exists. + pub fn set_location(&mut self, toplevel: &Kind, location: (i32, i32)) { + if let Some(w) = self.windows.iter_mut().find(|w| w.toplevel.equals(toplevel)) { + w.location = location; + w.self_update(self.ctoken, &self.get_size); + } + } }