diff --git a/src/desktop/space.rs b/src/desktop/space.rs index 4d60205..eba4c70 100644 --- a/src/desktop/space.rs +++ b/src/desktop/space.rs @@ -118,7 +118,11 @@ impl Space { /// /// This can safely be called on an already mapped window pub fn map_window(&mut self, window: &Window, location: Point) { - window_state(self.id, window).location = location - window.geometry().loc; + self.raise_window(window); + window_state(self.id, window).location = location; + } + + pub fn raise_window(&mut self, window: &Window) { self.windows.shift_remove(window); self.windows.insert(window.clone()); @@ -131,11 +135,6 @@ impl Space { } } - pub fn raise_window(&mut self, window: &Window) { - let loc = window_geo(window, &self.id).loc; - self.map_window(window, loc); - } - /// Unmap a window from this space by its id pub fn unmap_window(&mut self, window: &Window) { if let Some(map) = window.user_data().get::() { @@ -540,7 +539,7 @@ pub enum RenderError { fn window_geo(window: &Window, space_id: &usize) -> Rectangle { let loc = window_loc(window, space_id); let mut wgeo = window.geometry(); - wgeo.loc += loc; + wgeo.loc = loc; wgeo }