fix: clear popup state when it is dismissed by the compositor

This commit is contained in:
Ashley Wulber 2023-09-12 14:29:34 -04:00 committed by Ashley Wulber
parent f4cc4cecd0
commit 56d96e5282
8 changed files with 75 additions and 0 deletions

View file

@ -223,6 +223,7 @@ enum Message {
Favorite(String),
UnFavorite(String),
Popup(String),
CloseRequested(window::Id),
ClosePopup,
Activate(ZcosmicToplevelHandleV1),
Exec(String),
@ -819,6 +820,11 @@ impl cosmic::Application for CosmicAppList {
})
.collect();
}
Message::CloseRequested(id) => {
if Some(id) == self.popup.as_ref().map(|p| p.0) {
self.popup = None;
}
}
}
Command::none()
@ -1092,4 +1098,8 @@ impl cosmic::Application for CosmicAppList {
fn style(&self) -> Option<<Theme as application::StyleSheet>::Style> {
Some(cosmic::app::applet::style())
}
fn on_close_requested(&self, id: window::Id) -> Option<Message> {
Some(Message::CloseRequested(id))
}
}