From ea021c679f588e6f8b8b658e6d39067c05725120 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stephan=20A=C3=9Fmus?= Date: Tue, 22 Jul 2008 10:50:34 +0000 Subject: [PATCH] Clicking on a menu item that already has an open submenu will close the sub menu and quit menu tracking. This closes #1826. I tested a bit with various different menu situations and there seem to be no negative side effects. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@26561 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/kits/interface/MenuBar.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/kits/interface/MenuBar.cpp b/src/kits/interface/MenuBar.cpp index 723ac4471f..38b817a493 100644 --- a/src/kits/interface/MenuBar.cpp +++ b/src/kits/interface/MenuBar.cpp @@ -549,9 +549,12 @@ BMenuBar::_Track(int32 *action, int32 startIndex, bool showMenu) buttons = newButtons; if (buttons != 0 && _IsStickyMode()) { - if (menuItem == NULL) + if (menuItem == NULL + || (menuItem->Submenu() && menuItem->Submenu()->Window())) { + // clicked outside menu bar or on item with already + // open sub menu fState = MENU_STATE_CLOSED; - else + } else _SetStickyMode(false); } else if (buttons == 0 && !_IsStickyMode()) { if ((fSelected != NULL && fSelected->Submenu() == NULL)