diff options
Diffstat (limited to 'dw/oofawarewidget.cc')
-rw-r--r-- | dw/oofawarewidget.cc | 52 |
1 files changed, 50 insertions, 2 deletions
diff --git a/dw/oofawarewidget.cc b/dw/oofawarewidget.cc index 62a1e8d6..99f297ff 100644 --- a/dw/oofawarewidget.cc +++ b/dw/oofawarewidget.cc @@ -255,12 +255,12 @@ void OOFAwareWidget::drawOOF (View *view, Rectangle *area) outOfFlowMgr[i]->draw(view, area); } -Widget *OOFAwareWidget::getWidgetOOFAtPoint (int x, int y, int level) +Widget *OOFAwareWidget::getWidgetOOFAtPoint (int x, int y) { for (int i = 0; i < NUM_OOFM; i++) { Widget *oofWidget = outOfFlowMgr[i] ? - outOfFlowMgr[i]->getWidgetAtPoint (x, y, level) : NULL; + outOfFlowMgr[i]->getWidgetAtPoint (x, y) : NULL; if (oofWidget) return oofWidget; } @@ -299,6 +299,54 @@ void OOFAwareWidget::removeChild (Widget *child) assert (isWidgetOOF (child)); } +core::Widget *OOFAwareWidget::getWidgetAtPoint (int x, int y) +{ + if (x >= allocation.x && + y >= allocation.y && + x <= allocation.x + allocation.width && + y <= allocation.y + getHeight ()) { + + if (stackingContextMgr) { + Widget *scmWidget = + stackingContextMgr->getTopWidgetAtPoint (x, y); + if (scmWidget) + return scmWidget; + } + + Widget *oofWidget = getWidgetOOFAtPoint (x, y); + if (oofWidget) + return oofWidget; + + Widget *childAtPoint = NULL; + Iterator *it = + iterator ((Content::Type) + (Content::WIDGET_IN_FLOW | Content::WIDGET_OOF_CONT), + false); + + while (childAtPoint == NULL && it->next ()) { + Widget *child = it->getContent()->widget; + if (!StackingContextMgr::handledByStackingContextMgr (child) && + child->wasAllocated ()) + childAtPoint = child->getWidgetAtPoint (x, y); + } + + it->unref (); + + if (childAtPoint) + return childAtPoint; + + if (stackingContextMgr) { + Widget *scmWidget = + stackingContextMgr->getBottomWidgetAtPoint (x, y); + if (scmWidget) + return scmWidget; + } + + return this; + } else + return NULL; +} + void OOFAwareWidget::borderChanged (int y, Widget *vloat) { assertNotReached (); |