From 826ea6b6f1e5be7ea225b537275dff539934bda1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stephan=20A=C3=9Fmus?= Date: Wed, 9 Jan 2008 11:37:05 +0000 Subject: [PATCH] * the change to support B_DRAW_ON_CHILDREN broke ViewLayer::ViewAt(), ie mouse events would not be passed to the correct children of views with B_DRAW_ON_CHILDREN flag set -> fixed. (fixes #1673) git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@23300 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/servers/app/ViewLayer.cpp | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/src/servers/app/ViewLayer.cpp b/src/servers/app/ViewLayer.cpp index 743711b25e..6a35821ce7 100644 --- a/src/servers/app/ViewLayer.cpp +++ b/src/servers/app/ViewLayer.cpp @@ -340,14 +340,27 @@ ViewLayer::ViewAt(const BPoint& where, BRegion* windowContentClipping) if (!fVisible) return NULL; - if (ScreenClipping(windowContentClipping).Contains(where)) - return this; + // NOTE: if this view can draw on children, it's screen clipping + // excludes these children, so we need to ask those first if they + // contain "where", otherwise we check the screen clipping before + // recursing into the children + + if (!(fFlags & B_DRAW_ON_CHILDREN)) { + if (ScreenClipping(windowContentClipping).Contains(where)) + return this; + } for (ViewLayer* child = FirstChild(); child; child = child->NextSibling()) { ViewLayer* layer = child->ViewAt(where, windowContentClipping); if (layer) return layer; } + + if (fFlags & B_DRAW_ON_CHILDREN) { + if (ScreenClipping(windowContentClipping).Contains(where)) + return this; + } + return NULL; }