From 3ebeab17b78e50933756528c3fe2806a7df180ef Mon Sep 17 00:00:00 2001 From: Victoria Brekenfeld Date: Wed, 30 Mar 2022 16:06:35 +0200 Subject: [PATCH] tiling: Don't share workspaces across outputs --- src/debug.rs | 12 ++++++++++-- src/input/mod.rs | 7 +++++-- src/shell/mod.rs | 29 ++++++++++++++++++++++++++--- 3 files changed, 41 insertions(+), 7 deletions(-) diff --git a/src/debug.rs b/src/debug.rs index 82d23aae..aa9cbf48 100644 --- a/src/debug.rs +++ b/src/debug.rs @@ -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, + ); } }); } diff --git a/src/input/mod.rs b/src/input/mod.rs index 95f3c9ed..f3e61c90 100644 --- a/src/input/mod.rs +++ b/src/input/mod.rs @@ -271,8 +271,11 @@ impl Common { 0 => 9, x => x - 1, }; - self.shell - .activate(¤t_output, workspace as usize); + self.shell.activate( + seat, + ¤t_output, + workspace as usize, + ); userdata .get::() .unwrap() diff --git a/src/shell/mod.rs b/src/shell/mod.rs index 1bea84db..9bbf1fa6 100644 --- a/src/shell/mod.rs +++ b/src/shell/mod.rs @@ -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::() + .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::::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::() { 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;