Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions examples/open_parented/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ impl WindowHandler for ParentWindowHandler {
Event::Mouse(e) => println!("Parent Mouse event: {:?}", e),
Event::Keyboard(e) => println!("Parent Keyboard event: {:?}", e),
Event::Window(e) => println!("Parent Window event: {:?}", e),
_ => {}
}

EventStatus::Captured
Expand Down Expand Up @@ -111,6 +112,7 @@ impl WindowHandler for ChildWindowHandler {
Event::Mouse(e) => println!("Child Mouse event: {:?}", e),
Event::Keyboard(e) => println!("Child Keyboard event: {:?}", e),
Event::Window(e) => println!("Child Window event: {:?}", e),
_ => {}
}

EventStatus::Captured
Expand Down
1 change: 1 addition & 0 deletions examples/open_window/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -169,5 +169,6 @@ fn log_event(event: &Event) {
Event::Mouse(e) => println!("Mouse event: {:?}", e),
Event::Keyboard(e) => println!("Keyboard event: {:?}", e),
Event::Window(e) => println!("Window event: {:?}", e),
_ => {}
}
}
1 change: 1 addition & 0 deletions examples/render_femtovg/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -125,5 +125,6 @@ fn log_event(event: &Event) {
Event::Mouse(e) => println!("Mouse event: {:?}", e),
Event::Keyboard(e) => println!("Keyboard event: {:?}", e),
Event::Window(e) => println!("Window event: {:?}", e),
_ => {}
}
}
1 change: 1 addition & 0 deletions examples/render_wgpu/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -215,5 +215,6 @@ fn log_event(event: &Event) {
Event::Mouse(e) => println!("Mouse event: {:?}", e),
Event::Keyboard(e) => println!("Keyboard event: {:?}", e),
Event::Window(e) => println!("Window event: {:?}", e),
_ => {}
}
}
8 changes: 8 additions & 0 deletions src/event.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ use keyboard_types::{KeyboardEvent, Modifiers};
use std::path::PathBuf;

#[derive(Debug, Copy, Clone, Eq, PartialEq)]
#[non_exhaustive]
pub enum MouseButton {
Left,
Middle,
Expand All @@ -14,6 +15,7 @@ pub enum MouseButton {

/// A scroll movement.
#[derive(Debug, Clone, Copy, PartialEq)]
#[non_exhaustive]
pub enum ScrollDelta {
/// A line-based scroll movement
Lines {
Expand All @@ -33,6 +35,7 @@ pub enum ScrollDelta {
}

#[derive(Debug, Clone, PartialEq)]
#[non_exhaustive]
pub enum MouseEvent {
/// The mouse cursor was moved
CursorMoved {
Expand Down Expand Up @@ -107,19 +110,22 @@ pub enum MouseEvent {
}

#[derive(Debug, Clone)]
#[non_exhaustive]
pub enum WindowEvent {
Focused,
Unfocused,
WillClose,
}

#[derive(Debug, Clone)]
#[non_exhaustive]
pub enum Event {
Mouse(MouseEvent),
Keyboard(KeyboardEvent),
Window(WindowEvent),
}

#[non_exhaustive]
#[derive(Debug, Clone, Copy, PartialEq)]
pub enum DropEffect {
Copy,
Expand All @@ -128,6 +134,7 @@ pub enum DropEffect {
Scroll,
}

#[non_exhaustive]
#[derive(Debug, Clone, PartialEq)]
pub enum DropData {
None,
Expand All @@ -143,6 +150,7 @@ pub enum DropData {
/// or it isn't obviously useful. Currently, only [`Event::Keyboard`] variants
/// are supported.
#[derive(Debug, Clone, Copy, PartialEq)]
#[non_exhaustive]
pub enum EventStatus {
/// Event was handled by your window and will not be sent back to the
/// platform for further processing.
Expand Down
1 change: 1 addition & 0 deletions src/window_open_options.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ pub enum WindowScalePolicy {

/// The options for opening a new window
#[derive(Debug, Clone, PartialEq)]
#[non_exhaustive]
pub struct WindowOpenOptions {
pub title: String,

Expand Down
Loading