From a5a4ec57c56359ee3a144d26a76d3fef8c99c286 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stephan=20A=C3=9Fmus?= Date: Tue, 4 Nov 2008 14:45:58 +0000 Subject: [PATCH] Fixed two more problems with BWindow::FindView(BPoint): * The function is not supposed to return hidden views. * After iterating over the child views, the "view" variable was clobbered, so it didn't work to return the current view if none of it's child views were hit. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@28494 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/kits/interface/Window.cpp | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/src/kits/interface/Window.cpp b/src/kits/interface/Window.cpp index 033c1ca1dc..21a8e13594 100644 --- a/src/kits/interface/Window.cpp +++ b/src/kits/interface/Window.cpp @@ -3505,21 +3505,20 @@ BView* BWindow::_FindView(BView* view, BPoint point) const { // point is assumed to be already in view's coordinates - // TODO: since BView::Bounds() potentially queries the app_server anyway, - // we could just let the app_server answer this query directly. - if (view->Bounds().Contains(point)) { + if (!view->IsHidden() && view->Bounds().Contains(point)) { if (!view->fFirstChild) return view; else { BView* child = view->fFirstChild; while (child != NULL) { BPoint childPoint = point - child->Frame().LeftTop(); - if ((view = _FindView(child, childPoint)) != NULL) - return view; - child = child->fNextSibling; + BView* subView = _FindView(child, childPoint); + if (subView != NULL) + return subView; + + child = child->fNextSibling; } } - return view; } return NULL;