Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement android events and wake event loop #153

Merged
merged 1 commit into from
Mar 6, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "winit"
version = "0.6.0"
version = "0.6.1"
authors = ["The winit contributors, Pierre Krieger <pierre.krieger1708@gmail.com>"]
description = "Cross-platform window creation library."
keywords = ["windowing"]
Expand Down
19 changes: 18 additions & 1 deletion src/platform/android/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,23 @@ impl<'a> Iterator for PollEventsIterator<'a> {
location: (motion.x as f64, motion.y as f64),
id: motion.pointer_id as u64,
}))
},
Ok(android_glue::Event::InitWindow) => {
// The activity went to foreground.
Some(Event::Suspended(false))
},
Ok(android_glue::Event::TermWindow) => {
// The activity went to background.
Some(Event::Suspended(true))
},
Ok(android_glue::Event::WindowResized) |
Ok(android_glue::Event::ConfigChanged) => {
// Activity Orientation changed or resized.
self.window.get_inner_size().map(|s| Event::Resized(s.0, s.1))
},
Ok(android_glue::Event::WindowRedrawNeeded) => {
// The activity needs to be redrawn.
Some(Event::Refresh)
}
_ => {
None
Expand Down Expand Up @@ -253,6 +270,6 @@ pub struct WindowProxy;
impl WindowProxy {
#[inline]
pub fn wakeup_event_loop(&self) {
unimplemented!()
android_glue::wake_event_loop();
}
}