From d33ed5923ab5336005257203d21ddcb3d37d0ff8 Mon Sep 17 00:00:00 2001 From: Tametomo Date: Thu, 16 Jul 2009 08:53:08 -0600 Subject: Remove focus from a window's internal widgets on hiding. Signed-off-by: Tametomo --- src/gui/widgets/window.cpp | 9 +++++++++ src/gui/widgets/window.h | 2 +- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/src/gui/widgets/window.cpp b/src/gui/widgets/window.cpp index d4ecf75d..59ec8939 100644 --- a/src/gui/widgets/window.cpp +++ b/src/gui/widgets/window.cpp @@ -35,6 +35,7 @@ #include "resources/image.h" #include +#include int Window::instances = 0; int Window::mouseResize = 0; @@ -285,6 +286,14 @@ void Window::widgetHidden(const gcn::Event &event) { gui->setCursorType(Gui::CURSOR_POINTER); } + + WidgetListIterator it; + + for (it = mWidgets.begin(); it != mWidgets.end(); it++) + { + if (mFocusHandler->isFocused(*it)) + mFocusHandler->focusNone(); + } } void Window::setCloseButton(bool flag) diff --git a/src/gui/widgets/window.h b/src/gui/widgets/window.h index 37a6b1eb..5df431a3 100644 --- a/src/gui/widgets/window.h +++ b/src/gui/widgets/window.h @@ -105,7 +105,7 @@ class Window : public gcn::Window, gcn::WidgetListener /** * Called whenever the widget is hidden. */ - void widgetHidden(const gcn::Event &event); + virtual void widgetHidden(const gcn::Event& event); /** * Sets whether or not the window has a close button. -- cgit v1.2.3-70-g09d2