[gtk/wip/chergert/macos-fixes: 10/15] gdkkeys-win32: Ignore CTRL bit for key translation




commit c3be16f7918c7b40ace1c58469f8fbeb7d2de991
Author: Philip Zander <philip zander gmail com>
Date:   Sat Jan 29 22:36:40 2022 +0100

    gdkkeys-win32: Ignore CTRL bit for key translation
    
    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 | 7 +++++++
 1 file changed, 7 insertions(+)
---
diff --git a/gdk/win32/gdkkeys-win32-impl.c b/gdk/win32/gdkkeys-win32-impl.c
index 2e2a382d0a..51ed1f6381 100644
--- a/gdk/win32/gdkkeys-win32-impl.c
+++ b/gdk/win32/gdkkeys-win32-impl.c
@@ -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)
             {


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]