add focus event

This commit is contained in:
cossonleo 2021-01-15 22:40:16 +08:00
parent 0646280d67
commit 0b140488b4
2 changed files with 6 additions and 0 deletions

View File

@ -29,4 +29,7 @@ pub enum Event {
/// There will be a single `FilesHoveredLeft` event triggered even if
/// multiple files were hovered.
FilesHoveredLeft,
/// A window was focused or not
Focused(bool),
}

View File

@ -121,6 +121,9 @@ pub fn window_event(
WindowEvent::Touch(touch) => {
Some(Event::Touch(touch_event(*touch, scale_factor)))
}
WindowEvent::Focused(focused) => {
Some(Event::Window(window::Event::Focused(*focused)))
}
_ => None,
}
}