Skip to content

Commit

Permalink
native/linux_wayland: Fix invalid keycodes
Browse files Browse the repository at this point in the history
wayland treats shifted latin chars as a different keysym so handle that. (#400)
  • Loading branch information
narodnik authored Aug 5, 2023
1 parent 6bc256b commit 0fa2e35
Showing 1 changed file with 27 additions and 26 deletions.
53 changes: 27 additions & 26 deletions src/native/linux_wayland/keycodes.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
use crate::event::KeyCode;

pub fn translate(keysym: u32) -> KeyCode {
// See xkbcommon/xkbcommon-keysyms.h
match keysym {
65307 => return KeyCode::Escape,
65289 => return KeyCode::Tab,
Expand Down Expand Up @@ -72,32 +73,32 @@ pub fn translate(keysym: u32) -> KeyCode {
65439 => return KeyCode::KpDecimal,
65469 => return KeyCode::KpEqual,
65421 => return KeyCode::KpEnter,
97 => return KeyCode::A,
98 => return KeyCode::B,
99 => return KeyCode::C,
100 => return KeyCode::D,
101 => return KeyCode::E,
102 => return KeyCode::F,
103 => return KeyCode::G,
104 => return KeyCode::H,
105 => return KeyCode::I,
106 => return KeyCode::J,
107 => return KeyCode::K,
108 => return KeyCode::L,
109 => return KeyCode::M,
110 => return KeyCode::N,
111 => return KeyCode::O,
112 => return KeyCode::P,
113 => return KeyCode::Q,
114 => return KeyCode::R,
115 => return KeyCode::S,
116 => return KeyCode::T,
117 => return KeyCode::U,
118 => return KeyCode::V,
119 => return KeyCode::W,
120 => return KeyCode::X,
121 => return KeyCode::Y,
122 => return KeyCode::Z,
65 | 97 => return KeyCode::A,
66 | 98 => return KeyCode::B,
67 | 99 => return KeyCode::C,
68 | 100 => return KeyCode::D,
69 | 101 => return KeyCode::E,
70 | 102 => return KeyCode::F,
71 | 103 => return KeyCode::G,
72 | 104 => return KeyCode::H,
73 | 105 => return KeyCode::I,
74 | 106 => return KeyCode::J,
75 | 107 => return KeyCode::K,
76 | 108 => return KeyCode::L,
77 | 109 => return KeyCode::M,
78 | 110 => return KeyCode::N,
79 | 111 => return KeyCode::O,
80 | 112 => return KeyCode::P,
81 | 113 => return KeyCode::Q,
82 | 114 => return KeyCode::R,
83 | 115 => return KeyCode::S,
84 | 116 => return KeyCode::T,
85 | 117 => return KeyCode::U,
86 | 118 => return KeyCode::V,
87 | 119 => return KeyCode::W,
88 | 120 => return KeyCode::X,
89 | 121 => return KeyCode::Y,
90 | 122 => return KeyCode::Z,
49 => return KeyCode::Key1,
50 => return KeyCode::Key2,
51 => return KeyCode::Key3,
Expand Down

0 comments on commit 0fa2e35

Please sign in to comment.