From 1931eb352bd6db3e12285d7fde1e1be886fefa11 Mon Sep 17 00:00:00 2001 From: Bjørn Lindeijer Date: Sun, 10 May 2009 12:06:16 +0200 Subject: Don't show the chat input when a modal widget has focus For example, the chat input would become visible when using Enter to confirm the exit dialog. --- src/game.cpp | 8 ++++++-- src/gui/gui.h | 3 +++ 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/src/game.cpp b/src/game.cpp index 203629ff..d3ca2e7c 100644 --- a/src/game.cpp +++ b/src/game.cpp @@ -87,6 +87,7 @@ #include "utils/gettext.h" #include +#include #include #include @@ -544,11 +545,13 @@ void Game::handleInput() } } - if (!(chatWindow->isInputFocused() || deathNotice || weightNotice)) + if (!chatWindow->isInputFocused() + && !gui->getFocusHandler()->getModalFocused()) + { if (keyboard.isKeyActive(keyboard.KEY_OK)) { #ifdef TMWSERV_SUPPORT - // Don not focus chat input when quit dialog is active + // Do not focus chat input when quit dialog is active if (quitDialog != NULL && quitDialog->isVisible()) continue; #else @@ -579,6 +582,7 @@ void Game::handleInput() if (chatWindow->requestChatFocus()) used = true; } + } if (!chatWindow->isInputFocused() || (event.key.keysym.mod & KMOD_ALT)) diff --git a/src/gui/gui.h b/src/gui/gui.h index e4e83468..c7b9bbfa 100644 --- a/src/gui/gui.h +++ b/src/gui/gui.h @@ -70,6 +70,9 @@ class Gui : public gcn::Gui */ void draw(); + gcn::FocusHandler *getFocusHandler() const + { return mFocusHandler; } + /** * Return game font. */ -- cgit v1.2.3-60-g2f50