diff --git a/gui/widget.cpp b/gui/widget.cpp index 1dfd069f29b..2ac73dd4ca8 100644 --- a/gui/widget.cpp +++ b/gui/widget.cpp @@ -748,7 +748,10 @@ bool ContainerWidget::containsWidget(Widget *w) const { } Widget *ContainerWidget::findWidget(int x, int y) { - return findWidgetInChain(_firstWidget, x, y); + Widget *w = findWidgetInChain(_firstWidget, x, y); + if (w) + return w; + return this; } void ContainerWidget::removeWidget(Widget *widget) { diff --git a/gui/widgets/scrollcontainer.cpp b/gui/widgets/scrollcontainer.cpp index 7994c0078d9..33f7e7f7545 100644 --- a/gui/widgets/scrollcontainer.cpp +++ b/gui/widgets/scrollcontainer.cpp @@ -153,7 +153,10 @@ bool ScrollContainerWidget::containsWidget(Widget *w) const { Widget *ScrollContainerWidget::findWidget(int x, int y) { if (_verticalScroll->isVisible() && x >= _w - _verticalScroll->getWidth()) return _verticalScroll; - return Widget::findWidgetInChain(_firstWidget, x + _scrolledX, y + _scrolledY); + Widget *w = Widget::findWidgetInChain(_firstWidget, x + _scrolledX, y + _scrolledY); + if (w) + return w; + return this; } Common::Rect ScrollContainerWidget::getClipRect() const {