mirror of
https://github.com/FliegendeWurst/cursive.git
synced 2024-11-23 17:35:00 +00:00
Add Event::Exit
Currently only sent by the bear lib terminal.
This commit is contained in:
parent
4aaee06d9e
commit
65d86f3638
@ -81,7 +81,7 @@ impl backend::Backend for Concrete {
|
||||
if let Some(ev) = terminal::wait_event() {
|
||||
match ev {
|
||||
// TODO: what should we do here?
|
||||
BltEvent::Close => Event::Refresh,
|
||||
BltEvent::Close => Event::Exit,
|
||||
BltEvent::Resize { .. } => Event::WindowResize,
|
||||
// TODO: mouse support
|
||||
BltEvent::MouseMove { .. } => Event::Refresh,
|
||||
|
@ -218,6 +218,10 @@ pub enum Event {
|
||||
|
||||
/// An unknown event was received.
|
||||
Unknown(i32),
|
||||
|
||||
#[doc(hidden)]
|
||||
/// The application is about to exit.
|
||||
Exit,
|
||||
}
|
||||
|
||||
impl From<char> for Event {
|
||||
|
@ -530,6 +530,10 @@ impl Cursive {
|
||||
// Wait for next event.
|
||||
// (If set_fps was called, this returns -1 now and then)
|
||||
let event = self.backend.poll_event();
|
||||
if event == Event::Exit {
|
||||
self.quit();
|
||||
}
|
||||
|
||||
if event == Event::WindowResize {
|
||||
self.backend.clear();
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user