mirror of
https://github.com/vim/vim
synced 2025-07-16 01:01:58 +00:00
patch 9.0.0686: the right ALT key does not work on some MS-Windows keyboards
Problem: The right ALT key does not work on some MS-Windows keyboards. Solution: Adjust the modifiers based on GetKeyState(). (Anoton Sharonov, closes #11300)
This commit is contained in:
committed by
Bram Moolenaar
parent
07eaa1ede4
commit
8d8b9758ce
@ -852,6 +852,13 @@ get_active_modifiers(void)
|
||||
modifiers |= MOD_MASK_ALT;
|
||||
if ((modifiers & MOD_MASK_CTRL) && (GetKeyState(VK_RMENU) & 0x8000))
|
||||
modifiers &= ~MOD_MASK_CTRL;
|
||||
// Add RightALT only if it is hold alone (without Ctrl), because if AltGr
|
||||
// is pressed, Windows claims that Ctrl is hold as well. That way we can
|
||||
// recognize Right-ALT alone and be sure that not AltGr is hold.
|
||||
if (!(GetKeyState(VK_CONTROL) & 0x8000)
|
||||
&& (GetKeyState(VK_RMENU) & 0x8000)
|
||||
&& !(GetKeyState(VK_LMENU) & 0x8000)) // seems AltGr has both set
|
||||
modifiers |= MOD_MASK_ALT;
|
||||
|
||||
return modifiers;
|
||||
}
|
||||
|
@ -699,6 +699,8 @@ static char *(features[]) =
|
||||
|
||||
static int included_patches[] =
|
||||
{ /* Add new patch number below this line */
|
||||
/**/
|
||||
686,
|
||||
/**/
|
||||
685,
|
||||
/**/
|
||||
|
Reference in New Issue
Block a user