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 /gui | |
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 'gui')
-rw-r--r-- | gui/newgui.cpp | 28 | ||||
-rw-r--r-- | gui/newgui.h | 8 |
2 files changed, 1 insertions, 35 deletions
diff --git a/gui/newgui.cpp b/gui/newgui.cpp index 90a5c6d121..adb27b83df 100644 --- a/gui/newgui.cpp +++ b/gui/newgui.cpp @@ -50,9 +50,7 @@ namespace GUI { enum { kDoubleClickDelay = 500, // milliseconds - kCursorAnimateDelay = 250, - kKeyRepeatInitialDelay = 400, - kKeyRepeatSustainDelay = 100 + kCursorAnimateDelay = 250 }; void GuiObject::reflowLayout() { @@ -91,9 +89,6 @@ NewGui::NewGui() : _needRedraw(false), // Clear the cursor memset(_cursor, 0xFF, sizeof(_cursor)); - // Reset key repeat - _currentKeyDown.keycode = 0; - bool loadClassicTheme = true; #ifndef DISABLE_FANCY_THEMES ConfMan.registerDefault("gui_theme", "default"); @@ -272,21 +267,10 @@ void NewGui::runLoop() { switch (event.type) { case OSystem::EVENT_KEYDOWN: -#if !defined(PALMOS_MODE) - // init continuous event stream - // not done on PalmOS because keyboard is emulated and keyup is not generated - _currentKeyDown.ascii = event.kbd.ascii; - _currentKeyDown.keycode = event.kbd.keycode; - _currentKeyDown.flags = event.kbd.flags; - _keyRepeatTime = time + kKeyRepeatInitialDelay; -#endif activeDialog->handleKeyDown(event.kbd.ascii, event.kbd.keycode, event.kbd.flags); break; case OSystem::EVENT_KEYUP: activeDialog->handleKeyUp(event.kbd.ascii, event.kbd.keycode, event.kbd.flags); - if (event.kbd.keycode == _currentKeyDown.keycode) - // only stop firing events if it's the current key - _currentKeyDown.keycode = 0; break; case OSystem::EVENT_MOUSEMOVE: activeDialog->handleMouseMoved(mouse.x, mouse.y, 0); @@ -327,15 +311,6 @@ void NewGui::runLoop() { } } - // check if event should be sent again (keydown) - if (_currentKeyDown.keycode != 0 && activeDialog == getTopDialog()) { - if (_keyRepeatTime < time) { - // fire event - activeDialog->handleKeyDown(_currentKeyDown.ascii, _currentKeyDown.keycode, _currentKeyDown.flags); - _keyRepeatTime = time + kKeyRepeatSustainDelay; - } - } - // Delay for a moment _system->delayMillis(10); } @@ -353,7 +328,6 @@ void NewGui::runLoop() { void NewGui::saveState() { // Backup old cursor - _currentKeyDown.keycode = 0; _lastClick.x = _lastClick.y = 0; _lastClick.time = 0; _lastClick.count = 0; diff --git a/gui/newgui.h b/gui/newgui.h index 5a1c237475..70658abcb4 100644 --- a/gui/newgui.h +++ b/gui/newgui.h @@ -99,14 +99,6 @@ protected: bool _useStdCursor; - // for continuous events (keyDown) - struct { - uint16 ascii; - byte flags; - int keycode; - } _currentKeyDown; - uint32 _keyRepeatTime; - // position and time of last mouse click (used to detect double clicks) struct { int16 x, y; // Position of mouse when the click occured |