From a51e421c1922f58a85e364112085c3bf4fcefb42 Mon Sep 17 00:00:00 2001 From: Ivan Molodetskikh Date: Sat, 1 Feb 2020 18:30:01 +0300 Subject: [PATCH] anvil.window_map: add WindowMap::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 3a553c0..0021063 100644 --- a/anvil/src/window_map.rs +++ b/anvil/src/window_map.rs @@ -234,4 +234,12 @@ where pub fn clear(&mut self) { self.windows.clear(); } + + /// Returns the location of the toplevel, if it exists. + pub fn location(&self, toplevel: &Kind) -> Option<(i32, i32)> { + self.windows + .iter() + .find(|w| w.toplevel.equals(toplevel)) + .map(|w| w.location) + } }