Skip to content

Commit

Permalink
shell: Each surface has only one workspace
Browse files Browse the repository at this point in the history
  • Loading branch information
Drakulix committed Nov 9, 2023
1 parent 32efedc commit 9ced8c3
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 6 deletions.
6 changes: 1 addition & 5 deletions src/shell/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1006,10 +1006,7 @@ impl Shell {
}
}

pub fn workspaces_for_surface(
&self,
surface: &WlSurface,
) -> impl Iterator<Item = (WorkspaceHandle, Output)> {
pub fn workspace_for_surface(&self, surface: &WlSurface) -> Option<(WorkspaceHandle, Output)> {
match self.outputs().find(|o| {
let map = layer_map_for_output(o);
map.layer_for_surface(surface, WindowSurfaceType::ALL)
Expand All @@ -1029,7 +1026,6 @@ impl Shell {
})
.map(|w| (w.handle.clone(), w.output().clone())),
}
.into_iter()
}

pub fn element_for_surface(&self, surface: &CosmicSurface) -> Option<&CosmicMapped> {
Expand Down
2 changes: 1 addition & 1 deletion src/wayland/handlers/screencopy.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1246,7 +1246,7 @@ impl State {
.outputs()
.map(|o| (o.clone(), self.common.shell.active_space(o).handle.clone()))
.collect::<Vec<_>>();
for (handle, output) in self.common.shell.workspaces_for_surface(surface) {
if let Some((handle, output)) = self.common.shell.workspace_for_surface(surface) {
let workspace = self.common.shell.space_for_handle_mut(&handle).unwrap();
if !workspace.pending_buffers.is_empty() {
// TODO: replace with drain_filter....
Expand Down

0 comments on commit 9ced8c3

Please sign in to comment.