From 90f7d53a3a157f78e6694e9d65911e6c493990da Mon Sep 17 00:00:00 2001 From: Victor Brekenfeld Date: Thu, 2 Dec 2021 12:45:58 +0100 Subject: [PATCH] space: fixup miscalculations --- src/desktop/space.rs | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) 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 }