From 587d699c28e9c2234114702b92f46db361625e12 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stephan=20A=C3=9Fmus?= Date: Tue, 10 May 2005 11:33:14 +0000 Subject: [PATCH] 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 --- src/kits/interface/View.cpp | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/src/kits/interface/View.cpp b/src/kits/interface/View.cpp index 8c2446846d..a3f5b539f2 100644 --- a/src/kits/interface/View.cpp +++ b/src/kits/interface/View.cpp @@ -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); + } } } }