[gtk/matthiasc/for-master] shortcut controller: Fix mnemonic cycling



commit 2d80b105cef17fd790dbe8a0ae2c00a2da028e32
Author: Matthias Clasen <mclasen redhat com>
Date:   Thu May 28 08:52:55 2020 -0400

    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);
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]