mirror of
https://github.com/vim/vim.git
synced 2025-09-30 04:44:14 -04:00
patch 8.2.4843: treating CTRL + ALT as AltGr is not backwards compatible
Problem: Win32 GUI: Treating CTRL + ALT as AltGr is not backwards compatible. (Axel Bender) Solution: Make a difference between left and right menu keys. (closes #10308)
This commit is contained in:
@@ -827,13 +827,13 @@ get_active_modifiers(void)
|
|||||||
modifiers |= MOD_MASK_CTRL;
|
modifiers |= MOD_MASK_CTRL;
|
||||||
if (GetKeyState(VK_SHIFT) & 0x8000)
|
if (GetKeyState(VK_SHIFT) & 0x8000)
|
||||||
modifiers |= MOD_MASK_SHIFT;
|
modifiers |= MOD_MASK_SHIFT;
|
||||||
if (GetKeyState(VK_MENU) & 0x8000)
|
// Windows handles Ctrl + Alt as AltGr and vice-versa. We can distinguish
|
||||||
modifiers |= MOD_MASK_ALT;
|
// the two cases by checking whether the left or the right Alt key is
|
||||||
// Windows handles Ctrl + Alt as AltGr, in that case no modifier is actually
|
|
||||||
// pressed.
|
// pressed.
|
||||||
if ((modifiers & (MOD_MASK_CTRL | MOD_MASK_ALT)) ==
|
if (GetKeyState(VK_LMENU) & 0x8000)
|
||||||
(MOD_MASK_CTRL | MOD_MASK_ALT))
|
modifiers |= MOD_MASK_ALT;
|
||||||
modifiers &= ~(MOD_MASK_CTRL | MOD_MASK_ALT);
|
if ((modifiers & MOD_MASK_CTRL) && (GetKeyState(VK_RMENU) & 0x8000))
|
||||||
|
modifiers &= ~MOD_MASK_CTRL;
|
||||||
|
|
||||||
return modifiers;
|
return modifiers;
|
||||||
}
|
}
|
||||||
@@ -955,7 +955,7 @@ _OnMouseEvent(
|
|||||||
vim_modifiers |= MOUSE_SHIFT;
|
vim_modifiers |= MOUSE_SHIFT;
|
||||||
if (keyFlags & MK_CONTROL)
|
if (keyFlags & MK_CONTROL)
|
||||||
vim_modifiers |= MOUSE_CTRL;
|
vim_modifiers |= MOUSE_CTRL;
|
||||||
if (GetKeyState(VK_MENU) & 0x8000)
|
if (GetKeyState(VK_LMENU) & 0x8000)
|
||||||
vim_modifiers |= MOUSE_ALT;
|
vim_modifiers |= MOUSE_ALT;
|
||||||
|
|
||||||
gui_send_mouse_event(button, x, y, repeated_click, vim_modifiers);
|
gui_send_mouse_event(button, x, y, repeated_click, vim_modifiers);
|
||||||
@@ -1722,8 +1722,8 @@ gui_mch_haskey(char_u *name)
|
|||||||
int i;
|
int i;
|
||||||
|
|
||||||
for (i = 0; special_keys[i].vim_code1 != NUL; i++)
|
for (i = 0; special_keys[i].vim_code1 != NUL; i++)
|
||||||
if (name[0] == special_keys[i].vim_code0 &&
|
if (name[0] == special_keys[i].vim_code0
|
||||||
name[1] == special_keys[i].vim_code1)
|
&& name[1] == special_keys[i].vim_code1)
|
||||||
return OK;
|
return OK;
|
||||||
return FAIL;
|
return FAIL;
|
||||||
}
|
}
|
||||||
@@ -1972,7 +1972,7 @@ process_message(void)
|
|||||||
{
|
{
|
||||||
// ignore VK_SPACE when ALT key pressed: system menu
|
// ignore VK_SPACE when ALT key pressed: system menu
|
||||||
if (special_keys[i].key_sym == vk
|
if (special_keys[i].key_sym == vk
|
||||||
&& (vk != VK_SPACE || !(GetKeyState(VK_MENU) & 0x8000)))
|
&& (vk != VK_SPACE || !(GetKeyState(VK_LMENU) & 0x8000)))
|
||||||
{
|
{
|
||||||
/*
|
/*
|
||||||
* Behave as expected if we have a dead key and the special key
|
* Behave as expected if we have a dead key and the special key
|
||||||
@@ -2051,8 +2051,8 @@ process_message(void)
|
|||||||
if (GetKeyState(VK_CAPITAL) & 0x0001)
|
if (GetKeyState(VK_CAPITAL) & 0x0001)
|
||||||
keyboard_state[VK_CAPITAL] = 0x01;
|
keyboard_state[VK_CAPITAL] = 0x01;
|
||||||
// Alt-Gr is synthesized as Alt + Ctrl.
|
// Alt-Gr is synthesized as Alt + Ctrl.
|
||||||
if ((GetKeyState(VK_MENU) & 0x8000) &&
|
if ((GetKeyState(VK_RMENU) & 0x8000)
|
||||||
(GetKeyState(VK_CONTROL) & 0x8000))
|
&& (GetKeyState(VK_CONTROL) & 0x8000))
|
||||||
{
|
{
|
||||||
keyboard_state[VK_MENU] = 0x80;
|
keyboard_state[VK_MENU] = 0x80;
|
||||||
keyboard_state[VK_CONTROL] = 0x80;
|
keyboard_state[VK_CONTROL] = 0x80;
|
||||||
|
@@ -746,6 +746,8 @@ static char *(features[]) =
|
|||||||
|
|
||||||
static int included_patches[] =
|
static int included_patches[] =
|
||||||
{ /* Add new patch number below this line */
|
{ /* Add new patch number below this line */
|
||||||
|
/**/
|
||||||
|
4843,
|
||||||
/**/
|
/**/
|
||||||
4842,
|
4842,
|
||||||
/**/
|
/**/
|
||||||
|
Reference in New Issue
Block a user