[gtk/BUG_buttons_with_menu_onclick_GTK3: 3/3] GtkMenuButton: disable focus-on-click



commit 527a99e59871f278a2e5ee4b14233f2681fb5362
Author: Nelson Benítez León <nbenitezl gmail com>
Date:   Tue Mar 31 20:43:14 2020 -0400

    GtkMenuButton: disable focus-on-click
    
    As general rule, all buttons that launch a menu should
    not grab focus on click, because otherwise when the menu
    is closed the focus goes back to the button instead of
    the previously focused widget, which is the one the user
    was interacting with.
    
    GtkScaleButton and GtkVolumeButton set focus-on-click
    to FALSE for this same reason.
    
    Fixes #2557

 gtk/gtkmenubutton.c | 1 +
 1 file changed, 1 insertion(+)
---
diff --git a/gtk/gtkmenubutton.c b/gtk/gtkmenubutton.c
index 8eb18fc4c8..56b687f846 100644
--- a/gtk/gtkmenubutton.c
+++ b/gtk/gtkmenubutton.c
@@ -621,6 +621,7 @@ gtk_menu_button_init (GtkMenuButton *menu_button)
 
   add_arrow (menu_button);
 
+  gtk_widget_set_focus_on_click (GTK_WIDGET (menu_button), FALSE);
   gtk_widget_set_sensitive (GTK_WIDGET (menu_button), FALSE);
 
   context = gtk_widget_get_style_context (GTK_WIDGET (menu_button));


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