1#[allow(clippy::derive_partial_eq_without_eq)]
2#[derive(Clone, PartialEq, ::prost::Message)]
3pub struct Key {
4 #[prost(enumeration="key::KeyModifier", optional, tag="1")]
5 pub modifier: ::core::option::Option<i32>,
6 #[prost(enumeration="key::KeyModifier", repeated, tag="4")]
7 pub additional_modifiers: ::prost::alloc::vec::Vec<i32>,
8 #[prost(oneof="key::MainKey", tags="2, 3")]
9 pub main_key: ::core::option::Option<key::MainKey>,
10}
11pub mod key {
13 #[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
14 #[repr(i32)]
15 pub enum KeyModifier {
16 Ctrl = 0,
17 Alt = 1,
18 Shift = 2,
19 Super = 3,
20 }
21 impl KeyModifier {
22 pub fn as_str_name(&self) -> &'static str {
27 match self {
28 KeyModifier::Ctrl => "CTRL",
29 KeyModifier::Alt => "ALT",
30 KeyModifier::Shift => "SHIFT",
31 KeyModifier::Super => "SUPER",
32 }
33 }
34 pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
36 match value {
37 "CTRL" => Some(Self::Ctrl),
38 "ALT" => Some(Self::Alt),
39 "SHIFT" => Some(Self::Shift),
40 "SUPER" => Some(Self::Super),
41 _ => None,
42 }
43 }
44 }
45 #[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
46 #[repr(i32)]
47 pub enum NamedKey {
48 PageDown = 0,
49 PageUp = 1,
50 LeftArrow = 2,
51 DownArrow = 3,
52 UpArrow = 4,
53 RightArrow = 5,
54 Home = 6,
55 End = 7,
56 Backspace = 8,
57 Delete = 9,
58 Insert = 10,
59 F1 = 11,
60 F2 = 12,
61 F3 = 13,
62 F4 = 14,
63 F5 = 15,
64 F6 = 16,
65 F7 = 17,
66 F8 = 18,
67 F9 = 19,
68 F10 = 20,
69 F11 = 21,
70 F12 = 22,
71 Tab = 23,
72 Esc = 24,
73 CapsLock = 25,
74 ScrollLock = 26,
75 NumLock = 27,
76 PrintScreen = 28,
77 Pause = 29,
78 Menu = 30,
79 Enter = 31,
80 }
81 impl NamedKey {
82 pub fn as_str_name(&self) -> &'static str {
87 match self {
88 NamedKey::PageDown => "PageDown",
89 NamedKey::PageUp => "PageUp",
90 NamedKey::LeftArrow => "LeftArrow",
91 NamedKey::DownArrow => "DownArrow",
92 NamedKey::UpArrow => "UpArrow",
93 NamedKey::RightArrow => "RightArrow",
94 NamedKey::Home => "Home",
95 NamedKey::End => "End",
96 NamedKey::Backspace => "Backspace",
97 NamedKey::Delete => "Delete",
98 NamedKey::Insert => "Insert",
99 NamedKey::F1 => "F1",
100 NamedKey::F2 => "F2",
101 NamedKey::F3 => "F3",
102 NamedKey::F4 => "F4",
103 NamedKey::F5 => "F5",
104 NamedKey::F6 => "F6",
105 NamedKey::F7 => "F7",
106 NamedKey::F8 => "F8",
107 NamedKey::F9 => "F9",
108 NamedKey::F10 => "F10",
109 NamedKey::F11 => "F11",
110 NamedKey::F12 => "F12",
111 NamedKey::Tab => "Tab",
112 NamedKey::Esc => "Esc",
113 NamedKey::CapsLock => "CapsLock",
114 NamedKey::ScrollLock => "ScrollLock",
115 NamedKey::NumLock => "NumLock",
116 NamedKey::PrintScreen => "PrintScreen",
117 NamedKey::Pause => "Pause",
118 NamedKey::Menu => "Menu",
119 NamedKey::Enter => "Enter",
120 }
121 }
122 pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
124 match value {
125 "PageDown" => Some(Self::PageDown),
126 "PageUp" => Some(Self::PageUp),
127 "LeftArrow" => Some(Self::LeftArrow),
128 "DownArrow" => Some(Self::DownArrow),
129 "UpArrow" => Some(Self::UpArrow),
130 "RightArrow" => Some(Self::RightArrow),
131 "Home" => Some(Self::Home),
132 "End" => Some(Self::End),
133 "Backspace" => Some(Self::Backspace),
134 "Delete" => Some(Self::Delete),
135 "Insert" => Some(Self::Insert),
136 "F1" => Some(Self::F1),
137 "F2" => Some(Self::F2),
138 "F3" => Some(Self::F3),
139 "F4" => Some(Self::F4),
140 "F5" => Some(Self::F5),
141 "F6" => Some(Self::F6),
142 "F7" => Some(Self::F7),
143 "F8" => Some(Self::F8),
144 "F9" => Some(Self::F9),
145 "F10" => Some(Self::F10),
146 "F11" => Some(Self::F11),
147 "F12" => Some(Self::F12),
148 "Tab" => Some(Self::Tab),
149 "Esc" => Some(Self::Esc),
150 "CapsLock" => Some(Self::CapsLock),
151 "ScrollLock" => Some(Self::ScrollLock),
152 "NumLock" => Some(Self::NumLock),
153 "PrintScreen" => Some(Self::PrintScreen),
154 "Pause" => Some(Self::Pause),
155 "Menu" => Some(Self::Menu),
156 "Enter" => Some(Self::Enter),
157 _ => None,
158 }
159 }
160 }
161 #[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
162 #[repr(i32)]
163 pub enum Char {
164 A = 0,
165 B = 1,
166 C = 2,
167 D = 3,
168 E = 4,
169 F = 5,
170 G = 6,
171 H = 7,
172 I = 8,
173 J = 9,
174 K = 10,
175 L = 11,
176 M = 12,
177 N = 13,
178 O = 14,
179 P = 15,
180 Q = 16,
181 R = 17,
182 S = 18,
183 T = 19,
184 U = 20,
185 V = 21,
186 W = 22,
187 X = 23,
188 Y = 24,
189 Z = 25,
190 Zero = 26,
191 One = 27,
192 Two = 28,
193 Three = 29,
194 Four = 30,
195 Five = 31,
196 Six = 32,
197 Seven = 33,
198 Eight = 34,
199 Nine = 35,
200 }
201 impl Char {
202 pub fn as_str_name(&self) -> &'static str {
207 match self {
208 Char::A => "a",
209 Char::B => "b",
210 Char::C => "c",
211 Char::D => "d",
212 Char::E => "e",
213 Char::F => "f",
214 Char::G => "g",
215 Char::H => "h",
216 Char::I => "i",
217 Char::J => "j",
218 Char::K => "k",
219 Char::L => "l",
220 Char::M => "m",
221 Char::N => "n",
222 Char::O => "o",
223 Char::P => "p",
224 Char::Q => "q",
225 Char::R => "r",
226 Char::S => "s",
227 Char::T => "t",
228 Char::U => "u",
229 Char::V => "v",
230 Char::W => "w",
231 Char::X => "x",
232 Char::Y => "y",
233 Char::Z => "z",
234 Char::Zero => "zero",
235 Char::One => "one",
236 Char::Two => "two",
237 Char::Three => "three",
238 Char::Four => "four",
239 Char::Five => "five",
240 Char::Six => "six",
241 Char::Seven => "seven",
242 Char::Eight => "eight",
243 Char::Nine => "nine",
244 }
245 }
246 pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
248 match value {
249 "a" => Some(Self::A),
250 "b" => Some(Self::B),
251 "c" => Some(Self::C),
252 "d" => Some(Self::D),
253 "e" => Some(Self::E),
254 "f" => Some(Self::F),
255 "g" => Some(Self::G),
256 "h" => Some(Self::H),
257 "i" => Some(Self::I),
258 "j" => Some(Self::J),
259 "k" => Some(Self::K),
260 "l" => Some(Self::L),
261 "m" => Some(Self::M),
262 "n" => Some(Self::N),
263 "o" => Some(Self::O),
264 "p" => Some(Self::P),
265 "q" => Some(Self::Q),
266 "r" => Some(Self::R),
267 "s" => Some(Self::S),
268 "t" => Some(Self::T),
269 "u" => Some(Self::U),
270 "v" => Some(Self::V),
271 "w" => Some(Self::W),
272 "x" => Some(Self::X),
273 "y" => Some(Self::Y),
274 "z" => Some(Self::Z),
275 "zero" => Some(Self::Zero),
276 "one" => Some(Self::One),
277 "two" => Some(Self::Two),
278 "three" => Some(Self::Three),
279 "four" => Some(Self::Four),
280 "five" => Some(Self::Five),
281 "six" => Some(Self::Six),
282 "seven" => Some(Self::Seven),
283 "eight" => Some(Self::Eight),
284 "nine" => Some(Self::Nine),
285 _ => None,
286 }
287 }
288 }
289 #[allow(clippy::derive_partial_eq_without_eq)]
290#[derive(Clone, PartialEq, ::prost::Oneof)]
291 pub enum MainKey {
292 #[prost(enumeration="NamedKey", tag="2")]
293 Key(i32),
294 #[prost(enumeration="Char", tag="3")]
295 Char(i32),
296 }
297}