covalent/input/
mod.rs

1//! # Code copied from `winit`
2//! Some of this module is copied from the `winit` crate (0.22.2), which is a dependency of the
3//! `covalent_gl` graphics backend. The code is included here because it is very backend-agnostic,
4//! and means we don't need to include `winit` as a dependency for the whole `covalent` crate.
5//! This allows for more flexibility with designing a graphics backend, and also leaves room
6//! to just not make a graphics backend at all (e.g. for server-side code).
7
8/// Hardware-dependent keyboard scan code.
9/// Copied from the `winit` crate, version 0.22.2.
10pub type ScanCode = u32;
11
12/// Describes the input state of a key.
13/// Copied from the `winit` crate, version 0.22.2.
14#[derive(Debug, Hash, PartialEq, Eq, Clone, Copy)]
15#[allow(missing_docs)]
16pub enum ElementState {
17    Pressed,
18    Released,
19}
20
21/// Symbolic name for a keyboard key.
22/// Copied from the `winit` crate, version 0.22.2.
23#[derive(Debug, Hash, Ord, PartialOrd, PartialEq, Eq, Clone, Copy)]
24#[repr(u32)]
25#[allow(missing_docs)]
26pub enum VirtualKeyCode {
27    /// The '1' key over the letters.
28    Key1,
29    /// The '2' key over the letters.
30    Key2,
31    /// The '3' key over the letters.
32    Key3,
33    /// The '4' key over the letters.
34    Key4,
35    /// The '5' key over the letters.
36    Key5,
37    /// The '6' key over the letters.
38    Key6,
39    /// The '7' key over the letters.
40    Key7,
41    /// The '8' key over the letters.
42    Key8,
43    /// The '9' key over the letters.
44    Key9,
45    /// The '0' key over the 'O' and 'P' keys.
46    Key0,
47
48    A,
49    B,
50    C,
51    D,
52    E,
53    F,
54    G,
55    H,
56    I,
57    J,
58    K,
59    L,
60    M,
61    N,
62    O,
63    P,
64    Q,
65    R,
66    S,
67    T,
68    U,
69    V,
70    W,
71    X,
72    Y,
73    Z,
74
75    /// The Escape key, next to F1.
76    Escape,
77
78    F1,
79    F2,
80    F3,
81    F4,
82    F5,
83    F6,
84    F7,
85    F8,
86    F9,
87    F10,
88    F11,
89    F12,
90    F13,
91    F14,
92    F15,
93    F16,
94    F17,
95    F18,
96    F19,
97    F20,
98    F21,
99    F22,
100    F23,
101    F24,
102
103    /// Print Screen/SysRq.
104    Snapshot,
105    /// Scroll Lock.
106    Scroll,
107    /// Pause/Break key, next to Scroll lock.
108    Pause,
109
110    /// `Insert`, next to Backspace.
111    Insert,
112    Home,
113    Delete,
114    End,
115    PageDown,
116    PageUp,
117
118    Left,
119    Up,
120    Right,
121    Down,
122
123    /// The Backspace key, right over Enter.
124    Backspace,
125    /// The Enter key.
126    Return,
127    /// The space bar.
128    Space,
129
130    /// The "Compose" key on Linux.
131    Compose,
132
133    Caret,
134
135    Numlock,
136    Numpad0,
137    Numpad1,
138    Numpad2,
139    Numpad3,
140    Numpad4,
141    Numpad5,
142    Numpad6,
143    Numpad7,
144    Numpad8,
145    Numpad9,
146
147    AbntC1,
148    AbntC2,
149    Add,
150    Apostrophe,
151    Apps,
152    At,
153    Ax,
154    Backslash,
155    Calculator,
156    Capital,
157    Colon,
158    Comma,
159    Convert,
160    Decimal,
161    Divide,
162    Equals,
163    Grave,
164    Kana,
165    Kanji,
166    LAlt,
167    LBracket,
168    LControl,
169    LShift,
170    LWin,
171    Mail,
172    MediaSelect,
173    MediaStop,
174    Minus,
175    Multiply,
176    Mute,
177    MyComputer,
178    // also called "Next"
179    NavigateForward,
180    // also called "Prior"
181    NavigateBackward,
182    NextTrack,
183    NoConvert,
184    NumpadComma,
185    NumpadEnter,
186    NumpadEquals,
187    OEM102,
188    Period,
189    PlayPause,
190    Power,
191    PrevTrack,
192    RAlt,
193    RBracket,
194    RControl,
195    RShift,
196    RWin,
197    Semicolon,
198    Slash,
199    Sleep,
200    Stop,
201    Subtract,
202    Sysrq,
203    Tab,
204    Underline,
205    Unlabeled,
206    VolumeDown,
207    VolumeUp,
208    Wake,
209    WebBack,
210    WebFavorites,
211    WebForward,
212    WebHome,
213    WebRefresh,
214    WebSearch,
215    WebStop,
216    Yen,
217    Copy,
218    Paste,
219    Cut,
220}