Update for toplevel-info cctk changes

This commit is contained in:
Ian Douglas Scott 2025-02-10 14:33:51 -08:00 committed by Ian Douglas Scott
parent e283cfe456
commit 4acd62abb0
9 changed files with 90 additions and 68 deletions

View file

@ -75,22 +75,31 @@ impl AppData {
self.invalidate_capture_filter();
}
Cmd::ActivateToplevel(toplevel_handle) => {
for seat in self.seat_state.seats() {
self.toplevel_manager_state
.manager
.activate(&toplevel_handle, &seat);
let info = self.toplevel_info_state.info(&toplevel_handle);
if let Some(cosmic_toplevel) = info.and_then(|x| x.cosmic_toplevel.as_ref()) {
for seat in self.seat_state.seats() {
self.toplevel_manager_state
.manager
.activate(&cosmic_toplevel, &seat);
}
}
}
Cmd::CloseToplevel(toplevel_handle) => {
self.toplevel_manager_state.manager.close(&toplevel_handle);
let info = self.toplevel_info_state.info(&toplevel_handle);
if let Some(cosmic_toplevel) = info.and_then(|x| x.cosmic_toplevel.as_ref()) {
self.toplevel_manager_state.manager.close(&cosmic_toplevel);
}
}
Cmd::MoveToplevelToWorkspace(toplevel_handle, workspace_handle, output) => {
if self.toplevel_manager_state.manager.version() >= 2 {
self.toplevel_manager_state.manager.move_to_workspace(
&toplevel_handle,
&workspace_handle,
&output,
);
let info = self.toplevel_info_state.info(&toplevel_handle);
if let Some(cosmic_toplevel) = info.and_then(|x| x.cosmic_toplevel.as_ref()) {
if self.toplevel_manager_state.manager.version() >= 2 {
self.toplevel_manager_state.manager.move_to_workspace(
&cosmic_toplevel,
&workspace_handle,
&output,
);
}
}
}
Cmd::ActivateWorkspace(workspace_handle) => {
@ -105,12 +114,19 @@ impl AppData {
fn matches_capture_filter(&self, source: &CaptureSource) -> bool {
match source {
CaptureSource::CosmicToplevel(toplevel) => {
let info = self.toplevel_info_state.info(toplevel).unwrap();
info.workspace.iter().any(|workspace| {
self.capture_filter
.toplevels_on_workspaces
.contains(workspace)
})
let info = self
.toplevel_info_state
.toplevels()
.find(|info| info.cosmic_toplevel.as_ref() == Some(&toplevel));
if let Some(info) = info {
info.workspace.iter().any(|workspace| {
self.capture_filter
.toplevels_on_workspaces
.contains(workspace)
})
} else {
false
}
}
CaptureSource::CosmicWorkspace(workspace) => self
.workspace_state