Author: aandrejevic Date: Sun Apr 5 18:40:18 2015 New Revision: 67066
URL: http://svn.reactos.org/svn/reactos?rev=67066&view=rev Log: [NTVDM] Fix the shift key. Improve the BIOS keyboard handler. Do not append modifier keys to the buffer. CORE-8231 #resolve #comment Fixed in revision r67066.
Modified: trunk/reactos/subsystems/mvdm/ntvdm/bios/bios32/kbdbios32.c
Modified: trunk/reactos/subsystems/mvdm/ntvdm/bios/bios32/kbdbios32.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/mvdm/ntvdm/bios/... ============================================================================== --- trunk/reactos/subsystems/mvdm/ntvdm/bios/bios32/kbdbios32.c [iso-8859-1] (original) +++ trunk/reactos/subsystems/mvdm/ntvdm/bios/bios32/kbdbios32.c [iso-8859-1] Sun Apr 5 18:40:18 2015 @@ -232,33 +232,51 @@ /* Check if this is a key press or release */ if (!(ScanCode & (1 << 7))) { - /* Key press */ - if (VirtualKey == VK_NUMLOCK || - VirtualKey == VK_CAPITAL || - VirtualKey == VK_SCROLL || - VirtualKey == VK_INSERT) - { - /* For toggle keys, toggle the lowest bit in the keyboard map */ - BiosKeyboardMap[VirtualKey] ^= ~(1 << 0); - } - - /* Set the highest bit */ + /* Key press, set the highest bit */ BiosKeyboardMap[VirtualKey] |= (1 << 7);
- Character = 0; - - /* If ALT isn't held down, find out which character this is */ - if (!((BiosKeyboardMap[VK_MENU] | BiosKeyboardMap[VK_RMENU] | BiosKeyboardMap[VK_LMENU]) & (1 << 7))) - { - if (ToAscii(VirtualKey, ScanCode, BiosKeyboardMap, &Character, 0) == 0) - { - /* Not ASCII */ + switch (VirtualKey) + { + case VK_NUMLOCK: + case VK_CAPITAL: + case VK_SCROLL: + case VK_INSERT: + { + /* For toggle keys, toggle the lowest bit in the keyboard map */ + BiosKeyboardMap[VirtualKey] ^= ~(1 << 0); + break; + } + + case VK_CONTROL: + case VK_SHIFT: + case VK_LSHIFT: + case VK_RSHIFT: + case VK_MENU: + case VK_LMENU: + case VK_RMENU: + { + /* Modifier keys don't go in the buffer */ + break; + } + + default: + { Character = 0; - } - } - - /* Push it onto the BIOS keyboard queue */ - BiosKbdBufferPush(MAKEWORD(Character, ScanCode)); + + /* If ALT isn't held down, find out which character this is */ + if (!(Bda->KeybdShiftFlags & (BDA_KBDFLAG_ALT | BDA_KBDFLAG_LALT | BDA_KBDFLAG_RALT))) + { + if (ToAscii(VirtualKey, ScanCode, BiosKeyboardMap, &Character, 0) == 0) + { + /* Not ASCII */ + Character = 0; + } + } + + /* Push it onto the BIOS keyboard queue */ + BiosKbdBufferPush(MAKEWORD(Character, ScanCode)); + } + } } else { @@ -270,6 +288,7 @@ Bda->KeybdShiftFlags = 0;
/* Set the appropriate flags based on the state */ + if (BiosKeyboardMap[VK_SHIFT] & (1 << 7)) Bda->KeybdShiftFlags |= BDA_KBDFLAG_LSHIFT; if (BiosKeyboardMap[VK_RSHIFT] & (1 << 7)) Bda->KeybdShiftFlags |= BDA_KBDFLAG_RSHIFT; if (BiosKeyboardMap[VK_LSHIFT] & (1 << 7)) Bda->KeybdShiftFlags |= BDA_KBDFLAG_LSHIFT; if (BiosKeyboardMap[VK_CONTROL] & (1 << 7)) Bda->KeybdShiftFlags |= BDA_KBDFLAG_CTRL;