From f15bc53a011bcfbcb6848c19cae2d5ae4ff1fc64 Mon Sep 17 00:00:00 2001 From: Robin Haberkorn Date: Tue, 21 Jun 2022 02:06:11 +0200 Subject: Gtk+: fixed interpretation of Alt-Gr-keypresses * this is a regression in Gtk+ 3 * nowadays, Alt-Gr-keycombos are sometimes reported as Ctrl+Alt which resulted in control characters to be inserted --- src/interface-gtk/interface.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'src/interface-gtk/interface.c') diff --git a/src/interface-gtk/interface.c b/src/interface-gtk/interface.c index 207d01c..9b87abb 100644 --- a/src/interface-gtk/interface.c +++ b/src/interface-gtk/interface.c @@ -718,6 +718,7 @@ teco_interface_popup_clear(void) * @todo It would be great to have platform-specific optimizations, * so we can detect interruptions without having to drive the Glib * event loop (e.g. using libX11 or Win32 APIs). + * There already is a keyboard hook for Win32 in interface-curses. * On the downside, such solutions will probably freeze the window * while SciTECO is busy. */ @@ -883,7 +884,11 @@ teco_interface_handle_key_press(guint keyval, guint state, GError **error) g_unichar_to_utf8(u, &key); if (key > 0x7F) break; - if (state & GDK_CONTROL_MASK) + /* + * NOTE: Alt-Gr key-combinations are sometimes reported as + * Ctrl+Alt, so we filter those out. + */ + if ((state & (GDK_CONTROL_MASK | GDK_MOD1_MASK)) == GDK_CONTROL_MASK) key = TECO_CTL_KEY(g_ascii_toupper(key)); if (!teco_cmdline_keypress_c(key, error)) -- cgit v1.2.3