From b50a95807ab1248c68b213cc9c2b43ea0bbce0f5 Mon Sep 17 00:00:00 2001 From: Franklin Wei Date: Sun, 21 Jul 2024 04:55:01 -0400 Subject: [PATCH] GTK: Handle Shift+Tab properly. According to https://mail.gnome.org/archives/gtk-list/1999-August/msg00145.html pressing Shift+Tab generates a special keyval of ISO_Left_Tab, without a GDK_SHIFT_MASK applied. We now handle this case so that the midend receives ('\t' | MOD_SHFT) as intended. This will be used by the upcoming Untangle keyboard interface. --- gtk.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/gtk.c b/gtk.c index 035a300..a40a701 100644 --- a/gtk.c +++ b/gtk.c @@ -1541,6 +1541,11 @@ static gint key_event(GtkWidget *widget, GdkEventKey *event, gpointer data) keyval = '\177'; else if ((event->keyval == 'z' || event->keyval == 'Z') && shift && ctrl) keyval = UI_REDO; + else if (event->keyval == GDK_KEY_ISO_Left_Tab) { + /* SHIFT+TAB gets special handling. Ref: + * https://mail.gnome.org/archives/gtk-list/1999-August/msg00145.html */ + keyval = '\t' | MOD_SHFT; + } else if (event->string[0] && !event->string[1]) keyval = (unsigned char)event->string[0]; else