Helper methods on CatpureFilter for matching

Could be prettier, but want some way to check this in multiple places.
This commit is contained in:
Ian Douglas Scott 2025-06-04 09:35:08 -07:00 committed by Ian Douglas Scott
parent 6fd237ac39
commit a863e8f7d6
2 changed files with 19 additions and 8 deletions

View file

@ -44,6 +44,23 @@ pub struct CaptureFilter {
pub toplevels_on_workspaces: Vec<ExtWorkspaceHandleV1>,
}
impl CaptureFilter {
pub fn workspace_outputs_matches<'a>(
&self,
outputs: impl IntoIterator<Item = &'a wl_output::WlOutput>,
) -> bool {
outputs
.into_iter()
.any(|o| self.workspaces_on_outputs.contains(o))
}
pub fn toplevel_matches(&self, info: &ToplevelInfo) -> bool {
info.workspace
.iter()
.any(|workspace| self.toplevels_on_workspaces.contains(workspace))
}
}
#[derive(Clone, Debug)]
pub struct CaptureImage {
#[allow(dead_code)]