Keyboard: Refactor for GetKeyState()

This commit is contained in:
tomcw 2018-07-23 22:27:33 +01:00
parent 5e13bef808
commit 1afa2490c5
4 changed files with 11 additions and 11 deletions

View File

@ -780,7 +780,7 @@ Update_t CmdBenchmarkStop (int nArgs)
DWORD currtime = GetTickCount();
while ((extbench = GetTickCount()) != currtime)
; // intentional busy-waiting
KeybQueueKeypress(TEXT(' '),1);
KeybQueueKeypress(TEXT(' ') ,ASCII);
return UPDATE_ALL; // 0;
}
@ -2096,7 +2096,7 @@ Update_t CmdUnassemble (int nArgs)
Update_t CmdKey (int nArgs)
{
KeybQueueKeypress(
nArgs ? g_aArgs[1].nValue ? g_aArgs[1].nValue : g_aArgs[1].sArg[0] : TEXT(' '), 1); // FIXME!!!
nArgs ? g_aArgs[1].nValue ? g_aArgs[1].nValue : g_aArgs[1].sArg[0] : TEXT(' '), ASCII); // FIXME!!!
return UPDATE_CONSOLE_DISPLAY;
}

View File

@ -3,9 +3,6 @@
// 1.19.0.0 Hard Disk Status/Indicator Light
#define HD_LED 1
// Keyboard -- keystroke type
enum {NOT_ASCII=0, ASCII};
// Win32
extern HWND g_hFrameWindow;

View File

@ -102,9 +102,9 @@ bool KeybGetShiftStatus ()
//===========================================================================
void KeybUpdateCtrlShiftStatus()
{
g_bShiftKey = (GetKeyState( VK_SHIFT ) & KF_UP) ? true : false;
g_bCtrlKey = (GetKeyState( VK_CONTROL) & KF_UP) ? true : false;
g_bAltKey = (GetKeyState( VK_MENU ) & KF_UP) ? true : false;
g_bShiftKey = (GetKeyState( VK_SHIFT ) < 0) ? true : false; // L or R shift
g_bCtrlKey = (GetKeyState( VK_CONTROL) < 0) ? true : false; // L or R ctrl
g_bAltKey = (GetKeyState( VK_MENU ) < 0) ? true : false; // L or R alt
}
//===========================================================================
@ -114,7 +114,7 @@ BYTE KeybGetKeycode () // Used by IORead_C01x() and TapeRead() for Pravets8A
}
//===========================================================================
void KeybQueueKeypress (int key, BOOL bASCII)
void KeybQueueKeypress(WPARAM key, Keystroke_e bASCII)
{
if (bASCII == ASCII) // WM_CHAR
{
@ -307,9 +307,10 @@ void KeybQueueKeypress (int key, BOOL bASCII)
return;
keycode = n;
}
else if ((GetKeyState( VK_RMENU ) & KF_UP)) // Right ALT
else if ((GetKeyState(VK_RMENU) < 0)) // Right Alt (aka Alt Gr)
{
//
return;
}
else
{

View File

@ -1,5 +1,7 @@
#pragma once
enum Keystroke_e {NOT_ASCII=0, ASCII};
void ClipboardInitiatePaste();
void KeybReset();
@ -11,7 +13,7 @@ bool KeybGetShiftStatus();
bool KeybGetCapsAllowed(); //For Pravets8A/C only
void KeybUpdateCtrlShiftStatus();
BYTE KeybGetKeycode ();
void KeybQueueKeypress (int,BOOL);
void KeybQueueKeypress(WPARAM key, Keystroke_e bASCII);
void KeybToggleCapsLock ();
void KeybToggleP8ACapsLock ();
void KeybAnyKeyDown(UINT message, WPARAM wparam, bool bIsExtended);