我想创建一个linux方法,该方法返回由shift或大写锁定修改的键,用于当前键盘布局。我能够在win32上做到这一点,但是我不知道该怎么做linux版本:
internal uint8_t
platform_fplKeyToAscii(UINT key, bool shift, bool capsLock)
{
BYTE keyStates[256] = {};
if (shift)
{
keyStates[16] = 0x80;
}
if (capsLock)
{
keyStates[20] = 0x80;
}
wchar_t result[5];
HKL keyboardLayout = GetKeyboardLayout(0);
if (ToUnicodeEx(key, 0, keyStates, result, 4, 0, keyboardLayout))
{
return (uint8)result[0];
}
else
{
return 0;
}
}