From 037c0e4005b47a0b0f23c8f73944292d28eb1b8f Mon Sep 17 00:00:00 2001 From: Philip Zander Date: Tue, 8 Feb 2022 20:33:42 +0100 Subject: [PATCH] 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 --- gdk/win32/gdkkeys-win32-impl.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) 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]; -- 2.30.2