From 4254346a03a06bb612895d43329651e36ad3b482 Mon Sep 17 00:00:00 2001 From: Robin Haberkorn Date: Sun, 13 Apr 2025 06:48:12 +0300 Subject: Gtk: do not attempt automatic ANSI key translation for dead keys * At least on Windows it was observed that teco_interface_get_ansi_key() would find ANSI keys on other layouts, but nothing corresponding to the key itself. For instance, for a dead caret (^), we'd find backslash. This made it impossible to type caret in the parser start states. * We clumsily detect whether a keyevent refers to a dead key by checking its symbolic name and pass it down to the input method unmodified. * Fixes entering dead keys, at the very least on Windows, but potentially on all other systems as well. --- src/interface-gtk/interface.c | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'src/interface-gtk') diff --git a/src/interface-gtk/interface.c b/src/interface-gtk/interface.c index 25f4ccd..564358e 100644 --- a/src/interface-gtk/interface.c +++ b/src/interface-gtk/interface.c @@ -910,6 +910,11 @@ teco_interface_get_ansi_key(GdkEventKey *event) if (cp && cp < 0x80) return cp; + const gchar *name = gdk_keyval_name(event->keyval); + if (name && g_str_has_prefix(name, "dead_")) + /* we won't find the non-dead keyval anyway */ + return 0; + GdkKeymap *map = gdk_keymap_get_for_display(gdk_window_get_display(event->window)); g_autofree GdkKeymapKey *keys = NULL; g_autofree guint *keyvals = NULL; -- cgit v1.2.3