tiling: Don't share workspaces across outputs

This commit is contained in:
Victoria Brekenfeld 2022-03-30 16:06:35 +02:00
parent 45a478eff0
commit 3ebeab17b7
3 changed files with 41 additions and 7 deletions

View file

@ -146,7 +146,11 @@ pub fn debug_ui(
.speed(1.0),
);
if active != active_val as usize {
state.shell.activate(&output, active_val as usize);
state.shell.activate(
&state.seats[0],
&output,
active_val as usize,
);
}
});
}
@ -162,7 +166,11 @@ pub fn debug_ui(
);
if active != active_val as usize {
let output = state.shell.outputs().next().cloned().unwrap();
state.shell.activate(&output, active_val as usize);
state.shell.activate(
&state.seats[0],
&output,
active_val as usize,
);
}
});
}

View file

@ -271,8 +271,11 @@ impl Common {
0 => 9,
x => x - 1,
};
self.shell
.activate(&current_output, workspace as usize);
self.shell.activate(
seat,
&current_output,
workspace as usize,
);
userdata
.get::<SupressedKeys>()
.unwrap()

View file

@ -185,17 +185,40 @@ impl Shell {
Rectangle::from_loc_and_size(pos, self.output_size(output))
}
pub fn activate(&mut self, output: &Output, idx: usize) {
pub fn activate(&mut self, seat: &Seat, output: &Output, idx: usize) {
match self.mode {
Mode::OutputBound => {
// TODO check for other outputs already occupying that space
for output in &self.outputs {
if output
.user_data()
.get::<ActiveWorkspace>()
.and_then(|i| i.get().map(|i| i == idx))
.unwrap_or(false)
{
let geometry = self.output_geometry(output);
if let Some(ptr) = seat.get_pointer() {
ptr.motion(
Point::<i32, Logical>::from((
geometry.loc.x + (geometry.size.w / 2),
geometry.loc.y + (geometry.size.h / 2),
))
.to_f64(),
None,
SERIAL_COUNTER.next_serial(),
0,
);
return;
}
}
}
if let Some(active) = output.user_data().get::<ActiveWorkspace>() {
if let Some(old_idx) = active.set(idx) {
self.spaces[old_idx].space.unmap_output(output);
}
self.spaces[idx].space.map_output(output, 1.0, (0, 0));
self.spaces[idx].refresh();
}
// TODO translate windows from previous space size into new size
}
Mode::Global { ref mut active } => {
let old = *active;