mirror of
https://github.com/servo/servo.git
synced 2025-08-03 04:30:10 +01:00
Pass all key events to the current constellation frame.
This commit is contained in:
parent
c5e1b0d32e
commit
1c64dabb15
7 changed files with 304 additions and 9 deletions
|
@ -50,6 +50,137 @@ pub struct WindowSizeData {
|
|||
pub device_pixel_ratio: ScaleFactor<ViewportPx, DevicePixel, f32>,
|
||||
}
|
||||
|
||||
pub enum KeyState {
|
||||
Pressed,
|
||||
Released,
|
||||
Repeated,
|
||||
}
|
||||
|
||||
//N.B. Straight up copied from glfw-rs
|
||||
pub enum 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,
|
||||
}
|
||||
|
||||
/// Messages from the compositor and script to the constellation.
|
||||
pub enum Msg {
|
||||
ExitMsg,
|
||||
|
@ -62,6 +193,7 @@ pub enum Msg {
|
|||
NavigateMsg(NavigationDirection),
|
||||
RendererReadyMsg(PipelineId),
|
||||
ResizedWindowMsg(WindowSizeData),
|
||||
KeyEvent(Key, KeyState),
|
||||
}
|
||||
|
||||
/// Similar to net::resource_task::LoadData
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue