Fixed numerous problems in BWindow::_FindView:

1) If a view contained the point, but had children, that view would never be returned as a result, even if none of the children matched.
2) When converting coordinates to the child's coordinate space, it was using the bounds rectangle rather than the frame. This in most cases had the result that the coordinate was unchanged, and thus messed up the search completely.

This fixes ticket #3000.



git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@28440 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Rene Gollent
2008-11-01 20:14:56 +00:00
parent ac0a3e87f0
commit 73ca5aff45
+12 -10
View File
@@ -3507,19 +3507,21 @@ 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) && !view->fFirstChild)
return view;
BView* child = view->fFirstChild;
while (child != NULL) {
BPoint childPoint = point - child->LeftTop();
if ((view = _FindView(child, childPoint)) != NULL)
if (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;
}
}
child = child->fNextSibling;
return view;
}
return NULL;
}