From 23f87c10db7e6b149e9e1f351e1a82516c545df7 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Wed, 18 Apr 2012 02:58:23 +0300 Subject: First step for dehardcode input handling in widgets. Now widgets can check for input event. --- src/gui/gui.cpp | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) (limited to 'src/gui/gui.cpp') 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(); -- cgit v1.2.3-70-g09d2