gdkkeys-win32: Ignore CTRL bit for key translation
authorPhilip Zander <philip.zander@gmail.com>
Sat, 29 Jan 2022 21:36:40 +0000 (22:36 +0100)
committerLuca Bacci <luca.bacci982@gmail.com>
Tue, 1 Feb 2022 13:12:56 +0000 (14:12 +0100)
Some keymaps on Windows contain bogus mappings for Ctrl+key for certain
keys, e.g. Ctrl+Backspace = Delete, or Ctrl+[ = 0x1B. These are never
used on Windows, so we should ignore them.

Fixes #4667

gdk/win32/gdkkeys-win32-impl.c

index 2e2a382d0a08ff89cab3e4db6f9b74c173ec6c82..51ed1f63815b2935e457d01275173501d72b8f4e 100644 (file)
@@ -340,6 +340,13 @@ 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.
+           */
+          if (candidate_modbits == KBDCTRL)
+            continue;
+
           c = entry->wch[level];
           if (c == WCH_DEAD || have_sgcaps)
             {