GNOME Bugzilla – Bug 612611
auto-mnemonics breaks menu scrolling
Last modified: 2010-10-31 19:57:16 UTC
Turning on auto-mnemonics appears to break menu scrolling. Try running tests/testmenus and open up the dynamic menu (unless you have a really tall monitor, this will grow the menu enough that you should be able to key down the menu).
This is fixed in 2.20.
We also need to make sure keyboard_mode is disabled when a mouse enters the menu_shell. Otherwise, I see strange behavior for menus that scroll.
Created attachment 166290 [details] [review] Patch to fix menu scrolling and auto-mnemonics issue.
Comment on attachment 166290 [details] [review] Patch to fix menu scrolling and auto-mnemonics issue. index c3e107f..f3aca36 100644 --- a/gtk/gtkmenushell.c +++ b/gtk/gtkmenushell.c @@ -885,6 +885,11 @@ gtk_menu_shell_enter_notify (GtkWidget *widget, { GtkMenuShell *menu_shell = GTK_MENU_SHELL (widget); + /* If we've received a mouse enter event, it is safe to assume + * we are no longer in keyboard mode. + */ + menu_shell->keyboard_mode = FALSE; + if (event->mode == GDK_CROSSING_GTK_GRAB || event->mode == GDK_CROSSING_GTK_UNGRAB || event->mode == GDK_CROSSING_STATE_CHANGED)
Created attachment 166291 [details] [review] Patch for menu-scrolling and auto-mnemonics issue. Sorry -- please ignore the last attachment and comment. :( I'm having a long day. This is a proper patch for the menu-scrolling and auto-mnemonics issue I've been seeing.
Looks reasonable to me.
Re-opening for now. Matthias, does Ayan's patch look okay to you?
The way keyboard mode is designed is that it gets turned on on the first keynav, and then stays on until the entire menu hierarchy gets dismissed. The patch breaks that, so no, it doesn't look immediately ok. I think we need to track down the 'strange behaviour' instead.
Can you describe the 'strange behaviour' in some more detail ?
To reproduce the behavior, you need to be using a theme that has auto-mnemonics turned on and a menu that is so tall that it scrolls. First open the menu by navigating to it with the mouse, then scroll to the last entry with the keyboard (the easiest way is to press the up arrow). Now, once you move the mouse back into the menu, it will gtk_menu_scroll_to() to the 0th position. This makes it impossible to select, for example, the last entry in the menu with the mouse since the menu repositions itself when the mouse enters the menu shell. I hope that makes sense.
I don't think this problem is related to keyboard_mode at all. At least I can reproduce jumpy scrolling on mouse-enter with or without your change applied.
This turns out to be caused by appearing and disappearing mnemonics causing size changes of menu items, which in turn causes us to call gtk_menu_reposition on the attached submenu, which looses the scroll_offset information. Here is a not quite correct patch which fixes the problem.
Created attachment 172708 [details] [review] patch