From: Philip Zander Date: Tue, 8 Feb 2022 19:33:42 +0000 (+0100) Subject: gdkkeys-win32: Also ignore Ctrl + Shift (etc.) X-Git-Tag: archive/raspbian/4.6.5+ds-1+rpi1~1^2~19^2~4^2~16^2 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=037c0e4005b47a0b0f23c8f73944292d28eb1b8f;p=gtk4.git 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 --- diff --git a/gdk/win32/gdkkeys-win32-impl.c b/gdk/win32/gdkkeys-win32-impl.c index 51ed1f6381..f3d42481b4 100644 --- a/gdk/win32/gdkkeys-win32-impl.c +++ b/gdk/win32/gdkkeys-win32-impl.c @@ -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];