aboutsummaryrefslogtreecommitdiff
path: root/dw/textblock.cc
diff options
context:
space:
mode:
authorSebastian Geerken <devnull@localhost>2014-09-25 11:39:53 +0200
committerSebastian Geerken <devnull@localhost>2014-09-25 11:39:53 +0200
commita3486120edf86a0248f0162e5cae2ab7250c9848 (patch)
tree98a079b7125debaf44e62111ac64668f2e05c8a7 /dw/textblock.cc
parentbcebc40e56a88fac5fbdd4cc04d74d53ac6ec3ff (diff)
Some work on mouse events (getWidgetAtPoint).
Diffstat (limited to 'dw/textblock.cc')
-rw-r--r--dw/textblock.cc33
1 files changed, 21 insertions, 12 deletions
diff --git a/dw/textblock.cc b/dw/textblock.cc
index df38a8e7..e914c316 100644
--- a/dw/textblock.cc
+++ b/dw/textblock.cc
@@ -2642,12 +2642,8 @@ void Textblock::breakAdded ()
* This is an optimized version of the general
* dw::core::Widget::getWidgetAtPoint method.
*/
-core::Widget *Textblock::getWidgetAtPoint (int x, int y, int level)
+core::Widget *Textblock::getWidgetAtPoint (int x, int y)
{
- //printf ("%*s-> examining the %s %p (%d, %d, %d x (%d + %d))\n",
- // 3 * level, "", getClassName (), this, allocation.x, allocation.y,
- // allocation.width, allocation.ascent, allocation.descent);
-
int lineIndex, wordIndex;
Line *line;
@@ -2658,10 +2654,16 @@ core::Widget *Textblock::getWidgetAtPoint (int x, int y, int level)
return NULL;
}
- // First, search for widgets out of flow, notably floats, since
- // there are cases where they overlap child textblocks. Should
- // later be refined using z-index.
- Widget *oofWidget = getWidgetOOFAtPoint (x, y, level);
+ // First, ...
+ if (stackingContextMgr) {
+ Widget *scmWidget = stackingContextMgr->getTopWidgetAtPoint (x, y);
+ if (scmWidget)
+ return scmWidget;
+ }
+
+ // Then, search for widgets out of flow, notably floats, since
+ // there are cases where they overlap child textblocks.
+ Widget *oofWidget = getWidgetOOFAtPoint (x, y);
if (oofWidget)
return oofWidget;
@@ -2678,9 +2680,10 @@ core::Widget *Textblock::getWidgetAtPoint (int x, int y, int level)
if (word->content.type == core::Content::WIDGET_IN_FLOW) {
core::Widget * childAtPoint;
- if (word->content.widget->wasAllocated ()) {
- childAtPoint = word->content.widget->getWidgetAtPoint (x, y,
- level + 1);
+ if (!core::StackingContextMgr::handledByStackingContextMgr
+ (word->content.widget) &&
+ word->content.widget->wasAllocated ()) {
+ childAtPoint = word->content.widget->getWidgetAtPoint (x, y);
if (childAtPoint) {
return childAtPoint;
}
@@ -2688,6 +2691,12 @@ core::Widget *Textblock::getWidgetAtPoint (int x, int y, int level)
}
}
+ if (stackingContextMgr) {
+ Widget *scmWidget = stackingContextMgr->getBottomWidgetAtPoint (x, y);
+ if (scmWidget)
+ return scmWidget;
+ }
+
return this;
}