Split window::Event::Focused
into two variants
This commit is contained in:
parent
0b140488b4
commit
45dc02e9bd
@ -3,7 +3,7 @@ use std::path::PathBuf;
|
||||
/// A window-related event.
|
||||
#[derive(PartialEq, Clone, Debug)]
|
||||
pub enum Event {
|
||||
/// A window was resized
|
||||
/// A window was resized.
|
||||
Resized {
|
||||
/// The new width of the window (in units)
|
||||
width: u32,
|
||||
@ -12,6 +12,12 @@ pub enum Event {
|
||||
height: u32,
|
||||
},
|
||||
|
||||
/// A window was focused.
|
||||
Focused,
|
||||
|
||||
/// A window was unfocused.
|
||||
Unfocused,
|
||||
|
||||
/// A file is being hovered over the window.
|
||||
///
|
||||
/// When the user hovers multiple files at once, this event will be emitted
|
||||
@ -29,7 +35,4 @@ 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),
|
||||
}
|
||||
|
@ -109,6 +109,11 @@ pub fn window_event(
|
||||
WindowEvent::ModifiersChanged(new_modifiers) => Some(Event::Keyboard(
|
||||
keyboard::Event::ModifiersChanged(self::modifiers(*new_modifiers)),
|
||||
)),
|
||||
WindowEvent::Focused(focused) => Some(Event::Window(if *focused {
|
||||
window::Event::Focused
|
||||
} else {
|
||||
window::Event::Unfocused
|
||||
})),
|
||||
WindowEvent::HoveredFile(path) => {
|
||||
Some(Event::Window(window::Event::FileHovered(path.clone())))
|
||||
}
|
||||
@ -121,9 +126,6 @@ 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,
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user