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:
parent
a8d44b6fea
commit
5a67ef6634
@ -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;
|
||||
}
|
||||
}
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -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;
|
||||
|
Loading…
x
Reference in New Issue
Block a user