Add support for navigation keys

This commit is contained in:
Manish Goregaokar 2016-03-22 20:21:58 +05:30
parent 327f1c1eb8
commit f3162cd316
3 changed files with 18 additions and 0 deletions

View file

@ -498,6 +498,8 @@ impl Window {
VirtualKeyCode::Tab => Ok(Key::Tab),
VirtualKeyCode::Subtract => Ok(Key::Minus),
VirtualKeyCode::NavigateBackward => Ok(Key::NavigateBackward),
VirtualKeyCode::NavigateForward => Ok(Key::NavigateForward),
_ => Err(()),
}
}
@ -731,6 +733,12 @@ impl WindowMethods for Window {
(NONE, Key::Backspace) => {
self.event_queue.borrow_mut().push(WindowEvent::Navigation(WindowNavigateMsg::Back));
}
(SHIFT, Key::NavigateForward) => {
self.event_queue.borrow_mut().push(WindowEvent::Navigation(WindowNavigateMsg::Forward));
}
(NONE, Key::NavigateBackward) => {
self.event_queue.borrow_mut().push(WindowEvent::Navigation(WindowNavigateMsg::Back));
}
(NONE, Key::Escape) => {
self.event_queue.borrow_mut().push(WindowEvent::Quit);