From b78f096826576c0291a22015b2185d11ff7ac68b Mon Sep 17 00:00:00 2001 From: lllucius Date: Sat, 13 Dec 2014 08:38:07 +0000 Subject: [PATCH] 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. --- src/commands/CommandManager.cpp | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/src/commands/CommandManager.cpp b/src/commands/CommandManager.cpp index 47af6d7b3..c5f1cb56b 100644 --- a/src/commands/CommandManager.cpp +++ b/src/commands/CommandManager.cpp @@ -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(GetActiveProject()->GetMenuBar()->GetAccelTable()); + at = wxNullAcceleratorTable; +#endif + return; }