diff options
Diffstat (limited to 'engines')
-rw-r--r-- | engines/glk/events.cpp | 18 | ||||
-rw-r--r-- | engines/glk/events.h | 5 |
2 files changed, 18 insertions, 5 deletions
diff --git a/engines/glk/events.cpp b/engines/glk/events.cpp index 3689836020..10651b0031 100644 --- a/engines/glk/events.cpp +++ b/engines/glk/events.cpp @@ -185,8 +185,10 @@ void Events::pollEvents() { switch (event.type) { case Common::EVENT_KEYDOWN: - setCursor(CURSOR_NONE); - handleKeyDown(event.kbd); + if (!isModifierKey(event.kbd.keycode)) { + setCursor(CURSOR_NONE); + handleKeyDown(event.kbd); + } return; case Common::EVENT_LBUTTONDOWN: @@ -365,6 +367,13 @@ void Events::handleButtonUp(bool isLeft, const Point &pos) { } } +bool Events::isModifierKey(const Common::KeyCode &keycode) const { + return keycode == Common::KEYCODE_LCTRL || keycode == Common::KEYCODE_LALT + || keycode == Common::KEYCODE_RCTRL || keycode == Common::KEYCODE_RALT + || keycode == Common::KEYCODE_LSHIFT || keycode == Common::KEYCODE_RSHIFT + || keycode == Common::KEYCODE_LSUPER || keycode == Common::KEYCODE_RSUPER; +} + void Events::waitForPress() { Common::Event e; @@ -372,9 +381,8 @@ void Events::waitForPress() { g_system->getEventManager()->pollEvent(e); g_system->delayMillis(10); checkForNextFrameCounter(); - } while (!g_vm->shouldQuit() && e.type != Common::EVENT_KEYDOWN && - e.type != Common::EVENT_LBUTTONDOWN && e.type != Common::EVENT_RBUTTONDOWN && - e.type != Common::EVENT_MBUTTONDOWN); + } while (!g_vm->shouldQuit() && (e.type != Common::EVENT_KEYDOWN || isModifierKey(e.kbd.keycode)) + && e.type != Common::EVENT_LBUTTONDOWN && e.type != Common::EVENT_RBUTTONDOWN && e.type != Common::EVENT_MBUTTONDOWN); } void Events::setCursor(CursorId cursorId) { diff --git a/engines/glk/events.h b/engines/glk/events.h index 37cd3c24dd..2a4f10cb8f 100644 --- a/engines/glk/events.h +++ b/engines/glk/events.h @@ -220,6 +220,11 @@ private: * Handle mouse up events */ void handleButtonUp(bool isLeft, const Point &pos); + + /** + * Returns true if the passed keycode is for the Ctrl or Alt keys + */ + bool isModifierKey(const Common::KeyCode &keycode) const; public: bool _forceClick; public: |