diff options
Diffstat (limited to 'src/osx')
-rw-r--r-- | src/osx/event.rs | 206 | ||||
-rw-r--r-- | src/osx/mod.rs | 5 |
2 files changed, 106 insertions, 105 deletions
diff --git a/src/osx/event.rs b/src/osx/event.rs index 8b985b5..31bed10 100644 --- a/src/osx/event.rs +++ b/src/osx/event.rs @@ -2,133 +2,133 @@ use events; pub fn vkeycode_to_element(code: u16) -> Option<events::VirtualKeyCode> { Some(match code { - 0x00 => events::A, - 0x01 => events::S, - 0x02 => events::D, - 0x03 => events::F, - 0x04 => events::H, - 0x05 => events::G, - 0x06 => events::Z, - 0x07 => events::X, - 0x08 => events::C, - 0x09 => events::V, + 0x00 => events::VirtualKeyCode::A, + 0x01 => events::VirtualKeyCode::S, + 0x02 => events::VirtualKeyCode::D, + 0x03 => events::VirtualKeyCode::F, + 0x04 => events::VirtualKeyCode::H, + 0x05 => events::VirtualKeyCode::G, + 0x06 => events::VirtualKeyCode::Z, + 0x07 => events::VirtualKeyCode::X, + 0x08 => events::VirtualKeyCode::C, + 0x09 => events::VirtualKeyCode::V, //0x0a => World 1, - 0x0b => events::B, - 0x0c => events::Q, - 0x0d => events::W, - 0x0e => events::E, - 0x0f => events::R, - 0x10 => events::Y, - 0x11 => events::T, - 0x12 => events::Key1, - 0x13 => events::Key2, - 0x14 => events::Key3, - 0x15 => events::Key4, - 0x16 => events::Key6, - 0x17 => events::Key5, - 0x18 => events::Equals, - 0x19 => events::Key9, - 0x1a => events::Key7, - 0x1b => events::Minus, - 0x1c => events::Key8, - 0x1d => events::Key0, - 0x1e => events::RBracket, - 0x1f => events::O, - 0x20 => events::U, - 0x21 => events::LBracket, - 0x22 => events::I, - 0x23 => events::P, - 0x24 => events::Return, - 0x25 => events::L, - 0x26 => events::J, - 0x27 => events::Apostrophe, - 0x28 => events::K, - 0x29 => events::Semicolon, - 0x2a => events::Backslash, - 0x2b => events::Comma, - 0x2c => events::Slash, - 0x2d => events::N, - 0x2e => events::M, - 0x2f => events::Period, - 0x30 => events::Tab, - 0x31 => events::Space, - 0x32 => events::Grave, - 0x33 => events::Back, + 0x0b => events::VirtualKeyCode::B, + 0x0c => events::VirtualKeyCode::Q, + 0x0d => events::VirtualKeyCode::W, + 0x0e => events::VirtualKeyCode::E, + 0x0f => events::VirtualKeyCode::R, + 0x10 => events::VirtualKeyCode::Y, + 0x11 => events::VirtualKeyCode::T, + 0x12 => events::VirtualKeyCode::Key1, + 0x13 => events::VirtualKeyCode::Key2, + 0x14 => events::VirtualKeyCode::Key3, + 0x15 => events::VirtualKeyCode::Key4, + 0x16 => events::VirtualKeyCode::Key6, + 0x17 => events::VirtualKeyCode::Key5, + 0x18 => events::VirtualKeyCode::Equals, + 0x19 => events::VirtualKeyCode::Key9, + 0x1a => events::VirtualKeyCode::Key7, + 0x1b => events::VirtualKeyCode::Minus, + 0x1c => events::VirtualKeyCode::Key8, + 0x1d => events::VirtualKeyCode::Key0, + 0x1e => events::VirtualKeyCode::RBracket, + 0x1f => events::VirtualKeyCode::O, + 0x20 => events::VirtualKeyCode::U, + 0x21 => events::VirtualKeyCode::LBracket, + 0x22 => events::VirtualKeyCode::I, + 0x23 => events::VirtualKeyCode::P, + 0x24 => events::VirtualKeyCode::Return, + 0x25 => events::VirtualKeyCode::L, + 0x26 => events::VirtualKeyCode::J, + 0x27 => events::VirtualKeyCode::Apostrophe, + 0x28 => events::VirtualKeyCode::K, + 0x29 => events::VirtualKeyCode::Semicolon, + 0x2a => events::VirtualKeyCode::Backslash, + 0x2b => events::VirtualKeyCode::Comma, + 0x2c => events::VirtualKeyCode::Slash, + 0x2d => events::VirtualKeyCode::N, + 0x2e => events::VirtualKeyCode::M, + 0x2f => events::VirtualKeyCode::Period, + 0x30 => events::VirtualKeyCode::Tab, + 0x31 => events::VirtualKeyCode::Space, + 0x32 => events::VirtualKeyCode::Grave, + 0x33 => events::VirtualKeyCode::Back, //0x34 => unkown, - 0x35 => events::Escape, - 0x36 => events::RWin, - 0x37 => events::LWin, - 0x38 => events::LShift, + 0x35 => events::VirtualKeyCode::Escape, + 0x36 => events::VirtualKeyCode::RWin, + 0x37 => events::VirtualKeyCode::LWin, + 0x38 => events::VirtualKeyCode::LShift, //0x39 => Caps lock, //0x3a => Left alt, - 0x3b => events::LControl, - 0x3c => events::RShift, + 0x3b => events::VirtualKeyCode::LControl, + 0x3c => events::VirtualKeyCode::RShift, //0x3d => Right alt, - 0x3e => events::RControl, + 0x3e => events::VirtualKeyCode::RControl, //0x3f => Fn key, //0x40 => F17 Key, - 0x41 => events::Decimal, + 0x41 => events::VirtualKeyCode::Decimal, //0x42 -> unkown, - 0x43 => events::Multiply, + 0x43 => events::VirtualKeyCode::Multiply, //0x44 => unkown, - 0x45 => events::Add, + 0x45 => events::VirtualKeyCode::Add, //0x46 => unkown, - 0x47 => events::Numlock, + 0x47 => events::VirtualKeyCode::Numlock, //0x48 => KeypadClear, - 0x49 => events::VolumeUp, - 0x4a => events::VolumeDown, - 0x4b => events::Divide, - 0x4c => events::NumpadEnter, + 0x49 => events::VirtualKeyCode::VolumeUp, + 0x4a => events::VirtualKeyCode::VolumeDown, + 0x4b => events::VirtualKeyCode::Divide, + 0x4c => events::VirtualKeyCode::NumpadEnter, //0x4d => unkown, - 0x4e => events::Subtract, + 0x4e => events::VirtualKeyCode::Subtract, //0x4f => F18 key, //0x50 => F19 Key, - 0x51 => events::NumpadEquals, - 0x52 => events::Numpad0, - 0x53 => events::Numpad1, - 0x54 => events::Numpad2, - 0x55 => events::Numpad3, - 0x56 => events::Numpad4, - 0x57 => events::Numpad5, - 0x58 => events::Numpad6, - 0x59 => events::Numpad7, + 0x51 => events::VirtualKeyCode::NumpadEquals, + 0x52 => events::VirtualKeyCode::Numpad0, + 0x53 => events::VirtualKeyCode::Numpad1, + 0x54 => events::VirtualKeyCode::Numpad2, + 0x55 => events::VirtualKeyCode::Numpad3, + 0x56 => events::VirtualKeyCode::Numpad4, + 0x57 => events::VirtualKeyCode::Numpad5, + 0x58 => events::VirtualKeyCode::Numpad6, + 0x59 => events::VirtualKeyCode::Numpad7, //0x5a => F20 Key, - 0x5b => events::Numpad8, - 0x5c => events::Numpad9, + 0x5b => events::VirtualKeyCode::Numpad8, + 0x5c => events::VirtualKeyCode::Numpad9, //0x5d => unkown, //0x5e => unkown, //0x5f => unkown, - 0x60 => events::F5, - 0x61 => events::F6, - 0x62 => events::F7, - 0x63 => events::F3, - 0x64 => events::F8, - 0x65 => events::F9, + 0x60 => events::VirtualKeyCode::F5, + 0x61 => events::VirtualKeyCode::F6, + 0x62 => events::VirtualKeyCode::F7, + 0x63 => events::VirtualKeyCode::F3, + 0x64 => events::VirtualKeyCode::F8, + 0x65 => events::VirtualKeyCode::F9, //0x66 => unkown, - 0x67 => events::F11, + 0x67 => events::VirtualKeyCode::F11, //0x68 => unkown, - 0x69 => events::F13, + 0x69 => events::VirtualKeyCode::F13, //0x6a => F16 Key, - 0x6b => events::F14, + 0x6b => events::VirtualKeyCode::F14, //0x6c => unkown, - 0x6d => events::F10, + 0x6d => events::VirtualKeyCode::F10, //0x6e => unkown, - 0x6f => events::F12, + 0x6f => events::VirtualKeyCode::F12, //0x70 => unkown, - 0x71 => events::F15, - 0x72 => events::Insert, - 0x73 => events::Home, - 0x74 => events::PageUp, - 0x75 => events::Delete, - 0x76 => events::F4, - 0x77 => events::End, - 0x78 => events::F2, - 0x79 => events::PageDown, - 0x7a => events::F1, - 0x7b => events::Left, - 0x7c => events::Right, - 0x7d => events::Down, - 0x7e => events::Up, + 0x71 => events::VirtualKeyCode::F15, + 0x72 => events::VirtualKeyCode::Insert, + 0x73 => events::VirtualKeyCode::Home, + 0x74 => events::VirtualKeyCode::PageUp, + 0x75 => events::VirtualKeyCode::Delete, + 0x76 => events::VirtualKeyCode::F4, + 0x77 => events::VirtualKeyCode::End, + 0x78 => events::VirtualKeyCode::F2, + 0x79 => events::VirtualKeyCode::PageDown, + 0x7a => events::VirtualKeyCode::F1, + 0x7b => events::VirtualKeyCode::Left, + 0x7c => events::VirtualKeyCode::Right, + 0x7d => events::VirtualKeyCode::Down, + 0x7e => events::VirtualKeyCode::Up, //0x7f => unkown, _ => return None, diff --git a/src/osx/mod.rs b/src/osx/mod.rs index 80a4226..3b19b51 100644 --- a/src/osx/mod.rs +++ b/src/osx/mod.rs @@ -17,9 +17,10 @@ use core_foundation::string::CFString; use core_foundation::bundle::{CFBundleGetBundleWithIdentifier, CFBundleGetFunctionPointerForName}; use std::c_str::CString; -use {MouseInput, Pressed, Released, LeftMouseButton, RightMouseButton, MouseMoved, ReceivedCharacter, - KeyboardInput}; +use events::Event::{MouseInput, Pressed, Released, MouseMoved, ReceivedCharacter, KeyboardInput}; +use events::ElementState::{Pressed, Released}; +use events::MouseButton::{LeftMouseButton, RightMouseButton}; use events; pub use self::monitor::{MonitorID, get_available_monitors, get_primary_monitor}; |