Skip to content

Implement full debug for Event #740

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jan 3, 2018
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
48 changes: 1 addition & 47 deletions src/sdl2/event.rs
Original file line number Diff line number Diff line change
Expand Up @@ -451,7 +451,7 @@ impl WindowEvent {

}

#[derive(Clone, PartialEq)]
#[derive(Clone, PartialEq, Debug)]
/// Different event types.
pub enum Event {
Quit { timestamp: u32 },
Expand Down Expand Up @@ -709,52 +709,6 @@ pub enum Event {
}
}

impl ::std::fmt::Debug for Event {
fn fmt(&self, out: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
out.write_str(match *self {
Event::Quit{..} => "Event::Quit",
Event::AppTerminating{..} => "Event::AppTerminating",
Event::AppLowMemory{..} => "Event::AppLowMemory",
Event::AppWillEnterBackground{..} => "Event::AppWillEnterBackground",
Event::AppDidEnterBackground{..} => "Event::AppDidEnterBackground",
Event::AppWillEnterForeground{..} => "Event::AppWillEnterForeground",
Event::AppDidEnterForeground{..} => "Event::AppDidEnterForeground",
Event::Window{..} => "Event::Window",
Event::KeyDown{..} => "Event::KeyDown",
Event::KeyUp{..} => "Event::KeyUp",
Event::TextEditing{..} => "Event::TextEditing",
Event::TextInput{..} => "Event::TextInput",
Event::MouseMotion{..} => "Event::MouseMotion",
Event::MouseButtonDown{..} => "Event::MouseButtonDown",
Event::MouseButtonUp{..} => "Event::MouseButtonUp",
Event::MouseWheel{..} => "Event::MouseWheel",
Event::JoyAxisMotion{..} => "Event::JoyAxisMotion",
Event::JoyBallMotion{..} => "Event::JoyBallMotion",
Event::JoyHatMotion{..} => "Event::JoyHatMotion",
Event::JoyButtonDown{..} => "Event::JoyButtonDown",
Event::JoyButtonUp{..} => "Event::JoyButtonUp",
Event::JoyDeviceAdded{..} => "Event::JoyDeviceAdded",
Event::JoyDeviceRemoved{..} => "Event::JoyDeviceRemoved",
Event::ControllerAxisMotion{..} => "Event::ControllerAxisMotion",
Event::ControllerButtonDown{..} => "Event::ControllerButtonDown",
Event::ControllerButtonUp{..} => "Event::ControllerButtonUp",
Event::ControllerDeviceAdded{..} => "Event::ControllerDeviceAdded",
Event::ControllerDeviceRemoved{..} => "Event::ControllerDeviceRemoved",
Event::ControllerDeviceRemapped{..} => "Event::ControllerDeviceRemapped",
Event::FingerDown{..} => "Event::FingerDown",
Event::FingerUp{..} => "Event::FingerUp",
Event::FingerMotion{..} => "Event::FingerMotion",
Event::DollarGesture{..} => "Event::DollarGesture",
Event::DollarRecord{..} => "Event::DollarRecord",
Event::MultiGesture{..} => "Event::MultiGesture",
Event::ClipboardUpdate{..} => "Event::ClipboardUpdate",
Event::DropFile{..} => "Event::DropFile",
Event::User{..} => "Event::User",
Event::Unknown{..} => "Event::Unknown",
})
}
}

/// Helper function to make converting scancodes
/// and keycodes to primitive `SDL_Keysym` types.
fn mk_keysym<S, K>(scancode: S,
Expand Down
2 changes: 1 addition & 1 deletion src/sdl2/mouse/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ impl MouseButton {
}
}

#[derive(Copy, Clone, Eq, PartialEq, Hash)]
#[derive(Copy, Clone, Eq, PartialEq, Hash, Debug)]
pub struct MouseState {
mouse_state: u32,
x: i32,
Expand Down