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