From 556f83c6f78235c08890d1658b9b6d5e3e92bc7a Mon Sep 17 00:00:00 2001 From: Stefano Ceccherini Date: Fri, 7 Mar 2008 21:26:36 +0000 Subject: [PATCH] In the menubar tracking function, loop indefinitely if mouse stands still. This way keyboard menu navigation works much better. Unfortunately I can't apply the same trick for BMenu since it opens the submenu with a delay, and that won't work anymore. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@24296 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/kits/interface/MenuBar.cpp | 22 +++++++++++++++------- 1 file changed, 15 insertions(+), 7 deletions(-) diff --git a/src/kits/interface/MenuBar.cpp b/src/kits/interface/MenuBar.cpp index 14ef253676..d4b35c1ccc 100644 --- a/src/kits/interface/MenuBar.cpp +++ b/src/kits/interface/MenuBar.cpp @@ -531,14 +531,22 @@ BMenuBar::_Track(int32 *action, int32 startIndex, bool showMenu) window->Unlock(); - if (fState != MENU_STATE_CLOSED) { - if (snoozeAmount > 0) - snooze(snoozeAmount); + if (fState != MENU_STATE_CLOSED) { + // if user doesn't move the mouse, loop here, + // so we don't interfer with keyboard menu navigation + BPoint newLocation; + uint32 newButtons; + do { + snooze(snoozeAmount); + if (!LockLooper()) + break; + GetMouse(&newLocation, &newButtons, true); + UnlockLooper(); + } while (newLocation == where + && newButtons == buttons); - if (window->Lock()) { - GetMouse(&where, &buttons, true); - window->Unlock(); - } + where = newLocation; + buttons = newButtons; if (buttons != 0 && _IsStickyMode()) { if (menuItem == NULL)