Mercurial > vim
changeset 30703:47332719dbb5 v9.0.0686
patch 9.0.0686: the right ALT key does not work on some MS-Windows keyboards
Commit: https://github.com/vim/vim/commit/8d8b9758ced52b6303af95ad7e28ae9c5636cdf8
Author: Anton Sharonov <anton.sharonov@gmail.com>
Date: Fri Oct 7 16:28:48 2022 +0100
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)
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Fri, 07 Oct 2022 17:30:04 +0200 |
parents | 3ffb92bedeb4 |
children | 2721bdcfeadd |
files | src/gui_w32.c src/version.c |
diffstat | 2 files changed, 9 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/src/gui_w32.c +++ b/src/gui_w32.c @@ -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; }