shell: Fix render positions for global workspace mode

This commit is contained in:
Victoria Brekenfeld 2022-11-22 19:52:13 +01:00
parent c25f2ed447
commit 4a9afd0572
3 changed files with 21 additions and 23 deletions

View file

@ -82,9 +82,7 @@ where
Some(ptr) => ptr,
None => continue,
};
let location = state
.shell
.map_global_to_space(pointer.current_location().to_i32_round(), output);
let location = pointer.current_location() - output.current_location().to_f64();
if mode != CursorMode::None {
elements.extend(

View file

@ -1251,14 +1251,28 @@ impl TilingLayout {
}
Ok(self
.mapped()
.flat_map(|(o, mapped, loc)| {
if o == output {
Some((mapped, loc))
} else {
None
.trees
.iter()
.flat_map(|(output_data, tree)| {
if &output_data.output != output {
return None;
}
let root = tree.root_node_id()?;
Some(
tree.traverse_pre_order(root)
.unwrap()
.filter(|node| node.data().is_mapped(None))
.map(|node| match node.data() {
Data::Mapped {
mapped,
last_geometry,
..
} => (mapped, last_geometry.loc),
_ => unreachable!(),
}),
)
})
.flatten()
.flat_map(|(mapped, loc)| {
AsRenderElements::<R>::render_elements::<CosmicMappedRenderElement<R>>(
mapped,

View file

@ -903,20 +903,6 @@ impl Shell {
}
}
pub fn map_space_to_global<C: smithay::utils::Coordinate>(
&self,
space_loc: impl Into<Point<C, Logical>>,
output: &Output,
) -> Point<C, Logical> {
match self.workspaces {
WorkspaceMode::Global(_) => space_loc.into(),
WorkspaceMode::OutputBound(_, _) => {
let p = space_loc.into().to_f64() + output.current_location().to_f64();
(C::from_f64(p.x), C::from_f64(p.y)).into()
}
}
}
pub fn refresh(&mut self) {
self.popups.cleanup();