summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/game.cpp3
-rw-r--r--src/gui/npcdialog.cpp5
-rw-r--r--src/gui/npcdialog.h2
3 files changed, 9 insertions, 1 deletions
diff --git a/src/game.cpp b/src/game.cpp
index 77544058..cd36dcdd 100644
--- a/src/game.cpp
+++ b/src/game.cpp
@@ -438,7 +438,8 @@ void Game::handleInput()
&& !gui->getFocusHandler()->getModalFocused())
{
NpcDialog *dialog = NpcDialog::getActive();
- if (keyboard.isKeyActive(keyboard.KEY_OK))
+ if (keyboard.isKeyActive(keyboard.KEY_OK)
+ && (!dialog || !dialog->isTextInputFocused()))
{
// Close the Browser if opened
if (helpWindow->isVisible())
diff --git a/src/gui/npcdialog.cpp b/src/gui/npcdialog.cpp
index 6d3995a7..c4128588 100644
--- a/src/gui/npcdialog.cpp
+++ b/src/gui/npcdialog.cpp
@@ -299,6 +299,11 @@ void NpcDialog::textRequest(const std::string &defaultText)
buildLayout();
}
+bool NpcDialog::isTextInputFocused() const
+{
+ return mTextField->isFocused();
+}
+
bool NpcDialog::isInputFocused() const
{
return mTextField->isFocused() || mIntField->isFocused();
diff --git a/src/gui/npcdialog.h b/src/gui/npcdialog.h
index a8521ce9..337da6f2 100644
--- a/src/gui/npcdialog.h
+++ b/src/gui/npcdialog.h
@@ -133,6 +133,8 @@ class NpcDialog : public Window, public gcn::ActionListener,
bool isInputFocused() const;
+ bool isTextInputFocused() const;
+
static bool isAnyInputFocused();
/**