aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSebastian Geerken <devnull@localhost>2014-10-25 13:58:18 +0200
committerSebastian Geerken <devnull@localhost>2014-10-25 13:58:18 +0200
commitb93f16f2d770309eb49d9a3275a42e294a164f1a (patch)
tree9ca970199824b59bcb1aeea2bbd9cf75f1ff9bd8
parentdcf6e00e9b790e0868d8863f140567eef5e540c1 (diff)
Fixed problems with getWidgetAtPoint.
-rw-r--r--dw/iterator.cc6
-rw-r--r--dw/iterator.hh1
-rw-r--r--dw/oofawarewidget.cc18
-rw-r--r--dw/stackingcontextmgr.cc2
4 files changed, 26 insertions, 1 deletions
diff --git a/dw/iterator.cc b/dw/iterator.cc
index 92a028d0..fccd4c1a 100644
--- a/dw/iterator.cc
+++ b/dw/iterator.cc
@@ -955,5 +955,11 @@ void StackingIteratorStack::backward ()
topPos--;
}
+void StackingIteratorStack::cleanup ()
+{
+ while (!atRealTop ())
+ vector->remove (vector->size () - 1);
+}
+
} // namespace core
} // namespace dw
diff --git a/dw/iterator.hh b/dw/iterator.hh
index 773cf303..acef26da 100644
--- a/dw/iterator.hh
+++ b/dw/iterator.hh
@@ -285,6 +285,7 @@ public:
void pop ();
void forward ();
void backward ();
+ void cleanup ();
};
} // namespace core
diff --git a/dw/oofawarewidget.cc b/dw/oofawarewidget.cc
index c31aa83a..2c7afd1f 100644
--- a/dw/oofawarewidget.cc
+++ b/dw/oofawarewidget.cc
@@ -532,6 +532,24 @@ Widget *OOFAwareWidget::getWidgetAtPoint (int x, int y,
// Continue with the current state of "iterator".
*interruptedWidget = NULL;
DBG_OBJ_MSG ("events", 1, "done with interruption");
+
+ // The interrupted widget may have returned non-NULL. In this
+ // case, the stack must be cleaned up explicitly, which would
+ // otherwise be done implicitly during the further search.
+ // (Since drawing is never quit completely, this problem only
+ // applies to searching.)
+ if (widgetAtPoint) {
+ iteratorStack->cleanup ();
+
+ DBG_IF_RTFL {
+ StringBuffer sb;
+ iteratorStack->intoStringBuffer (&sb);
+ DBG_OBJ_MSGF ("events", 2,
+ "iteratorStack after cleanup: %s",
+ sb.getChars ());
+ }
+ }
+
}
} else {
OOFStackingIterator* osi =
diff --git a/dw/stackingcontextmgr.cc b/dw/stackingcontextmgr.cc
index 9f8747f9..cbdef129 100644
--- a/dw/stackingcontextmgr.cc
+++ b/dw/stackingcontextmgr.cc
@@ -172,7 +172,7 @@ Widget *StackingContextMgr::getWidgetAtPoint (int x, int y,
int startZIndex, int endZIndex,
int *index)
{
- DBG_OBJ_ENTER ("events", 0, "getWidgetAtPointBottom", "%d, %d", x, y);
+ DBG_OBJ_ENTER ("events", 0, "getWidgetAtPoint", "%d, %d", x, y);
Widget *widgetAtPoint = NULL;