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
This commit is contained in:
Stephan Aßmus 2008-11-04 14:45:58 +00:00
parent 6427c2e3fc
commit a5a4ec57c5

View File

@ -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;