- applied patch #830079: fixed bochs's application error if unsupported key

pressed and added supported keys that was already assigned BX_KEY_xxx code
This commit is contained in:
Volker Ruppert 2003-10-25 17:37:58 +00:00
parent a9a7fa3ed6
commit d179cd7fdb

View File

@ -1,5 +1,5 @@
/////////////////////////////////////////////////////////////////////////
// $Id: win32.cc,v 1.67 2003-10-25 11:57:42 sshwarts Exp $
// $Id: win32.cc,v 1.68 2003-10-25 17:37:58 vruppert Exp $
/////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2002 MandrakeSoft S.A.
@ -175,102 +175,267 @@ void DestroyFont(void);
#endif
Bit32u win32_to_bx_key[0x59] = {
/* 0x00 - 0x0f */
0,
BX_KEY_ESC,
BX_KEY_1,
BX_KEY_2,
BX_KEY_3,
BX_KEY_4,
BX_KEY_5,
BX_KEY_6,
BX_KEY_7,
BX_KEY_8,
BX_KEY_9,
BX_KEY_0,
BX_KEY_MINUS,
BX_KEY_EQUALS,
BX_KEY_BACKSPACE,
BX_KEY_TAB,
/* 0x10 - 0x1f */
BX_KEY_Q,
BX_KEY_W,
BX_KEY_E,
BX_KEY_R,
BX_KEY_T,
BX_KEY_Y,
BX_KEY_U,
BX_KEY_I,
BX_KEY_O,
BX_KEY_P,
BX_KEY_LEFT_BRACKET,
BX_KEY_RIGHT_BRACKET,
BX_KEY_ENTER,
BX_KEY_CTRL_L,
BX_KEY_A,
BX_KEY_S,
/* 0x20 - 0x2f */
BX_KEY_D,
BX_KEY_F,
BX_KEY_G,
BX_KEY_H,
BX_KEY_J,
BX_KEY_K,
BX_KEY_L,
BX_KEY_SEMICOLON,
BX_KEY_SINGLE_QUOTE,
BX_KEY_GRAVE,
BX_KEY_SHIFT_L,
BX_KEY_BACKSLASH,
BX_KEY_Z,
BX_KEY_X,
BX_KEY_C,
BX_KEY_V,
/* 0x30 - 0x3f */
BX_KEY_B,
BX_KEY_N,
BX_KEY_M,
BX_KEY_COMMA,
BX_KEY_PERIOD,
BX_KEY_SLASH,
BX_KEY_SHIFT_R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_KEY_SINGLE_QUOTE,
BX_KEY_GRAVE,
BX_KEY_SHIFT_L,
BX_KEY_BACKSLASH,
BX_KEY_Z,
BX_KEY_X,
BX_KEY_C,
BX_KEY_V,
/* 0x30 - 0x3f */
BX_KEY_B,
BX_KEY_N,
BX_KEY_M,
BX_KEY_COMMA,
BX_KEY_PERIOD,
BX_KEY_SLASH,
BX_KEY_SHIFT_R,
BX_KEY_KP_MULTIPLY,
BX_KEY_ALT_L,
BX_KEY_SPACE,
BX_KEY_CAPS_LOCK,
BX_KEY_F1,
BX_KEY_F2,
BX_KEY_F3,
BX_KEY_F4,
BX_KEY_F5,
/* 0x40 - 0x4f */
BX_KEY_F6,
BX_KEY_F7,
BX_KEY_F8,
BX_KEY_F9,
BX_KEY_F10,
BX_KEY_PAUSE,
BX_KEY_SCRL_LOCK,
BX_KEY_KP_HOME,
BX_KEY_KP_UP,
BX_KEY_KP_PAGE_UP,
BX_KEY_KP_SUBTRACT,
BX_KEY_KP_LEFT,
BX_KEY_KP_5,
BX_KEY_KP_RIGHT,
BX_KEY_KP_ADD,
BX_KEY_KP_END,
/* 0x50 - 0x5f */
BX_KEY_KP_DOWN,
BX_KEY_KP_PAGE_DOWN,
BX_KEY_KP_INSERT,
BX_KEY_KP_DELETE,
0,
0,
BX_KEY_LEFT_BACKSLASH,
BX_KEY_F11,
BX_KEY_F12,
0,
0,
0,
0,
0,
0,
0,
/* 0x60 - 0x6f */
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
/* 0x70 - 0x7f */
0, /* Todo: "Katakana" key ( ibm 133 ) for Japanese 106 keyboard */
0,
0,
0, /* Todo: "Ro" key ( ibm 56 ) for Japanese 106 keyboard */
0,
0,
0,
0,
0,
0, /* Todo: "convert" key ( ibm 132 ) for Japanese 106 keyboard */
0,
0, /* Todo: "non-convert" key ( ibm 131 ) for Japanese 106 keyboard */
0,
0, /* Todo: "Yen" key ( ibm 14 ) for Japanese 106 keyboard */
0,
0,
},
{ /* extended-keys */
/* 0x00 - 0x0f */
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
/* 0x10 - 0x1f */
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
BX_KEY_KP_ENTER,
BX_KEY_CTRL_R,
0,
0,
/* 0x20 - 0x2f */
0,
BX_KEY_POWER_CALC,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
/* 0x30 - 0x3f */
0,
0,
BX_KEY_INT_HOME,
0,
0,
BX_KEY_KP_DIVIDE,
0,
0, /* ?? BX_KEY_PRINT ( ibm 124 ) ?? */
BX_KEY_ALT_R,
0,
0,
0,
0,
0,
0,
0,
/* 0x40 - 0x4f */
0,
0,
0,
0,
0,
BX_KEY_NUM_LOCK,
0,
BX_KEY_HOME,
BX_KEY_UP,
BX_KEY_PAGE_UP,
0,
BX_KEY_LEFT,
0,
BX_KEY_RIGHT,
0,
BX_KEY_END,
/* 0x50 - 0x5f */
BX_KEY_DOWN,
BX_KEY_PAGE_DOWN,
BX_KEY_INSERT,
BX_KEY_DELETE,
0,
0,
0,
0,
0,
0,
0,
BX_KEY_WIN_L,
BX_KEY_WIN_R,
BX_KEY_MENU,
BX_KEY_POWER_POWER,
BX_KEY_POWER_SLEEP,
/* 0x60 - 0x6f */
0,
0,
0,
BX_KEY_POWER_WAKE,
0,
BX_KEY_INT_SEARCH,
BX_KEY_INT_FAV,
0,
BX_KEY_INT_STOP,
BX_KEY_INT_FORWARD,
BX_KEY_INT_BACK,
BX_KEY_POWER_MYCOMP,
BX_KEY_INT_MAIL,
0,
0,
0,
}
};
/* Macro to convert WM_ button state to BX button state */
@ -856,66 +1021,13 @@ void bx_win32_gui_c::handle_events(void) {
if (key & 0x0100) {
// It's an extended key
switch (key & 0xff) {
case 0x1C:
key_event = BX_KEY_KP_ENTER;
break;
case 0x1D:
key_event = BX_KEY_CTRL_R;
break;
case 0x35:
key_event = BX_KEY_KP_DIVIDE;
break;
case 0x38:
// This makes the "AltGr" key on European keyboards work
DEV_kbd_gen_scancode(BX_KEY_CTRL_L | BX_KEY_RELEASED);
key_event = BX_KEY_ALT_R;
break;
case 0x45:
key_event = BX_KEY_NUM_LOCK;
break;
case 0x47:
key_event = BX_KEY_HOME;
break;
case 0x48:
key_event = BX_KEY_UP;
break;
case 0x49:
key_event = BX_KEY_PAGE_UP;
break;
case 0x4B:
key_event = BX_KEY_LEFT;
break;
case 0x4D:
key_event = BX_KEY_RIGHT;
break;
case 0x4F:
key_event = BX_KEY_END;
break;
case 0x50:
key_event = BX_KEY_DOWN;
break;
case 0x51:
key_event = BX_KEY_PAGE_DOWN;
break;
case 0x52:
key_event = BX_KEY_INSERT;
break;
case 0x53:
key_event = BX_KEY_DELETE;
break;
case 0x5B:
key_event = BX_KEY_WIN_L;
break;
case 0x5C:
key_event = BX_KEY_WIN_R;
break;
case 0x5D:
key_event = BX_KEY_MENU;
break;
}
} else {
key_event = win32_to_bx_key[key & 0xff];
}
key_event = win32_to_bx_key[(key & 0x100) ? 1 : 0][key & 0xff];
if (key & BX_KEY_RELEASED) key_event |= BX_KEY_RELEASED;
DEV_kbd_gen_scancode(key_event);
}