diff options
author | Andrei Karas <akaras@inbox.ru> | 2014-03-07 17:06:23 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2014-03-07 17:06:23 +0300 |
commit | a225638721d2bba53c15379d48ddab04d7568e24 (patch) | |
tree | 1c357290f2525a247a40fb5a887fddfe0728768d /src/gui | |
parent | d2b06398ce43e1ad46078571b41d05df7c1d344b (diff) | |
download | manaplus-a225638721d2bba53c15379d48ddab04d7568e24.tar.gz manaplus-a225638721d2bba53c15379d48ddab04d7568e24.tar.bz2 manaplus-a225638721d2bba53c15379d48ddab04d7568e24.tar.xz manaplus-a225638721d2bba53c15379d48ddab04d7568e24.zip |
Remove unused events flags.
Diffstat (limited to 'src/gui')
-rw-r--r-- | src/gui/gui.cpp | 27 | ||||
-rw-r--r-- | src/gui/gui.h | 10 | ||||
-rw-r--r-- | src/gui/sdlinput.cpp | 12 | ||||
-rw-r--r-- | src/gui/viewport.cpp | 4 |
4 files changed, 8 insertions, 45 deletions
diff --git a/src/gui/gui.cpp b/src/gui/gui.cpp index 0b0290be4..d5fbd6e86 100644 --- a/src/gui/gui.cpp +++ b/src/gui/gui.cpp @@ -87,6 +87,7 @@ #include "listeners/keylistener.h" #include "listeners/mouselistener.h" +#include "input/inputmanager.h" #include "input/keydata.h" #include "input/keyinput.h" #include "input/mouseinput.h" @@ -141,10 +142,6 @@ Gui::Gui() : mInput(nullptr), mFocusHandler(new FocusHandler), mKeyListeners(), - mShiftPressed(false), - mMetaPressed(false), - mControlPressed(false), - mAltPressed(false), mLastMousePressButton(0), mLastMousePressTimeStamp(0), mLastMouseX(0), @@ -428,15 +425,8 @@ bool Gui::handleKeyInput() { const KeyInput keyInput = guiInput->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.getType(), keyInput.getActionId(), keyInput.getKey()); #ifdef USE_SDL2 @@ -463,8 +453,7 @@ bool Gui::handleKeyInput() if (mFocusHandler->getFocused()) { KeyEvent keyEvent(getKeyEventSource(), - mShiftPressed, mControlPressed, mAltPressed, mMetaPressed, - keyInput.getType(), keyInput.isNumericPad(), + keyInput.getType(), keyInput.getActionId(), keyInput.getKey()); #ifdef USE_SDL2 if (!keyInput.getText().empty()) @@ -488,7 +477,7 @@ bool Gui::handleKeyInput() == static_cast<int>(Input::KEY_GUI_TAB) && keyInput.getType() == KeyInput::PRESSED) { - if (keyInput.isShiftPressed()) + if (inputManager.isActionActive(Input::KEY_GUI_MOD)) mFocusHandler->tabPrevious(); else mFocusHandler->tabNext(); @@ -852,8 +841,8 @@ void Gui::distributeMouseEvent(Widget* source, int type, int button, return; } - MouseEvent mouseEvent(source, mShiftPressed, mControlPressed, - mAltPressed, mMetaPressed, type, button, + MouseEvent mouseEvent(source, + type, button, x, y, mClickCount); Widget* parent = source; @@ -965,8 +954,8 @@ MouseEvent *Gui::createMouseEvent(Window *const widget) getAbsolutePosition(widget, x, y); getMouseState(&mouseX, &mouseY); - return new MouseEvent(widget, mShiftPressed, - mControlPressed, mAltPressed, mMetaPressed, 0, 0, + return new MouseEvent(widget, + 0, 0, mouseX - x, mouseY - y, mClickCount); } diff --git a/src/gui/gui.h b/src/gui/gui.h index 85388b8c4..fdd9eaaec 100644 --- a/src/gui/gui.h +++ b/src/gui/gui.h @@ -446,16 +446,6 @@ class Gui final KeyListenerList mKeyListeners; /** - * True if shift is pressed, false otherwise. - */ - bool mShiftPressed; - - /** - * True if meta is pressed, false otherwise. - */ - bool mMetaPressed; - - /** * True if control is pressed, false otherwise. */ bool mControlPressed; diff --git a/src/gui/sdlinput.cpp b/src/gui/sdlinput.cpp index b0ac7d613..c1e02e9b2 100644 --- a/src/gui/sdlinput.cpp +++ b/src/gui/sdlinput.cpp @@ -303,18 +303,6 @@ void SDLInput::pushInput(const SDL_Event &event) void SDLInput::convertKeyEventToKey(const SDL_Event &event, KeyInput &keyInput) { keyInput.setKey(Key(convertKeyCharacter(event))); - keyInput.setShiftPressed(event.key.keysym.mod & KMOD_SHIFT); - keyInput.setControlPressed(event.key.keysym.mod & KMOD_CTRL); - keyInput.setAltPressed(event.key.keysym.mod & KMOD_ALT); - keyInput.setMetaPressed(event.key.keysym.mod & KMOD_META); -#ifdef USE_SDL2 - const int code = event.key.keysym.scancode; - keyInput.setNumericPad((code >= SDL_SCANCODE_KP_DIVIDE - && code <= SDL_SCANCODE_KP_PERIOD) || code == SDL_SCANCODE_KP_EQUALS); -#else - const int code = event.key.keysym.sym; - keyInput.setNumericPad(code >= SDLK_KP0 && code <= SDLK_KP_EQUALS); -#endif const int actionId = inputManager.getActionByKey(event); if (actionId >= 0) keyInput.setActionId(actionId); diff --git a/src/gui/viewport.cpp b/src/gui/viewport.cpp index 96760f8c7..7ae209b92 100644 --- a/src/gui/viewport.cpp +++ b/src/gui/viewport.cpp @@ -281,10 +281,6 @@ void Viewport::_followMouse() { // We create a mouse event and send it to mouseDragged. MouseEvent mouseEvent(nullptr, - 0, - false, - false, - false, MouseEvent::DRAGGED, MouseEvent::LEFT, mMouseX, |