@@ -47,17 +47,6 @@ KeyMapState::operator bool() const {
4747 return this ->xkbKeymap != nullptr && this ->xkbState != nullptr ;
4848}
4949
50- namespace {
51- const char * getName (char key);
52- }
53- xkb_keycode_t KeyMapState::toKey (QChar character) const {
54- if (!*this ) return XKB_KEYCODE_INVALID;
55- auto keycode = xkb_keymap_key_by_name (this ->xkbKeymap , getName (character.toLatin1 ()));
56- if (keycode == XKB_KEYCODE_INVALID)
57- qDebug () << character << " :" << getName (character.toLatin1 ()) << " was not found in the keymap." ;
58- return keycode;
59- }
60-
6150const char * KeyMapState::keyName (xkb_keycode_t key) const {
6251 return xkb_keymap_key_get_name (this ->xkbKeymap , key);
6352}
@@ -100,86 +89,10 @@ std::string_view KeyMapState::keyStateName(wl_keyboard_key_state state) {
10089 switch (state) {
10190 case WL_KEYBOARD_KEY_STATE_RELEASED: return " released" ;
10291 case WL_KEYBOARD_KEY_STATE_PRESSED: return " pressed" ;
103- #ifndef WL_KEYBOARD_KEY_STATE_REPEATED_SINCE_VERSION
104- case WL_KEYBOARD_KEY_STATE_REPEATED: return " repeated" ;
105- #endif
10692 default : return " unknown state" ;
10793 }
10894}
10995
11096xkb_context* KeyMapState::xkbContext = xkb_context_new(XKB_CONTEXT_NO_FLAGS);
11197
112- namespace {
113- const char * getName (char key) {
114- switch (key) {
115- case 13 : return " RTRN" ;
116- case 8 : return " BKSP" ;
117- case ' 1' : return " AE01" ;
118- case ' 2' : return " AE02" ;
119- case ' 3' : return " AE03" ;
120- case ' 4' : return " AE04" ;
121- case ' 5' : return " AE05" ;
122- case ' 6' : return " AE06" ;
123- case ' 7' : return " AE07" ;
124- case ' 8' : return " AE08" ;
125- case ' 9' : return " AE09" ;
126- case ' 0' : return " AE10" ;
127- case ' a' :
128- case ' A' : return " LatA" ;
129- case ' b' :
130- case ' B' : return " LatB" ;
131- case ' c' :
132- case ' C' : return " LatC" ;
133- case ' d' :
134- case ' D' : return " LatD" ;
135- case ' e' :
136- case ' E' : return " LatE" ;
137- case ' f' :
138- case ' F' : return " LatF" ;
139- case ' g' :
140- case ' G' : return " LatG" ;
141- case ' h' :
142- case ' H' : return " LatH" ;
143- case ' i' :
144- case ' I' : return " LatI" ;
145- case ' j' :
146- case ' J' : return " LatJ" ;
147- case ' k' :
148- case ' K' : return " LatK" ;
149- case ' l' :
150- case ' L' : return " LatL" ;
151- case ' m' :
152- case ' M' : return " LatM" ;
153- case ' n' :
154- case ' N' : return " LatN" ;
155- case ' o' :
156- case ' O' : return " LatO" ;
157- case ' p' :
158- case ' P' : return " LatP" ;
159- case ' q' :
160- case ' Q' : return " LatQ" ;
161- case ' r' :
162- case ' R' : return " LatR" ;
163- case ' s' :
164- case ' S' : return " LatS" ;
165- case ' t' :
166- case ' T' : return " LatT" ;
167- case ' u' :
168- case ' U' : return " LatU" ;
169- case ' v' :
170- case ' V' : return " LatV" ;
171- case ' w' :
172- case ' W' : return " LatW" ;
173- case ' x' :
174- case ' X' : return " LatX" ;
175- case ' y' :
176- case ' Y' : return " LatY" ;
177- case ' z' :
178- case ' Z' : return " LatZ" ;
179- }
180- qDebug () << " Did not know the key name of character:" << key;
181- return " " ;
182- }
183- } // namespace
184-
18598} // namespace qs::wayland::input_method::impl
0 commit comments