diff options
author | Torbjörn Andersson | 2007-03-17 15:44:26 +0000 |
---|---|---|
committer | Torbjörn Andersson | 2007-03-17 15:44:26 +0000 |
commit | 53624376b4d614689695d1ea56c1052cd0e7ad12 (patch) | |
tree | c98fc0e637f6634d270ae0b6e5311852e3634811 /engines/sword2 | |
parent | e72455c215a1deebe235d18e7efbe55f76d8f2da (diff) | |
download | scummvm-rg350-53624376b4d614689695d1ea56c1052cd0e7ad12.tar.gz scummvm-rg350-53624376b4d614689695d1ea56c1052cd0e7ad12.tar.bz2 scummvm-rg350-53624376b4d614689695d1ea56c1052cd0e7ad12.zip |
Applied my re-revised patch #1487149 ("Simplified keyboard repeat"), with
Fingolfin's blessings. Keyboard repeat is now handled by the event manager,
rather than by individual engines.
Since this can cause problems with some engines (see the AGI engine), the extra
"key down" events are marked as "synthetic", so that they can be ignored if
necessary.
svn-id: r26170
Diffstat (limited to 'engines/sword2')
-rw-r--r-- | engines/sword2/sword2.cpp | 17 | ||||
-rw-r--r-- | engines/sword2/sword2.h | 1 |
2 files changed, 0 insertions, 18 deletions
diff --git a/engines/sword2/sword2.cpp b/engines/sword2/sword2.cpp index d04cdadfa2..3e313fcdcc 100644 --- a/engines/sword2/sword2.cpp +++ b/engines/sword2/sword2.cpp @@ -187,7 +187,6 @@ Sword2Engine::Sword2Engine(OSystem *syst) : Engine(syst) { _debugger = NULL; _keyboardEvent.pending = false; - _keyboardEvent.repeat = 0; _mouseEvent.pending = false; _wantSfxDebug = false; @@ -377,10 +376,6 @@ int Sword2Engine::go() { if (ke) { if ((ke->modifiers == OSystem::KBD_CTRL && ke->keycode == 'd') || ke->ascii == '#' || ke->ascii == '~') { - // HACK: We have to clear the 'repeat' flag, or - // it will probably trigger a keyboard repeat - // immediately after the debug console closes. - _keyboardEvent.repeat = 0; _debugger->attach(); } else if (ke->modifiers == 0 || ke->modifiers == OSystem::KBD_SHIFT) { switch (ke->keycode) { @@ -539,8 +534,6 @@ uint32 Sword2Engine::setInputEventFilter(uint32 filter) { void Sword2Engine::parseInputEvents() { OSystem::Event event; - uint32 now = _system->getMillis(); - Common::EventManager *eventMan = _system->getEventManager(); while (eventMan->pollEvent(event)) { switch (event.type) { @@ -555,15 +548,11 @@ void Sword2Engine::parseInputEvents() { } if (!(_inputEventFilter & RD_KEYDOWN)) { _keyboardEvent.pending = true; - _keyboardEvent.repeat = now + 400; _keyboardEvent.ascii = event.kbd.ascii; _keyboardEvent.keycode = event.kbd.keycode; _keyboardEvent.modifiers = event.kbd.flags; } break; - case OSystem::EVENT_KEYUP: - _keyboardEvent.repeat = 0; - break; case OSystem::EVENT_MOUSEMOVE: if (!(_inputEventFilter & RD_KEYDOWN)) { _mouse->setPos(event.mouse.x, event.mouse.y - MENUDEEP); @@ -612,12 +601,6 @@ void Sword2Engine::parseInputEvents() { break; } } - - // Handle keyboard auto-repeat - if (!_keyboardEvent.pending && _keyboardEvent.repeat && now >= _keyboardEvent.repeat) { - _keyboardEvent.pending = true; - _keyboardEvent.repeat = now + 100; - } } void Sword2Engine::gameCycle() { diff --git a/engines/sword2/sword2.h b/engines/sword2/sword2.h index 3acdce0eeb..c3fc99268d 100644 --- a/engines/sword2/sword2.h +++ b/engines/sword2/sword2.h @@ -74,7 +74,6 @@ struct MouseEvent { struct KeyboardEvent { bool pending; - uint32 repeat; uint16 ascii; int keycode; int modifiers; |