mirror of
https://git.code.sf.net/p/quake/quakeforge
synced 2024-11-13 00:24:12 +00:00
fix -wgl's keyboard input
This commit is contained in:
parent
9a5ec9c187
commit
82aa0fde58
1 changed files with 20 additions and 8 deletions
|
@ -615,21 +615,30 @@ byte extscantokey[128] = {
|
||||||
|
|
||||||
Map from windows to quake keynums
|
Map from windows to quake keynums
|
||||||
*/
|
*/
|
||||||
int
|
void
|
||||||
MapKey (int key)
|
MapKey (int key, int *k, int *u)
|
||||||
{
|
{
|
||||||
int extended;
|
int extended;
|
||||||
|
|
||||||
extended = (key >> 24) & 1;
|
extended = (key >> 24) & 1;
|
||||||
|
|
||||||
key = (key >> 16) & 255;
|
key = (key >> 16) & 255;
|
||||||
if (key > 127)
|
if (key > 127) {
|
||||||
return 0;
|
*u = *k = 0;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (extended)
|
if (extended)
|
||||||
return extscantokey[key];
|
key = extscantokey[key];
|
||||||
else
|
else
|
||||||
return scantokey[key];
|
key = scantokey[key];
|
||||||
|
if (key >= 0 && key <= 255)
|
||||||
|
*u = key;
|
||||||
|
else
|
||||||
|
*u = 0;
|
||||||
|
if (key >= 'A' && key <= 'Z')
|
||||||
|
key += 'a' - 'A';
|
||||||
|
*k = key;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -713,6 +722,7 @@ MainWndProc (HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
|
||||||
{
|
{
|
||||||
LONG lRet = 1;
|
LONG lRet = 1;
|
||||||
int fActive, fMinimized, temp;
|
int fActive, fMinimized, temp;
|
||||||
|
int key, unicode;
|
||||||
extern unsigned int uiWheelMessage;
|
extern unsigned int uiWheelMessage;
|
||||||
|
|
||||||
if (uMsg == uiWheelMessage)
|
if (uMsg == uiWheelMessage)
|
||||||
|
@ -734,12 +744,14 @@ MainWndProc (HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
|
||||||
|
|
||||||
case WM_KEYDOWN:
|
case WM_KEYDOWN:
|
||||||
case WM_SYSKEYDOWN:
|
case WM_SYSKEYDOWN:
|
||||||
Key_Event (MapKey (lParam), -1, true);
|
MapKey (lParam, &key, &unicode);
|
||||||
|
Key_Event (key, unicode, true);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case WM_KEYUP:
|
case WM_KEYUP:
|
||||||
case WM_SYSKEYUP:
|
case WM_SYSKEYUP:
|
||||||
Key_Event (MapKey (lParam), -1, false);
|
MapKey (lParam, &key, &unicode);
|
||||||
|
Key_Event (key, unicode, false);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case WM_SYSCHAR:
|
case WM_SYSCHAR:
|
||||||
|
|
Loading…
Reference in a new issue