Implement focus event

This commit is contained in:
Ryan Goldstein 2019-03-16 18:44:13 -04:00
parent a5166baba2
commit 96786bbb87

View file

@ -106,9 +106,17 @@ impl<T> EventLoop<T> {
runner.set_listener(Box::new(move |evt, ctrl| event_handler(evt, &relw, ctrl)));
let document = &document();
add_event(&runner, document, |_, _: BlurEvent| {
add_event(&runner, document, |elrs, _: BlurEvent| {
elrs.send_event(Event::WindowEvent {
window_id: RootWI(WindowId),
event: WindowEvent::Focused(false)
});
});
add_event(&runner, document, |_, _: FocusEvent| {
add_event(&runner, document, |elrs, _: FocusEvent| {
elrs.send_event(Event::WindowEvent {
window_id: RootWI(WindowId),
event: WindowEvent::Focused(true)
});
});
add_event(&runner, document, |elrs, event: KeyDownEvent| {