diff options
author | Robin Haberkorn <robin.haberkorn@googlemail.com> | 2025-04-13 06:48:12 +0300 |
---|---|---|
committer | Robin Haberkorn <robin.haberkorn@googlemail.com> | 2025-04-13 06:58:11 +0300 |
commit | 4254346a03a06bb612895d43329651e36ad3b482 (patch) | |
tree | a7ce007b27ff41ca686b5135b77292327527e9fb /src/interface-gtk/interface.c | |
parent | 59ef388128936ca846a96052938a14131067d3d2 (diff) | |
download | sciteco-4254346a03a06bb612895d43329651e36ad3b482.tar.gz |
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.
Diffstat (limited to 'src/interface-gtk/interface.c')
-rw-r--r-- | src/interface-gtk/interface.c | 5 |
1 files changed, 5 insertions, 0 deletions
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; |