MCPcopy Create free account
hub / github.com/OpenDUNE/OpenDUNE / Input_EventHandler

Function Input_EventHandler

src/input/input.c:174–220  ·  view source on GitHub ↗

Receive the keyboard scancodes from the AT keyboard */

Source from the content-addressed store, hash-verified

172
173/* Receive the keyboard scancodes from the AT keyboard */
174void Input_EventHandler(uint8 key)
175{
176 uint8 state;
177 uint8 i;
178
179 state = 0;
180
181 /* escape code for escaped scancodes */
182 if (key == 0xE0) {
183 s_input_extendedKey = true;
184 return;
185 }
186
187 /* Key up */
188 if ((key & 0x80) != 0) {
189 key &= 0x7F;
190 state |= 0x08; /* KEYUP */
191 }
192
193 if (s_input_extendedKey) {
194 s_input_extendedKey = false;
195
196 for (i = 0; i < lengthof(s_translateExtendedMap); i++) {
197 if (s_translateExtendedMap[i] == key) {
198 key = s_translateMap[i];
199 break;
200 }
201 }
202 if (i == 16) return;
203 } else if (key == 0x7A) {
204 key = 0x80;
205 } else {
206 key = s_keyTranslate[key & 0x7F];
207 }
208
209 if ((s_activeInputMap[7] & 0x4) != 0) return; /* 0x3a : LCTRL */
210 if ((s_activeInputMap[7] & 0x50) != 0) state |= 0x04; /* 0x3c 0x3e : LALT RALT => ALT */
211
212 key = Input_Keyboard_Translate(key) & 0xFF;
213
214 if ((s_activeInputMap[7] & 0x2) != 0) state |= 0x01; /* 0x39 : RSHIFT */
215
216 if (state == 0x06 && key == 0x68) return; /* state == ALT+??? && key == KP DEL */
217 if (state == 0x06 && key == 0x4C) return; /* state == ALT+??? && key == DELETE */
218
219 Input_HandleInput((state << 8) | key);
220}
221
222/**
223 * Clears the given bits in input flags.

Callers 5

WindowProcFunction · 0.85
Video_Key_CallbackFunction · 0.85
Video_TickFunction · 0.85
Video_Key_CallbackFunction · 0.85
Video_TickFunction · 0.85

Calls 2

Input_Keyboard_TranslateFunction · 0.85
Input_HandleInputFunction · 0.85

Tested by

no test coverage detected