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:
@@ -2064,8 +2064,14 @@ BMenu::OkToProceed(BMenuItem* item)
|
|||||||
void
|
void
|
||||||
BMenu::QuitTracking()
|
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;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -909,12 +909,14 @@ FrameMoved(origin);
|
|||||||
|
|
||||||
case B_MOUSE_DOWN:
|
case B_MOUSE_DOWN:
|
||||||
{
|
{
|
||||||
// Close an eventually opened menu.
|
BView *view = dynamic_cast<BView *>(target);
|
||||||
if (BMenu *menu = dynamic_cast<BMenu *>(fFocus)) {
|
|
||||||
|
// 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();
|
menu->QuitTracking();
|
||||||
}
|
|
||||||
|
if (view != NULL) {
|
||||||
if (BView *view = dynamic_cast<BView *>(target)) {
|
|
||||||
BPoint where;
|
BPoint where;
|
||||||
msg->FindPoint("be:view_where", &where);
|
msg->FindPoint("be:view_where", &where);
|
||||||
view->MouseDown(where);
|
view->MouseDown(where);
|
||||||
|
|||||||
Reference in New Issue
Block a user