Deleted the vkey->sancode array, because QWERTY specific.

Back to using the X keycode instead as the scancode. Tested.
This commit is contained in:
David Faure 1998-11-01 13:02:59 +00:00 committed by Alexandre Julliard
parent bcad255cb4
commit 6f75dc440f

View file

@ -34,10 +34,11 @@ BYTE InputKeyStateTable[256];
BYTE QueueKeyStateTable[256];
BYTE AsyncKeyStateTable[256];
int min_keycode, max_keycode, keysyms_per_keycode;
WORD keyc2vkey[256];
static int NumLockMask, AltGrMask; /* mask in the XKeyEvent state */
static int kcControl, kcAlt, kcShift, kcNumLock, kcCapsLock; /* keycodes */
static int min_keycode, max_keycode, keysyms_per_keycode;
static int keyc2vkey[256];
typedef union
{
@ -104,49 +105,6 @@ static const int modifier_key[] =
VK_MENU, VK_MENU, VK_MENU, VK_MENU /* FFE7 */
};
/*
* Table for vkey to scancode translation - 5/29/97 chrisf@america.com
* 0x00 -> 0x01 so that the scancode is not 0x00 unless for generated
* key events (e.g. down arrow when selecting a menu with Alt-letter)
* Lots of 0x01 here should be replaced with the actual scancode of the key
* but for this we have to run a spy program in Windows. - 24/Oct/98 faure@kde.org
*/
const BYTE vkey2scode[512] = {
0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01, 0x0e,0x0f,0x01,0x01,0x01,0x1c,0x01,0x01,
0x2a,0x1d,0x38,0x01,0x3a,0x01,0x01,0x01, 0x01,0x01,0x01,0x01/*real one*/,0x01,0x01,0x01,0x01,
0x39,0x49,0x51,0x4f,0x47,0x4b,0x48,0x4d, 0x50,0x01,0x01,0x01,0x01,0x52,0x53,0x01,
0x0b,0x02,0x03,0x04,0x05,0x06,0x07,0x08, 0x09,0x0a,0x01,0x01,0x01,0x01,0x01,0x01,
0x01,0x1e,0x30,0x2e,0x20,0x12,0x21,0x22, 0x23,0x17,0x24,0x25,0x26,0x32,0x31,0x18,
0x19,0x10,0x13,0x1f,0x14,0x16,0x2f,0x11, 0x2d,0x15,0x2c,0x01,0x01,0x01,0x01,0x01,
0x0b,0x02,0x03,0x04,0x05,0x06,0x07,0x08, 0x09,0x0a,0x37,0x4e,0x01,0x4a,0x34,0x01,
0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01, 0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,
0x01,0x46,0x01,0x01,0x01,0x01,0x01,0x01, 0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,
0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01, 0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,
0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01, 0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,
0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01, 0x01,0x01,0x29,0x0c,0x0d,0x1a,0x1b,0x2b,
0x27,0x01,0x01,0x01,0x01,0x01,0x01,0x01, 0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,
0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01, 0x01,0x01,0x01,0x28,0x33,0x34,0x35,0x4c,
0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01, 0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,
0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01, 0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,
/* 256 */
0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01, 0x01,0x01,0x01,0x01,0x01,0x1c,0x01,0x01,
0x01,0x1d,0x38,0x01,0x01,0x01,0x01,0x01, 0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,
0x01,0x49,0x51,0x4f,0x47,0x4b,0x48,0x4d, 0x50,0x01,0x01,0x01,0x01,0x52,0x53,0x01,
0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01, 0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,
0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01, 0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,
0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01, 0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,
0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01, 0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x35,
0x3b,0x3c,0x3d,0x3e,0x3f,0x40,0x41,0x42, 0x43,0x44,0x57,0x58,0x01,0x01,0x01,0x01,
0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01, 0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,
0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01, 0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,
0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01, 0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,
0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01, 0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,
0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01, 0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,
0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01, 0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,
0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01, 0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,
0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01, 0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,
};
static WORD EVENT_event_to_vkey( XKeyEvent *e)
{
KeySym keysym;
@ -532,7 +490,8 @@ void KEYBOARD_HandleEvent( WND *pWnd, XKeyEvent *event )
if (vkey)
{
keylp.lp1.count = 1;
keylp.lp1.code = vkey2scode[vkey]; /* 5/29/97 chrisf@america.com */
keylp.lp1.code = event->keycode - min_keycode; /* Windows starts from 0, X from
min_keycode (8 usually) */
keylp.lp1.extended = (vkey & 0x100 ? 1 : 0);
keylp.lp1.win_internal = 0; /* this has something to do with dialogs,
* don't remember where I read it - AK */
@ -1091,15 +1050,15 @@ UINT16 WINAPI MapVirtualKey16(UINT16 wCode, UINT16 wMapType)
case 0: { /* vkey-code to scan-code */
/* let's do vkey -> keycode -> scan */
int keyc;
for (keyc=min_keycode; keyc<=max_keycode; keyc++) /* see event.c */
if ((keyc2vkey[keyc] & 0xFF)== wCode)
returnMVK (keyc - 8);
for (keyc=min_keycode; keyc<=max_keycode; keyc++)
if ((keyc2vkey[keyc] & 0xFF) == wCode)
returnMVK (keyc - min_keycode);
return 0; }
case 1: /* scan-code to vkey-code */
/* let's do scan -> keycode -> vkey */
returnMVK (keyc2vkey[(wCode & 0xFF) + 8]);
returnMVK (keyc2vkey[(wCode & 0xFF) + min_keycode]);
case 2: { /* vkey-code to unshifted ANSI code */
/* (was FIXME) : what does unshifted mean ? 'a' or 'A' ? */
@ -1203,19 +1162,19 @@ INT16 WINAPI GetKeyNameText16(LONG lParam, LPSTR lpBuffer, INT16 nSize)
{
/* int i; */
TRACE(keyboard,"(%ld,<ptr>,%d)\n",lParam,nSize);
FIXME(keyboard,"(%ld,<ptr>,%d): stub\n",lParam,nSize);
lParam >>= 16;
lParam &= 0xff;
/*
lParam >>= 16;
lParam &= 0xff;
/* for (i = 0 ; i != KeyTableSize ; i++)
for (i = 0 ; i != KeyTableSize ; i++)
if (KeyTable[i].scancode == lParam) {
lstrcpyn32A( lpBuffer, KeyTable[i].name, nSize );
return strlen(lpBuffer);
}
*/
/* FIXME ! GetKeyNameText is still to do...
*/
*lpBuffer = 0;
return 0;
}
@ -1272,7 +1231,7 @@ INT32 WINAPI ToAscii32( UINT32 virtKey,UINT32 scanCode,LPBYTE lpKeyState,
if ((keyc2vkey[keyc] & 0xFF) == virtKey)
{ /* we can filter the extended bit, VK* are different enough... */
e.keycode = keyc; /* Store it temporarily */
if (EVENT_event_to_vkey(&e) != virtKey)
if ((EVENT_event_to_vkey(&e) & 0xFF) != virtKey)
e.keycode = 0; /* Wrong one (ex: because of the NumLock
state), so set it to 0, we'll find another one */
}
@ -1412,8 +1371,11 @@ INT32 WINAPI ToAscii32( UINT32 virtKey,UINT32 scanCode,LPBYTE lpKeyState,
*/
HKL32 WINAPI GetKeyboardLayout(DWORD dwLayout)
{
HKL32 layout;
FIXME(keyboard,"(%ld): stub\n",dwLayout);
return (0xcafe<<16)|GetSystemDefaultLCID(); /* FIXME */
layout = (0xcafe<<16)|GetSystemDefaultLCID(); /* FIXME */
TRACE(keyboard,"returning %x\n",layout);
return layout;
}
/***********************************************************************