X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/71908213057690d5452f72b2b9c8e62b53357170..30a72e62977e4c532ae2f265db72535a5cccbbab:/src/univ/menu.cpp diff --git a/src/univ/menu.cpp b/src/univ/menu.cpp index 11d1187870..1d819ad0fe 100644 --- a/src/univ/menu.cpp +++ b/src/univ/menu.cpp @@ -18,8 +18,8 @@ // ---------------------------------------------------------------------------- #ifdef __GNUG__ - #pragma implementation "menuitem.h" - #pragma implementation "menu.h" + #pragma implementation "univmenuitem.h" + #pragma implementation "univmenu.h" #endif #include "wx/wxprec.h" @@ -601,10 +601,12 @@ void wxPopupMenuWindow::ClickItem(wxMenuItem *item) wxASSERT_MSG( !item->IsSeparator() && !item->IsSubMenu(), _T("can't click this item") ); - m_menu->ClickItem(item); + wxMenu* menu = m_menu; // close all menus DismissAndNotify(); + + menu->ClickItem(item); } void wxPopupMenuWindow::OpenSubmenu(wxMenuItem *item, InputMethod how) @@ -1963,7 +1965,7 @@ bool wxMenuBar::ProcessMouseEvent(const wxPoint& pt) // show the menu if we know that we should, even if we hadn't been showing // it before (this may happen if the previous menu was disabled) - if ( m_shouldShowMenu ) + if ( m_shouldShowMenu && !m_menuShown) { // open the new menu if the old one we closed had been opened PopupCurrentMenu(FALSE /* don't select first item - as Windows does */); @@ -2223,6 +2225,11 @@ void wxMenuBar::PopupCurrentMenu(bool selectFirst) // that we pass 0 as width to position the menu exactly below the // item, not to the right of it wxRect rectItem = GetItemRect(m_current); + + // Release mouse, because the menu will get the capture. + if (HasCapture()) + ReleaseMouse(); + m_menuShown->Popup(ClientToScreen(rectItem.GetPosition()), wxSize(0, rectItem.GetHeight()), selectFirst);