More hacks to BWindow's mousedown handler, to fix some problems with menus. Fixes bug 610 among other things. Note: I don't like this code so much, but apparently BeOS handles it in a similar way. I accept suggestions on how to improve this.

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@17606 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Stefano Ceccherini 2006-05-27 13:00:35 +00:00
parent e061d1bae5
commit 848b89034e
2 changed files with 14 additions and 6 deletions

View File

@ -2064,8 +2064,14 @@ BMenu::OkToProceed(BMenuItem* item)
void
BMenu::QuitTracking()
{
fState = MENU_STATE_CLOSED;
if (IsStickyMode())
SetStickyMode(false);
if (fSelected != NULL)
SelectItem(NULL);
if (BMenuBar *menuBar = dynamic_cast<BMenuBar *>(this))
menuBar->RestoreFocus();
fState = MENU_STATE_CLOSED;
}

View File

@ -909,12 +909,14 @@ FrameMoved(origin);
case B_MOUSE_DOWN:
{
// Close an eventually opened menu.
if (BMenu *menu = dynamic_cast<BMenu *>(fFocus)) {
BView *view = dynamic_cast<BView *>(target);
// Close an eventually opened menu, unless the target is the menu itself
BMenu *menu = dynamic_cast<BMenu *>(fFocus);
if (menu != NULL && menu != view)
menu->QuitTracking();
}
if (BView *view = dynamic_cast<BView *>(target)) {
if (view != NULL) {
BPoint where;
msg->FindPoint("be:view_where", &where);
view->MouseDown(where);