shell: Fix incomplete focus_stack after swapping
This commit is contained in:
parent
03430b76c5
commit
4d215755f6
4 changed files with 34 additions and 3 deletions
|
|
@ -272,6 +272,22 @@ impl State {
|
||||||
let (mut old_w, mut other_w) = spaces.partition::<Vec<_>, _>(|w| w.handle == old_descriptor.handle);
|
let (mut old_w, mut other_w) = spaces.partition::<Vec<_>, _>(|w| w.handle == old_descriptor.handle);
|
||||||
if let Some(old_workspace) = old_w.get_mut(0) {
|
if let Some(old_workspace) = old_w.get_mut(0) {
|
||||||
if let Some(new_workspace) = other_w.iter_mut().find(|w| w.handle == new_descriptor.handle) {
|
if let Some(new_workspace) = other_w.iter_mut().find(|w| w.handle == new_descriptor.handle) {
|
||||||
|
{
|
||||||
|
let mut stack = new_workspace.focus_stack.get_mut(&seat);
|
||||||
|
for elem in old_descriptor.focus_stack.iter().flat_map(|node_id| {
|
||||||
|
old_workspace.tiling_layer.element_for_node(node_id)
|
||||||
|
}) {
|
||||||
|
stack.append(elem);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
{
|
||||||
|
let mut stack = old_workspace.focus_stack.get_mut(&seat);
|
||||||
|
for elem in new_descriptor.focus_stack.iter().flat_map(|node_id| {
|
||||||
|
new_workspace.tiling_layer.element_for_node(node_id)
|
||||||
|
}) {
|
||||||
|
stack.append(elem);
|
||||||
|
}
|
||||||
|
}
|
||||||
if let Some(focus) = TilingLayout::swap_trees(&mut old_workspace.tiling_layer, Some(&mut new_workspace.tiling_layer), &old_descriptor, &new_descriptor) {
|
if let Some(focus) = TilingLayout::swap_trees(&mut old_workspace.tiling_layer, Some(&mut new_workspace.tiling_layer), &old_descriptor, &new_descriptor) {
|
||||||
let seat = seat.clone();
|
let seat = seat.clone();
|
||||||
data.common.event_loop_handle.insert_idle(move |state| {
|
data.common.event_loop_handle.insert_idle(move |state| {
|
||||||
|
|
@ -303,6 +319,14 @@ impl State {
|
||||||
if let Some(old_workspace) = old_w.get_mut(0) {
|
if let Some(old_workspace) = old_w.get_mut(0) {
|
||||||
if let Some(new_workspace) = other_w.iter_mut().find(|w| w.handle == new_workspace) {
|
if let Some(new_workspace) = other_w.iter_mut().find(|w| w.handle == new_workspace) {
|
||||||
if new_workspace.tiling_layer.windows().next().is_none() {
|
if new_workspace.tiling_layer.windows().next().is_none() {
|
||||||
|
{
|
||||||
|
let mut stack = new_workspace.focus_stack.get_mut(&seat);
|
||||||
|
for elem in old_descriptor.focus_stack.iter().flat_map(|node_id| {
|
||||||
|
old_workspace.tiling_layer.element_for_node(node_id)
|
||||||
|
}) {
|
||||||
|
stack.append(elem);
|
||||||
|
}
|
||||||
|
}
|
||||||
if let Some(focus) = TilingLayout::move_tree(&mut old_workspace.tiling_layer, &mut new_workspace.tiling_layer, &new_workspace.handle, &seat, new_workspace.focus_stack.get(&seat).iter(), old_descriptor.clone(), None) {
|
if let Some(focus) = TilingLayout::move_tree(&mut old_workspace.tiling_layer, &mut new_workspace.tiling_layer, &new_workspace.handle, &seat, new_workspace.focus_stack.get(&seat).iter(), old_descriptor.clone(), None) {
|
||||||
let seat = seat.clone();
|
let seat = seat.clone();
|
||||||
data.common.event_loop_handle.insert_idle(move |state| {
|
data.common.event_loop_handle.insert_idle(move |state| {
|
||||||
|
|
|
||||||
|
|
@ -86,6 +86,7 @@ pub struct NodeDesc {
|
||||||
pub handle: WorkspaceHandle,
|
pub handle: WorkspaceHandle,
|
||||||
pub node: NodeId,
|
pub node: NodeId,
|
||||||
pub stack_window: Option<CosmicSurface>,
|
pub stack_window: Option<CosmicSurface>,
|
||||||
|
pub focus_stack: Vec<NodeId>,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Clone, PartialEq)]
|
#[derive(Debug, Clone, PartialEq)]
|
||||||
|
|
@ -813,8 +814,9 @@ impl TilingLayout {
|
||||||
|
|
||||||
other.node_desc_to_focus(&NodeDesc {
|
other.node_desc_to_focus(&NodeDesc {
|
||||||
handle: other_handle.clone(),
|
handle: other_handle.clone(),
|
||||||
node: id,
|
node: id.clone(),
|
||||||
stack_window: None,
|
stack_window: None,
|
||||||
|
focus_stack: Vec::new(), // node_desc_to_focus doesn't use this
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -2564,6 +2564,7 @@ impl Shell {
|
||||||
handle: from,
|
handle: from,
|
||||||
node,
|
node,
|
||||||
stack_window: None,
|
stack_window: None,
|
||||||
|
focus_stack,
|
||||||
},
|
},
|
||||||
direction,
|
direction,
|
||||||
);
|
);
|
||||||
|
|
|
||||||
|
|
@ -974,7 +974,7 @@ impl Workspace {
|
||||||
.clone()
|
.clone()
|
||||||
.map(|node_id| NodeDesc {
|
.map(|node_id| NodeDesc {
|
||||||
handle: self.handle.clone(),
|
handle: self.handle.clone(),
|
||||||
node: node_id,
|
node: node_id.clone(),
|
||||||
stack_window: if mapped
|
stack_window: if mapped
|
||||||
.stack_ref()
|
.stack_ref()
|
||||||
.map(|stack| !stack.whole_stack_focused())
|
.map(|stack| !stack.whole_stack_focused())
|
||||||
|
|
@ -984,16 +984,20 @@ impl Workspace {
|
||||||
} else {
|
} else {
|
||||||
None
|
None
|
||||||
},
|
},
|
||||||
|
focus_stack: vec![node_id],
|
||||||
})
|
})
|
||||||
} else {
|
} else {
|
||||||
None
|
None
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
KeyboardFocusTarget::Group(WindowGroup { node, .. }) => Some(NodeDesc {
|
KeyboardFocusTarget::Group(WindowGroup {
|
||||||
|
node, focus_stack, ..
|
||||||
|
}) => Some(NodeDesc {
|
||||||
handle: self.handle.clone(),
|
handle: self.handle.clone(),
|
||||||
node,
|
node,
|
||||||
stack_window: None,
|
stack_window: None,
|
||||||
|
focus_stack,
|
||||||
}),
|
}),
|
||||||
_ => None,
|
_ => None,
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue