mirror of
https://github.com/FliegendeWurst/cursive.git
synced 2024-11-24 01:46:31 +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() {
|
if let Some(ev) = terminal::wait_event() {
|
||||||
match ev {
|
match ev {
|
||||||
// TODO: what should we do here?
|
// TODO: what should we do here?
|
||||||
BltEvent::Close => Event::Refresh,
|
BltEvent::Close => Event::Exit,
|
||||||
BltEvent::Resize { .. } => Event::WindowResize,
|
BltEvent::Resize { .. } => Event::WindowResize,
|
||||||
// TODO: mouse support
|
// TODO: mouse support
|
||||||
BltEvent::MouseMove { .. } => Event::Refresh,
|
BltEvent::MouseMove { .. } => Event::Refresh,
|
||||||
|
@ -218,6 +218,10 @@ pub enum Event {
|
|||||||
|
|
||||||
/// An unknown event was received.
|
/// An unknown event was received.
|
||||||
Unknown(i32),
|
Unknown(i32),
|
||||||
|
|
||||||
|
#[doc(hidden)]
|
||||||
|
/// The application is about to exit.
|
||||||
|
Exit,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl From<char> for Event {
|
impl From<char> for Event {
|
||||||
|
@ -530,6 +530,10 @@ impl Cursive {
|
|||||||
// Wait for next event.
|
// Wait for next event.
|
||||||
// (If set_fps was called, this returns -1 now and then)
|
// (If set_fps was called, this returns -1 now and then)
|
||||||
let event = self.backend.poll_event();
|
let event = self.backend.poll_event();
|
||||||
|
if event == Event::Exit {
|
||||||
|
self.quit();
|
||||||
|
}
|
||||||
|
|
||||||
if event == Event::WindowResize {
|
if event == Event::WindowResize {
|
||||||
self.backend.clear();
|
self.backend.clear();
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user