mirror of
https://git.tartarus.org/simon/putty.git
synced 2025-07-17 11:00:59 -05:00
Keyboard handling patch from RDB: the Windows Application key is now
always Compose (we have no better use for it), and Ctrl-Alt can be made to act like AltGr (but it's never Compose even when AltGr is). [originally from svn r1033]
This commit is contained in:
63
window.c
63
window.c
@ -2018,29 +2018,6 @@ static int TranslateKey(UINT message, WPARAM wParam, LPARAM lParam,
|
||||
keystate[VK_RMENU] = keystate[VK_MENU];
|
||||
}
|
||||
|
||||
/* Note if AltGr was pressed and if it was used as a compose key */
|
||||
if (cfg.compose_key) {
|
||||
if (wParam == VK_MENU && (HIWORD(lParam)&KF_EXTENDED))
|
||||
{
|
||||
if (!compose_state) compose_key = wParam;
|
||||
}
|
||||
if (wParam == VK_APPS && !compose_state)
|
||||
compose_key = wParam;
|
||||
|
||||
if (wParam == compose_key)
|
||||
{
|
||||
if (compose_state == 0 && (HIWORD(lParam)&(KF_UP|KF_REPEAT))==0)
|
||||
compose_state = 1;
|
||||
else if (compose_state == 1 && (HIWORD(lParam)&KF_UP))
|
||||
compose_state = 2;
|
||||
else
|
||||
compose_state = 0;
|
||||
}
|
||||
else if (compose_state==1 && wParam != VK_CONTROL)
|
||||
compose_state = 0;
|
||||
} else {
|
||||
compose_state = 0;
|
||||
}
|
||||
|
||||
/* Nastyness with NUMLock - Shift-NUMLock is left alone though */
|
||||
if ( (cfg.funky_type == 3 ||
|
||||
@ -2067,14 +2044,43 @@ static int TranslateKey(UINT message, WPARAM wParam, LPARAM lParam,
|
||||
|
||||
key_down = ((HIWORD(lParam)&KF_UP)==0);
|
||||
|
||||
/* Make sure Ctrl-ALT is not the same as AltGr for ToAscii */
|
||||
if (left_alt && (keystate[VK_CONTROL]&0x80))
|
||||
keystate[VK_MENU] = 0;
|
||||
/* Make sure Ctrl-ALT is not the same as AltGr for ToAscii unless told. */
|
||||
if (left_alt && (keystate[VK_CONTROL]&0x80)) {
|
||||
if (cfg.ctrlaltkeys)
|
||||
keystate[VK_MENU] = 0;
|
||||
else {
|
||||
keystate[VK_RMENU] = 0x80;
|
||||
left_alt = 0;
|
||||
}
|
||||
}
|
||||
|
||||
scan = (HIWORD(lParam) & (KF_UP | KF_EXTENDED | 0xFF));
|
||||
shift_state = ((keystate[VK_SHIFT]&0x80)!=0)
|
||||
+ ((keystate[VK_CONTROL]&0x80)!=0)*2;
|
||||
|
||||
/* Note if AltGr was pressed and if it was used as a compose key */
|
||||
if (!compose_state) {
|
||||
compose_key = -1;
|
||||
if (cfg.compose_key) {
|
||||
if (wParam == VK_MENU && (HIWORD(lParam)&KF_EXTENDED))
|
||||
compose_key = wParam;
|
||||
}
|
||||
if (wParam == VK_APPS)
|
||||
compose_key = wParam;
|
||||
}
|
||||
|
||||
if (wParam == compose_key)
|
||||
{
|
||||
if (compose_state == 0 && (HIWORD(lParam)&(KF_UP|KF_REPEAT))==0)
|
||||
compose_state = 1;
|
||||
else if (compose_state == 1 && (HIWORD(lParam)&KF_UP))
|
||||
compose_state = 2;
|
||||
else
|
||||
compose_state = 0;
|
||||
}
|
||||
else if (compose_state==1 && wParam != VK_CONTROL)
|
||||
compose_state = 0;
|
||||
|
||||
/*
|
||||
* Record that we pressed key so the scroll window can be reset, but
|
||||
* be careful to avoid Shift-UP/Down
|
||||
@ -2245,6 +2251,10 @@ static int TranslateKey(UINT message, WPARAM wParam, LPARAM lParam,
|
||||
{
|
||||
*p++ = 3; return p - output;
|
||||
}
|
||||
if (wParam == VK_PAUSE) /* Break/Pause */
|
||||
{
|
||||
*p++ = 26; *p++ = 0; return -2;
|
||||
}
|
||||
/* Control-2 to Control-8 are special */
|
||||
if (shift_state == 2 && wParam >= '2' && wParam <= '8')
|
||||
{
|
||||
@ -2428,6 +2438,7 @@ static int TranslateKey(UINT message, WPARAM wParam, LPARAM lParam,
|
||||
} else
|
||||
return 0;
|
||||
}
|
||||
else alt_state = 0;
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
Reference in New Issue
Block a user