window: Prefer menu bars when handling F10
authorFlorian Müllner <fmuellner@gnome.org>
Fri, 27 Aug 2021 22:10:00 +0000 (00:10 +0200)
committerMatthias Clasen <mclasen@redhat.com>
Thu, 2 Sep 2021 23:59:41 +0000 (19:59 -0400)
Focusing the first widget in the titlebar is a good fallback,
but a "real" menubar or :primary menu button should take
precedence.

gtk/gtkwindow.c

index 57f2484d44490385fb6383ff6ce8c7ab8119e783..44cf033d2ae8aac6239afe2e92f9436b5cbbc78d 100644 (file)
@@ -5796,16 +5796,14 @@ gtk_window_activate_menubar (GtkWidget *widget,
   GtkWidget *focus;
   GtkWidget *first;
 
-  focus = gtk_window_get_focus (window);
-
-  if (priv->title_box != NULL &&
-      (focus == NULL || !gtk_widget_is_ancestor (focus, priv->title_box)) &&
-      gtk_widget_child_focus (priv->title_box, GTK_DIR_TAB_FORWARD))
-    return TRUE;
-
   tmp_menubars = gtk_popover_menu_bar_get_viewable_menu_bars (window);
   if (tmp_menubars == NULL)
-    return FALSE;
+    {
+      focus = gtk_window_get_focus (window);
+      return priv->title_box != NULL &&
+             (focus == NULL || !gtk_widget_is_ancestor (focus, priv->title_box)) &&
+             gtk_widget_child_focus (priv->title_box, GTK_DIR_TAB_FORWARD);
+    }
 
   menubars = g_ptr_array_sized_new (g_list_length (tmp_menubars));;
   for (l = tmp_menubars; l; l = l->next)