toplevel-management: Move window, not whole stack
If the window is part of a stack, remove it then map it outside of the stack, before calling `Shell::move_window.` Somewhat similar to the code in `Shell::move_request`. It would be more elegant if `move_window` handled this in some way, but I can't think of a way to change the API there that would be better than this. (Perhaps some of the naming of methods could also be updated, given "window" in functions like this means a `CosmicMapped`.) Protocol support for moving workspaces would also be useful, but should involve a new protocol object representing the stack. Fixes https://github.com/pop-os/cosmic-workspaces-epoch/issues/41.
This commit is contained in:
parent
9b3a42d450
commit
649547d3cc
1 changed files with 23 additions and 3 deletions
|
|
@ -10,7 +10,7 @@ use smithay::{
|
|||
};
|
||||
|
||||
use crate::{
|
||||
shell::{CosmicSurface, Shell, WorkspaceDelta},
|
||||
shell::{element::CosmicWindow, CosmicSurface, Shell, WorkspaceDelta},
|
||||
utils::prelude::*,
|
||||
wayland::protocols::{
|
||||
toplevel_info::ToplevelInfoHandler,
|
||||
|
|
@ -109,8 +109,28 @@ impl ToplevelManagementHandler for State {
|
|||
};
|
||||
|
||||
let mut shell = self.common.shell.write().unwrap();
|
||||
if let Some(mapped) = shell.element_for_surface(window).cloned() {
|
||||
if let Some(from_workspace) = shell.space_for(&mapped) {
|
||||
if let Some(mut mapped) = shell.element_for_surface(window).cloned() {
|
||||
if let Some(from_workspace) = shell.space_for_mut(&mapped) {
|
||||
// If window is part of a stack, remove it and map it outside the stack
|
||||
if let Some(stack) = mapped.stack_ref() {
|
||||
stack.remove_window(&window);
|
||||
mapped = CosmicWindow::new(
|
||||
window.clone(),
|
||||
self.common.event_loop_handle.clone(),
|
||||
self.common.theme.clone(),
|
||||
)
|
||||
.into();
|
||||
if from_workspace.tiling_enabled {
|
||||
from_workspace.tiling_layer.map(
|
||||
mapped.clone(),
|
||||
None::<std::iter::Empty<_>>,
|
||||
None,
|
||||
);
|
||||
} else {
|
||||
from_workspace.floating_layer.map(mapped.clone(), None);
|
||||
}
|
||||
}
|
||||
|
||||
let from_handle = from_workspace.handle;
|
||||
let seat = shell.seats.last_active().clone();
|
||||
let res = shell.move_window(
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue