summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/client.cpp3
-rw-r--r--src/inputmanager.cpp21
-rw-r--r--src/inputmanager.h2
3 files changed, 19 insertions, 7 deletions
diff --git a/src/client.cpp b/src/client.cpp
index 12415c6e4..a7ee6a32c 100644
--- a/src/client.cpp
+++ b/src/client.cpp
@@ -857,6 +857,9 @@ int Client::gameExec()
break;
case SDL_KEYDOWN:
+ inputManager.handleAssignKey(event);
+ break;
+
default:
break;
diff --git a/src/inputmanager.cpp b/src/inputmanager.cpp
index cc45a79cf..22af8438c 100644
--- a/src/inputmanager.cpp
+++ b/src/inputmanager.cpp
@@ -361,18 +361,25 @@ void InputManager::unassignKey()
keyboard.update();
}
+bool InputManager::handleAssignKey(const SDL_Event &event)
+{
+ if (setupWindow && setupWindow->isVisible() &&
+ getNewKeyIndex() > Input::KEY_NO_VALUE)
+ {
+ setNewKey(event);
+ callbackNewKey();
+ setNewKeyIndex(Input::KEY_NO_VALUE);
+ return true;
+ }
+ return false;
+}
+
bool InputManager::handleEvent(const SDL_Event &event)
{
if (event.type == SDL_KEYDOWN)
{
- if (setupWindow && setupWindow->isVisible() &&
- getNewKeyIndex() > Input::KEY_NO_VALUE)
- {
- setNewKey(event);
- callbackNewKey();
- setNewKeyIndex(Input::KEY_NO_VALUE);
+ if (handleAssignKey(event))
return true;
- }
// send straight to gui for certain windows
if (quitDialog || TextDialog::isActive() ||
diff --git a/src/inputmanager.h b/src/inputmanager.h
index 0efe2d85e..0c78e1e09 100644
--- a/src/inputmanager.h
+++ b/src/inputmanager.h
@@ -139,6 +139,8 @@ class InputManager
bool invokeKey(const KeyData *key, int keyNum, int mask);
+ bool handleAssignKey(const SDL_Event &event);
+
protected:
Setup_Keyboard *mSetupKey; /**< Reference to setup window */