Removed broken Layer::LayerAt() semantics (for recursive == false),

and introduced a RootLayer::_ChildAt() that is used instead.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@15097 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Axel Dörfler 2005-11-23 22:01:49 +00:00
parent a8d44b6fea
commit 5a67ef6634
4 changed files with 24 additions and 20 deletions

View File

@ -358,26 +358,14 @@ Layer::FindLayer(const int32 token)
\return The layer containing the point or NULL if no layer found
*/
Layer*
Layer::LayerAt(const BPoint &pt, bool recursive)
Layer::LayerAt(BPoint where)
{
//printf("%p:%s:LayerAt(x = %g, y = %g)\n", this, Name(), pt.x, pt.y);
if (!recursive) {
if (VisibleRegion().Contains(pt))
return this;
for (Layer* child = LastChild(); child; child = PreviousChild())
if (child->FullVisible().Contains(pt))
return child;
return NULL;
}
if (fVisible.Contains(pt))
if (fVisible.Contains(where))
return this;
if (fFullVisible.Contains(pt)) {
if (fFullVisible.Contains(where)) {
for (Layer* child = LastChild(); child; child = PreviousChild()) {
if (Layer* layer = child->LayerAt(pt))
if (Layer* layer = child->LayerAt(where))
return layer;
}
}

View File

@ -83,7 +83,7 @@ class Layer {
uint32 CountChildren() const;
Layer* FindLayer(const int32 token);
Layer* LayerAt(const BPoint &pt, bool recursive = true);
Layer* LayerAt(BPoint where);
virtual Layer* FirstChild() const;
virtual Layer* NextChild() const;

View File

@ -694,8 +694,7 @@ RootLayer::RevealNewWMState(Workspace::State &oldWMState)
// check to see if window count changed over states
if (oldWMState.WindowList.CountItems() != fWMState.WindowList.CountItems()) {
invalidate = true;
}
else if (memcmp(oldWMState.WindowList.Items(), fWMState.WindowList.Items(),
} else if (memcmp(oldWMState.WindowList.Items(), fWMState.WindowList.Items(),
fWMState.WindowList.CountItems()*sizeof(void*)) != 0) {
invalidate = true;
}
@ -794,6 +793,7 @@ GetDrawingEngine()->ConstrainClippingRegion(NULL);
}
}
bool
RootLayer::SetActive(WinBorder* newActive, bool activate)
{
@ -840,6 +840,21 @@ RootLayer::SetActive(WinBorder* newActive, bool activate)
}
Layer*
RootLayer::_ChildAt(BPoint where)
{
if (VisibleRegion().Contains(where))
return NULL;
for (Layer* child = LastChild(); child; child = PreviousChild()) {
if (child->FullVisible().Contains(where))
return child;
}
return NULL;
}
// #pragma mark - Input related methods
@ -852,7 +867,7 @@ RootLayer::MouseEventHandler(BMessage *event)
Layer* layer = fMouseEventLayer;
if (layer == NULL) {
layer = LayerAt(where, false);
layer = _ChildAt(where);
if (layer == NULL)
return;
}

View File

@ -133,6 +133,7 @@ friend class Desktop;
void change_winBorder_feel(WinBorder *winBorder, int32 newFeel);
void MouseEventHandler(BMessage *msg);
Layer* _ChildAt(BPoint where);
Desktop* fDesktop;
BMessage* fDragMessage;