Fix re-opening popup after it is dismissed by the compositor
I noticed working on https://github.com/pop-os/cosmic-applets/pull/33 that https://github.com/pop-os/cosmic-applets/pull/110 seems to have broken the behavior here. After the popup is dismissed by the compositor, it requires two clicks to re-open instead of one. This change will need to be made to all the applets.
This commit is contained in:
parent
28446a33ab
commit
f4cc4cecd0
1 changed files with 11 additions and 0 deletions
|
|
@ -72,6 +72,7 @@ enum Message {
|
||||||
Confirm,
|
Confirm,
|
||||||
Cancel,
|
Cancel,
|
||||||
Zbus(Result<(), zbus::Error>),
|
Zbus(Result<(), zbus::Error>),
|
||||||
|
Closed(window::Id),
|
||||||
}
|
}
|
||||||
|
|
||||||
impl cosmic::Application for Power {
|
impl cosmic::Application for Power {
|
||||||
|
|
@ -211,6 +212,12 @@ impl cosmic::Application for Power {
|
||||||
}
|
}
|
||||||
Command::none()
|
Command::none()
|
||||||
}
|
}
|
||||||
|
Message::Closed(id) => {
|
||||||
|
if self.popup == Some(id) {
|
||||||
|
self.popup = None;
|
||||||
|
}
|
||||||
|
Command::none()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -330,6 +337,10 @@ impl cosmic::Application for Power {
|
||||||
widget::text("").into()
|
widget::text("").into()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn on_close_requested(&self, id: window::Id) -> Option<Message> {
|
||||||
|
Some(Message::Closed(id))
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// ### UI Helplers
|
// ### UI Helplers
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue