diff options
author | Andrei Karas <akaras@inbox.ru> | 2012-04-18 02:58:23 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2012-04-18 02:58:23 +0300 |
commit | 23f87c10db7e6b149e9e1f351e1a82516c545df7 (patch) | |
tree | a64be1829568f16108c0a39c4a9a5e3957466831 /src/gui/gui.cpp | |
parent | 0f82a8b4a599fbeb2663680deb406bbc15a67576 (diff) | |
download | plus-23f87c10db7e6b149e9e1f351e1a82516c545df7.tar.gz plus-23f87c10db7e6b149e9e1f351e1a82516c545df7.tar.bz2 plus-23f87c10db7e6b149e9e1f351e1a82516c545df7.tar.xz plus-23f87c10db7e6b149e9e1f351e1a82516c545df7.zip |
First step for dehardcode input handling in widgets.
Now widgets can check for input event.
Diffstat (limited to 'src/gui/gui.cpp')
-rw-r--r-- | src/gui/gui.cpp | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/src/gui/gui.cpp b/src/gui/gui.cpp index e45bc71c0..61e434d77 100644 --- a/src/gui/gui.cpp +++ b/src/gui/gui.cpp @@ -35,6 +35,8 @@ #include "configlistener.h" #include "configuration.h" #include "graphics.h" +#include "keyevent.h" +#include "keyinput.h" #include "logger.h" #include "resources/image.h" @@ -284,11 +286,14 @@ bool Gui::handleInput() bool Gui::handleKeyInput2() { + if (!guiInput) + return false; + bool consumed(false); while (!mInput->isKeyQueueEmpty()) { - gcn::KeyInput keyInput = mInput->dequeueKeyInput(); + KeyInput keyInput = guiInput->dequeueKeyInput2(); // Save modifiers state mShiftPressed = keyInput.isShiftPressed(); @@ -296,9 +301,10 @@ bool Gui::handleKeyInput2() mControlPressed = keyInput.isControlPressed(); mAltPressed = keyInput.isAltPressed(); - gcn::KeyEvent keyEventToGlobalKeyListeners(nullptr, + KeyEvent keyEventToGlobalKeyListeners(nullptr, mShiftPressed, mControlPressed, mAltPressed, mMetaPressed, - keyInput.getType(), keyInput.isNumericPad(), keyInput.getKey()); + keyInput.getType(), keyInput.isNumericPad(), + keyInput.getActionId(), keyInput.getKey()); distributeKeyEventToGlobalKeyListeners( keyEventToGlobalKeyListeners); @@ -318,10 +324,10 @@ bool Gui::handleKeyInput2() // Send key inputs to the focused widgets if (mFocusHandler->getFocused()) { - gcn::KeyEvent keyEvent(getKeyEventSource(), + KeyEvent keyEvent(getKeyEventSource(), mShiftPressed, mControlPressed, mAltPressed, mMetaPressed, keyInput.getType(), keyInput.isNumericPad(), - keyInput.getKey()); + keyInput.getActionId(), keyInput.getKey()); if (!mFocusHandler->getFocused()->isFocusable()) mFocusHandler->focusNone(); |