fix: clear popup state when it is dismissed by the compositor
This commit is contained in:
parent
f4cc4cecd0
commit
56d96e5282
8 changed files with 75 additions and 0 deletions
|
|
@ -40,6 +40,7 @@ enum Every {
|
|||
#[derive(Debug, Clone)]
|
||||
enum Message {
|
||||
TogglePopup,
|
||||
CloseRequested(window::Id),
|
||||
Tick,
|
||||
Rectangle(RectangleUpdate<u32>),
|
||||
}
|
||||
|
|
@ -163,6 +164,12 @@ impl cosmic::Application for Time {
|
|||
}
|
||||
Command::none()
|
||||
}
|
||||
Message::CloseRequested(id) => {
|
||||
if Some(id) == self.popup {
|
||||
self.popup = None;
|
||||
}
|
||||
Command::none()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -219,4 +226,8 @@ impl cosmic::Application for Time {
|
|||
|
||||
self.core.applet_helper.popup_container(content).into()
|
||||
}
|
||||
|
||||
fn on_close_requested(&self, id: window::Id) -> Option<Message> {
|
||||
Some(Message::CloseRequested(id))
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue