From 15b4cc6ea6933fb22fc77dbd16bc6ad65de10ee5 Mon Sep 17 00:00:00 2001 From: Stefano Ceccherini Date: Thu, 9 Feb 2006 22:07:48 +0000 Subject: [PATCH] reduced the histeresis, now it's a fixed value git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@16319 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/kits/interface/Menu.cpp | 17 +++++------------ 1 file changed, 5 insertions(+), 12 deletions(-) diff --git a/src/kits/interface/Menu.cpp b/src/kits/interface/Menu.cpp index 2790209c84..4e7f6c8a20 100644 --- a/src/kits/interface/Menu.cpp +++ b/src/kits/interface/Menu.cpp @@ -104,8 +104,7 @@ sPropList[] = { BMenu::BMenu(const char *name, menu_layout layout) -// : BView(BRect(), name, 0, B_WILL_DRAW), - : BView(BRect(0.0, 0.0, 5.0, 5.0), name, 0, B_WILL_DRAW), + : BView(BRect(0, 0, 0, 0), name, 0, B_WILL_DRAW), fChosenItem(NULL), fPad(14.0f, 2.0f, 20.0f, 0.0f), fSelected(NULL), @@ -1113,11 +1112,7 @@ BMenu::_track(int *action, long start) int localAction = MENU_ACT_NONE; bigtime_t startTime = system_time(); - bigtime_t clickTime = 0; - get_click_speed(&clickTime); - - // TODO: Test and reduce the timeout if needed. - clickTime /= 2; + bigtime_t delay = 200000; // TODO: Test and reduce if needed. do { if (!LockLooper()) @@ -1127,14 +1122,13 @@ BMenu::_track(int *action, long start) BPoint location; GetMouse(&location, &buttons, true); BPoint screenLocation = ConvertToScreen(location); - item = HitTestItems(location, B_ORIGIN); if (item != NULL) { if (item != fSelected) { SelectItem(item, -1); startTime = system_time(); snoozeAmount = 20000; - } else if (system_time() > clickTime + startTime && item->Submenu() + } else if (system_time() > delay + startTime && item->Submenu() && item->Submenu()->Window() == NULL) { // Open the submenu if it's not opened yet, but only if // the mouse pointer stayed over there for some time @@ -1150,8 +1144,7 @@ BMenu::_track(int *action, long start) SelectItem(NULL); } - if (fSelected != NULL && OverSubmenu(fSelected, screenLocation) - && fSelected->Submenu()->Window() != NULL) { + if (fSelected != NULL && OverSubmenu(fSelected, screenLocation)) { UnlockLooper(); int submenuAction = MENU_ACT_NONE; @@ -1167,7 +1160,7 @@ BMenu::_track(int *action, long start) } UnlockLooper(); - + snooze(snoozeAmount); } while (buttons != 0);