aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--engines/glk/window_pair.cpp6
1 files changed, 4 insertions, 2 deletions
diff --git a/engines/glk/window_pair.cpp b/engines/glk/window_pair.cpp
index d571dc58e7..60d17957d0 100644
--- a/engines/glk/window_pair.cpp
+++ b/engines/glk/window_pair.cpp
@@ -245,8 +245,10 @@ void PairWindow::setArrangement(uint method, uint size, Window *keyWin) {
}
void PairWindow::click(const Point &newPos) {
- for (int ctr = 0, idx = (_backward ? (int)_children.size() - 1 : 0); ctr < (int)_children.size();
- ++ctr, idx += (_backward ? -1 : 1)) {
+ // Note in case windows are partially overlapping, we want the top-most window to get the click.
+ // WHich is why we recurse in the opposite of the rendering direction (as the _backward flag) indicates
+ for (int ctr = 0, idx = (!_backward ? (int)_children.size() - 1 : 0); ctr < (int)_children.size();
+ ++ctr, idx += (!_backward ? -1 : 1)) {
Window *w = _children[idx];
if (w->_bbox.contains(newPos))
w->click(newPos);