From 2e3f9dffa7f5b3f0e97f68d5f8ab5561b3dd524a Mon Sep 17 00:00:00 2001 From: Trygve Aaberge Date: Fri, 10 Apr 2020 17:13:23 +0200 Subject: [PATCH] Ignore keys for switching keyboard layout XKB has various options for using keys to switch the keyboard layout. When these are set, XKB will return keysyms which are unknown to GLFW, so kitty will fallback to using a keymap without the options set, which causes the keys to be interpreted as the original keysyms. However, when these options are set, kitty shouldn't interpret the keys. Therefore, check for some specific keysyms and return before translating to GLFW keysyms. There may be more keysyms which should be ignored, but as far as I can see from https://gitlab.freedesktop.org/xkeyboard-config/xkeyboard-config/-/blob/xkeyboard-config-2.29/symbols/group these are the ones which can be triggered by XKB options. Fixes #2519 --- glfw/xkb_glfw.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/glfw/xkb_glfw.c b/glfw/xkb_glfw.c index 54dc20d5c..18d7e5e52 100644 --- a/glfw/xkb_glfw.c +++ b/glfw/xkb_glfw.c @@ -620,6 +620,9 @@ glfw_xkb_handle_key_event(_GLFWwindow *window, _GLFWXKBData *xkb, xkb_keycode_t } if (key_text[0]) { debug("%s: %s ", text_type, key_text); } } + if (xkb_sym == XKB_KEY_ISO_First_Group || xkb_sym == XKB_KEY_ISO_Last_Group || xkb_sym == XKB_KEY_ISO_Next_Group || xkb_sym == XKB_KEY_ISO_Prev_Group || xkb_sym == XKB_KEY_Mode_switch) { + return; + } int glfw_sym = glfw_key_for_sym(xkb_sym); bool is_fallback = false; if (glfw_sym == GLFW_KEY_UNKNOWN && !key_text[0]) {