Apply the patch from Pete Goodeve from #7165 and therefore fix that ticket.

Instead of forcing a click to open rect this just restarts menu tracking if the
mouse was clicked. It seems to work great and is cleaner than my solution which
is removed in this commit as well.

This still fixes the problem of accidentially selecting menu items but also
maintains the API.

Good job Pete!


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@40306 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Ryan Leavengood
2011-01-28 05:31:40 +00:00
parent 91f0846f8a
commit f71910c068
+9 -12
View File
@@ -317,18 +317,6 @@ BMenuItem *
BPopUpMenu::_Go(BPoint where, bool autoInvoke, bool startOpened,
BRect *_specialRect, bool async)
{
// Force start opened. This is just better behavior.
startOpened = true;
BRect clickToOpenRect;
// If no click to open rect was provided make one around the opening
// point.
if (startOpened && _specialRect == NULL) {
clickToOpenRect.Set(where.x, where.y, where.x, where.y);
clickToOpenRect.InsetBy(-2, -2);
_specialRect = &clickToOpenRect;
}
if (fTrackThread >= B_OK) {
// we already have an active menu, wait for it to go away before
@@ -430,10 +418,19 @@ BPopUpMenu::_StartTrack(BPoint where, bool autoInvoke, bool startOpened, BRect *
// called by BMenu::Track()
fUseWhere = true;
// Determine when mouse-down-up will be taken as a 'press', rather than a 'click'
bigtime_t clickMaxTime = 0;
get_click_speed(&clickMaxTime);
clickMaxTime += system_time();
// Show the menu's window
Show();
snooze(50000);
BMenuItem *result = Track(startOpened, _specialRect);
// If it was a click, keep the menu open and tracking
if (system_time() <= clickMaxTime)
result = Track(true, _specialRect);
if (result != NULL && autoInvoke)
result->Invoke();