It seemed to me that the MakeFocus() implementation was overly complicated and even incorrect (cyclic) if the view in question already had focus.

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@12619 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Stephan Aßmus 2005-05-10 11:33:14 +00:00
parent 5b5e713f82
commit 587d699c28
1 changed files with 11 additions and 9 deletions

View File

@ -1233,18 +1233,20 @@ void
BView::MakeFocus(bool focusState)
{
if (owner) {
// if a view is in focus
BView *focus = owner->CurrentFocus();
if (focus) {
owner->fFocus = NULL;
focus->MakeFocus(false);
owner->SetPreferredHandler(NULL);
}
// if we want to make this view the current focus view
// TODO: If this view has focus and focusState==false,
// will there really be no other view with focus? No
// cycling to the next one?
if (focusState) {
// if we want to make this view the current focus view
owner->fFocus = this;
owner->SetPreferredHandler(this);
} else {
// we want to unfocus this view, but only if it actually has focus
BView *focus = owner->CurrentFocus();
if (focus == this) {
owner->fFocus = NULL;
owner->SetPreferredHandler(NULL);
}
}
}
}