mirror of
https://git.code.sf.net/p/quake/quakeforge
synced 2025-01-18 06:51:47 +00:00
fix the mangled key codes
This commit is contained in:
parent
52252616ff
commit
3252ee3eb6
1 changed files with 27 additions and 22 deletions
|
@ -542,7 +542,7 @@ IN_LL_SendKeyEvents (void)
|
||||||
|
|
||||||
//==========================================================================
|
//==========================================================================
|
||||||
|
|
||||||
byte scantokey[128] = {
|
unsigned short scantokey[128] = {
|
||||||
// 0 1 2 3 4 5 6 7
|
// 0 1 2 3 4 5 6 7
|
||||||
// 8 9 A B C D E F
|
// 8 9 A B C D E F
|
||||||
0, 27, '1', '2', '3', '4', '5', '6',
|
0, 27, '1', '2', '3', '4', '5', '6',
|
||||||
|
@ -563,21 +563,21 @@ byte scantokey[128] = {
|
||||||
0, 0, 0, 0, 0, 0, 0, 0
|
0, 0, 0, 0, 0, 0, 0, 0
|
||||||
};
|
};
|
||||||
|
|
||||||
byte extscantokey[128] = {
|
unsigned short extscantokey[128] = {
|
||||||
// 0 1 2 3 4 5 6 7
|
// 0 1 2 3 4 5 6 7
|
||||||
// 8 9 A B C D E F
|
// 8 9 A B C D E F
|
||||||
0, 27, '1', '2', '3', '4', '5', '6',
|
0, 27, '1', '2', '3', '4', '5', '6', // 0
|
||||||
'7', '8', '9', '0', '-', '=', K_BACKSPACE, 9, // 0
|
'7', '8', '9', '0', '-', '=', K_BACKSPACE, 9,
|
||||||
'q', 'w', 'e', 'r', 't', 'y', 'u', 'i',
|
'q', 'w', 'e', 'r', 't', 'y', 'u', 'i', // 1
|
||||||
'o', 'p', '[', ']', K_KP_ENTER, K_RCTRL, 'a', 's', // 1
|
'o', 'p', '[', ']', K_KP_ENTER, K_RCTRL, 'a', 's',
|
||||||
'd', 'f', 'g', 'h', 'j', 'k', 'l', ';',
|
'd', 'f', 'g', 'h', 'j', 'k', 'l', ';', // 2
|
||||||
'\'', '`', K_LSHIFT, '\\', 'z', 'x', 'c', 'v', // 2
|
'\'', '`', K_LSHIFT, '\\', 'z', 'x', 'c', 'v',
|
||||||
'b', 'n', 'm', ',', '.', K_KP_DIVIDE, K_RSHIFT, '*',
|
'b', 'n', 'm', ',', '.', K_KP_DIVIDE, K_RSHIFT, '*', // 3
|
||||||
K_RALT, ' ', K_CAPSLOCK, K_F1, K_F2, K_F3, K_F4, K_F5, // 3
|
K_RALT, ' ', K_CAPSLOCK, K_F1, K_F2, K_F3, K_F4, K_F5,
|
||||||
K_F6, K_F7, K_F8, K_F9, K_F10, K_NUMLOCK, 0, K_HOME,
|
K_F6, K_F7, K_F8, K_F9, K_F10, K_NUMLOCK, 0, K_HOME, // 4
|
||||||
K_UP, K_PAGEUP, '-', K_LEFT, '5', K_RIGHT, '+', K_END, // 4
|
K_UP, K_PAGEUP, '-', K_LEFT, '5', K_RIGHT, '+', K_END,
|
||||||
K_DOWN, K_PAGEDOWN, K_INSERT, K_DELETE, 0, 0, 0, K_F11,
|
K_DOWN, K_PAGEDOWN, K_INSERT, K_DELETE, 0, 0, 0, K_F11, // 5
|
||||||
K_F12, 0, 0, 0, 0, 0, 0, 0, // 5
|
K_F12, 0, 0, 0, 0, 0, 0, 0,
|
||||||
0, 0, 0, 0, 0, 0, 0, 0,
|
0, 0, 0, 0, 0, 0, 0, 0,
|
||||||
0, 0, 0, 0, 0, 0, 0, 0,
|
0, 0, 0, 0, 0, 0, 0, 0,
|
||||||
0, 0, 0, 0, 0, 0, 0, 0,
|
0, 0, 0, 0, 0, 0, 0, 0,
|
||||||
|
@ -590,29 +590,34 @@ byte extscantokey[128] = {
|
||||||
Map from windows to quake keynums
|
Map from windows to quake keynums
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
MapKey (int key, int *k, int *u)
|
MapKey (unsigned int keycode, int *k, int *u)
|
||||||
{
|
{
|
||||||
int extended;
|
int extended;
|
||||||
|
int scan;
|
||||||
|
int key;
|
||||||
|
int uc;
|
||||||
|
|
||||||
extended = (key >> 24) & 1;
|
extended = (keycode >> 24) & 1;
|
||||||
|
scan = (keycode >> 16) & 255;
|
||||||
|
|
||||||
key = (key >> 16) & 255;
|
if (scan > 127) {
|
||||||
if (key > 127) {
|
|
||||||
*u = *k = 0;
|
*u = *k = 0;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (extended)
|
if (extended)
|
||||||
key = extscantokey[key];
|
key = extscantokey[scan];
|
||||||
else
|
else
|
||||||
key = scantokey[key];
|
key = scantokey[scan];
|
||||||
if (key >= 0 && key <= 255)
|
if (key >= 0 && key <= 255)
|
||||||
*u = key;
|
uc = key;
|
||||||
else
|
else
|
||||||
*u = 0;
|
uc = 0;
|
||||||
|
Con_DPrintf ("%08x %02x %04x %c\n", keycode, scan, key, uc > 32 && uc < 127 ? uc : '#');
|
||||||
if (key >= 'A' && key <= 'Z')
|
if (key >= 'A' && key <= 'Z')
|
||||||
key += 'a' - 'A';
|
key += 'a' - 'A';
|
||||||
*k = key;
|
*k = key;
|
||||||
|
*u = uc;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
Loading…
Reference in a new issue