gdkkeys-win32: Also ignore Ctrl + Shift (etc.)

Some Windows keymaps have bogus mappings for the Ctrl modifier. !4423 attempted
to fix this by ignoring the Ctrl layer, but that was not enough. We also need to
ignore combinations of Ctrl with other modifiers, i.e. Ctrl + Shift. For example,
Ctrl + Shift + 6 is mapped to the character 0x1E on a US keyboard (but it should
be treated as Ctrl + ^). Basically, always ignore Ctrl unless it is used in
conjunction with Alt, i.e. as part of AltGr.

Related issue: #4667
This commit is contained in:
Philip Zander 2022-02-08 20:33:42 +01:00
parent 38a1a23a53
commit a40f9261e9

View File

@ -340,11 +340,12 @@ vk_to_char_fuzzy (GdkWin32KeymapLayoutInfo *info,
if (candidate_modbits & ~mod_bits)
continue;
/* Some keys have bogus mappings for the control key, e.g.
* Ctrl + Backspace = Delete, or Ctrl + [ = 0x1B. These are
* never used on Windows, so we ignore them.
/* Some keys have bogus mappings for the control key, e.g. Ctrl +
* Backspace = Delete, Ctrl + [ = 0x1B or even Ctrl + Shift + 6 =
* 0x1E on a US keyboard. So we have to ignore all cases of
* Ctrl that aren't part of AltGr.
*/
if (candidate_modbits == KBDCTRL)
if ((candidate_modbits & KBDCTRL) && !(candidate_modbits & KBDALT))
continue;
c = entry->wch[level];