[gtk/gtk-3-24: 1/2] gdkkeys-win32: Also ignore Ctrl + Shift (etc.)




commit a40f9261e92567b242643f7c15ddaf4f415750e3
Author: Philip Zander <philip zander gmail com>
Date:   Tue Feb 8 20:33:42 2022 +0100

    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 74f9615c19..818887c458 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];


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