Skip to content

Commit

Permalink
Merge pull request PistonDevelopers#1037 from Thomasdezeeuw/winit-ref…
Browse files Browse the repository at this point in the history
…resh

Add Input::Redraw
  • Loading branch information
mitchmindtree committed Aug 1, 2017
2 parents fd10b27 + c04c2fe commit 1f44dc4
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 1 deletion.
4 changes: 4 additions & 0 deletions src/backend/winit.rs
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,10 @@ pub fn convert_window_event<W>(e: winit::WindowEvent, window: &W) -> Option<Inpu
Some(Input::Release(input::Button::Mouse(map_mouse(button))).into()),
},

winit::WindowEvent::Refresh => {
Some(Input::Redraw)
},

_ => None,
}
}
Expand Down
4 changes: 3 additions & 1 deletion src/event.rs
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,8 @@ pub enum Input {
Text(String),
/// The window was focused or lost focus.
Focus(bool),
/// The backed requested to redraw.
Redraw,
}


Expand All @@ -82,7 +84,7 @@ pub enum Event {
Raw(Input),
/// Events that have been interpreted from `backend::RawEvent`s by the `Ui`.
///
/// Most events usually
/// Most events usually
Ui(Ui)
}

Expand Down
2 changes: 2 additions & 0 deletions src/ui.rs
Original file line number Diff line number Diff line change
Expand Up @@ -890,6 +890,8 @@ impl Ui {
},

Input::Focus(_focused) => (),

Input::Redraw => self.needs_redraw(),
}
}

Expand Down

0 comments on commit 1f44dc4

Please sign in to comment.