From 2d80b105cef17fd790dbe8a0ae2c00a2da028e32 Mon Sep 17 00:00:00 2001 From: Matthias Clasen Date: Thu, 28 May 2020 08:52:55 -0400 Subject: [PATCH] shortcut controller: Fix mnemonic cycling Iterate the shortcuts we found in order, not in reverse. Otherwise, we always end up activating the last_selected one, since it is last in the list. This broke in fb9b54d4b209afc when a list was turned into an array. --- gtk/gtkshortcutcontroller.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/gtk/gtkshortcutcontroller.c b/gtk/gtkshortcutcontroller.c index 92f244455b..81ca7f7b26 100644 --- a/gtk/gtkshortcutcontroller.c +++ b/gtk/gtkshortcutcontroller.c @@ -373,7 +373,8 @@ gtk_shortcut_controller_run_controllers (GtkEventController *controller, if (!shortcuts) return retval; - for (i = shortcuts->len - 1, p = shortcuts->len; i >= 0; i--) + p = shortcuts->len; + for (i = 0; i < shortcuts->len; i++) { const ShortcutData *data = &g_array_index (shortcuts, ShortcutData, i);