#![allow(clippy::match_same_arms, clippy::too_many_lines)]
use crate::auto::xproto::Keysym;
use gluten_keyboard::Key;
#[inline]
#[must_use]
pub fn keysym_to_key(keysym: Keysym) -> Option<Key> {
match keysym {
48 => Some(Key::Zero),
49 => Some(Key::One),
50 => Some(Key::Two),
51 => Some(Key::Three),
52 => Some(Key::Four),
53 => Some(Key::Five),
54 => Some(Key::Six),
55 => Some(Key::Seven),
56 => Some(Key::Eight),
57 => Some(Key::Nine),
32 => Some(Key::Space),
33 => Some(Key::ExclamationMark),
34 => Some(Key::DoubleQuote),
35 => Some(Key::NumberSign),
36 => Some(Key::Dollar),
37 => Some(Key::Percent),
38 => Some(Key::Ampersand),
39 => Some(Key::Quote),
40 => Some(Key::ParenthesisLeft),
41 => Some(Key::ParenthesisRight),
42 => Some(Key::Asterisk),
43 => Some(Key::Plus),
44 => Some(Key::Comma),
45 => Some(Key::Minus),
46 => Some(Key::Period),
47 => Some(Key::Slash),
58 => Some(Key::Colon),
59 => Some(Key::Semicolon),
60 => Some(Key::Less),
61 => Some(Key::Equals),
62 => Some(Key::Greater),
64 => Some(Key::At),
65 => Some(Key::A),
66 => Some(Key::B),
67 => Some(Key::C),
68 => Some(Key::D),
69 => Some(Key::E),
70 => Some(Key::F),
71 => Some(Key::G),
72 => Some(Key::H),
73 => Some(Key::I),
74 => Some(Key::J),
75 => Some(Key::K),
76 => Some(Key::L),
77 => Some(Key::M),
78 => Some(Key::N),
79 => Some(Key::O),
80 => Some(Key::P),
81 => Some(Key::Q),
82 => Some(Key::R),
83 => Some(Key::S),
84 => Some(Key::T),
85 => Some(Key::U),
86 => Some(Key::V),
87 => Some(Key::W),
88 => Some(Key::X),
89 => Some(Key::Y),
90 => Some(Key::Z),
91 => Some(Key::BracketLeft),
92 => Some(Key::BackSlash),
93 => Some(Key::BracketRight),
94 => Some(Key::Circumflex),
95 => Some(Key::Underscore),
97 => Some(Key::A),
98 => Some(Key::B),
99 => Some(Key::C),
100 => Some(Key::D),
101 => Some(Key::E),
102 => Some(Key::F),
103 => Some(Key::G),
104 => Some(Key::H),
105 => Some(Key::I),
106 => Some(Key::J),
107 => Some(Key::K),
108 => Some(Key::L),
109 => Some(Key::M),
110 => Some(Key::N),
111 => Some(Key::O),
112 => Some(Key::P),
113 => Some(Key::Q),
114 => Some(Key::R),
115 => Some(Key::S),
116 => Some(Key::T),
117 => Some(Key::U),
118 => Some(Key::V),
119 => Some(Key::W),
120 => Some(Key::X),
121 => Some(Key::Y),
122 => Some(Key::Z),
123 => Some(Key::BraceLeft),
125 => Some(Key::BraceRight),
126 => Some(Key::Tilde),
161 => Some(Key::InvertedExclamationMark),
65288 => Some(Key::Backspace),
65289 => Some(Key::Tab),
65293 => Some(Key::Enter),
65299 => Some(Key::Pause),
65300 => Some(Key::ScrollLock),
65307 => Some(Key::Escape),
65325 => Some(Key::KanaLock),
65326 => Some(Key::Kana),
65360 => Some(Key::Home),
65335 => Some(Key::CodeInput),
65343 => Some(Key::PreviousCandidate),
65361 => Some(Key::Left),
65362 => Some(Key::Up),
65363 => Some(Key::Right),
65364 => Some(Key::Down),
65367 => Some(Key::End),
65368 => Some(Key::Begin),
65379 => Some(Key::Insert),
65385 => Some(Key::Cancel),
65386 => Some(Key::Help),
65430 => Some(Key::KpLeft),
65431 => Some(Key::KpUp),
65432 => Some(Key::KpRight),
65433 => Some(Key::KpDown),
65456 => Some(Key::NumpadZero),
65457 => Some(Key::NumpadOne),
65458 => Some(Key::NumpadTwo),
65459 => Some(Key::NumpadThree),
65460 => Some(Key::NumpadFour),
65461 => Some(Key::NumpadFive),
65462 => Some(Key::NumpadSix),
65463 => Some(Key::NumpadSeven),
65464 => Some(Key::NumpadEight),
65465 => Some(Key::NumpadNine),
65470 => Some(Key::F1),
65471 => Some(Key::F2),
65472 => Some(Key::F3),
65473 => Some(Key::F4),
65474 => Some(Key::F5),
65475 => Some(Key::F6),
65476 => Some(Key::F7),
65477 => Some(Key::F8),
65478 => Some(Key::F9),
65479 => Some(Key::F10),
65480 => Some(Key::F11),
65481 => Some(Key::F12),
65482 => Some(Key::F13),
65483 => Some(Key::F14),
65484 => Some(Key::F15),
65485 => Some(Key::F16),
65486 => Some(Key::F17),
65487 => Some(Key::F18),
65488 => Some(Key::F19),
65489 => Some(Key::F20),
65490 => Some(Key::F21),
65491 => Some(Key::F22),
65492 => Some(Key::F23),
65493 => Some(Key::F24),
124 => Some(Key::Bar),
65505 => Some(Key::LeftShift),
65506 => Some(Key::RightShift),
65507 => Some(Key::LeftControl),
65508 => Some(Key::RightControl),
65509 => Some(Key::CapsLock),
65510 => Some(Key::ShiftLock),
65511 => Some(Key::LeftMeta),
65512 => Some(Key::RightMeta),
65513 => Some(Key::LeftAlt),
65514 => Some(Key::RightAlt),
65515 => Some(Key::LeftSuper),
65516 => Some(Key::RightSuper),
65517 => Some(Key::LeftHyper),
65518 => Some(Key::RightHyper),
65535 => Some(Key::Delete),
_ => None,
}
}