Update rustc to revision 3dcd2157403163789aaf21a9ab3c4d30a7c6494d.

This commit is contained in:
Ms2ger 2014-12-17 10:42:52 +01:00 committed by Josh Matthews
parent b8900782b0
commit 466faac2a5
223 changed files with 4414 additions and 4105 deletions

View file

@ -11,7 +11,7 @@ use dom::bindings::global::GlobalRef;
use dom::bindings::global;
use dom::bindings::js::{JSRef, Temporary, RootedReference};
use dom::bindings::utils::{Reflectable, Reflector, reflect_dom_object};
use dom::event::{Event, KeyboardEventTypeId};
use dom::event::{Event, EventTypeId};
use dom::uievent::UIEvent;
use dom::window::Window;
use servo_msg::constellation_msg;
@ -37,14 +37,14 @@ pub struct KeyboardEvent {
impl KeyboardEventDerived for Event {
fn is_keyboardevent(&self) -> bool {
*self.type_id() == KeyboardEventTypeId
*self.type_id() == EventTypeId::KeyboardEvent
}
}
impl KeyboardEvent {
fn new_inherited() -> KeyboardEvent {
KeyboardEvent {
uievent: UIEvent::new_inherited(KeyboardEventTypeId),
uievent: UIEvent::new_inherited(EventTypeId::KeyboardEvent),
key: RefCell::new("".to_string()),
code: RefCell::new("".to_string()),
location: Cell::new(0),
@ -127,316 +127,316 @@ impl KeyboardEvent {
fn key_value(key: constellation_msg::Key, mods: constellation_msg::KeyModifiers) -> &'static str {
let shift = mods.contains(constellation_msg::SHIFT);
match key {
constellation_msg::KeySpace => " ",
constellation_msg::KeyApostrophe if shift => "\"",
constellation_msg::KeyApostrophe => "'",
constellation_msg::KeyComma if shift => "<",
constellation_msg::KeyComma => ",",
constellation_msg::KeyMinus if shift => "_",
constellation_msg::KeyMinus => "-",
constellation_msg::KeyPeriod if shift => ">",
constellation_msg::KeyPeriod => ".",
constellation_msg::KeySlash if shift => "?",
constellation_msg::KeySlash => "/",
constellation_msg::Key0 if shift => ")",
constellation_msg::Key0 => "0",
constellation_msg::Key1 if shift => "!",
constellation_msg::Key1 => "1",
constellation_msg::Key2 if shift => "@",
constellation_msg::Key2 => "2",
constellation_msg::Key3 if shift => "#",
constellation_msg::Key3 => "3",
constellation_msg::Key4 if shift => "$",
constellation_msg::Key4 => "4",
constellation_msg::Key5 if shift => "%",
constellation_msg::Key5 => "5",
constellation_msg::Key6 if shift => "^",
constellation_msg::Key6 => "6",
constellation_msg::Key7 if shift => "&",
constellation_msg::Key7 => "7",
constellation_msg::Key8 if shift => "*",
constellation_msg::Key8 => "8",
constellation_msg::Key9 if shift => "(",
constellation_msg::Key9 => "9",
constellation_msg::KeySemicolon if shift => ":",
constellation_msg::KeySemicolon => ";",
constellation_msg::KeyEqual if shift => "+",
constellation_msg::KeyEqual => "=",
constellation_msg::KeyA if shift => "A",
constellation_msg::KeyA => "a",
constellation_msg::KeyB if shift => "B",
constellation_msg::KeyB => "b",
constellation_msg::KeyC if shift => "C",
constellation_msg::KeyC => "c",
constellation_msg::KeyD if shift => "D",
constellation_msg::KeyD => "d",
constellation_msg::KeyE if shift => "E",
constellation_msg::KeyE => "e",
constellation_msg::KeyF if shift => "F",
constellation_msg::KeyF => "f",
constellation_msg::KeyG if shift => "G",
constellation_msg::KeyG => "g",
constellation_msg::KeyH if shift => "H",
constellation_msg::KeyH => "h",
constellation_msg::KeyI if shift => "I",
constellation_msg::KeyI => "i",
constellation_msg::KeyJ if shift => "J",
constellation_msg::KeyJ => "j",
constellation_msg::KeyK if shift => "K",
constellation_msg::KeyK => "k",
constellation_msg::KeyL if shift => "L",
constellation_msg::KeyL => "l",
constellation_msg::KeyM if shift => "M",
constellation_msg::KeyM => "m",
constellation_msg::KeyN if shift => "N",
constellation_msg::KeyN => "n",
constellation_msg::KeyO if shift => "O",
constellation_msg::KeyO => "o",
constellation_msg::KeyP if shift => "P",
constellation_msg::KeyP => "p",
constellation_msg::KeyQ if shift => "Q",
constellation_msg::KeyQ => "q",
constellation_msg::KeyR if shift => "R",
constellation_msg::KeyR => "r",
constellation_msg::KeyS if shift => "S",
constellation_msg::KeyS => "s",
constellation_msg::KeyT if shift => "T",
constellation_msg::KeyT => "t",
constellation_msg::KeyU if shift => "U",
constellation_msg::KeyU => "u",
constellation_msg::KeyV if shift => "V",
constellation_msg::KeyV => "v",
constellation_msg::KeyW if shift => "W",
constellation_msg::KeyW => "w",
constellation_msg::KeyX if shift => "X",
constellation_msg::KeyX => "x",
constellation_msg::KeyY if shift => "Y",
constellation_msg::KeyY => "y",
constellation_msg::KeyZ if shift => "Z",
constellation_msg::KeyZ => "z",
constellation_msg::KeyLeftBracket if shift => "{",
constellation_msg::KeyLeftBracket => "[",
constellation_msg::KeyBackslash if shift => "|",
constellation_msg::KeyBackslash => "\\",
constellation_msg::KeyRightBracket if shift => "}",
constellation_msg::KeyRightBracket => "]",
constellation_msg::KeyGraveAccent => "Dead",
constellation_msg::KeyWorld1 => "Unidentified",
constellation_msg::KeyWorld2 => "Unidentified",
constellation_msg::KeyEscape => "Escape",
constellation_msg::KeyEnter => "Enter",
constellation_msg::KeyTab => "Tab",
constellation_msg::KeyBackspace => "Backspace",
constellation_msg::KeyInsert => "Insert",
constellation_msg::KeyDelete => "Delete",
constellation_msg::KeyRight => "ArrowRight",
constellation_msg::KeyLeft => "ArrowLeft",
constellation_msg::KeyDown => "ArrowDown",
constellation_msg::KeyUp => "ArrowUp",
constellation_msg::KeyPageUp => "PageUp",
constellation_msg::KeyPageDown => "PageDown",
constellation_msg::KeyHome => "Home",
constellation_msg::KeyEnd => "End",
constellation_msg::KeyCapsLock => "CapsLock",
constellation_msg::KeyScrollLock => "ScrollLock",
constellation_msg::KeyNumLock => "NumLock",
constellation_msg::KeyPrintScreen => "PrintScreen",
constellation_msg::KeyPause => "Pause",
constellation_msg::KeyF1 => "F1",
constellation_msg::KeyF2 => "F2",
constellation_msg::KeyF3 => "F3",
constellation_msg::KeyF4 => "F4",
constellation_msg::KeyF5 => "F5",
constellation_msg::KeyF6 => "F6",
constellation_msg::KeyF7 => "F7",
constellation_msg::KeyF8 => "F8",
constellation_msg::KeyF9 => "F9",
constellation_msg::KeyF10 => "F10",
constellation_msg::KeyF11 => "F11",
constellation_msg::KeyF12 => "F12",
constellation_msg::KeyF13 => "F13",
constellation_msg::KeyF14 => "F14",
constellation_msg::KeyF15 => "F15",
constellation_msg::KeyF16 => "F16",
constellation_msg::KeyF17 => "F17",
constellation_msg::KeyF18 => "F18",
constellation_msg::KeyF19 => "F19",
constellation_msg::KeyF20 => "F20",
constellation_msg::KeyF21 => "F21",
constellation_msg::KeyF22 => "F22",
constellation_msg::KeyF23 => "F23",
constellation_msg::KeyF24 => "F24",
constellation_msg::KeyF25 => "F25",
constellation_msg::KeyKp0 => "0",
constellation_msg::KeyKp1 => "1",
constellation_msg::KeyKp2 => "2",
constellation_msg::KeyKp3 => "3",
constellation_msg::KeyKp4 => "4",
constellation_msg::KeyKp5 => "5",
constellation_msg::KeyKp6 => "6",
constellation_msg::KeyKp7 => "7",
constellation_msg::KeyKp8 => "8",
constellation_msg::KeyKp9 => "9",
constellation_msg::KeyKpDecimal => ".",
constellation_msg::KeyKpDivide => "/",
constellation_msg::KeyKpMultiply => "*",
constellation_msg::KeyKpSubtract => "-",
constellation_msg::KeyKpAdd => "+",
constellation_msg::KeyKpEnter => "Enter",
constellation_msg::KeyKpEqual => "=",
constellation_msg::KeyLeftShift => "Shift",
constellation_msg::KeyLeftControl => "Control",
constellation_msg::KeyLeftAlt => "Alt",
constellation_msg::KeyLeftSuper => "Super",
constellation_msg::KeyRightShift => "Shift",
constellation_msg::KeyRightControl => "Control",
constellation_msg::KeyRightAlt => "Alt",
constellation_msg::KeyRightSuper => "Super",
constellation_msg::KeyMenu => "ContextMenu",
constellation_msg::Key::Space => " ",
constellation_msg::Key::Apostrophe if shift => "\"",
constellation_msg::Key::Apostrophe => "'",
constellation_msg::Key::Comma if shift => "<",
constellation_msg::Key::Comma => ",",
constellation_msg::Key::Minus if shift => "_",
constellation_msg::Key::Minus => "-",
constellation_msg::Key::Period if shift => ">",
constellation_msg::Key::Period => ".",
constellation_msg::Key::Slash if shift => "?",
constellation_msg::Key::Slash => "/",
constellation_msg::Key::Num0 if shift => ")",
constellation_msg::Key::Num0 => "0",
constellation_msg::Key::Num1 if shift => "!",
constellation_msg::Key::Num1 => "1",
constellation_msg::Key::Num2 if shift => "@",
constellation_msg::Key::Num2 => "2",
constellation_msg::Key::Num3 if shift => "#",
constellation_msg::Key::Num3 => "3",
constellation_msg::Key::Num4 if shift => "$",
constellation_msg::Key::Num4 => "4",
constellation_msg::Key::Num5 if shift => "%",
constellation_msg::Key::Num5 => "5",
constellation_msg::Key::Num6 if shift => "^",
constellation_msg::Key::Num6 => "6",
constellation_msg::Key::Num7 if shift => "&",
constellation_msg::Key::Num7 => "7",
constellation_msg::Key::Num8 if shift => "*",
constellation_msg::Key::Num8 => "8",
constellation_msg::Key::Num9 if shift => "(",
constellation_msg::Key::Num9 => "9",
constellation_msg::Key::Semicolon if shift => ":",
constellation_msg::Key::Semicolon => ";",
constellation_msg::Key::Equal if shift => "+",
constellation_msg::Key::Equal => "=",
constellation_msg::Key::A if shift => "A",
constellation_msg::Key::A => "a",
constellation_msg::Key::B if shift => "B",
constellation_msg::Key::B => "b",
constellation_msg::Key::C if shift => "C",
constellation_msg::Key::C => "c",
constellation_msg::Key::D if shift => "D",
constellation_msg::Key::D => "d",
constellation_msg::Key::E if shift => "E",
constellation_msg::Key::E => "e",
constellation_msg::Key::F if shift => "F",
constellation_msg::Key::F => "f",
constellation_msg::Key::G if shift => "G",
constellation_msg::Key::G => "g",
constellation_msg::Key::H if shift => "H",
constellation_msg::Key::H => "h",
constellation_msg::Key::I if shift => "I",
constellation_msg::Key::I => "i",
constellation_msg::Key::J if shift => "J",
constellation_msg::Key::J => "j",
constellation_msg::Key::K if shift => "K",
constellation_msg::Key::K => "k",
constellation_msg::Key::L if shift => "L",
constellation_msg::Key::L => "l",
constellation_msg::Key::M if shift => "M",
constellation_msg::Key::M => "m",
constellation_msg::Key::N if shift => "N",
constellation_msg::Key::N => "n",
constellation_msg::Key::O if shift => "O",
constellation_msg::Key::O => "o",
constellation_msg::Key::P if shift => "P",
constellation_msg::Key::P => "p",
constellation_msg::Key::Q if shift => "Q",
constellation_msg::Key::Q => "q",
constellation_msg::Key::R if shift => "R",
constellation_msg::Key::R => "r",
constellation_msg::Key::S if shift => "S",
constellation_msg::Key::S => "s",
constellation_msg::Key::T if shift => "T",
constellation_msg::Key::T => "t",
constellation_msg::Key::U if shift => "U",
constellation_msg::Key::U => "u",
constellation_msg::Key::V if shift => "V",
constellation_msg::Key::V => "v",
constellation_msg::Key::W if shift => "W",
constellation_msg::Key::W => "w",
constellation_msg::Key::X if shift => "X",
constellation_msg::Key::X => "x",
constellation_msg::Key::Y if shift => "Y",
constellation_msg::Key::Y => "y",
constellation_msg::Key::Z if shift => "Z",
constellation_msg::Key::Z => "z",
constellation_msg::Key::LeftBracket if shift => "{",
constellation_msg::Key::LeftBracket => "[",
constellation_msg::Key::Backslash if shift => "|",
constellation_msg::Key::Backslash => "\\",
constellation_msg::Key::RightBracket if shift => "}",
constellation_msg::Key::RightBracket => "]",
constellation_msg::Key::GraveAccent => "Dead",
constellation_msg::Key::World1 => "Unidentified",
constellation_msg::Key::World2 => "Unidentified",
constellation_msg::Key::Escape => "Escape",
constellation_msg::Key::Enter => "Enter",
constellation_msg::Key::Tab => "Tab",
constellation_msg::Key::Backspace => "Backspace",
constellation_msg::Key::Insert => "Insert",
constellation_msg::Key::Delete => "Delete",
constellation_msg::Key::Right => "ArrowRight",
constellation_msg::Key::Left => "ArrowLeft",
constellation_msg::Key::Down => "ArrowDown",
constellation_msg::Key::Up => "ArrowUp",
constellation_msg::Key::PageUp => "PageUp",
constellation_msg::Key::PageDown => "PageDown",
constellation_msg::Key::Home => "Home",
constellation_msg::Key::End => "End",
constellation_msg::Key::CapsLock => "CapsLock",
constellation_msg::Key::ScrollLock => "ScrollLock",
constellation_msg::Key::NumLock => "NumLock",
constellation_msg::Key::PrintScreen => "PrintScreen",
constellation_msg::Key::Pause => "Pause",
constellation_msg::Key::F1 => "F1",
constellation_msg::Key::F2 => "F2",
constellation_msg::Key::F3 => "F3",
constellation_msg::Key::F4 => "F4",
constellation_msg::Key::F5 => "F5",
constellation_msg::Key::F6 => "F6",
constellation_msg::Key::F7 => "F7",
constellation_msg::Key::F8 => "F8",
constellation_msg::Key::F9 => "F9",
constellation_msg::Key::F10 => "F10",
constellation_msg::Key::F11 => "F11",
constellation_msg::Key::F12 => "F12",
constellation_msg::Key::F13 => "F13",
constellation_msg::Key::F14 => "F14",
constellation_msg::Key::F15 => "F15",
constellation_msg::Key::F16 => "F16",
constellation_msg::Key::F17 => "F17",
constellation_msg::Key::F18 => "F18",
constellation_msg::Key::F19 => "F19",
constellation_msg::Key::F20 => "F20",
constellation_msg::Key::F21 => "F21",
constellation_msg::Key::F22 => "F22",
constellation_msg::Key::F23 => "F23",
constellation_msg::Key::F24 => "F24",
constellation_msg::Key::F25 => "F25",
constellation_msg::Key::Kp0 => "0",
constellation_msg::Key::Kp1 => "1",
constellation_msg::Key::Kp2 => "2",
constellation_msg::Key::Kp3 => "3",
constellation_msg::Key::Kp4 => "4",
constellation_msg::Key::Kp5 => "5",
constellation_msg::Key::Kp6 => "6",
constellation_msg::Key::Kp7 => "7",
constellation_msg::Key::Kp8 => "8",
constellation_msg::Key::Kp9 => "9",
constellation_msg::Key::KpDecimal => ".",
constellation_msg::Key::KpDivide => "/",
constellation_msg::Key::KpMultiply => "*",
constellation_msg::Key::KpSubtract => "-",
constellation_msg::Key::KpAdd => "+",
constellation_msg::Key::KpEnter => "Enter",
constellation_msg::Key::KpEqual => "=",
constellation_msg::Key::LeftShift => "Shift",
constellation_msg::Key::LeftControl => "Control",
constellation_msg::Key::LeftAlt => "Alt",
constellation_msg::Key::LeftSuper => "Super",
constellation_msg::Key::RightShift => "Shift",
constellation_msg::Key::RightControl => "Control",
constellation_msg::Key::RightAlt => "Alt",
constellation_msg::Key::RightSuper => "Super",
constellation_msg::Key::Menu => "ContextMenu",
}
}
// https://dvcs.w3.org/hg/dom3events/raw-file/tip/html/DOM3Events-code.html
fn code_value(key: constellation_msg::Key) -> &'static str {
match key {
constellation_msg::KeySpace => "Space",
constellation_msg::KeyApostrophe => "Quote",
constellation_msg::KeyComma => "Comma",
constellation_msg::KeyMinus => "Minus",
constellation_msg::KeyPeriod => "Period",
constellation_msg::KeySlash => "Slash",
constellation_msg::Key0 => "Digit0",
constellation_msg::Key1 => "Digit1",
constellation_msg::Key2 => "Digit2",
constellation_msg::Key3 => "Digit3",
constellation_msg::Key4 => "Digit4",
constellation_msg::Key5 => "Digit5",
constellation_msg::Key6 => "Digit6",
constellation_msg::Key7 => "Digit7",
constellation_msg::Key8 => "Digit8",
constellation_msg::Key9 => "Digit9",
constellation_msg::KeySemicolon => "Semicolon",
constellation_msg::KeyEqual => "Equals",
constellation_msg::KeyA => "KeyA",
constellation_msg::KeyB => "KeyB",
constellation_msg::KeyC => "KeyC",
constellation_msg::KeyD => "KeyD",
constellation_msg::KeyE => "KeyE",
constellation_msg::KeyF => "KeyF",
constellation_msg::KeyG => "KeyG",
constellation_msg::KeyH => "KeyH",
constellation_msg::KeyI => "KeyI",
constellation_msg::KeyJ => "KeyJ",
constellation_msg::KeyK => "KeyK",
constellation_msg::KeyL => "KeyL",
constellation_msg::KeyM => "KeyM",
constellation_msg::KeyN => "KeyN",
constellation_msg::KeyO => "KeyO",
constellation_msg::KeyP => "KeyP",
constellation_msg::KeyQ => "KeyQ",
constellation_msg::KeyR => "KeyR",
constellation_msg::KeyS => "KeyS",
constellation_msg::KeyT => "KeyT",
constellation_msg::KeyU => "KeyU",
constellation_msg::KeyV => "KeyV",
constellation_msg::KeyW => "KeyW",
constellation_msg::KeyX => "KeyX",
constellation_msg::KeyY => "KeyY",
constellation_msg::KeyZ => "KeyZ",
constellation_msg::KeyLeftBracket => "BracketLeft",
constellation_msg::KeyBackslash => "Backslash",
constellation_msg::KeyRightBracket => "BracketRight",
constellation_msg::Key::Space => "Space",
constellation_msg::Key::Apostrophe => "Quote",
constellation_msg::Key::Comma => "Comma",
constellation_msg::Key::Minus => "Minus",
constellation_msg::Key::Period => "Period",
constellation_msg::Key::Slash => "Slash",
constellation_msg::Key::Num0 => "Digit0",
constellation_msg::Key::Num1 => "Digit1",
constellation_msg::Key::Num2 => "Digit2",
constellation_msg::Key::Num3 => "Digit3",
constellation_msg::Key::Num4 => "Digit4",
constellation_msg::Key::Num5 => "Digit5",
constellation_msg::Key::Num6 => "Digit6",
constellation_msg::Key::Num7 => "Digit7",
constellation_msg::Key::Num8 => "Digit8",
constellation_msg::Key::Num9 => "Digit9",
constellation_msg::Key::Semicolon => "Semicolon",
constellation_msg::Key::Equal => "Equals",
constellation_msg::Key::A => "Key::A",
constellation_msg::Key::B => "Key::B",
constellation_msg::Key::C => "Key::C",
constellation_msg::Key::D => "Key::D",
constellation_msg::Key::E => "Key::E",
constellation_msg::Key::F => "Key::F",
constellation_msg::Key::G => "Key::G",
constellation_msg::Key::H => "Key::H",
constellation_msg::Key::I => "Key::I",
constellation_msg::Key::J => "Key::J",
constellation_msg::Key::K => "Key::K",
constellation_msg::Key::L => "Key::L",
constellation_msg::Key::M => "Key::M",
constellation_msg::Key::N => "Key::N",
constellation_msg::Key::O => "Key::O",
constellation_msg::Key::P => "Key::P",
constellation_msg::Key::Q => "Key::Q",
constellation_msg::Key::R => "Key::R",
constellation_msg::Key::S => "Key::S",
constellation_msg::Key::T => "Key::T",
constellation_msg::Key::U => "Key::U",
constellation_msg::Key::V => "Key::V",
constellation_msg::Key::W => "Key::W",
constellation_msg::Key::X => "Key::X",
constellation_msg::Key::Y => "Key::Y",
constellation_msg::Key::Z => "Key::Z",
constellation_msg::Key::LeftBracket => "BracketLeft",
constellation_msg::Key::Backslash => "Backslash",
constellation_msg::Key::RightBracket => "BracketRight",
constellation_msg::KeyGraveAccent |
constellation_msg::KeyWorld1 |
constellation_msg::KeyWorld2 => panic!("unknown char code for {}", key),
constellation_msg::Key::GraveAccent |
constellation_msg::Key::World1 |
constellation_msg::Key::World2 => panic!("unknown char code for {}", key),
constellation_msg::KeyEscape => "Escape",
constellation_msg::KeyEnter => "Enter",
constellation_msg::KeyTab => "Tab",
constellation_msg::KeyBackspace => "Backspace",
constellation_msg::KeyInsert => "Insert",
constellation_msg::KeyDelete => "Delete",
constellation_msg::KeyRight => "ArrowRight",
constellation_msg::KeyLeft => "ArrowLeft",
constellation_msg::KeyDown => "ArrowDown",
constellation_msg::KeyUp => "ArrowUp",
constellation_msg::KeyPageUp => "PageUp",
constellation_msg::KeyPageDown => "PageDown",
constellation_msg::KeyHome => "Home",
constellation_msg::KeyEnd => "End",
constellation_msg::KeyCapsLock => "CapsLock",
constellation_msg::KeyScrollLock => "ScrollLock",
constellation_msg::KeyNumLock => "NumLock",
constellation_msg::KeyPrintScreen => "PrintScreen",
constellation_msg::KeyPause => "Pause",
constellation_msg::KeyF1 => "F1",
constellation_msg::KeyF2 => "F2",
constellation_msg::KeyF3 => "F3",
constellation_msg::KeyF4 => "F4",
constellation_msg::KeyF5 => "F5",
constellation_msg::KeyF6 => "F6",
constellation_msg::KeyF7 => "F7",
constellation_msg::KeyF8 => "F8",
constellation_msg::KeyF9 => "F9",
constellation_msg::KeyF10 => "F10",
constellation_msg::KeyF11 => "F11",
constellation_msg::KeyF12 => "F12",
constellation_msg::KeyF13 => "F13",
constellation_msg::KeyF14 => "F14",
constellation_msg::KeyF15 => "F15",
constellation_msg::KeyF16 => "F16",
constellation_msg::KeyF17 => "F17",
constellation_msg::KeyF18 => "F18",
constellation_msg::KeyF19 => "F19",
constellation_msg::KeyF20 => "F20",
constellation_msg::KeyF21 => "F21",
constellation_msg::KeyF22 => "F22",
constellation_msg::KeyF23 => "F23",
constellation_msg::KeyF24 => "F24",
constellation_msg::KeyF25 => "F25",
constellation_msg::KeyKp0 => "Numpad0",
constellation_msg::KeyKp1 => "Numpad1",
constellation_msg::KeyKp2 => "Numpad2",
constellation_msg::KeyKp3 => "Numpad3",
constellation_msg::KeyKp4 => "Numpad4",
constellation_msg::KeyKp5 => "Numpad5",
constellation_msg::KeyKp6 => "Numpad6",
constellation_msg::KeyKp7 => "Numpad7",
constellation_msg::KeyKp8 => "Numpad8",
constellation_msg::KeyKp9 => "Numpad9",
constellation_msg::KeyKpDecimal => "NumpadDecimal",
constellation_msg::KeyKpDivide => "NumpadDivide",
constellation_msg::KeyKpMultiply => "NumpadMultiply",
constellation_msg::KeyKpSubtract => "NumpadSubtract",
constellation_msg::KeyKpAdd => "NumpadAdd",
constellation_msg::KeyKpEnter => "NumpadEnter",
constellation_msg::KeyKpEqual => "NumpadEquals",
constellation_msg::KeyLeftShift | constellation_msg::KeyRightShift => "Shift",
constellation_msg::KeyLeftControl | constellation_msg::KeyRightControl => "Control",
constellation_msg::KeyLeftAlt | constellation_msg::KeyRightAlt => "Alt",
constellation_msg::KeyLeftSuper | constellation_msg::KeyRightSuper => "Super",
constellation_msg::KeyMenu => "Menu",
constellation_msg::Key::Escape => "Escape",
constellation_msg::Key::Enter => "Enter",
constellation_msg::Key::Tab => "Tab",
constellation_msg::Key::Backspace => "Backspace",
constellation_msg::Key::Insert => "Insert",
constellation_msg::Key::Delete => "Delete",
constellation_msg::Key::Right => "ArrowRight",
constellation_msg::Key::Left => "ArrowLeft",
constellation_msg::Key::Down => "ArrowDown",
constellation_msg::Key::Up => "ArrowUp",
constellation_msg::Key::PageUp => "PageUp",
constellation_msg::Key::PageDown => "PageDown",
constellation_msg::Key::Home => "Home",
constellation_msg::Key::End => "End",
constellation_msg::Key::CapsLock => "CapsLock",
constellation_msg::Key::ScrollLock => "ScrollLock",
constellation_msg::Key::NumLock => "NumLock",
constellation_msg::Key::PrintScreen => "PrintScreen",
constellation_msg::Key::Pause => "Pause",
constellation_msg::Key::F1 => "F1",
constellation_msg::Key::F2 => "F2",
constellation_msg::Key::F3 => "F3",
constellation_msg::Key::F4 => "F4",
constellation_msg::Key::F5 => "F5",
constellation_msg::Key::F6 => "F6",
constellation_msg::Key::F7 => "F7",
constellation_msg::Key::F8 => "F8",
constellation_msg::Key::F9 => "F9",
constellation_msg::Key::F10 => "F10",
constellation_msg::Key::F11 => "F11",
constellation_msg::Key::F12 => "F12",
constellation_msg::Key::F13 => "F13",
constellation_msg::Key::F14 => "F14",
constellation_msg::Key::F15 => "F15",
constellation_msg::Key::F16 => "F16",
constellation_msg::Key::F17 => "F17",
constellation_msg::Key::F18 => "F18",
constellation_msg::Key::F19 => "F19",
constellation_msg::Key::F20 => "F20",
constellation_msg::Key::F21 => "F21",
constellation_msg::Key::F22 => "F22",
constellation_msg::Key::F23 => "F23",
constellation_msg::Key::F24 => "F24",
constellation_msg::Key::F25 => "F25",
constellation_msg::Key::Kp0 => "Numpad0",
constellation_msg::Key::Kp1 => "Numpad1",
constellation_msg::Key::Kp2 => "Numpad2",
constellation_msg::Key::Kp3 => "Numpad3",
constellation_msg::Key::Kp4 => "Numpad4",
constellation_msg::Key::Kp5 => "Numpad5",
constellation_msg::Key::Kp6 => "Numpad6",
constellation_msg::Key::Kp7 => "Numpad7",
constellation_msg::Key::Kp8 => "Numpad8",
constellation_msg::Key::Kp9 => "Numpad9",
constellation_msg::Key::KpDecimal => "NumpadDecimal",
constellation_msg::Key::KpDivide => "NumpadDivide",
constellation_msg::Key::KpMultiply => "NumpadMultiply",
constellation_msg::Key::KpSubtract => "NumpadSubtract",
constellation_msg::Key::KpAdd => "NumpadAdd",
constellation_msg::Key::KpEnter => "NumpadEnter",
constellation_msg::Key::KpEqual => "NumpadEquals",
constellation_msg::Key::LeftShift | constellation_msg::Key::RightShift => "Shift",
constellation_msg::Key::LeftControl | constellation_msg::Key::RightControl => "Control",
constellation_msg::Key::LeftAlt | constellation_msg::Key::RightAlt => "Alt",
constellation_msg::Key::LeftSuper | constellation_msg::Key::RightSuper => "Super",
constellation_msg::Key::Menu => "Menu",
}
}
fn key_location(key: constellation_msg::Key) -> u32 {
match key {
constellation_msg::KeyKp0 | constellation_msg::KeyKp1 | constellation_msg::KeyKp2 |
constellation_msg::KeyKp3 | constellation_msg::KeyKp4 | constellation_msg::KeyKp5 |
constellation_msg::KeyKp6 | constellation_msg::KeyKp7 | constellation_msg::KeyKp8 |
constellation_msg::KeyKp9 | constellation_msg::KeyKpDecimal |
constellation_msg::KeyKpDivide | constellation_msg::KeyKpMultiply |
constellation_msg::KeyKpSubtract | constellation_msg::KeyKpAdd |
constellation_msg::KeyKpEnter | constellation_msg::KeyKpEqual =>
constellation_msg::Key::Kp0 | constellation_msg::Key::Kp1 | constellation_msg::Key::Kp2 |
constellation_msg::Key::Kp3 | constellation_msg::Key::Kp4 | constellation_msg::Key::Kp5 |
constellation_msg::Key::Kp6 | constellation_msg::Key::Kp7 | constellation_msg::Key::Kp8 |
constellation_msg::Key::Kp9 | constellation_msg::Key::KpDecimal |
constellation_msg::Key::KpDivide | constellation_msg::Key::KpMultiply |
constellation_msg::Key::KpSubtract | constellation_msg::Key::KpAdd |
constellation_msg::Key::KpEnter | constellation_msg::Key::KpEqual =>
KeyboardEventConstants::DOM_KEY_LOCATION_NUMPAD,
constellation_msg::KeyLeftShift | constellation_msg::KeyLeftAlt |
constellation_msg::KeyLeftControl | constellation_msg::KeyLeftSuper =>
constellation_msg::Key::LeftShift | constellation_msg::Key::LeftAlt |
constellation_msg::Key::LeftControl | constellation_msg::Key::LeftSuper =>
KeyboardEventConstants::DOM_KEY_LOCATION_LEFT,
constellation_msg::KeyRightShift | constellation_msg::KeyRightAlt |
constellation_msg::KeyRightControl | constellation_msg::KeyRightSuper =>
constellation_msg::Key::RightShift | constellation_msg::Key::RightAlt |
constellation_msg::Key::RightControl | constellation_msg::Key::RightSuper =>
KeyboardEventConstants::DOM_KEY_LOCATION_RIGHT,
_ => KeyboardEventConstants::DOM_KEY_LOCATION_STANDARD,
@ -457,76 +457,76 @@ fn key_charcode(key: constellation_msg::Key, mods: constellation_msg::KeyModifie
fn key_keycode(key: constellation_msg::Key) -> u32 {
match key {
// https://dvcs.w3.org/hg/dom3events/raw-file/tip/html/DOM3-Events.html#legacy-key-models
constellation_msg::KeyBackspace => 8,
constellation_msg::KeyTab => 9,
constellation_msg::KeyEnter => 13,
constellation_msg::KeyLeftShift | constellation_msg::KeyRightShift => 16,
constellation_msg::KeyLeftControl | constellation_msg::KeyRightControl => 17,
constellation_msg::KeyLeftAlt | constellation_msg::KeyRightAlt => 18,
constellation_msg::KeyCapsLock => 20,
constellation_msg::KeyEscape => 27,
constellation_msg::KeySpace => 32,
constellation_msg::KeyPageUp => 33,
constellation_msg::KeyPageDown => 34,
constellation_msg::KeyEnd => 35,
constellation_msg::KeyHome => 36,
constellation_msg::KeyLeft => 37,
constellation_msg::KeyUp => 38,
constellation_msg::KeyRight => 39,
constellation_msg::KeyDown => 40,
constellation_msg::KeyDelete => 46,
constellation_msg::Key::Backspace => 8,
constellation_msg::Key::Tab => 9,
constellation_msg::Key::Enter => 13,
constellation_msg::Key::LeftShift | constellation_msg::Key::RightShift => 16,
constellation_msg::Key::LeftControl | constellation_msg::Key::RightControl => 17,
constellation_msg::Key::LeftAlt | constellation_msg::Key::RightAlt => 18,
constellation_msg::Key::CapsLock => 20,
constellation_msg::Key::Escape => 27,
constellation_msg::Key::Space => 32,
constellation_msg::Key::PageUp => 33,
constellation_msg::Key::PageDown => 34,
constellation_msg::Key::End => 35,
constellation_msg::Key::Home => 36,
constellation_msg::Key::Left => 37,
constellation_msg::Key::Up => 38,
constellation_msg::Key::Right => 39,
constellation_msg::Key::Down => 40,
constellation_msg::Key::Delete => 46,
// https://dvcs.w3.org/hg/dom3events/raw-file/tip/html/DOM3-Events.html#optionally-fixed-virtual-key-codes
constellation_msg::KeySemicolon => 186,
constellation_msg::KeyEqual => 187,
constellation_msg::KeyComma => 188,
constellation_msg::KeyMinus => 189,
constellation_msg::KeyPeriod => 190,
constellation_msg::KeySlash => 191,
constellation_msg::KeyLeftBracket => 219,
constellation_msg::KeyBackslash => 220,
constellation_msg::KeyRightBracket => 221,
constellation_msg::KeyApostrophe => 222,
constellation_msg::Key::Semicolon => 186,
constellation_msg::Key::Equal => 187,
constellation_msg::Key::Comma => 188,
constellation_msg::Key::Minus => 189,
constellation_msg::Key::Period => 190,
constellation_msg::Key::Slash => 191,
constellation_msg::Key::LeftBracket => 219,
constellation_msg::Key::Backslash => 220,
constellation_msg::Key::RightBracket => 221,
constellation_msg::Key::Apostrophe => 222,
//§ B.2.1.3
constellation_msg::Key0 |
constellation_msg::Key1 |
constellation_msg::Key2 |
constellation_msg::Key3 |
constellation_msg::Key4 |
constellation_msg::Key5 |
constellation_msg::Key6 |
constellation_msg::Key7 |
constellation_msg::Key8 |
constellation_msg::Key9 => key as u32 - constellation_msg::Key0 as u32 + '0' as u32,
constellation_msg::Key::Num0 |
constellation_msg::Key::Num1 |
constellation_msg::Key::Num2 |
constellation_msg::Key::Num3 |
constellation_msg::Key::Num4 |
constellation_msg::Key::Num5 |
constellation_msg::Key::Num6 |
constellation_msg::Key::Num7 |
constellation_msg::Key::Num8 |
constellation_msg::Key::Num9 => key as u32 - constellation_msg::Key::Num0 as u32 + '0' as u32,
//§ B.2.1.4
constellation_msg::KeyA |
constellation_msg::KeyB |
constellation_msg::KeyC |
constellation_msg::KeyD |
constellation_msg::KeyE |
constellation_msg::KeyF |
constellation_msg::KeyG |
constellation_msg::KeyH |
constellation_msg::KeyI |
constellation_msg::KeyJ |
constellation_msg::KeyK |
constellation_msg::KeyL |
constellation_msg::KeyM |
constellation_msg::KeyN |
constellation_msg::KeyO |
constellation_msg::KeyP |
constellation_msg::KeyQ |
constellation_msg::KeyR |
constellation_msg::KeyS |
constellation_msg::KeyT |
constellation_msg::KeyU |
constellation_msg::KeyV |
constellation_msg::KeyW |
constellation_msg::KeyX |
constellation_msg::KeyY |
constellation_msg::KeyZ => key as u32 - constellation_msg::KeyA as u32 + 'A' as u32,
constellation_msg::Key::A |
constellation_msg::Key::B |
constellation_msg::Key::C |
constellation_msg::Key::D |
constellation_msg::Key::E |
constellation_msg::Key::F |
constellation_msg::Key::G |
constellation_msg::Key::H |
constellation_msg::Key::I |
constellation_msg::Key::J |
constellation_msg::Key::K |
constellation_msg::Key::L |
constellation_msg::Key::M |
constellation_msg::Key::N |
constellation_msg::Key::O |
constellation_msg::Key::P |
constellation_msg::Key::Q |
constellation_msg::Key::R |
constellation_msg::Key::S |
constellation_msg::Key::T |
constellation_msg::Key::U |
constellation_msg::Key::V |
constellation_msg::Key::W |
constellation_msg::Key::X |
constellation_msg::Key::Y |
constellation_msg::Key::Z => key as u32 - constellation_msg::Key::A as u32 + 'A' as u32,
//§ B.2.1.8
_ => 0