aboutsummaryrefslogtreecommitdiff
path: root/dw
diff options
context:
space:
mode:
authorSebastian Geerken <devnull@localhost>2014-06-11 13:13:10 +0200
committerSebastian Geerken <devnull@localhost>2014-06-11 13:13:10 +0200
commit24f92f1a625dfd9631b5350a56e75205083350df (patch)
tree9aef4cb3644304e24138ac8f7ac83712a2ee485a /dw
parentf108a0bef057ca4b8c239b99ee9efd14e5d71f37 (diff)
'getWidgetAtPoint' is only called for allocated widgets.
Diffstat (limited to 'dw')
-rw-r--r--dw/layout.cc2
-rw-r--r--dw/outofflowmgr.cc19
-rw-r--r--dw/textblock.cc10
-rw-r--r--dw/widget.cc8
4 files changed, 24 insertions, 15 deletions
diff --git a/dw/layout.cc b/dw/layout.cc
index f9b3f763..1609dae0 100644
--- a/dw/layout.cc
+++ b/dw/layout.cc
@@ -1088,7 +1088,7 @@ Widget *Layout::getWidgetAtPoint (int x, int y)
{
_MSG ("------------------------------------------------------------\n");
_MSG ("widget at (%d, %d)\n", x, y);
- if (topLevel)
+ if (topLevel && topLevel->wasAllocated ())
return topLevel->getWidgetAtPoint (x, y, 0);
else
return NULL;
diff --git a/dw/outofflowmgr.cc b/dw/outofflowmgr.cc
index bbfe42e0..eb5bf3e8 100644
--- a/dw/outofflowmgr.cc
+++ b/dw/outofflowmgr.cc
@@ -1366,10 +1366,12 @@ Widget *OutOfFlowMgr::getFloatWidgetAtPoint (SortedFloatsVector *list,
for (int i = 0; i < list->size(); i++) {
// Could use binary search to be faster.
Float *vloat = list->get(i);
- Widget *childAtPoint =
- vloat->getWidget()->getWidgetAtPoint (x, y, level + 1);
- if (childAtPoint)
- return childAtPoint;
+ if (vloat->getWidget()->wasAllocated ()) {
+ Widget *childAtPoint =
+ vloat->getWidget()->getWidgetAtPoint (x, y, level + 1);
+ if (childAtPoint)
+ return childAtPoint;
+ }
}
return NULL;
@@ -1380,9 +1382,12 @@ Widget *OutOfFlowMgr::getAbsolutelyPositionedWidgetAtPoint (int x, int y,
{
for (int i = 0; i < absolutelyPositioned->size(); i++) {
AbsolutelyPositioned *abspos = absolutelyPositioned->get(i);
- Widget *childAtPoint = abspos->widget->getWidgetAtPoint (x, y, level + 1);
- if (childAtPoint)
- return childAtPoint;
+ if (abspos->widget->wasAllocated ()) {
+ Widget *childAtPoint =
+ abspos->widget->getWidgetAtPoint (x, y, level + 1);
+ if (childAtPoint)
+ return childAtPoint;
+ }
}
return NULL;
diff --git a/dw/textblock.cc b/dw/textblock.cc
index 590ffb60..beb3f3f8 100644
--- a/dw/textblock.cc
+++ b/dw/textblock.cc
@@ -2713,10 +2713,12 @@ core::Widget *Textblock::getWidgetAtPoint(int x, int y, int level)
if (word->content.type == core::Content::WIDGET_IN_FLOW) {
core::Widget * childAtPoint;
- childAtPoint = word->content.widget->getWidgetAtPoint (x, y,
- level + 1);
- if (childAtPoint) {
- return childAtPoint;
+ if (word->content.widget->wasAllocated ()) {
+ childAtPoint = word->content.widget->getWidgetAtPoint (x, y,
+ level + 1);
+ if (childAtPoint) {
+ return childAtPoint;
+ }
}
}
}
diff --git a/dw/widget.cc b/dw/widget.cc
index e6c2aa76..a3d85d0a 100644
--- a/dw/widget.cc
+++ b/dw/widget.cc
@@ -740,9 +740,11 @@ Widget *Widget::getWidgetAtPoint (int x, int y, int level)
(Content::WIDGET_IN_FLOW | Content::WIDGET_OOF_CONT),
false);
- while (childAtPoint == NULL && it->next ())
- childAtPoint = it->getContent()->widget->getWidgetAtPoint (x, y,
- level + 1);
+ while (childAtPoint == NULL && it->next ()) {
+ Widget *child = it->getContent()->widget;
+ if (child->wasAllocated ())
+ childAtPoint = child->getWidgetAtPoint (x, y, level + 1);
+ }
it->unref ();