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
This commit is contained in:
Stefano Ceccherini 2006-02-09 22:07:48 +00:00
parent ee47c06033
commit 15b4cc6ea6

View File

@ -104,8 +104,7 @@ sPropList[] = {
BMenu::BMenu(const char *name, menu_layout layout) BMenu::BMenu(const char *name, menu_layout layout)
// : BView(BRect(), name, 0, B_WILL_DRAW), : BView(BRect(0, 0, 0, 0), name, 0, B_WILL_DRAW),
: BView(BRect(0.0, 0.0, 5.0, 5.0), name, 0, B_WILL_DRAW),
fChosenItem(NULL), fChosenItem(NULL),
fPad(14.0f, 2.0f, 20.0f, 0.0f), fPad(14.0f, 2.0f, 20.0f, 0.0f),
fSelected(NULL), fSelected(NULL),
@ -1113,11 +1112,7 @@ BMenu::_track(int *action, long start)
int localAction = MENU_ACT_NONE; int localAction = MENU_ACT_NONE;
bigtime_t startTime = system_time(); bigtime_t startTime = system_time();
bigtime_t clickTime = 0; bigtime_t delay = 200000; // TODO: Test and reduce if needed.
get_click_speed(&clickTime);
// TODO: Test and reduce the timeout if needed.
clickTime /= 2;
do { do {
if (!LockLooper()) if (!LockLooper())
@ -1127,14 +1122,13 @@ BMenu::_track(int *action, long start)
BPoint location; BPoint location;
GetMouse(&location, &buttons, true); GetMouse(&location, &buttons, true);
BPoint screenLocation = ConvertToScreen(location); BPoint screenLocation = ConvertToScreen(location);
item = HitTestItems(location, B_ORIGIN); item = HitTestItems(location, B_ORIGIN);
if (item != NULL) { if (item != NULL) {
if (item != fSelected) { if (item != fSelected) {
SelectItem(item, -1); SelectItem(item, -1);
startTime = system_time(); startTime = system_time();
snoozeAmount = 20000; snoozeAmount = 20000;
} else if (system_time() > clickTime + startTime && item->Submenu() } else if (system_time() > delay + startTime && item->Submenu()
&& item->Submenu()->Window() == NULL) { && item->Submenu()->Window() == NULL) {
// Open the submenu if it's not opened yet, but only if // Open the submenu if it's not opened yet, but only if
// the mouse pointer stayed over there for some time // the mouse pointer stayed over there for some time
@ -1150,8 +1144,7 @@ BMenu::_track(int *action, long start)
SelectItem(NULL); SelectItem(NULL);
} }
if (fSelected != NULL && OverSubmenu(fSelected, screenLocation) if (fSelected != NULL && OverSubmenu(fSelected, screenLocation)) {
&& fSelected->Submenu()->Window() != NULL) {
UnlockLooper(); UnlockLooper();
int submenuAction = MENU_ACT_NONE; int submenuAction = MENU_ACT_NONE;
@ -1167,7 +1160,7 @@ BMenu::_track(int *action, long start)
} }
UnlockLooper(); UnlockLooper();
snooze(snoozeAmount); snooze(snoozeAmount);
} while (buttons != 0); } while (buttons != 0);