X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/54800df8d8f5e425c4f11538cd05341c51243543..057b55b016d9e2076fde422f29948dc55e97f0d7:/src/univ/menu.cpp diff --git a/src/univ/menu.cpp b/src/univ/menu.cpp index 001380d7f2..ba08a02a6e 100644 --- a/src/univ/menu.cpp +++ b/src/univ/menu.cpp @@ -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) @@ -2036,7 +2038,7 @@ void wxMenuBar::OnKeyDown(wxKeyEvent& event) } else // right { - if ( ++currentNew == (int)count ) + if ( ++currentNew == count ) currentNew = 0; } @@ -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); @@ -2256,7 +2263,7 @@ void wxMenuBar::OnDismissMenu(bool dismissMenuBar) void wxMenuBar::OnDismiss() { - ReleaseCapture(); + ReleaseMouse(); if ( m_current != -1 ) {