space: fixup miscalculations

This commit is contained in:
Victor Brekenfeld 2021-12-02 12:45:58 +01:00
parent 25b74e2eaa
commit 90f7d53a3a
1 changed files with 6 additions and 7 deletions

View File

@ -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<i32, Logical>) {
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::<WindowUserdata>() {
@ -540,7 +539,7 @@ pub enum RenderError<R: Renderer> {
fn window_geo(window: &Window, space_id: &usize) -> Rectangle<i32, Logical> {
let loc = window_loc(window, space_id);
let mut wgeo = window.geometry();
wgeo.loc += loc;
wgeo.loc = loc;
wgeo
}