From 5e4a1bf239d76a5525a4409dc7a2094fbffe0eb3 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Tue, 3 Apr 2012 01:29:22 +0300 Subject: Put gui input logic before most game input logic. This solving game and gui shortcuts conflicts. --- src/guichan/gui.cpp | 78 ----------------------------------------------------- 1 file changed, 78 deletions(-) (limited to 'src/guichan') diff --git a/src/guichan/gui.cpp b/src/guichan/gui.cpp index 5a3e16784..bd811014f 100644 --- a/src/guichan/gui.cpp +++ b/src/guichan/gui.cpp @@ -128,22 +128,6 @@ namespace gcn void Gui::logic() { - if (!mTop) - throw GCN_EXCEPTION("No top widget set"); - - handleModalFocus(); - handleModalMouseInputFocus(); - - if (mInput) - { - mInput->_pollInput(); - - handleKeyInput(); - handleMouseInput(); - - } // end if - - mTop->logic(); } void Gui::draw() @@ -241,68 +225,6 @@ namespace gcn void Gui::handleKeyInput() { - while (!mInput->isKeyQueueEmpty()) - { - KeyInput keyInput = mInput->dequeueKeyInput(); - - // Save modifiers state - mShiftPressed = keyInput.isShiftPressed(); - mMetaPressed = keyInput.isMetaPressed(); - mControlPressed = keyInput.isControlPressed(); - mAltPressed = keyInput.isAltPressed(); - - KeyEvent keyEventToGlobalKeyListeners(nullptr, - mShiftPressed, - mControlPressed, - mAltPressed, - mMetaPressed, - keyInput.getType(), - keyInput.isNumericPad(), - keyInput.getKey()); - - distributeKeyEventToGlobalKeyListeners( - keyEventToGlobalKeyListeners); - - // If a global key listener consumes the event it will not be - // sent further to the source of the event. - if (keyEventToGlobalKeyListeners.isConsumed()) - continue; - - bool keyEventConsumed = false; - - // Send key inputs to the focused widgets - if (mFocusHandler->getFocused()) - { - KeyEvent keyEvent(getKeyEventSource(), - mShiftPressed, - mControlPressed, - mAltPressed, - mMetaPressed, - keyInput.getType(), - keyInput.isNumericPad(), - keyInput.getKey()); - - if (!mFocusHandler->getFocused()->isFocusable()) - mFocusHandler->focusNone(); - else - distributeKeyEvent(keyEvent); - - keyEventConsumed = keyEvent.isConsumed(); - } - - // If the key event hasn't been consumed and - // tabbing is enable check for tab press and - // change focus. - if (!keyEventConsumed && mTabbing - && keyInput.getKey().getValue() == Key::TAB - && keyInput.getType() == KeyInput::PRESSED) - { - if (keyInput.isShiftPressed()) - mFocusHandler->tabPrevious(); - else - mFocusHandler->tabNext(); - } - } // end while } void Gui::handleMouseMoved(const MouseInput& mouseInput) -- cgit v1.2.3-60-g2f50