GNOME Bugzilla – Bug 688738
GtkMenuButton problem with mnemonics / accelerators
Last modified: 2013-08-19 02:23:50 UTC
If you activate a GtkMenuButton by a mnemonic or accelerator, it will not show the menu. However if you've clicked it one time before - thus showing the menu - it'll work. gtk3-3.6.2-1.fc18.x86_64 To easily reproduce just try the Disks application in gnome-disk-utility. Just hit F10 once the main window shows - it's the accelerator for the gear menu-button.
f10 doesn't seem to work here, regardless of whether the menu was shown before or not.
(In reply to comment #1) > f10 doesn't seem to work here, regardless of whether the menu was shown before > or not. Make sure you're using master, the F10 accelerator was added Nov 16 2012.
hmm, haven't tried git gnome-disks, but it seems to work fine in my simple test case.
Could this be related to the fact that GTK+ itself is using F10 for the application menu? I just noticed this when running my application on XQuartz and tunneled through X11... The decision for GTK+ to do that (steal F10 for the application menu) doesn't seem to jive well with the guidelines in https://live.gnome.org/GnomeOS/Design/Whiteboards/KeyboardShortcuts ...
Created attachment 251986 [details] test case I'm using GTK+3.8.2 and I still have this bug. Please find enclose a test case that doesn't work. If you press Alt+s the button is press but the menu doesn't show. If you click with the mouse then press Alt+s, it's working. In the "builder.ui", if you change the visible property of the GtkMenu to False, the problem disappear. I think the problem come from gtk_menu_button_toggled because of the line : if (gtk_toggle_button_get_active (button) && !gtk_widget_get_visible (GTK_WIDGET (priv->popup))) so if the menu is visible, nothing's done. This test is not in the "button_press_event" event. An easy way is to add a "gtk_widget_hide (GTK_WIDGET (priv->popup));" right after the gtk_menu_attach_to_widget in the function _gtk_menu_button_set_popup_with_func.