diff options
author | Andrei Karas <akaras@inbox.ru> | 2012-05-30 19:19:58 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2012-05-30 19:19:58 +0300 |
commit | a8b1e41599fd1f18fccc8f34ddca2bca33c4bf4f (patch) | |
tree | c30c586086c1b9797a0b59a420dcdd68d71edb43 /src/gui/widgets/textfield.cpp | |
parent | 4c1ecb78ef90c709acad9023cfd7a13e9f1a1814 (diff) | |
download | mv-a8b1e41599fd1f18fccc8f34ddca2bca33c4bf4f.tar.gz mv-a8b1e41599fd1f18fccc8f34ddca2bca33c4bf4f.tar.bz2 mv-a8b1e41599fd1f18fccc8f34ddca2bca33c4bf4f.tar.xz mv-a8b1e41599fd1f18fccc8f34ddca2bca33c4bf4f.zip |
Fix key handling conflict issue in login dialog.
Diffstat (limited to 'src/gui/widgets/textfield.cpp')
-rw-r--r-- | src/gui/widgets/textfield.cpp | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/src/gui/widgets/textfield.cpp b/src/gui/widgets/textfield.cpp index 99cc93fd1..4f8f0d093 100644 --- a/src/gui/widgets/textfield.cpp +++ b/src/gui/widgets/textfield.cpp @@ -206,6 +206,9 @@ void TextField::keyPressed(gcn::KeyEvent &keyEvent) buf[1] = 0; mText.insert(mCaretPosition, std::string(buf)); mCaretPosition += 1; + keyEvent.consume(); + logger->log("TextField::keyPressed1"); + return; } } else if (!mMaximum || mText.size() < mMaximum) @@ -233,6 +236,8 @@ void TextField::keyPressed(gcn::KeyEvent &keyEvent) mText.insert(mCaretPosition, std::string(buf, buf + len)); mCaretPosition += len; + keyEvent.consume(); + return; } } @@ -362,6 +367,7 @@ void TextField::keyPressed(gcn::KeyEvent &keyEvent) { case Input::KEY_GUI_LEFT: { + consumed = true; while (mCaretPosition > 0) { --mCaretPosition; @@ -373,6 +379,7 @@ void TextField::keyPressed(gcn::KeyEvent &keyEvent) case Input::KEY_GUI_RIGHT: { + consumed = true; unsigned sz = static_cast<unsigned>(mText.size()); while (mCaretPosition < sz) { @@ -388,6 +395,7 @@ void TextField::keyPressed(gcn::KeyEvent &keyEvent) case Input::KEY_GUI_DELETE: { + consumed = true; unsigned sz = static_cast<unsigned>(mText.size()); while (mCaretPosition < sz) { @@ -403,6 +411,7 @@ void TextField::keyPressed(gcn::KeyEvent &keyEvent) } case Input::KEY_GUI_BACKSPACE: + consumed = true; deleteCharLeft(mText, &mCaretPosition); break; @@ -414,15 +423,18 @@ void TextField::keyPressed(gcn::KeyEvent &keyEvent) case Input::KEY_GUI_HOME: mCaretPosition = 0; + consumed = true; break; case Input::KEY_GUI_END: mCaretPosition = static_cast<unsigned>(mText.size()); + consumed = true; break; case Input::KEY_GUI_TAB: if (mLoseFocusOnTab) return; + consumed = true; break; default: @@ -432,7 +444,8 @@ void TextField::keyPressed(gcn::KeyEvent &keyEvent) if (mSendAlwaysEvents) distributeActionEvent(); - keyEvent.consume(); + if (consumed) + keyEvent.consume(); fixScroll(); } |