mirror of https://github.com/odrling/Aegisub
"Fix" issues with hotkeys not working with wxGTK
GTK accelerators silently swallow the keypresses when the menu item is disabled, so disable accelerators completely and just use our hotkey system. Closes #1314. Originally committed to SVN as r6673.
This commit is contained in:
parent
db69fdbbcd
commit
c614980dca
|
@ -441,7 +441,25 @@ namespace menu {
|
|||
|
||||
window->Bind(wxEVT_MENU_OPEN, &CommandManager::OnMenuOpen, &menu->cm);
|
||||
window->Bind(wxEVT_COMMAND_MENU_SELECTED, &CommandManager::OnMenuClick, &menu->cm);
|
||||
window->SetMenuBar(menu.release());
|
||||
window->SetMenuBar(menu.get());
|
||||
|
||||
#ifdef __WXGTK__
|
||||
// GTK silently swallows keypresses for accelerators whose associated
|
||||
// menu items are disabled. As we don't update the menu until it's
|
||||
// opened, this means that conditional hotkeys don't work if the menu
|
||||
// hasn't been opened since they became valid.
|
||||
//
|
||||
// To work around this, we completely disable accelerators from menu
|
||||
// item. wxGTK doesn't expose any way to do this other that at wx
|
||||
// compile time (SetAcceleratorTable is a no-op), so have some fun with
|
||||
// the implementation details of undocumented methods. Detaching via
|
||||
// wxMenuBar::Detach removes the accelerator table, and then
|
||||
// wxMenuBarBase::Attch is used to avoid readding it.
|
||||
menu->Detach();
|
||||
menu->wxMenuBarBase::Attach(window);
|
||||
#endif
|
||||
|
||||
menu.release();
|
||||
}
|
||||
|
||||
wxMenu *GetMenu(std::string const& name, agi::Context *c) {
|
||||
|
|
Loading…
Reference in New Issue