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
+11 -9
View File
@@ -1233,18 +1233,20 @@ void
BView::MakeFocus(bool focusState) BView::MakeFocus(bool focusState)
{ {
if (owner) { if (owner) {
// if a view is in focus // TODO: If this view has focus and focusState==false,
BView *focus = owner->CurrentFocus(); // will there really be no other view with focus? No
if (focus) { // cycling to the next one?
owner->fFocus = NULL;
focus->MakeFocus(false);
owner->SetPreferredHandler(NULL);
}
// if we want to make this view the current focus view
if (focusState) { if (focusState) {
// if we want to make this view the current focus view
owner->fFocus = this; owner->fFocus = this;
owner->SetPreferredHandler(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);
}
} }
} }
} }