fidl_fuchsia_input_common/
fidl_fuchsia_input_common.rs

1// WARNING: This file is machine generated by fidlgen.
2
3#![warn(clippy::all)]
4#![allow(unused_parens, unused_mut, unused_imports, nonstandard_style)]
5
6use bitflags::bitflags;
7use fidl::encoding::{MessageBufFor, ProxyChannelBox, ResourceDialect};
8use futures::future::{self, MaybeDone, TryFutureExt};
9use zx_status;
10
11/// A Fuchsia key represents a control that can be pressed or released such as a key or
12/// a button on a keyboard or another input device.
13///
14/// The ordinal index for enum elements is derived from the USB HID Usage Tables at the
15/// time of definition. It is a 32 bit unsigned integer representing the USB HID Usage
16/// where the low 16 bits are the USB HID Usage ID and the high 16 bits are the
17/// USB HID Usage Page.
18///
19/// The descriptions for each value in the enum assume a US English keyboard layout.
20/// Actual behavior varies by layout.
21#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
22pub enum Key {
23    /// Used when the value of Key is not known.
24    Unknown,
25    /// Keyboard a and A
26    A,
27    /// Keyboard b and B
28    B,
29    /// Keyboard c and C
30    C,
31    /// Keyboard d and D
32    D,
33    /// Keyboard e and E
34    E,
35    /// Keyboard f and F
36    F,
37    /// Keyboard g and G
38    G,
39    /// Keyboard h and H
40    H,
41    /// Keyboard i and I
42    I,
43    /// Keyboard j and J
44    J,
45    /// Keyboard k and K
46    K,
47    /// Keyboard l and L
48    L,
49    /// Keyboard m and M
50    M,
51    /// Keyboard n and N
52    N,
53    /// Keyboard o and O
54    O,
55    /// Keyboard p and P
56    P,
57    /// Keyboard q and Q
58    Q,
59    /// Keyboard r and R
60    R,
61    /// Keyboard s and S
62    S,
63    /// Keyboard t and T
64    T,
65    /// Keyboard u and U
66    U,
67    /// Keyboard v and V
68    V,
69    /// Keyboard w and W
70    W,
71    /// Keyboard x and X
72    X,
73    /// Keyboard y and Y
74    Y,
75    /// Keyboard z and Z
76    Z,
77    /// Keyboard 1 and !
78    Key1,
79    /// Keyboard 2 and @
80    Key2,
81    /// Keyboard 3 and #
82    Key3,
83    /// Keyboard 4 and $
84    Key4,
85    /// Keyboard 5 and %
86    Key5,
87    /// Keyboard 6 and ^
88    Key6,
89    /// Keyboard 7 and &
90    Key7,
91    /// Keyboard 8 and *
92    Key8,
93    /// Keyboard 9 and (
94    Key9,
95    /// Keyboard 0 and )
96    Key0,
97    /// Keyboard Enter (Return)
98    Enter,
99    /// Keyboard Escape
100    Escape,
101    /// Keyboard Backspace (Backward Delete)
102    Backspace,
103    /// Keyboard Tab
104    Tab,
105    /// Keyboard Spacebar
106    Space,
107    /// Keyboard - and (underscore)
108    Minus,
109    /// Keyboard = and +
110    Equals,
111    /// Keyboard [ and {
112    LeftBrace,
113    /// Keyboard ] and }
114    RightBrace,
115    /// Keyboard \ and |
116    Backslash,
117    /// Keyboard Non-US # and ~
118    NonUsHash,
119    /// Keyboard ; and :
120    Semicolon,
121    /// Keyboard ' and "
122    Apostrophe,
123    /// Keyboard Grave Accent and Tilde
124    GraveAccent,
125    /// Keyboard , and <
126    Comma,
127    /// Keyboard . and >
128    Dot,
129    /// Keyboard / and ?
130    Slash,
131    /// Keyboard Caps Lock
132    CapsLock,
133    /// Keyboard F1
134    F1,
135    /// Keyboard F2
136    F2,
137    /// Keyboard F3
138    F3,
139    /// Keyboard F4
140    F4,
141    /// Keyboard F5
142    F5,
143    /// Keyboard F6
144    F6,
145    /// Keyboard F7
146    F7,
147    /// Keyboard F8
148    F8,
149    /// Keyboard F9
150    F9,
151    /// Keyboard F10
152    F10,
153    /// Keyboard F11
154    F11,
155    /// Keyboard F12
156    F12,
157    /// Keyboard Print Screen
158    PrintScreen,
159    /// Keyboard Scroll Lock
160    ScrollLock,
161    /// Keyboard Pause
162    Pause,
163    /// Keyboard Insert
164    Insert,
165    /// Keyboard Home
166    Home,
167    /// Keyboard Page Up
168    PageUp,
169    /// Keyboard Forward Delete
170    Delete,
171    /// Keyboard End
172    End,
173    /// Keyboard Page Down
174    PageDown,
175    /// Keyboard Right Arrow
176    Right,
177    /// Keyboard Left Arrow
178    Left,
179    /// Keyboard Down Arrow
180    Down,
181    /// Keyboard Up Arrow
182    Up,
183    /// Keypad Num Lock and Clear
184    NumLock,
185    /// Keypad /
186    KeypadSlash,
187    /// Keypad *
188    KeypadAsterisk,
189    /// Keypad -
190    KeypadMinus,
191    /// Keypad +
192    KeypadPlus,
193    /// Keypad ENTER
194    KeypadEnter,
195    /// Keypad 1 and End
196    Keypad1,
197    /// Keypad 2 and Down Arrow
198    Keypad2,
199    /// Keypad 3 and Page Down
200    Keypad3,
201    /// Keypad 4 and Left Arrow
202    Keypad4,
203    /// Keypad 5
204    Keypad5,
205    /// Keypad 6 and Right Arrow
206    Keypad6,
207    /// Keypad 7 and Home
208    Keypad7,
209    /// Keypad 8 and Up Arrow
210    Keypad8,
211    /// Keypad 9 and Page Up
212    Keypad9,
213    /// Keypad 0 and Insert
214    Keypad0,
215    /// Keypad . and Delete
216    KeypadDot,
217    /// Keyboard Non-US \ and |
218    NonUsBackslash,
219    /// Keypad =
220    KeypadEquals,
221    /// Keyboard Menu
222    Menu,
223    /// Keyboard Left Control
224    LeftCtrl,
225    /// Keyboard Left Shift
226    LeftShift,
227    /// Keyboard Left Alt
228    LeftAlt,
229    /// Keyboard Left GUI (Meta, Windows)
230    LeftMeta,
231    /// Keyboard Right Control
232    RightCtrl,
233    /// Keyboard Right Shift
234    RightShift,
235    /// Keyboard Right Alt
236    RightAlt,
237    /// Keyboard Right GUI (Meta, Windows)
238    RightMeta,
239    /// Mute
240    ///
241    /// Silences played sounds.
242    Mute,
243    /// Turn volume down
244    VolumeDown,
245    /// Turn volume up
246    VolumeUp,
247    /// Play media, or pause media if playing
248    PlayPause,
249    /// Media mute
250    ///
251    /// Silences media playback. Other sounds may still be heard, e.g. system
252    /// notification sounds.
253    MediaMute,
254    /// Volume Increment
255    MediaVolumeIncrement,
256    /// Volume Decrement
257    MediaVolumeDecrement,
258    /// Back
259    ///
260    /// Go back to the previous page in the browser.
261    /// This, and other action keys are [defined in Chromium][1].
262    ///
263    /// [1]: https://source.chromium.org/chromium/chromium/src/+/main:ui/events/keycodes/dom/dom_code_data.inc
264    AcBack,
265    /// Refresh
266    ///
267    /// Refresh the current page in the browser.
268    AcRefresh,
269    /// Full screen view
270    ///
271    /// Zooms the focused window to full screen.
272    AcFullScreenView,
273    /// Select task/application
274    ///
275    /// Shows the task selection window
276    AcSelectTaskApplication,
277    /// Reduce screen brightness
278    BrightnessDown,
279    /// Increase screen brightness
280    BrightnessUp,
281    /// NOTE: the following are self-defined and do not have to follow the HID usage pages.
282    /// We use HID-Vendor-Specific page 0xFFFF to represent Fuchsia defined keys.
283    /// Assistant Key.
284    Assistant,
285    /// Power Button.
286    Power,
287    /// Sleep Button.
288    Sleep,
289    /// Warning: following keycodes maybe changed in the future, please don't use!!!
290    /// We use following keycodes in starnix tests. Most of them are keycodes in non-US keyboard
291    /// layouts, we may move them to meaning enum once we support those keyboard layouts.
292    /// See b/311425670 for details.
293    Unknown0055,
294    Unknown0056,
295    Unknown0059,
296    Unknown005C,
297    Unknown005D,
298    Unknown005E,
299    Unknown0079,
300    Unknown007A,
301    Unknown007B,
302    Unknown007C,
303    Unknown0085,
304    Unknown0087,
305    Unknown0089,
306    Unknown009C,
307    Unknown009F,
308    Unknown00A0,
309    Unknown00A2,
310    Unknown00A3,
311    Unknown00A5,
312    Unknown00A6,
313    Unknown00A7,
314    Unknown00A8,
315    Unknown00A9,
316    Unknown00Ad,
317    Unknown00B1,
318    Unknown00B2,
319    Unknown00B3,
320    Unknown00B4,
321    Unknown00C9,
322    Unknown00Cf,
323    Unknown00D0,
324    Unknown00D4,
325    Unknown00E2,
326    Unknown0120,
327    Unknown0121,
328    Unknown0122,
329    Unknown0123,
330    Unknown0124,
331    Unknown0125,
332    Unknown0126,
333    Unknown0127,
334    Unknown0128,
335    Unknown0129,
336    Unknown012A,
337    Unknown012B,
338    Unknown012C,
339    Unknown012D,
340    Unknown012E,
341    Unknown012F,
342    Unknown0130,
343    Unknown0131,
344    Unknown0132,
345    Unknown0133,
346    Unknown0134,
347    Unknown0135,
348    Unknown0136,
349    Unknown0137,
350    Unknown0138,
351    Unknown0139,
352    Unknown013A,
353    Unknown013B,
354    Unknown013C,
355    Unknown013D,
356    Unknown013E,
357    Unknown0161,
358    Unknown016A,
359    Unknown016E,
360    Unknown0172,
361    Unknown0179,
362    Unknown018E,
363    Unknown018F,
364    Unknown0190,
365    Unknown0191,
366    Unknown0192,
367    Unknown0193,
368    Unknown0195,
369    Unknown01D0,
370    Unknown020A,
371    Unknown020B,
372    #[doc(hidden)]
373    __SourceBreaking {
374        unknown_ordinal: u32,
375    },
376}
377
378/// Pattern that matches an unknown `Key` member.
379#[macro_export]
380macro_rules! KeyUnknown {
381    () => {
382        _
383    };
384}
385
386impl Key {
387    #[inline]
388    pub fn from_primitive(prim: u32) -> Option<Self> {
389        match prim {
390            0 => Some(Self::Unknown),
391            458756 => Some(Self::A),
392            458757 => Some(Self::B),
393            458758 => Some(Self::C),
394            458759 => Some(Self::D),
395            458760 => Some(Self::E),
396            458761 => Some(Self::F),
397            458762 => Some(Self::G),
398            458763 => Some(Self::H),
399            458764 => Some(Self::I),
400            458765 => Some(Self::J),
401            458766 => Some(Self::K),
402            458767 => Some(Self::L),
403            458768 => Some(Self::M),
404            458769 => Some(Self::N),
405            458770 => Some(Self::O),
406            458771 => Some(Self::P),
407            458772 => Some(Self::Q),
408            458773 => Some(Self::R),
409            458774 => Some(Self::S),
410            458775 => Some(Self::T),
411            458776 => Some(Self::U),
412            458777 => Some(Self::V),
413            458778 => Some(Self::W),
414            458779 => Some(Self::X),
415            458780 => Some(Self::Y),
416            458781 => Some(Self::Z),
417            458782 => Some(Self::Key1),
418            458783 => Some(Self::Key2),
419            458784 => Some(Self::Key3),
420            458785 => Some(Self::Key4),
421            458786 => Some(Self::Key5),
422            458787 => Some(Self::Key6),
423            458788 => Some(Self::Key7),
424            458789 => Some(Self::Key8),
425            458790 => Some(Self::Key9),
426            458791 => Some(Self::Key0),
427            458792 => Some(Self::Enter),
428            458793 => Some(Self::Escape),
429            458794 => Some(Self::Backspace),
430            458795 => Some(Self::Tab),
431            458796 => Some(Self::Space),
432            458797 => Some(Self::Minus),
433            458798 => Some(Self::Equals),
434            458799 => Some(Self::LeftBrace),
435            458800 => Some(Self::RightBrace),
436            458801 => Some(Self::Backslash),
437            458802 => Some(Self::NonUsHash),
438            458803 => Some(Self::Semicolon),
439            458804 => Some(Self::Apostrophe),
440            458805 => Some(Self::GraveAccent),
441            458806 => Some(Self::Comma),
442            458807 => Some(Self::Dot),
443            458808 => Some(Self::Slash),
444            458809 => Some(Self::CapsLock),
445            458810 => Some(Self::F1),
446            458811 => Some(Self::F2),
447            458812 => Some(Self::F3),
448            458813 => Some(Self::F4),
449            458814 => Some(Self::F5),
450            458815 => Some(Self::F6),
451            458816 => Some(Self::F7),
452            458817 => Some(Self::F8),
453            458818 => Some(Self::F9),
454            458819 => Some(Self::F10),
455            458820 => Some(Self::F11),
456            458821 => Some(Self::F12),
457            458822 => Some(Self::PrintScreen),
458            458823 => Some(Self::ScrollLock),
459            458824 => Some(Self::Pause),
460            458825 => Some(Self::Insert),
461            458826 => Some(Self::Home),
462            458827 => Some(Self::PageUp),
463            458828 => Some(Self::Delete),
464            458829 => Some(Self::End),
465            458830 => Some(Self::PageDown),
466            458831 => Some(Self::Right),
467            458832 => Some(Self::Left),
468            458833 => Some(Self::Down),
469            458834 => Some(Self::Up),
470            458835 => Some(Self::NumLock),
471            458836 => Some(Self::KeypadSlash),
472            458837 => Some(Self::KeypadAsterisk),
473            458838 => Some(Self::KeypadMinus),
474            458839 => Some(Self::KeypadPlus),
475            458840 => Some(Self::KeypadEnter),
476            458841 => Some(Self::Keypad1),
477            458842 => Some(Self::Keypad2),
478            458843 => Some(Self::Keypad3),
479            458844 => Some(Self::Keypad4),
480            458845 => Some(Self::Keypad5),
481            458846 => Some(Self::Keypad6),
482            458847 => Some(Self::Keypad7),
483            458848 => Some(Self::Keypad8),
484            458849 => Some(Self::Keypad9),
485            458850 => Some(Self::Keypad0),
486            458851 => Some(Self::KeypadDot),
487            458852 => Some(Self::NonUsBackslash),
488            458855 => Some(Self::KeypadEquals),
489            458870 => Some(Self::Menu),
490            458976 => Some(Self::LeftCtrl),
491            458977 => Some(Self::LeftShift),
492            458978 => Some(Self::LeftAlt),
493            458979 => Some(Self::LeftMeta),
494            458980 => Some(Self::RightCtrl),
495            458981 => Some(Self::RightShift),
496            458982 => Some(Self::RightAlt),
497            458983 => Some(Self::RightMeta),
498            458879 => Some(Self::Mute),
499            458881 => Some(Self::VolumeDown),
500            458880 => Some(Self::VolumeUp),
501            786637 => Some(Self::PlayPause),
502            786658 => Some(Self::MediaMute),
503            786665 => Some(Self::MediaVolumeIncrement),
504            786666 => Some(Self::MediaVolumeDecrement),
505            786980 => Some(Self::AcBack),
506            786983 => Some(Self::AcRefresh),
507            786992 => Some(Self::AcFullScreenView),
508            786850 => Some(Self::AcSelectTaskApplication),
509            786543 => Some(Self::BrightnessDown),
510            786544 => Some(Self::BrightnessUp),
511            4294901761 => Some(Self::Assistant),
512            4294901762 => Some(Self::Power),
513            4294901763 => Some(Self::Sleep),
514            4294901845 => Some(Self::Unknown0055),
515            4294901846 => Some(Self::Unknown0056),
516            4294901849 => Some(Self::Unknown0059),
517            4294901852 => Some(Self::Unknown005C),
518            4294901853 => Some(Self::Unknown005D),
519            4294901854 => Some(Self::Unknown005E),
520            4294901881 => Some(Self::Unknown0079),
521            4294901882 => Some(Self::Unknown007A),
522            4294901883 => Some(Self::Unknown007B),
523            4294901884 => Some(Self::Unknown007C),
524            4294901893 => Some(Self::Unknown0085),
525            4294901895 => Some(Self::Unknown0087),
526            4294901897 => Some(Self::Unknown0089),
527            4294901916 => Some(Self::Unknown009C),
528            4294901919 => Some(Self::Unknown009F),
529            4294901920 => Some(Self::Unknown00A0),
530            4294901922 => Some(Self::Unknown00A2),
531            4294901923 => Some(Self::Unknown00A3),
532            4294901925 => Some(Self::Unknown00A5),
533            4294901926 => Some(Self::Unknown00A6),
534            4294901927 => Some(Self::Unknown00A7),
535            4294901928 => Some(Self::Unknown00A8),
536            4294901929 => Some(Self::Unknown00A9),
537            4294901933 => Some(Self::Unknown00Ad),
538            4294901937 => Some(Self::Unknown00B1),
539            4294901938 => Some(Self::Unknown00B2),
540            4294901939 => Some(Self::Unknown00B3),
541            4294901940 => Some(Self::Unknown00B4),
542            4294901961 => Some(Self::Unknown00C9),
543            4294901967 => Some(Self::Unknown00Cf),
544            4294901968 => Some(Self::Unknown00D0),
545            4294901972 => Some(Self::Unknown00D4),
546            4294901986 => Some(Self::Unknown00E2),
547            4294902048 => Some(Self::Unknown0120),
548            4294902049 => Some(Self::Unknown0121),
549            4294902050 => Some(Self::Unknown0122),
550            4294902051 => Some(Self::Unknown0123),
551            4294902052 => Some(Self::Unknown0124),
552            4294902053 => Some(Self::Unknown0125),
553            4294902054 => Some(Self::Unknown0126),
554            4294902055 => Some(Self::Unknown0127),
555            4294902056 => Some(Self::Unknown0128),
556            4294902057 => Some(Self::Unknown0129),
557            4294902058 => Some(Self::Unknown012A),
558            4294902059 => Some(Self::Unknown012B),
559            4294902060 => Some(Self::Unknown012C),
560            4294902061 => Some(Self::Unknown012D),
561            4294902062 => Some(Self::Unknown012E),
562            4294902063 => Some(Self::Unknown012F),
563            4294902064 => Some(Self::Unknown0130),
564            4294902065 => Some(Self::Unknown0131),
565            4294902066 => Some(Self::Unknown0132),
566            4294902067 => Some(Self::Unknown0133),
567            4294902068 => Some(Self::Unknown0134),
568            4294902069 => Some(Self::Unknown0135),
569            4294902070 => Some(Self::Unknown0136),
570            4294902071 => Some(Self::Unknown0137),
571            4294902072 => Some(Self::Unknown0138),
572            4294902073 => Some(Self::Unknown0139),
573            4294902074 => Some(Self::Unknown013A),
574            4294902075 => Some(Self::Unknown013B),
575            4294902076 => Some(Self::Unknown013C),
576            4294902077 => Some(Self::Unknown013D),
577            4294902078 => Some(Self::Unknown013E),
578            4294902113 => Some(Self::Unknown0161),
579            4294902122 => Some(Self::Unknown016A),
580            4294902126 => Some(Self::Unknown016E),
581            4294902130 => Some(Self::Unknown0172),
582            4294902137 => Some(Self::Unknown0179),
583            4294902158 => Some(Self::Unknown018E),
584            4294902159 => Some(Self::Unknown018F),
585            4294902160 => Some(Self::Unknown0190),
586            4294902161 => Some(Self::Unknown0191),
587            4294902162 => Some(Self::Unknown0192),
588            4294902163 => Some(Self::Unknown0193),
589            4294902165 => Some(Self::Unknown0195),
590            4294902224 => Some(Self::Unknown01D0),
591            4294902282 => Some(Self::Unknown020A),
592            4294902283 => Some(Self::Unknown020B),
593            _ => None,
594        }
595    }
596
597    #[inline]
598    pub fn from_primitive_allow_unknown(prim: u32) -> Self {
599        match prim {
600            0 => Self::Unknown,
601            458756 => Self::A,
602            458757 => Self::B,
603            458758 => Self::C,
604            458759 => Self::D,
605            458760 => Self::E,
606            458761 => Self::F,
607            458762 => Self::G,
608            458763 => Self::H,
609            458764 => Self::I,
610            458765 => Self::J,
611            458766 => Self::K,
612            458767 => Self::L,
613            458768 => Self::M,
614            458769 => Self::N,
615            458770 => Self::O,
616            458771 => Self::P,
617            458772 => Self::Q,
618            458773 => Self::R,
619            458774 => Self::S,
620            458775 => Self::T,
621            458776 => Self::U,
622            458777 => Self::V,
623            458778 => Self::W,
624            458779 => Self::X,
625            458780 => Self::Y,
626            458781 => Self::Z,
627            458782 => Self::Key1,
628            458783 => Self::Key2,
629            458784 => Self::Key3,
630            458785 => Self::Key4,
631            458786 => Self::Key5,
632            458787 => Self::Key6,
633            458788 => Self::Key7,
634            458789 => Self::Key8,
635            458790 => Self::Key9,
636            458791 => Self::Key0,
637            458792 => Self::Enter,
638            458793 => Self::Escape,
639            458794 => Self::Backspace,
640            458795 => Self::Tab,
641            458796 => Self::Space,
642            458797 => Self::Minus,
643            458798 => Self::Equals,
644            458799 => Self::LeftBrace,
645            458800 => Self::RightBrace,
646            458801 => Self::Backslash,
647            458802 => Self::NonUsHash,
648            458803 => Self::Semicolon,
649            458804 => Self::Apostrophe,
650            458805 => Self::GraveAccent,
651            458806 => Self::Comma,
652            458807 => Self::Dot,
653            458808 => Self::Slash,
654            458809 => Self::CapsLock,
655            458810 => Self::F1,
656            458811 => Self::F2,
657            458812 => Self::F3,
658            458813 => Self::F4,
659            458814 => Self::F5,
660            458815 => Self::F6,
661            458816 => Self::F7,
662            458817 => Self::F8,
663            458818 => Self::F9,
664            458819 => Self::F10,
665            458820 => Self::F11,
666            458821 => Self::F12,
667            458822 => Self::PrintScreen,
668            458823 => Self::ScrollLock,
669            458824 => Self::Pause,
670            458825 => Self::Insert,
671            458826 => Self::Home,
672            458827 => Self::PageUp,
673            458828 => Self::Delete,
674            458829 => Self::End,
675            458830 => Self::PageDown,
676            458831 => Self::Right,
677            458832 => Self::Left,
678            458833 => Self::Down,
679            458834 => Self::Up,
680            458835 => Self::NumLock,
681            458836 => Self::KeypadSlash,
682            458837 => Self::KeypadAsterisk,
683            458838 => Self::KeypadMinus,
684            458839 => Self::KeypadPlus,
685            458840 => Self::KeypadEnter,
686            458841 => Self::Keypad1,
687            458842 => Self::Keypad2,
688            458843 => Self::Keypad3,
689            458844 => Self::Keypad4,
690            458845 => Self::Keypad5,
691            458846 => Self::Keypad6,
692            458847 => Self::Keypad7,
693            458848 => Self::Keypad8,
694            458849 => Self::Keypad9,
695            458850 => Self::Keypad0,
696            458851 => Self::KeypadDot,
697            458852 => Self::NonUsBackslash,
698            458855 => Self::KeypadEquals,
699            458870 => Self::Menu,
700            458976 => Self::LeftCtrl,
701            458977 => Self::LeftShift,
702            458978 => Self::LeftAlt,
703            458979 => Self::LeftMeta,
704            458980 => Self::RightCtrl,
705            458981 => Self::RightShift,
706            458982 => Self::RightAlt,
707            458983 => Self::RightMeta,
708            458879 => Self::Mute,
709            458881 => Self::VolumeDown,
710            458880 => Self::VolumeUp,
711            786637 => Self::PlayPause,
712            786658 => Self::MediaMute,
713            786665 => Self::MediaVolumeIncrement,
714            786666 => Self::MediaVolumeDecrement,
715            786980 => Self::AcBack,
716            786983 => Self::AcRefresh,
717            786992 => Self::AcFullScreenView,
718            786850 => Self::AcSelectTaskApplication,
719            786543 => Self::BrightnessDown,
720            786544 => Self::BrightnessUp,
721            4294901761 => Self::Assistant,
722            4294901762 => Self::Power,
723            4294901763 => Self::Sleep,
724            4294901845 => Self::Unknown0055,
725            4294901846 => Self::Unknown0056,
726            4294901849 => Self::Unknown0059,
727            4294901852 => Self::Unknown005C,
728            4294901853 => Self::Unknown005D,
729            4294901854 => Self::Unknown005E,
730            4294901881 => Self::Unknown0079,
731            4294901882 => Self::Unknown007A,
732            4294901883 => Self::Unknown007B,
733            4294901884 => Self::Unknown007C,
734            4294901893 => Self::Unknown0085,
735            4294901895 => Self::Unknown0087,
736            4294901897 => Self::Unknown0089,
737            4294901916 => Self::Unknown009C,
738            4294901919 => Self::Unknown009F,
739            4294901920 => Self::Unknown00A0,
740            4294901922 => Self::Unknown00A2,
741            4294901923 => Self::Unknown00A3,
742            4294901925 => Self::Unknown00A5,
743            4294901926 => Self::Unknown00A6,
744            4294901927 => Self::Unknown00A7,
745            4294901928 => Self::Unknown00A8,
746            4294901929 => Self::Unknown00A9,
747            4294901933 => Self::Unknown00Ad,
748            4294901937 => Self::Unknown00B1,
749            4294901938 => Self::Unknown00B2,
750            4294901939 => Self::Unknown00B3,
751            4294901940 => Self::Unknown00B4,
752            4294901961 => Self::Unknown00C9,
753            4294901967 => Self::Unknown00Cf,
754            4294901968 => Self::Unknown00D0,
755            4294901972 => Self::Unknown00D4,
756            4294901986 => Self::Unknown00E2,
757            4294902048 => Self::Unknown0120,
758            4294902049 => Self::Unknown0121,
759            4294902050 => Self::Unknown0122,
760            4294902051 => Self::Unknown0123,
761            4294902052 => Self::Unknown0124,
762            4294902053 => Self::Unknown0125,
763            4294902054 => Self::Unknown0126,
764            4294902055 => Self::Unknown0127,
765            4294902056 => Self::Unknown0128,
766            4294902057 => Self::Unknown0129,
767            4294902058 => Self::Unknown012A,
768            4294902059 => Self::Unknown012B,
769            4294902060 => Self::Unknown012C,
770            4294902061 => Self::Unknown012D,
771            4294902062 => Self::Unknown012E,
772            4294902063 => Self::Unknown012F,
773            4294902064 => Self::Unknown0130,
774            4294902065 => Self::Unknown0131,
775            4294902066 => Self::Unknown0132,
776            4294902067 => Self::Unknown0133,
777            4294902068 => Self::Unknown0134,
778            4294902069 => Self::Unknown0135,
779            4294902070 => Self::Unknown0136,
780            4294902071 => Self::Unknown0137,
781            4294902072 => Self::Unknown0138,
782            4294902073 => Self::Unknown0139,
783            4294902074 => Self::Unknown013A,
784            4294902075 => Self::Unknown013B,
785            4294902076 => Self::Unknown013C,
786            4294902077 => Self::Unknown013D,
787            4294902078 => Self::Unknown013E,
788            4294902113 => Self::Unknown0161,
789            4294902122 => Self::Unknown016A,
790            4294902126 => Self::Unknown016E,
791            4294902130 => Self::Unknown0172,
792            4294902137 => Self::Unknown0179,
793            4294902158 => Self::Unknown018E,
794            4294902159 => Self::Unknown018F,
795            4294902160 => Self::Unknown0190,
796            4294902161 => Self::Unknown0191,
797            4294902162 => Self::Unknown0192,
798            4294902163 => Self::Unknown0193,
799            4294902165 => Self::Unknown0195,
800            4294902224 => Self::Unknown01D0,
801            4294902282 => Self::Unknown020A,
802            4294902283 => Self::Unknown020B,
803            unknown_ordinal => Self::__SourceBreaking { unknown_ordinal },
804        }
805    }
806
807    #[inline]
808    pub fn unknown() -> Self {
809        Self::__SourceBreaking { unknown_ordinal: 0x0 }
810    }
811
812    #[inline]
813    pub const fn into_primitive(self) -> u32 {
814        match self {
815            Self::Unknown => 0,
816            Self::A => 458756,
817            Self::B => 458757,
818            Self::C => 458758,
819            Self::D => 458759,
820            Self::E => 458760,
821            Self::F => 458761,
822            Self::G => 458762,
823            Self::H => 458763,
824            Self::I => 458764,
825            Self::J => 458765,
826            Self::K => 458766,
827            Self::L => 458767,
828            Self::M => 458768,
829            Self::N => 458769,
830            Self::O => 458770,
831            Self::P => 458771,
832            Self::Q => 458772,
833            Self::R => 458773,
834            Self::S => 458774,
835            Self::T => 458775,
836            Self::U => 458776,
837            Self::V => 458777,
838            Self::W => 458778,
839            Self::X => 458779,
840            Self::Y => 458780,
841            Self::Z => 458781,
842            Self::Key1 => 458782,
843            Self::Key2 => 458783,
844            Self::Key3 => 458784,
845            Self::Key4 => 458785,
846            Self::Key5 => 458786,
847            Self::Key6 => 458787,
848            Self::Key7 => 458788,
849            Self::Key8 => 458789,
850            Self::Key9 => 458790,
851            Self::Key0 => 458791,
852            Self::Enter => 458792,
853            Self::Escape => 458793,
854            Self::Backspace => 458794,
855            Self::Tab => 458795,
856            Self::Space => 458796,
857            Self::Minus => 458797,
858            Self::Equals => 458798,
859            Self::LeftBrace => 458799,
860            Self::RightBrace => 458800,
861            Self::Backslash => 458801,
862            Self::NonUsHash => 458802,
863            Self::Semicolon => 458803,
864            Self::Apostrophe => 458804,
865            Self::GraveAccent => 458805,
866            Self::Comma => 458806,
867            Self::Dot => 458807,
868            Self::Slash => 458808,
869            Self::CapsLock => 458809,
870            Self::F1 => 458810,
871            Self::F2 => 458811,
872            Self::F3 => 458812,
873            Self::F4 => 458813,
874            Self::F5 => 458814,
875            Self::F6 => 458815,
876            Self::F7 => 458816,
877            Self::F8 => 458817,
878            Self::F9 => 458818,
879            Self::F10 => 458819,
880            Self::F11 => 458820,
881            Self::F12 => 458821,
882            Self::PrintScreen => 458822,
883            Self::ScrollLock => 458823,
884            Self::Pause => 458824,
885            Self::Insert => 458825,
886            Self::Home => 458826,
887            Self::PageUp => 458827,
888            Self::Delete => 458828,
889            Self::End => 458829,
890            Self::PageDown => 458830,
891            Self::Right => 458831,
892            Self::Left => 458832,
893            Self::Down => 458833,
894            Self::Up => 458834,
895            Self::NumLock => 458835,
896            Self::KeypadSlash => 458836,
897            Self::KeypadAsterisk => 458837,
898            Self::KeypadMinus => 458838,
899            Self::KeypadPlus => 458839,
900            Self::KeypadEnter => 458840,
901            Self::Keypad1 => 458841,
902            Self::Keypad2 => 458842,
903            Self::Keypad3 => 458843,
904            Self::Keypad4 => 458844,
905            Self::Keypad5 => 458845,
906            Self::Keypad6 => 458846,
907            Self::Keypad7 => 458847,
908            Self::Keypad8 => 458848,
909            Self::Keypad9 => 458849,
910            Self::Keypad0 => 458850,
911            Self::KeypadDot => 458851,
912            Self::NonUsBackslash => 458852,
913            Self::KeypadEquals => 458855,
914            Self::Menu => 458870,
915            Self::LeftCtrl => 458976,
916            Self::LeftShift => 458977,
917            Self::LeftAlt => 458978,
918            Self::LeftMeta => 458979,
919            Self::RightCtrl => 458980,
920            Self::RightShift => 458981,
921            Self::RightAlt => 458982,
922            Self::RightMeta => 458983,
923            Self::Mute => 458879,
924            Self::VolumeDown => 458881,
925            Self::VolumeUp => 458880,
926            Self::PlayPause => 786637,
927            Self::MediaMute => 786658,
928            Self::MediaVolumeIncrement => 786665,
929            Self::MediaVolumeDecrement => 786666,
930            Self::AcBack => 786980,
931            Self::AcRefresh => 786983,
932            Self::AcFullScreenView => 786992,
933            Self::AcSelectTaskApplication => 786850,
934            Self::BrightnessDown => 786543,
935            Self::BrightnessUp => 786544,
936            Self::Assistant => 4294901761,
937            Self::Power => 4294901762,
938            Self::Sleep => 4294901763,
939            Self::Unknown0055 => 4294901845,
940            Self::Unknown0056 => 4294901846,
941            Self::Unknown0059 => 4294901849,
942            Self::Unknown005C => 4294901852,
943            Self::Unknown005D => 4294901853,
944            Self::Unknown005E => 4294901854,
945            Self::Unknown0079 => 4294901881,
946            Self::Unknown007A => 4294901882,
947            Self::Unknown007B => 4294901883,
948            Self::Unknown007C => 4294901884,
949            Self::Unknown0085 => 4294901893,
950            Self::Unknown0087 => 4294901895,
951            Self::Unknown0089 => 4294901897,
952            Self::Unknown009C => 4294901916,
953            Self::Unknown009F => 4294901919,
954            Self::Unknown00A0 => 4294901920,
955            Self::Unknown00A2 => 4294901922,
956            Self::Unknown00A3 => 4294901923,
957            Self::Unknown00A5 => 4294901925,
958            Self::Unknown00A6 => 4294901926,
959            Self::Unknown00A7 => 4294901927,
960            Self::Unknown00A8 => 4294901928,
961            Self::Unknown00A9 => 4294901929,
962            Self::Unknown00Ad => 4294901933,
963            Self::Unknown00B1 => 4294901937,
964            Self::Unknown00B2 => 4294901938,
965            Self::Unknown00B3 => 4294901939,
966            Self::Unknown00B4 => 4294901940,
967            Self::Unknown00C9 => 4294901961,
968            Self::Unknown00Cf => 4294901967,
969            Self::Unknown00D0 => 4294901968,
970            Self::Unknown00D4 => 4294901972,
971            Self::Unknown00E2 => 4294901986,
972            Self::Unknown0120 => 4294902048,
973            Self::Unknown0121 => 4294902049,
974            Self::Unknown0122 => 4294902050,
975            Self::Unknown0123 => 4294902051,
976            Self::Unknown0124 => 4294902052,
977            Self::Unknown0125 => 4294902053,
978            Self::Unknown0126 => 4294902054,
979            Self::Unknown0127 => 4294902055,
980            Self::Unknown0128 => 4294902056,
981            Self::Unknown0129 => 4294902057,
982            Self::Unknown012A => 4294902058,
983            Self::Unknown012B => 4294902059,
984            Self::Unknown012C => 4294902060,
985            Self::Unknown012D => 4294902061,
986            Self::Unknown012E => 4294902062,
987            Self::Unknown012F => 4294902063,
988            Self::Unknown0130 => 4294902064,
989            Self::Unknown0131 => 4294902065,
990            Self::Unknown0132 => 4294902066,
991            Self::Unknown0133 => 4294902067,
992            Self::Unknown0134 => 4294902068,
993            Self::Unknown0135 => 4294902069,
994            Self::Unknown0136 => 4294902070,
995            Self::Unknown0137 => 4294902071,
996            Self::Unknown0138 => 4294902072,
997            Self::Unknown0139 => 4294902073,
998            Self::Unknown013A => 4294902074,
999            Self::Unknown013B => 4294902075,
1000            Self::Unknown013C => 4294902076,
1001            Self::Unknown013D => 4294902077,
1002            Self::Unknown013E => 4294902078,
1003            Self::Unknown0161 => 4294902113,
1004            Self::Unknown016A => 4294902122,
1005            Self::Unknown016E => 4294902126,
1006            Self::Unknown0172 => 4294902130,
1007            Self::Unknown0179 => 4294902137,
1008            Self::Unknown018E => 4294902158,
1009            Self::Unknown018F => 4294902159,
1010            Self::Unknown0190 => 4294902160,
1011            Self::Unknown0191 => 4294902161,
1012            Self::Unknown0192 => 4294902162,
1013            Self::Unknown0193 => 4294902163,
1014            Self::Unknown0195 => 4294902165,
1015            Self::Unknown01D0 => 4294902224,
1016            Self::Unknown020A => 4294902282,
1017            Self::Unknown020B => 4294902283,
1018            Self::__SourceBreaking { unknown_ordinal } => unknown_ordinal,
1019        }
1020    }
1021
1022    #[inline]
1023    pub fn is_unknown(&self) -> bool {
1024        match self {
1025            Self::__SourceBreaking { unknown_ordinal: _ } => true,
1026            _ => false,
1027        }
1028    }
1029}
1030
1031/// Keymaps that should always be present and selectable.  The fallback keymaps
1032/// may be useful on their own but are mainly here to ensure that at least some
1033/// keymap is present if no other custom keymaps have been defined or in use.
1034#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
1035pub enum KeymapId {
1036    /// The US_QWERTY keymap.  This is also the default if no settings are
1037    /// ever applied.
1038    UsQwerty,
1039    /// The FR AZERTY keymap.
1040    FrAzerty,
1041    /// The US Dvorak keymap.
1042    UsDvorak,
1043    /// The US Colemak keymap.
1044    UsColemak,
1045    #[doc(hidden)]
1046    __SourceBreaking { unknown_ordinal: u32 },
1047}
1048
1049/// Pattern that matches an unknown `KeymapId` member.
1050#[macro_export]
1051macro_rules! KeymapIdUnknown {
1052    () => {
1053        _
1054    };
1055}
1056
1057impl KeymapId {
1058    #[inline]
1059    pub fn from_primitive(prim: u32) -> Option<Self> {
1060        match prim {
1061            0 => Some(Self::UsQwerty),
1062            1 => Some(Self::FrAzerty),
1063            2 => Some(Self::UsDvorak),
1064            3 => Some(Self::UsColemak),
1065            _ => None,
1066        }
1067    }
1068
1069    #[inline]
1070    pub fn from_primitive_allow_unknown(prim: u32) -> Self {
1071        match prim {
1072            0 => Self::UsQwerty,
1073            1 => Self::FrAzerty,
1074            2 => Self::UsDvorak,
1075            3 => Self::UsColemak,
1076            unknown_ordinal => Self::__SourceBreaking { unknown_ordinal },
1077        }
1078    }
1079
1080    #[inline]
1081    pub fn unknown() -> Self {
1082        Self::__SourceBreaking { unknown_ordinal: 0xffffffff }
1083    }
1084
1085    #[inline]
1086    pub const fn into_primitive(self) -> u32 {
1087        match self {
1088            Self::UsQwerty => 0,
1089            Self::FrAzerty => 1,
1090            Self::UsDvorak => 2,
1091            Self::UsColemak => 3,
1092            Self::__SourceBreaking { unknown_ordinal } => unknown_ordinal,
1093        }
1094    }
1095
1096    #[inline]
1097    pub fn is_unknown(&self) -> bool {
1098        match self {
1099            Self::__SourceBreaking { unknown_ordinal: _ } => true,
1100            _ => false,
1101        }
1102    }
1103}
1104
1105mod internal {
1106    use super::*;
1107    unsafe impl fidl::encoding::TypeMarker for Key {
1108        type Owned = Self;
1109
1110        #[inline(always)]
1111        fn inline_align(_context: fidl::encoding::Context) -> usize {
1112            std::mem::align_of::<u32>()
1113        }
1114
1115        #[inline(always)]
1116        fn inline_size(_context: fidl::encoding::Context) -> usize {
1117            std::mem::size_of::<u32>()
1118        }
1119
1120        #[inline(always)]
1121        fn encode_is_copy() -> bool {
1122            false
1123        }
1124
1125        #[inline(always)]
1126        fn decode_is_copy() -> bool {
1127            false
1128        }
1129    }
1130
1131    impl fidl::encoding::ValueTypeMarker for Key {
1132        type Borrowed<'a> = Self;
1133        #[inline(always)]
1134        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1135            *value
1136        }
1137    }
1138
1139    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D> for Key {
1140        #[inline]
1141        unsafe fn encode(
1142            self,
1143            encoder: &mut fidl::encoding::Encoder<'_, D>,
1144            offset: usize,
1145            _depth: fidl::encoding::Depth,
1146        ) -> fidl::Result<()> {
1147            encoder.debug_check_bounds::<Self>(offset);
1148            encoder.write_num(self.into_primitive(), offset);
1149            Ok(())
1150        }
1151    }
1152
1153    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for Key {
1154        #[inline(always)]
1155        fn new_empty() -> Self {
1156            Self::unknown()
1157        }
1158
1159        #[inline]
1160        unsafe fn decode(
1161            &mut self,
1162            decoder: &mut fidl::encoding::Decoder<'_, D>,
1163            offset: usize,
1164            _depth: fidl::encoding::Depth,
1165        ) -> fidl::Result<()> {
1166            decoder.debug_check_bounds::<Self>(offset);
1167            let prim = decoder.read_num::<u32>(offset);
1168
1169            *self = Self::from_primitive_allow_unknown(prim);
1170            Ok(())
1171        }
1172    }
1173    unsafe impl fidl::encoding::TypeMarker for KeymapId {
1174        type Owned = Self;
1175
1176        #[inline(always)]
1177        fn inline_align(_context: fidl::encoding::Context) -> usize {
1178            std::mem::align_of::<u32>()
1179        }
1180
1181        #[inline(always)]
1182        fn inline_size(_context: fidl::encoding::Context) -> usize {
1183            std::mem::size_of::<u32>()
1184        }
1185
1186        #[inline(always)]
1187        fn encode_is_copy() -> bool {
1188            false
1189        }
1190
1191        #[inline(always)]
1192        fn decode_is_copy() -> bool {
1193            false
1194        }
1195    }
1196
1197    impl fidl::encoding::ValueTypeMarker for KeymapId {
1198        type Borrowed<'a> = Self;
1199        #[inline(always)]
1200        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1201            *value
1202        }
1203    }
1204
1205    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D> for KeymapId {
1206        #[inline]
1207        unsafe fn encode(
1208            self,
1209            encoder: &mut fidl::encoding::Encoder<'_, D>,
1210            offset: usize,
1211            _depth: fidl::encoding::Depth,
1212        ) -> fidl::Result<()> {
1213            encoder.debug_check_bounds::<Self>(offset);
1214            encoder.write_num(self.into_primitive(), offset);
1215            Ok(())
1216        }
1217    }
1218
1219    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for KeymapId {
1220        #[inline(always)]
1221        fn new_empty() -> Self {
1222            Self::unknown()
1223        }
1224
1225        #[inline]
1226        unsafe fn decode(
1227            &mut self,
1228            decoder: &mut fidl::encoding::Decoder<'_, D>,
1229            offset: usize,
1230            _depth: fidl::encoding::Depth,
1231        ) -> fidl::Result<()> {
1232            decoder.debug_check_bounds::<Self>(offset);
1233            let prim = decoder.read_num::<u32>(offset);
1234
1235            *self = Self::from_primitive_allow_unknown(prim);
1236            Ok(())
1237        }
1238    }
1239}