wayland: Handle virtual keyboards that don't fit the X mapping

SDL is built around the concept of keyboards having a fixed layout with scancodes that correspond to physical keys no matter what linguistic layout is used. Virtual keyboards don't have this concept and can present an arbitrary layout of keys with arbitrary scancodes and names, which don't fit the SDL model. When one of these keyboards is encountered, it requires special handling: use the keysym of the pressed keys to derive their ANSI keyboard scancode equivalents for control keys and ASCII characters. All other characters are passed through as text events only.
This commit is contained in:
Frank Praznik
2022-11-04 12:41:46 -04:00
committed by Sam Lantinga
parent d1858eb124
commit c855184765
5 changed files with 154 additions and 115 deletions

View File

@@ -24,6 +24,7 @@
#include "SDL_scancode.h"
/* This function only correctly maps letters and numbers for keyboards in US QWERTY layout */
extern SDL_Scancode SDL_GetScancodeFromKeySym(Uint32 keysym, Uint32 keycode);
#endif /* SDL_keysym_to_scancode_c_h_ */