shell: Handle tiling_enabled for previous_state better
This commit is contained in:
parent
61a3aa8d79
commit
ce74675b0e
3 changed files with 34 additions and 31 deletions
|
|
@ -546,27 +546,6 @@ impl Drop for MoveGrab {
|
||||||
}
|
}
|
||||||
|
|
||||||
match previous {
|
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 => {
|
ManagedLayer::Sticky => {
|
||||||
grab_state.window.set_geometry(Rectangle::from_loc_and_size(
|
grab_state.window.set_geometry(Rectangle::from_loc_and_size(
|
||||||
window_location,
|
window_location,
|
||||||
|
|
@ -579,6 +558,30 @@ impl Drop for MoveGrab {
|
||||||
|
|
||||||
Some((window, location.to_global(&output)))
|
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 {
|
} else {
|
||||||
None
|
None
|
||||||
|
|
|
||||||
|
|
@ -1605,12 +1605,12 @@ impl Shell {
|
||||||
.sticky_layer
|
.sticky_layer
|
||||||
.map(mapped, None)
|
.map(mapped, None)
|
||||||
}
|
}
|
||||||
ManagedLayer::Floating => new_workspace.floating_layer.map(mapped, None),
|
ManagedLayer::Tiling if new_workspace.tiling_enabled => {
|
||||||
ManagedLayer::Tiling => {
|
|
||||||
new_workspace
|
new_workspace
|
||||||
.tiling_layer
|
.tiling_layer
|
||||||
.map(mapped, Option::<std::iter::Empty<_>>::None, None)
|
.map(mapped, Option::<std::iter::Empty<_>>::None, None)
|
||||||
}
|
}
|
||||||
|
_ => new_workspace.floating_layer.map(mapped, None),
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1949,7 +1949,7 @@ impl Shell {
|
||||||
.space_for_handle_mut(to)
|
.space_for_handle_mut(to)
|
||||||
.unwrap(); // checked above
|
.unwrap(); // checked above
|
||||||
let focus_stack = seat.map(|seat| to_workspace.focus_stack.get(&seat));
|
let focus_stack = seat.map(|seat| to_workspace.focus_stack.get(&seat));
|
||||||
if window_state.layer == ManagedLayer::Floating {
|
if window_state.layer == ManagedLayer::Floating || !to_workspace.tiling_enabled {
|
||||||
to_workspace.floating_layer.map(mapped.clone(), None);
|
to_workspace.floating_layer.map(mapped.clone(), None);
|
||||||
} else {
|
} else {
|
||||||
to_workspace.tiling_layer.map(
|
to_workspace.tiling_layer.map(
|
||||||
|
|
@ -2934,16 +2934,16 @@ impl Shell {
|
||||||
.take()
|
.take()
|
||||||
.unwrap_or(ManagedLayer::Floating)
|
.unwrap_or(ManagedLayer::Floating)
|
||||||
{
|
{
|
||||||
ManagedLayer::Floating => {
|
ManagedLayer::Tiling if workspace.tiling_enabled => {
|
||||||
workspace.floating_layer.map(mapped.clone(), geometry.loc)
|
|
||||||
}
|
|
||||||
ManagedLayer::Tiling => {
|
|
||||||
let focus_stack = workspace.focus_stack.get(seat);
|
let focus_stack = workspace.focus_stack.get(seat);
|
||||||
workspace
|
workspace
|
||||||
.tiling_layer
|
.tiling_layer
|
||||||
.map(mapped.clone(), Some(focus_stack.iter()), None);
|
.map(mapped.clone(), Some(focus_stack.iter()), None);
|
||||||
}
|
}
|
||||||
ManagedLayer::Sticky => unreachable!(),
|
ManagedLayer::Sticky => unreachable!(),
|
||||||
|
_ => {
|
||||||
|
workspace.floating_layer.map(mapped.clone(), geometry.loc)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -444,7 +444,7 @@ impl Workspace {
|
||||||
let mut state = elem.maximized_state.lock().unwrap();
|
let mut state = elem.maximized_state.lock().unwrap();
|
||||||
if let Some(state) = state.take() {
|
if let Some(state) = state.take() {
|
||||||
match state.original_layer {
|
match state.original_layer {
|
||||||
ManagedLayer::Tiling => {
|
ManagedLayer::Tiling if self.tiling_enabled => {
|
||||||
// should still be mapped in tiling
|
// should still be mapped in tiling
|
||||||
self.floating_layer.unmap(&elem);
|
self.floating_layer.unmap(&elem);
|
||||||
elem.output_enter(&self.output, elem.bbox());
|
elem.output_enter(&self.output, elem.bbox());
|
||||||
|
|
@ -456,7 +456,8 @@ impl Workspace {
|
||||||
.element_geometry(&elem)
|
.element_geometry(&elem)
|
||||||
.map(|geo| geo.size.as_logical())
|
.map(|geo| geo.size.as_logical())
|
||||||
}
|
}
|
||||||
ManagedLayer::Floating => {
|
ManagedLayer::Sticky => unreachable!(),
|
||||||
|
_ => {
|
||||||
elem.set_maximized(false);
|
elem.set_maximized(false);
|
||||||
self.floating_layer.map_internal(
|
self.floating_layer.map_internal(
|
||||||
elem.clone(),
|
elem.clone(),
|
||||||
|
|
@ -466,7 +467,6 @@ impl Workspace {
|
||||||
);
|
);
|
||||||
Some(state.original_geometry.size.as_logical())
|
Some(state.original_geometry.size.as_logical())
|
||||||
}
|
}
|
||||||
ManagedLayer::Sticky => unreachable!(),
|
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
None
|
None
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue