shell: Handle tiling_enabled for previous_state better

This commit is contained in:
Victoria Brekenfeld 2024-01-26 18:47:59 +00:00 committed by Victoria Brekenfeld
parent 61a3aa8d79
commit ce74675b0e
3 changed files with 34 additions and 31 deletions

View file

@ -546,27 +546,6 @@ impl Drop for MoveGrab {
}
match previous {
ManagedLayer::Tiling => {
let (window, location) = state
.common
.shell
.active_space_mut(&output)
.tiling_layer
.drop_window(grab_state.window);
Some((window, location.to_global(&output)))
}
ManagedLayer::Floating => {
grab_state.window.set_geometry(Rectangle::from_loc_and_size(
window_location,
grab_state.window.geometry().size.as_global(),
));
let workspace = state.common.shell.active_space_mut(&output);
let (window, location) = workspace.floating_layer.drop_window(
grab_state.window,
window_location.to_local(&workspace.output),
);
Some((window, location.to_global(&output)))
}
ManagedLayer::Sticky => {
grab_state.window.set_geometry(Rectangle::from_loc_and_size(
window_location,
@ -579,6 +558,30 @@ impl Drop for MoveGrab {
Some((window, location.to_global(&output)))
}
ManagedLayer::Tiling if state
.common
.shell
.active_space(&output).tiling_enabled => {
let (window, location) = state
.common
.shell
.active_space_mut(&output)
.tiling_layer
.drop_window(grab_state.window);
Some((window, location.to_global(&output)))
}
_ => {
grab_state.window.set_geometry(Rectangle::from_loc_and_size(
window_location,
grab_state.window.geometry().size.as_global(),
));
let workspace = state.common.shell.active_space_mut(&output);
let (window, location) = workspace.floating_layer.drop_window(
grab_state.window,
window_location.to_local(&workspace.output),
);
Some((window, location.to_global(&output)))
}
}
} else {
None