wxWindow* tlw = wxGetTopLevelParent(menu->GetWindow());
if ( !tlw || !wxDynamicCast(tlw, wxDialog) )
{
- return true;
+ // This must be an event from a menu bar of one of the frames.
+ return false;
}
}
wxMenu* menu = item->GetMenu();
menu->SendEvent(id, item->IsCheckable() ? item->IsChecked() : -1);
+
+ // A lot of existing code, including any program that closes its main
+ // window from a menu handler and expects the program to exit -- as our own
+ // minimal sample -- relies on getting an idle event after a menu event.
+ // But when using Ubuntu Unity detached menus, we get called from a DBUS
+ // handler called from g_timeout_dispatch() and Glib doesn't send us any
+ // idle events after it. So ask explicitly for an idle event to get one.
+ wxWakeUpIdle();
}
}