fixed a small problem with StealFocus and RestoreFocus

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@18148 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Stefano Ceccherini 2006-07-14 12:09:49 +00:00
parent 39d02f8967
commit cf2ef43abd
2 changed files with 8 additions and 4 deletions

View File

@ -493,6 +493,10 @@ BMenuBar::Track(int32 *action, int32 startIndex, bool showMenu)
void
BMenuBar::StealFocus()
{
// We already stole the focus, don't do anything
if (fPrevFocusToken != -1)
return;
BWindow *window = Window();
if (window != NULL && window->Lock()) {
BView *focus = window->CurrentFocus();
@ -515,11 +519,11 @@ BMenuBar::RestoreFocus()
BView *view = dynamic_cast<BView *>(handler);
if (view != NULL && view->Window() == window)
view->MakeFocus();
fPrevFocusToken = -1;
} else if (IsFocus())
MakeFocus(false);
fPrevFocusToken = -1;
window->Unlock();
}
}