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