Fix interfaces test

This commit is contained in:
Keegan McAllister 2014-11-03 17:21:18 -08:00 committed by Josh Matthews
parent 89a27dd11a
commit 642a3592c7
7 changed files with 169 additions and 138 deletions

View file

@ -454,127 +454,135 @@ fn glfw_mods_to_script_mods(mods: glfw::Modifiers) -> constellation_msg::KeyModi
result
}
macro_rules! glfw_keys_to_script_keys(
($key:expr, $($name:ident),+) => (
match $key {
$(glfw::$name => constellation_msg::$name,)+
}
);
)
fn glfw_key_to_script_key(key: glfw::Key) -> constellation_msg::Key {
match key {
glfw::KeySpace => constellation_msg::KeySpace,
glfw::KeyApostrophe => constellation_msg::KeyApostrophe,
glfw::KeyComma => constellation_msg::KeyComma,
glfw::KeyMinus => constellation_msg::KeyMinus,
glfw::KeyPeriod => constellation_msg::KeyPeriod,
glfw::KeySlash => constellation_msg::KeySlash,
glfw::Key0 => constellation_msg::Key0,
glfw::Key1 => constellation_msg::Key1,
glfw::Key2 => constellation_msg::Key2,
glfw::Key3 => constellation_msg::Key3,
glfw::Key4 => constellation_msg::Key4,
glfw::Key5 => constellation_msg::Key5,
glfw::Key6 => constellation_msg::Key6,
glfw::Key7 => constellation_msg::Key7,
glfw::Key8 => constellation_msg::Key8,
glfw::Key9 => constellation_msg::Key9,
glfw::KeySemicolon => constellation_msg::KeySemicolon,
glfw::KeyEqual => constellation_msg::KeyEqual,
glfw::KeyA => constellation_msg::KeyA,
glfw::KeyB => constellation_msg::KeyB,
glfw::KeyC => constellation_msg::KeyC,
glfw::KeyD => constellation_msg::KeyD,
glfw::KeyE => constellation_msg::KeyE,
glfw::KeyF => constellation_msg::KeyF,
glfw::KeyG => constellation_msg::KeyG,
glfw::KeyH => constellation_msg::KeyH,
glfw::KeyI => constellation_msg::KeyI,
glfw::KeyJ => constellation_msg::KeyJ,
glfw::KeyK => constellation_msg::KeyK,
glfw::KeyL => constellation_msg::KeyL,
glfw::KeyM => constellation_msg::KeyM,
glfw::KeyN => constellation_msg::KeyN,
glfw::KeyO => constellation_msg::KeyO,
glfw::KeyP => constellation_msg::KeyP,
glfw::KeyQ => constellation_msg::KeyQ,
glfw::KeyR => constellation_msg::KeyR,
glfw::KeyS => constellation_msg::KeyS,
glfw::KeyT => constellation_msg::KeyT,
glfw::KeyU => constellation_msg::KeyU,
glfw::KeyV => constellation_msg::KeyV,
glfw::KeyW => constellation_msg::KeyW,
glfw::KeyX => constellation_msg::KeyX,
glfw::KeyY => constellation_msg::KeyY,
glfw::KeyZ => constellation_msg::KeyZ,
glfw::KeyLeftBracket => constellation_msg::KeyLeftBracket,
glfw::KeyBackslash => constellation_msg::KeyBackslash,
glfw::KeyRightBracket => constellation_msg::KeyRightBracket,
glfw::KeyGraveAccent => constellation_msg::KeyGraveAccent,
glfw::KeyWorld1 => constellation_msg::KeyWorld1,
glfw::KeyWorld2 => constellation_msg::KeyWorld2,
glfw::KeyEscape => constellation_msg::KeyEscape,
glfw::KeyEnter => constellation_msg::KeyEnter,
glfw::KeyTab => constellation_msg::KeyTab,
glfw::KeyBackspace => constellation_msg::KeyBackspace,
glfw::KeyInsert => constellation_msg::KeyInsert,
glfw::KeyDelete => constellation_msg::KeyDelete,
glfw::KeyRight => constellation_msg::KeyRight,
glfw::KeyLeft => constellation_msg::KeyLeft,
glfw::KeyDown => constellation_msg::KeyDown,
glfw::KeyUp => constellation_msg::KeyUp,
glfw::KeyPageUp => constellation_msg::KeyPageUp,
glfw::KeyPageDown => constellation_msg::KeyPageDown,
glfw::KeyHome => constellation_msg::KeyHome,
glfw::KeyEnd => constellation_msg::KeyEnd,
glfw::KeyCapsLock => constellation_msg::KeyCapsLock,
glfw::KeyScrollLock => constellation_msg::KeyScrollLock,
glfw::KeyNumLock => constellation_msg::KeyNumLock,
glfw::KeyPrintScreen => constellation_msg::KeyPrintScreen,
glfw::KeyPause => constellation_msg::KeyPause,
glfw::KeyF1 => constellation_msg::KeyF1,
glfw::KeyF2 => constellation_msg::KeyF2,
glfw::KeyF3 => constellation_msg::KeyF3,
glfw::KeyF4 => constellation_msg::KeyF4,
glfw::KeyF5 => constellation_msg::KeyF5,
glfw::KeyF6 => constellation_msg::KeyF6,
glfw::KeyF7 => constellation_msg::KeyF7,
glfw::KeyF8 => constellation_msg::KeyF8,
glfw::KeyF9 => constellation_msg::KeyF9,
glfw::KeyF10 => constellation_msg::KeyF10,
glfw::KeyF11 => constellation_msg::KeyF11,
glfw::KeyF12 => constellation_msg::KeyF12,
glfw::KeyF13 => constellation_msg::KeyF13,
glfw::KeyF14 => constellation_msg::KeyF14,
glfw::KeyF15 => constellation_msg::KeyF15,
glfw::KeyF16 => constellation_msg::KeyF16,
glfw::KeyF17 => constellation_msg::KeyF17,
glfw::KeyF18 => constellation_msg::KeyF18,
glfw::KeyF19 => constellation_msg::KeyF19,
glfw::KeyF20 => constellation_msg::KeyF20,
glfw::KeyF21 => constellation_msg::KeyF21,
glfw::KeyF22 => constellation_msg::KeyF22,
glfw::KeyF23 => constellation_msg::KeyF23,
glfw::KeyF24 => constellation_msg::KeyF24,
glfw::KeyF25 => constellation_msg::KeyF25,
glfw::KeyKp0 => constellation_msg::KeyKp0,
glfw::KeyKp1 => constellation_msg::KeyKp1,
glfw::KeyKp2 => constellation_msg::KeyKp2,
glfw::KeyKp3 => constellation_msg::KeyKp3,
glfw::KeyKp4 => constellation_msg::KeyKp4,
glfw::KeyKp5 => constellation_msg::KeyKp5,
glfw::KeyKp6 => constellation_msg::KeyKp6,
glfw::KeyKp7 => constellation_msg::KeyKp7,
glfw::KeyKp8 => constellation_msg::KeyKp8,
glfw::KeyKp9 => constellation_msg::KeyKp9,
glfw::KeyKpDecimal => constellation_msg::KeyKpDecimal,
glfw::KeyKpDivide => constellation_msg::KeyKpDivide,
glfw::KeyKpMultiply => constellation_msg::KeyKpMultiply,
glfw::KeyKpSubtract => constellation_msg::KeyKpSubtract,
glfw::KeyKpAdd => constellation_msg::KeyKpAdd,
glfw::KeyKpEnter => constellation_msg::KeyKpEnter,
glfw::KeyKpEqual => constellation_msg::KeyKpEqual,
glfw::KeyLeftShift => constellation_msg::KeyLeftShift,
glfw::KeyLeftControl => constellation_msg::KeyLeftControl,
glfw::KeyLeftAlt => constellation_msg::KeyLeftAlt,
glfw::KeyLeftSuper => constellation_msg::KeyLeftSuper,
glfw::KeyRightShift => constellation_msg::KeyRightShift,
glfw::KeyRightControl => constellation_msg::KeyRightControl,
glfw::KeyRightAlt => constellation_msg::KeyRightAlt,
glfw::KeyRightSuper => constellation_msg::KeyRightSuper,
glfw::KeyMenu => constellation_msg::KeyMenu,
}
glfw_keys_to_script_keys!(key,
KeySpace,
KeyApostrophe,
KeyComma,
KeyMinus,
KeyPeriod,
KeySlash,
Key0,
Key1,
Key2,
Key3,
Key4,
Key5,
Key6,
Key7,
Key8,
Key9,
KeySemicolon,
KeyEqual,
KeyA,
KeyB,
KeyC,
KeyD,
KeyE,
KeyF,
KeyG,
KeyH,
KeyI,
KeyJ,
KeyK,
KeyL,
KeyM,
KeyN,
KeyO,
KeyP,
KeyQ,
KeyR,
KeyS,
KeyT,
KeyU,
KeyV,
KeyW,
KeyX,
KeyY,
KeyZ,
KeyLeftBracket,
KeyBackslash,
KeyRightBracket,
KeyGraveAccent,
KeyWorld1,
KeyWorld2,
KeyEscape,
KeyEnter,
KeyTab,
KeyBackspace,
KeyInsert,
KeyDelete,
KeyRight,
KeyLeft,
KeyDown,
KeyUp,
KeyPageUp,
KeyPageDown,
KeyHome,
KeyEnd,
KeyCapsLock,
KeyScrollLock,
KeyNumLock,
KeyPrintScreen,
KeyPause,
KeyF1,
KeyF2,
KeyF3,
KeyF4,
KeyF5,
KeyF6,
KeyF7,
KeyF8,
KeyF9,
KeyF10,
KeyF11,
KeyF12,
KeyF13,
KeyF14,
KeyF15,
KeyF16,
KeyF17,
KeyF18,
KeyF19,
KeyF20,
KeyF21,
KeyF22,
KeyF23,
KeyF24,
KeyF25,
KeyKp0,
KeyKp1,
KeyKp2,
KeyKp3,
KeyKp4,
KeyKp5,
KeyKp6,
KeyKp7,
KeyKp8,
KeyKp9,
KeyKpDecimal,
KeyKpDivide,
KeyKpMultiply,
KeyKpSubtract,
KeyKpAdd,
KeyKpEnter,
KeyKpEqual,
KeyLeftShift,
KeyLeftControl,
KeyLeftAlt,
KeyLeftSuper,
KeyRightShift,
KeyRightControl,
KeyRightAlt,
KeyRightSuper,
KeyMenu)
}