Pressing Alt in a menu (opened by mouse) should reveal mnemonic underlines
Submitted by Daniel Boles
If a menu is opened by mouse, mnemonic underlines are not shown. Fair enough: I might be a user who doesn't care about keynav.
However, users who do would expect that, based on the convention everywhere else, pressing Alt would reveal which, if any, mnemonics are usable in the menu. There should be a way to open a menu by mouse but then discover what keynav it offers.
Pressing Alt almost works for this , but only coincidentally: In fact, pressing any key activates "keyboard mode" and therefore triggers the underlines to be shown, even if the key is not otherwise consumed. However, the addition of the underlines doesn't take effect immediately. Instead, showing the underlines is delayed until the menu is redrawn, e.g. by moving the cursor over it.
So, Alt is not handled specifically here; any keypress means 'enable keyboard mode' but doesn't cause a redraw to indicate this.
I feel like a queue_draw() would be good if Alt specifically is pressed. That key is going to be people's first guess as to 'how can I see which mnemonics are available?'. At present, if the user has opened the menu by mouse but might be interested to know that keynav is also an option, they won't discover this, or get any feedback from Alt, unless they incidentally cause a redraw to occur.
IMO the ideal would be to only show mnemonics while Alt is held down, as done by other widgets, but I'm not yet sure if this can work without conflicting with other key handling. So an immediate solution is just to redraw if Alt's pressed.
A somewhat related issue is that the underlines are not reset when the menu is closed, so once you've opened with a key, or pressed a key in the menu then triggered a redraw, underlines are visible forevermore. That's not so bad - it's better always to see info than never(?) - but it contradicts how other widgets handle underlines, and seems to contradict this comment in gtkmenushell.c:
/* The idea with keyboard mode is that once you start using * the keyboard to navigate the menus, we show mnemonics * until the menu navigation is over.
I don't know, but maybe this behaviour of the menu is a consequence of how once keyboard navigation has begun in a window (illustrated by the focus rectangle being visible), there doesn't seem to be a way to turn it off.