MCPcopy Create free account
hub / github.com/ClassiCube/ClassiCube / TryGetKey

Function TryGetKey

src/Window_X11.c:615–627  ·  view source on GitHub ↗

#######################################################################################################################* *-------------------------------------------------Keyboard event handling-------------------------------------------------* *#########################################################################################################################*/

Source from the content-addressed store, hash-verified

613*-------------------------------------------------Keyboard event handling-------------------------------------------------*
614*#########################################################################################################################*/
615static int TryGetKey(XKeyEvent* ev) {
616 KeySym keysym1 = XLookupKeysym(ev, 0);
617 KeySym keysym2 = XLookupKeysym(ev, 1);
618
619 int key = MapNativeKey(keysym1, ev->state);
620 if (!key) key = MapNativeKey(keysym2, ev->state);
621 if (key) return key;
622
623 Platform_Log3("Unknown key %i (%x, %x)", &ev->keycode, &keysym1, &keysym2);
624 /* The user may be using a keyboard layout such as cryllic - */
625 /* fallback to trying to conver the raw scancodes instead */
626 return MapNativeKeycode(ev->keycode);
627}
628
629static void HandleKeyPress(XEvent* e) {
630 char data[64];

Callers 2

HandleKeyPressFunction · 0.85
HandleKeyReleaseFunction · 0.85

Calls 3

Platform_Log3Function · 0.85
MapNativeKeycodeFunction · 0.85
MapNativeKeyFunction · 0.70

Tested by

no test coverage detected