Revert my hack from r40132 and just go ahead and fix our pop-up menu behavior
by forcing openAnyway and creating a clickToOpen rect if there is not one. Should fix #7022 and maybe others. Partially based on the patch from #7022 and Travis Reed's patch from the mailing list discussion in December. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@40142 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -1563,20 +1563,9 @@ BMenu::_Track(int* action, long start)
|
|||||||
fSuper->fState = MENU_STATE_TRACKING_SUBMENU;
|
fSuper->fState = MENU_STATE_TRACKING_SUBMENU;
|
||||||
|
|
||||||
BPoint location;
|
BPoint location;
|
||||||
BPoint screenLocation;
|
|
||||||
uint32 buttons = 0;
|
uint32 buttons = 0;
|
||||||
bool openedUnderMouse = false;
|
|
||||||
if (LockLooper()) {
|
if (LockLooper()) {
|
||||||
GetMouse(&location, &buttons);
|
GetMouse(&location, &buttons);
|
||||||
|
|
||||||
// If the menu has opened underneath the mouse we will not invoke or return
|
|
||||||
// the selected item unless the mouse is moved. This only applies if there
|
|
||||||
// is no parent menu.
|
|
||||||
if (fSuper == NULL) {
|
|
||||||
screenLocation = ConvertToScreen(location);
|
|
||||||
openedUnderMouse = Window()->Frame().Contains(screenLocation);
|
|
||||||
}
|
|
||||||
|
|
||||||
UnlockLooper();
|
UnlockLooper();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1589,7 +1578,7 @@ BMenu::_Track(int* action, long start)
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
BMenuWindow* window = static_cast<BMenuWindow*>(Window());
|
BMenuWindow* window = static_cast<BMenuWindow*>(Window());
|
||||||
screenLocation = ConvertToScreen(location);
|
BPoint screenLocation = ConvertToScreen(location);
|
||||||
if (window->CheckForScrolling(screenLocation)) {
|
if (window->CheckForScrolling(screenLocation)) {
|
||||||
UnlockLooper();
|
UnlockLooper();
|
||||||
continue;
|
continue;
|
||||||
@@ -1601,8 +1590,7 @@ BMenu::_Track(int* action, long start)
|
|||||||
// then if the menu is inside this menu,
|
// then if the menu is inside this menu,
|
||||||
// then if it's over a super menu.
|
// then if it's over a super menu.
|
||||||
bool overSub = _OverSubmenu(fSelected, screenLocation);
|
bool overSub = _OverSubmenu(fSelected, screenLocation);
|
||||||
if (!openedUnderMouse)
|
item = _HitTestItems(location, B_ORIGIN);
|
||||||
item = _HitTestItems(location, B_ORIGIN);
|
|
||||||
if (overSub) {
|
if (overSub) {
|
||||||
navAreaRectAbove = BRect();
|
navAreaRectAbove = BRect();
|
||||||
navAreaRectBelow = BRect();
|
navAreaRectBelow = BRect();
|
||||||
@@ -1682,7 +1670,6 @@ BMenu::_Track(int* action, long start)
|
|||||||
releasedOnce = true;
|
releasedOnce = true;
|
||||||
location = newLocation;
|
location = newLocation;
|
||||||
buttons = newButtons;
|
buttons = newButtons;
|
||||||
openedUnderMouse = false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (releasedOnce)
|
if (releasedOnce)
|
||||||
|
|||||||
@@ -317,6 +317,19 @@ BMenuItem *
|
|||||||
BPopUpMenu::_Go(BPoint where, bool autoInvoke, bool startOpened,
|
BPopUpMenu::_Go(BPoint where, bool autoInvoke, bool startOpened,
|
||||||
BRect *_specialRect, bool async)
|
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) {
|
if (fTrackThread >= B_OK) {
|
||||||
// we already have an active menu, wait for it to go away before
|
// we already have an active menu, wait for it to go away before
|
||||||
// spawning another
|
// spawning another
|
||||||
|
|||||||
Reference in New Issue
Block a user