diff --git a/src/kits/interface/Menu.cpp b/src/kits/interface/Menu.cpp index 958a125cd7..441f607984 100644 --- a/src/kits/interface/Menu.cpp +++ b/src/kits/interface/Menu.cpp @@ -741,7 +741,7 @@ void BMenu::KeyDown(const char *bytes, int32 numBytes) { switch (bytes[0]) { - case B_UP_ARROW: + /*case B_UP_ARROW: { if (fSelected) { fSelected->fSelected = false; @@ -801,6 +801,11 @@ BMenu::KeyDown(const char *bytes, int32 numBytes) break; } + */ + case B_ESCAPE: + QuitTracking(); + break; + default: BView::KeyDown(bytes, numBytes); } @@ -1240,8 +1245,7 @@ BMenu::_track(int *action, bigtime_t trackTime, long start) bigtime_t snoozeAmount = 50000; BPoint location; ulong buttons; - GetMouse(&location, &buttons, false); - // Get the current mouse state + GetMouse(&location, &buttons, true); Window()->UpdateIfNeeded(); BPoint screenLocation = ConvertToScreen(location); @@ -2063,10 +2067,7 @@ BMenu::OkToProceed(BMenuItem* item) void BMenu::QuitTracking() { - if (IsStickyMode()) - SetStickyMode(false); - if (fSelected != NULL) - SelectItem(NULL); + SelectItem(NULL); if (BMenuBar *menuBar = dynamic_cast(this)) menuBar->RestoreFocus(); diff --git a/src/kits/interface/MenuBar.cpp b/src/kits/interface/MenuBar.cpp index b0103d754a..9528fc9880 100644 --- a/src/kits/interface/MenuBar.cpp +++ b/src/kits/interface/MenuBar.cpp @@ -400,8 +400,8 @@ BMenuBar::Track(int32 *action, int32 startIndex, bool showMenu) BPoint where; ulong buttons; - GetMouse(&where, &buttons, false); - // Get the current mouse state + GetMouse(&where, &buttons, true); + window->UpdateIfNeeded(); BMenuItem *menuItem = HitTestItems(where, B_ORIGIN); if (menuItem != NULL) { @@ -450,7 +450,10 @@ BMenuBar::Track(int32 *action, int32 startIndex, bool showMenu) if (locked) window->Unlock(); - + + if (fState == MENU_STATE_CLOSED) + break; + if (localAction == MENU_STATE_CLOSED || (buttons != 0 && IsStickyMode() && menuItem == NULL)) break; else if (buttons == 0 && !IsStickyMode()) { @@ -462,9 +465,6 @@ BMenuBar::Track(int32 *action, int32 startIndex, bool showMenu) SetStickyMode(true); } - if (fState == MENU_STATE_CLOSED) - break; - if (snoozeAmount > 0) snooze(snoozeAmount); }