fix: restore the window to where it was before the drag
Restoring a window after snapping it to a corner, or maximizing it should restore to where the window was before the drag, not after the drop.
This commit is contained in:
parent
b955789a4e
commit
7c02df250e
1 changed files with 13 additions and 0 deletions
|
|
@ -869,12 +869,22 @@ impl Drop for MoveGrab {
|
|||
if matches!(previous, ManagedLayer::Floating)
|
||||
&& let Some(sz) = grab_state.snapping_zone
|
||||
{
|
||||
// `last_geometry` was set to the pre-drag geometry(in FloatingLayout::unmap).
|
||||
// Snapshot it here and restore it after so "restore-to-floating" goes back to where the user had the window.
|
||||
let pre_drag_geometry = *window.last_geometry.lock().unwrap();
|
||||
|
||||
if sz == SnappingZone::Maximize {
|
||||
shell.maximize_toggle(
|
||||
&window,
|
||||
&seat,
|
||||
&state.common.event_loop_handle,
|
||||
);
|
||||
if let Some(geo) = pre_drag_geometry
|
||||
&& let Some(state) =
|
||||
window.maximized_state.lock().unwrap().as_mut()
|
||||
{
|
||||
state.original_geometry = geo;
|
||||
}
|
||||
} else {
|
||||
let directions = match sz {
|
||||
SnappingZone::Maximize => vec![],
|
||||
|
|
@ -904,6 +914,9 @@ impl Drop for MoveGrab {
|
|||
&window,
|
||||
);
|
||||
}
|
||||
if let Some(geo) = pre_drag_geometry {
|
||||
*window.last_geometry.lock().unwrap() = Some(geo);
|
||||
}
|
||||
}
|
||||
}
|
||||
Some((window, location.to_global(&output)))
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue