diff --git a/src/grab/resize_grab.rs b/src/grab/resize_grab.rs index 3b14adc..f4b4f24 100644 --- a/src/grab/resize_grab.rs +++ b/src/grab/resize_grab.rs @@ -402,20 +402,21 @@ pub fn handle_commit(state: &mut State, surface: &WlSurface) -> Option<()> { window_loc.y = new_y; } + let size = state + .space + .element_geometry(&window) + .expect("called element_geometry on unmapped window") + .size; + + window.with_state(|state| { + if state.floating_or_tiled.is_floating() { + state.floating_or_tiled = + FloatingOrTiled::Floating(Rectangle::from_loc_and_size(window_loc, size)); + } + }); + if new_loc.x.is_some() || new_loc.y.is_some() { state.space.map_element(window.clone(), window_loc, false); - let size = state - .space - .element_geometry(&window) - .expect("called element_geometry on unmapped window") - .size; - - window.with_state(|state| { - if state.floating_or_tiled.is_floating() { - state.floating_or_tiled = - FloatingOrTiled::Floating(Rectangle::from_loc_and_size(window_loc, size)); - } - }); if let WindowElement::X11(surface) = window { let geo = surface.geometry();