1
0
mirror of https://github.com/cookiengineer/audacity synced 2025-07-02 17:23:18 +02:00

Final fix for bug #40 on Windows

I'm 100% certain I found the cause this time (r13739 was
still needed though).

There's a design flaw in wxMenuBar::RebuildAccelTable() that
will always leave the last accelerator active as they are
removed from the menus.

For the Edit menu, that will be "Move Cursor -> to Track End"
because of the way the submenus are traversed.  And because that
fella happens to have an unmodified character for an accelerator
it can't be used in a label track until another menu is opened
and closed.

The workaround is to nullify the accelerator table when a menu
closes.
This commit is contained in:
lllucius 2014-12-13 08:38:07 +00:00
parent f7837eea1b
commit b78f096826

View File

@ -913,6 +913,19 @@ void CommandManager::HandleMenuClose(wxMenuEvent &evt)
// Forget about it
mOpenMenu = NULL;
#if defined(__WXMSW__)
// On Windows, the last accelerator entry will remain active due to the way that
// wxMenuBar::RebuildAccelTable() functions. Just so happens that if that last
// entry is an unmodified character, then that character will not be usable in
// a label track until a different menu has been opened...thus replacing that
// dangling accelerator entry.
//
// This should go away (or at least be re-evaluated) when moving to wx3 as they've
// completely redesigned the accelerator table handling.
wxAcceleratorTable & at = const_cast<wxAcceleratorTable &>(GetActiveProject()->GetMenuBar()->GetAccelTable());
at = wxNullAcceleratorTable;
#endif
return;
}