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

@ -56,6 +56,7 @@ impl CosmicBluetoothApplet {
#[derive(Debug, Clone)]
enum Message {
TogglePopup,
CloseRequested(window::Id),
ToggleVisibleDevices(bool),
Ignore,
BluetoothEvent(BluerEvent),
@ -270,6 +271,11 @@ impl cosmic::Application for CosmicBluetoothApplet {
);
}
}
Message::CloseRequested(id) => {
if Some(id) == self.popup {
self.popup = None;
}
}
}
self.update_icon();
Command::none()
@ -524,4 +530,8 @@ impl cosmic::Application for CosmicBluetoothApplet {
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))
}
}