diff --git a/src/kits/interface/Window.cpp b/src/kits/interface/Window.cpp index a3bc3e91c0..033c1ca1dc 100644 --- a/src/kits/interface/Window.cpp +++ b/src/kits/interface/Window.cpp @@ -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; }