Handle toplevel removal

This commit is contained in:
Ian Douglas Scott 2023-01-18 11:01:47 -08:00
parent 0226f20da1
commit 349a7f5a3e
2 changed files with 7 additions and 1 deletions

View file

@ -210,6 +210,11 @@ impl Application for App {
img: None,
});
}
wayland::Event::CloseToplevel(handle) => {
if let Some(idx) = self.toplevels.iter().position(|x| x.handle == handle) {
self.toplevels.remove(idx);
}
}
wayland::Event::WorkspaceCapture(handle, image) => {
if let Some(workspace) = self.workspace_for_handle_mut(&handle) {
workspace.img = Some(image.clone());

View file

@ -56,6 +56,7 @@ pub enum Event {
zcosmic_toplevel_handle_v1::ZcosmicToplevelHandleV1,
ToplevelInfo,
),
CloseToplevel(zcosmic_toplevel_handle_v1::ZcosmicToplevelHandleV1),
ToplevelCapture(
zcosmic_toplevel_handle_v1::ZcosmicToplevelHandleV1,
image::Handle,
@ -230,7 +231,7 @@ impl ToplevelInfoHandler for AppData {
_qh: &QueueHandle<Self>,
toplevel: &zcosmic_toplevel_handle_v1::ZcosmicToplevelHandleV1,
) {
// TODO
self.send_event(Event::CloseToplevel(toplevel.clone()));
}
}