shell: One workspace per output

This commit is contained in:
Victoria Brekenfeld 2023-10-25 19:40:26 +02:00
parent 42aaafe586
commit 72df9d07e6
21 changed files with 1561 additions and 1987 deletions

View file

@ -154,7 +154,7 @@ impl Shell {
return None;
}
Some(self.outputs.iter().flat_map(|o| {
Some(self.outputs().flat_map(|o| {
let space = self.active_space(o);
let stack = space.focus_stack.get(seat);
stack.last().cloned()
@ -163,8 +163,9 @@ impl Shell {
.flatten()
.collect::<Vec<_>>();
for output in self.outputs.iter() {
let workspace = self.workspaces.active_mut(output);
for output in self.outputs().cloned().collect::<Vec<_>>().into_iter() {
// TODO: Add self.workspaces.active_workspaces()
let workspace = self.workspaces.active_mut(&output);
for focused in focused_windows.iter() {
if let CosmicSurface::X11(window) = focused.active_window() {
if let Some(xwm) = xwm.as_mut().and_then(|state| state.xwm.as_mut()) {
@ -223,8 +224,8 @@ impl Common {
let seats = state.common.seats().cloned().collect::<Vec<_>>();
for seat in seats {
let output = seat.active_output();
if !state.common.shell.outputs.contains(&output) {
seat.set_active_output(&state.common.shell.outputs[0]);
if !state.common.shell.outputs().any(|o| o == &output) {
seat.set_active_output(&state.common.shell.outputs().next().unwrap());
continue;
}
let last_known_focus = ActiveFocus::get(&seat);
@ -248,11 +249,16 @@ impl Common {
continue; // Focus is valid
}
}
KeyboardFocusTarget::Group(WindowGroup {
output: weak_output,
..
}) => {
if weak_output == output {
KeyboardFocusTarget::Group(WindowGroup { node, .. }) => {
if state
.common
.shell
.workspaces
.active(&output)
.1
.tiling_layer
.has_node(&node)
{
continue; // Focus is valid,
}
}

View file

@ -87,16 +87,13 @@ impl KeyboardFocusTarget {
#[derive(Debug, Clone)]
pub struct WindowGroup {
pub node: NodeId,
pub output: WeakOutput,
pub alive: Weak<()>,
pub focus_stack: Vec<NodeId>,
}
impl PartialEq for WindowGroup {
fn eq(&self, other: &Self) -> bool {
self.node == other.node
&& self.output == other.output
&& Weak::ptr_eq(&self.alive, &other.alive)
self.node == other.node && Weak::ptr_eq(&self.alive, &other.alive)
}
}