mirror of
https://github.com/AppleWin/AppleWin.git
synced 2025-02-07 16:31:00 +00:00
Added new switch: '-no-hook-alt' - used to prevent left/right ALT from emulating open/closed apple keys (#583)
This commit is contained in:
parent
6fb5b3b0e8
commit
14e0bb7b71
@ -1313,6 +1313,10 @@ int APIENTRY WinMain(HINSTANCE passinstance, HINSTANCE, LPSTR lpCmdLine, int)
|
|||||||
{
|
{
|
||||||
g_bHookAltGrControl = true;
|
g_bHookAltGrControl = true;
|
||||||
}
|
}
|
||||||
|
else if (strcmp(lpCmdLine, "-no-hook-alt") == 0) // GH#583
|
||||||
|
{
|
||||||
|
JoySetHookAltKeys(false);
|
||||||
|
}
|
||||||
else if (strcmp(lpCmdLine, "-spkr-inc") == 0)
|
else if (strcmp(lpCmdLine, "-spkr-inc") == 0)
|
||||||
{
|
{
|
||||||
lpCmdLine = GetCurrArg(lpNextArg);
|
lpCmdLine = GetCurrArg(lpNextArg);
|
||||||
|
@ -1378,10 +1378,10 @@ LRESULT CALLBACK FrameWndProc (
|
|||||||
else if ((g_nAppMode == MODE_RUNNING) || (g_nAppMode == MODE_LOGO) || (g_nAppMode == MODE_STEPPING))
|
else if ((g_nAppMode == MODE_RUNNING) || (g_nAppMode == MODE_LOGO) || (g_nAppMode == MODE_STEPPING))
|
||||||
{
|
{
|
||||||
// NB. Alt Gr (Right-Alt): this normally send 2 WM_KEYDOWN messages for: VK_LCONTROL, then VK_RMENU
|
// NB. Alt Gr (Right-Alt): this normally send 2 WM_KEYDOWN messages for: VK_LCONTROL, then VK_RMENU
|
||||||
// . NB. The keyboard hook filter now suppresses VK_LCONTROL
|
// . NB. The keyboard hook filter will suppress VK_LCONTROL (if -hook-altgr-control is passed on the cmd-line)
|
||||||
bool extended = (HIWORD(lparam) & KF_EXTENDED) != 0;
|
bool extended = (HIWORD(lparam) & KF_EXTENDED) != 0;
|
||||||
BOOL down = 1;
|
bool down = true;
|
||||||
BOOL autorep = (HIWORD(lparam) & KF_REPEAT) != 0;
|
bool autorep = (HIWORD(lparam) & KF_REPEAT) != 0;
|
||||||
BOOL IsJoyKey = JoyProcessKey((int)wparam, extended, down, autorep);
|
BOOL IsJoyKey = JoyProcessKey((int)wparam, extended, down, autorep);
|
||||||
|
|
||||||
#if DEBUG_KEY_MESSAGES
|
#if DEBUG_KEY_MESSAGES
|
||||||
@ -1436,8 +1436,8 @@ LRESULT CALLBACK FrameWndProc (
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
bool extended = (HIWORD(lparam) & KF_EXTENDED) != 0;
|
bool extended = (HIWORD(lparam) & KF_EXTENDED) != 0;
|
||||||
BOOL down = 0;
|
bool down = false;
|
||||||
BOOL autorep = 0;
|
bool autorep = false;
|
||||||
BOOL bIsJoyKey = JoyProcessKey((int)wparam, extended, down, autorep);
|
BOOL bIsJoyKey = JoyProcessKey((int)wparam, extended, down, autorep);
|
||||||
|
|
||||||
#if DEBUG_KEY_MESSAGES
|
#if DEBUG_KEY_MESSAGES
|
||||||
|
@ -111,6 +111,15 @@ static UINT g_bJoyportEnabled = 0; // Set to use Joyport to drive the 3 button i
|
|||||||
static UINT g_uJoyportActiveStick = 0;
|
static UINT g_uJoyportActiveStick = 0;
|
||||||
static UINT g_uJoyportReadMode = JOYPORT_LEFTRIGHT;
|
static UINT g_uJoyportReadMode = JOYPORT_LEFTRIGHT;
|
||||||
|
|
||||||
|
static bool g_bHookAltKeys = true;
|
||||||
|
|
||||||
|
//===========================================================================
|
||||||
|
|
||||||
|
void JoySetHookAltKeys(bool hook)
|
||||||
|
{
|
||||||
|
g_bHookAltKeys = hook;
|
||||||
|
}
|
||||||
|
|
||||||
//===========================================================================
|
//===========================================================================
|
||||||
void CheckJoystick0()
|
void CheckJoystick0()
|
||||||
{
|
{
|
||||||
@ -296,7 +305,7 @@ void JoyInitialize()
|
|||||||
|
|
||||||
#define SUPPORT_CURSOR_KEYS
|
#define SUPPORT_CURSOR_KEYS
|
||||||
|
|
||||||
BOOL JoyProcessKey(int virtkey, BOOL extended, BOOL down, BOOL autorep)
|
BOOL JoyProcessKey(int virtkey, bool extended, bool down, bool autorep)
|
||||||
{
|
{
|
||||||
static struct
|
static struct
|
||||||
{
|
{
|
||||||
@ -314,6 +323,9 @@ BOOL JoyProcessKey(int virtkey, BOOL extended, BOOL down, BOOL autorep)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!g_bHookAltKeys && virtkey == VK_MENU) // GH#583
|
||||||
|
return 0;
|
||||||
|
|
||||||
//
|
//
|
||||||
|
|
||||||
BOOL keychange = 0;
|
BOOL keychange = 0;
|
||||||
|
@ -8,7 +8,7 @@ enum JOY1CHOICE {J1C_DISABLED=0, J1C_JOYSTICK2, J1C_KEYBD_CURSORS, J1C_KEYBD_NUM
|
|||||||
enum {JOYSTICK_MODE_FLOATING=0, JOYSTICK_MODE_CENTERING}; // Joystick centering control
|
enum {JOYSTICK_MODE_FLOATING=0, JOYSTICK_MODE_CENTERING}; // Joystick centering control
|
||||||
|
|
||||||
void JoyInitialize();
|
void JoyInitialize();
|
||||||
BOOL JoyProcessKey(int,BOOL,BOOL,BOOL);
|
BOOL JoyProcessKey(int,bool,bool,bool);
|
||||||
void JoyReset();
|
void JoyReset();
|
||||||
void JoySetButton(eBUTTON,eBUTTONSTATE);
|
void JoySetButton(eBUTTON,eBUTTONSTATE);
|
||||||
BOOL JoySetEmulationType(HWND,DWORD,int, const bool bMousecardActive);
|
BOOL JoySetEmulationType(HWND,DWORD,int, const bool bMousecardActive);
|
||||||
@ -24,6 +24,7 @@ DWORD JoyGetJoyType(UINT num);
|
|||||||
void JoySetTrim(short nValue, bool bAxisX);
|
void JoySetTrim(short nValue, bool bAxisX);
|
||||||
short JoyGetTrim(bool bAxisX);
|
short JoyGetTrim(bool bAxisX);
|
||||||
void JoyportControl(const UINT uControl);
|
void JoyportControl(const UINT uControl);
|
||||||
|
void JoySetHookAltKeys(bool hook);
|
||||||
void JoySetSnapshot_v1(const unsigned __int64 JoyCntrResetCycle);
|
void JoySetSnapshot_v1(const unsigned __int64 JoyCntrResetCycle);
|
||||||
void JoySaveSnapshot(class YamlSaveHelper& yamlSaveHelper);
|
void JoySaveSnapshot(class YamlSaveHelper& yamlSaveHelper);
|
||||||
void JoyLoadSnapshot(class YamlLoadHelper& yamlLoadHelper);
|
void JoyLoadSnapshot(class YamlLoadHelper& yamlLoadHelper);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user