mirror of
https://github.com/FliegendeWurst/cursive.git
synced 2024-11-23 17:35:00 +00:00
Backend::poll_event now takes &mut self
To manage an internal buffer, in case backend events and cursive events don't match 1-for-1. Planned uses: mouse support (translate click into Press+Release).
This commit is contained in:
parent
c7f995fd72
commit
7df4b06ef8
@ -79,7 +79,7 @@ impl backend::Backend for Concrete {
|
||||
// TODO: unsupported
|
||||
}
|
||||
|
||||
fn poll_event(&self) -> Event {
|
||||
fn poll_event(&mut self) -> Event {
|
||||
// TODO: we could add backend-specific controls here.
|
||||
// Ex: ctrl+mouse wheel cause window cellsize to change
|
||||
if let Some(ev) = terminal::wait_event() {
|
||||
|
@ -139,7 +139,7 @@ impl backend::Backend for Concrete {
|
||||
ncurses::mvaddstr(y as i32, x as i32, text);
|
||||
}
|
||||
|
||||
fn poll_event(&self) -> Event {
|
||||
fn poll_event(&mut self) -> Event {
|
||||
let ch: i32 = ncurses::getch();
|
||||
|
||||
// Is it a UTF-8 starting point?
|
||||
|
@ -136,7 +136,7 @@ impl backend::Backend for Concrete {
|
||||
self.window.mvaddstr(y as i32, x as i32, text);
|
||||
}
|
||||
|
||||
fn poll_event(&self) -> Event {
|
||||
fn poll_event(&mut self) -> Event {
|
||||
// TODO: there seems to not be any indication
|
||||
// of Ctrl/Alt/Shift in these :v
|
||||
if let Some(ev) = self.window.getch() {
|
||||
|
@ -27,7 +27,7 @@ pub trait Backend {
|
||||
fn screen_size(&self) -> (usize, usize);
|
||||
|
||||
/// Main input method
|
||||
fn poll_event(&self) -> event::Event;
|
||||
fn poll_event(&mut self) -> event::Event;
|
||||
|
||||
/// Main method used for printing
|
||||
fn print_at(&self, (usize, usize), &str);
|
||||
|
@ -144,7 +144,7 @@ impl backend::Backend for Concrete {
|
||||
self.timeout = Some(1000 / fps as u32);
|
||||
}
|
||||
|
||||
fn poll_event(&self) -> Event {
|
||||
fn poll_event(&mut self) -> Event {
|
||||
let input = &self.input;
|
||||
let resize = &self.resize;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user