diff options
author | Stephen Kennedy | 2008-08-23 17:04:40 +0000 |
---|---|---|
committer | Stephen Kennedy | 2008-08-23 17:04:40 +0000 |
commit | baae044e388bca79a593ce083037c5da777818ea (patch) | |
tree | 60f6ccad59f2182d5ad9d9bcb4eab9ff78d3237e /backends/events/default | |
parent | 648f6ed9341775457c301e9055afd40a37b02d6a (diff) | |
download | scummvm-rg350-baae044e388bca79a593ce083037c5da777818ea.tar.gz scummvm-rg350-baae044e388bca79a593ce083037c5da777818ea.tar.bz2 scummvm-rg350-baae044e388bca79a593ce083037c5da777818ea.zip |
Proper fix for key repeat bug - r34094 caused different problems due to repeated key up events
svn-id: r34115
Diffstat (limited to 'backends/events/default')
-rw-r--r-- | backends/events/default/default-events.cpp | 30 | ||||
-rw-r--r-- | backends/events/default/default-events.h | 4 |
2 files changed, 20 insertions, 14 deletions
diff --git a/backends/events/default/default-events.cpp b/backends/events/default/default-events.cpp index d6b9978d94..9a0b5de298 100644 --- a/backends/events/default/default-events.cpp +++ b/backends/events/default/default-events.cpp @@ -110,7 +110,6 @@ DefaultEventManager::DefaultEventManager(OSystem *boss) : _eventCount = 0; _lastEventCount = 0; _lastMillis = 0; - _artificialEventCounter = 0; Common::String recordModeString = ConfMan.get("record_mode"); if (recordModeString.compareToIgnoreCase("record") == 0) { @@ -364,19 +363,20 @@ void DefaultEventManager::processMillis(uint32 &millis) { _lastMillis = millis; _boss->unlockMutex(_timeMutex); } - +#include "backends/vkeybd/keycode-descriptions.h" bool DefaultEventManager::pollEvent(Common::Event &event) { uint32 time = _boss->getMillis(); bool result = false; // poll for pushed events if (!_artificialEventQueue.empty()) { - // delay the feeding of artificial events - if (++_artificialEventCounter % kArtificialEventDelay == 0) { - event = _artificialEventQueue.pop(); - result = true; - _artificialEventCounter = 0; - } + event = _artificialEventQueue.pop(); + result = true; + + if (event.type == Common::EVENT_KEYDOWN) + printf("ART. KEY DOWN: %d (%s)\n", event.kbd.keycode, keycodeDescTable[event.kbd.keycode]); + else if (event.type == Common::EVENT_KEYUP) + printf("ART. KEY UP: %d (%s)\n", event.kbd.keycode, keycodeDescTable[event.kbd.keycode]); } // poll for event from backend @@ -385,11 +385,21 @@ bool DefaultEventManager::pollEvent(Common::Event &event) { if (result) { // send key press events to keymapper if (event.type == Common::EVENT_KEYDOWN) { - if (_keymapper->mapKeyDown(event.kbd)) + printf("KEY DOWN: %d (%s)", event.kbd.keycode, keycodeDescTable[event.kbd.keycode]); + if (_keymapper->mapKeyDown(event.kbd)) { result = false; + printf(" - MAPPED!\n"); + } else { + printf("\n"); + } } else if (event.type == Common::EVENT_KEYUP) { - if (_keymapper->mapKeyUp(event.kbd)) + printf("KEY UP: %d (%s)", event.kbd.keycode, keycodeDescTable[event.kbd.keycode]); + if (_keymapper->mapKeyUp(event.kbd)) { result = false; + printf(" - MAPPED!\n"); + } else { + printf("\n"); + } } } } diff --git a/backends/events/default/default-events.h b/backends/events/default/default-events.h index ba30cb2383..0087265e2a 100644 --- a/backends/events/default/default-events.h +++ b/backends/events/default/default-events.h @@ -55,10 +55,6 @@ class DefaultEventManager : public Common::EventManager { bool _remap; Common::Queue<Common::Event> _artificialEventQueue; - int _artificialEventCounter; - enum { - kArtificialEventDelay = 5 - }; Common::Point _mousePos; int _buttonState; |