[gtk/backports-for-4-4: 2/16] window: Prefer menu bars when handling F10




commit d0d982e2eddd00ff935193673c6d60f3c9a535aa
Author: Florian Müllner <fmuellner gnome org>
Date:   Sat Aug 28 00:10:00 2021 +0200

    window: Prefer menu bars when handling F10
    
    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 | 14 ++++++--------
 1 file changed, 6 insertions(+), 8 deletions(-)
---
diff --git a/gtk/gtkwindow.c b/gtk/gtkwindow.c
index 57f2484d44..44cf033d2a 100644
--- a/gtk/gtkwindow.c
+++ b/gtk/gtkwindow.c
@@ -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)


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