mirror of
https://github.com/rust-windowing/winit.git
synced 2026-06-27 07:03:15 -04:00
Implement focus event
This commit is contained in:
@@ -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| {
|
||||
|
||||
Reference in New Issue
Block a user