Menus don't flicker anymore, extended some ToDos, small cleanups. Implemented BMenu::IsItemVisible() as I think I'll need it soon, extended Bmenu::OverSubmenu() to be recursive, it's not used at the moment but should be.

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@12899 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Stefano Ceccherini
2005-05-30 10:10:52 +00:00
parent 60d5a3fc59
commit 26ad9841a2
2 changed files with 56 additions and 36 deletions
+5 -6
View File
@@ -395,13 +395,14 @@ BMenuBar::Track(int32 *action, int32 startIndex, bool showMenu)
{
// TODO: This function is very incomplete and just partially working:
// For example, it doesn't respect the "sticky mode" setting.
// Cleanup
// Cleanup: We shouldn't use two nested loops. This simplifies the code
// but doesn't work well
BMenuItem *resultItem = NULL;
BWindow *window = Window();
int localAction;
bool exitLoop = false;
do {
if (window->LockLooperWithTimeout(200000) < B_OK)
if (window->LockWithTimeout(200000) < B_OK)
break;
BPoint where;
@@ -432,7 +433,7 @@ BMenuBar::Track(int32 *action, int32 startIndex, bool showMenu)
resultItem = menu->_track(&localAction, startIndex);
if (window->LockLooperWithTimeout(200000) < B_OK)
if (window->LockWithTimeout(200000) < B_OK)
break;
// the returned action is "5" when the BMenu is closed.
@@ -487,12 +488,10 @@ BMenuBar::RestoreFocus()
if (BPrivate::gDefaultTokens.GetToken(fPrevFocusToken, B_HANDLER_TOKEN,
(void **)&handler, NULL) == B_OK) {
BView *view = dynamic_cast<BView *>(handler);
// TODO: Are there other things to do in case the BHandler
// is not a BView ?
if (view != NULL)
view->MakeFocus();
}
fPrevFocusToken = NULL;
fPrevFocusToken = -1;
window->Unlock();
}
}