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

@ -84,6 +84,7 @@ impl Notifications {
#[derive(Debug, Clone)]
enum Message {
TogglePopup,
CloseRequested(window::Id),
DoNotDisturb(chain::Toggler, bool),
Settings,
Frame(Instant),
@ -296,6 +297,11 @@ impl cosmic::Application for Notifications {
};
self.update_cards(id);
}
Message::CloseRequested(id) => {
if Some(id) == self.popup {
self.popup = None;
}
}
};
self.update_icon();
Command::none()
@ -486,6 +492,10 @@ impl cosmic::Application for Notifications {
self.core.applet_helper.popup_container(content).into()
}
fn on_close_requested(&self, id: window::Id) -> Option<Message> {
Some(Message::CloseRequested(id))
}
}
// todo put into libcosmic doing so will fix the row_button's border radius