]> git.saurik.com Git - wxWidgets.git/blobdiff - src/univ/menu.cpp
removed incorrect 'static' keyword from var declarations
[wxWidgets.git] / src / univ / menu.cpp
index 001380d7f25dbf2da7c1b67add78670968f6418a..ba08a02a6ed8257f0a1b77dfc084f5f003cb82fc 100644 (file)
@@ -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 )
     {