shortcutcontroller: Only do round-robin for mnemonics
authorMatthias Clasen <mclasen@redhat.com>
Tue, 3 Aug 2021 20:23:16 +0000 (16:23 -0400)
committerMatthias Clasen <mclasen@redhat.com>
Fri, 20 Aug 2021 13:26:37 +0000 (09:26 -0400)
Don't do round-robin activation unless we are looking
for mnemonics, where this is an expected feature.

Fixes: #4130
gtk/gtkshortcutcontroller.c

index e830503b159f80520aeb61434707924c48824c9f..5eb0187022ff052a00b719866dad44d3fbe473e3 100644 (file)
@@ -310,7 +310,14 @@ gtk_shortcut_controller_run_controllers (GtkEventController *controller,
       GtkWidget *widget;
       GtkNative *native;
 
-      index = (self->last_activated + 1 + i) % g_list_model_get_n_items (self->shortcuts);
+      /* This is not entirely right, but we only want to do round-robin cycling
+       * for mnemonics.
+       */
+      if (enable_mnemonics)
+        index = (self->last_activated + 1 + i) % g_list_model_get_n_items (self->shortcuts);
+      else
+        index = i;
+
       shortcut = g_list_model_get_item (self->shortcuts, index);
       if (!GTK_IS_SHORTCUT (shortcut))
         {