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) + } }