Index: gui/newgui.cpp
===================================================================
--- gui/newgui.cpp	(revision 23577)
+++ gui/newgui.cpp	(working copy)
@@ -48,9 +48,7 @@
 
 enum {
 	kDoubleClickDelay = 500, // milliseconds
-	kCursorAnimateDelay = 250,
-	kKeyRepeatInitialDelay = 400,
-	kKeyRepeatSustainDelay = 100
+	kCursorAnimateDelay = 250
 };
 
 // HACK. FIXME. This doesn't belong here. But otherwise it creates compilation problems
@@ -92,9 +90,6 @@
 	// Clear the cursor
 	memset(_cursor, 0xFF, sizeof(_cursor));
 
-	// Reset key repeat
-	_currentKeyDown.keycode = 0;
-
 #ifndef DISABLE_FANCY_THEMES
 	ConfMan.registerDefault("gui_theme", "default");
 	Common::String style(ConfMan.get("gui_theme"));
@@ -208,21 +203,10 @@
 			
 			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);
@@ -272,15 +256,6 @@
 			}
 		}
 
-		// check if event should be sent again (keydown)
-		if (_currentKeyDown.keycode != 0 && activeDialog == _dialogStack.top()) {
-			if (_keyRepeatTime < time) {
-				// fire event
-				activeDialog->handleKeyDown(_currentKeyDown.ascii, _currentKeyDown.keycode, _currentKeyDown.flags);
-				_keyRepeatTime = time + kKeyRepeatSustainDelay;
-			}
-		}
-
 		// Delay for a moment
 		_system->delayMillis(10);
 	}
@@ -298,8 +273,6 @@
 #pragma mark -
 
 void NewGui::saveState() {
-	// Backup old cursor
-	_currentKeyDown.keycode = 0;
 	_lastClick.x = _lastClick.y = 0;
 	_lastClick.time = 0;
 	_lastClick.count = 0;
Index: gui/newgui.h
===================================================================
--- gui/newgui.h	(revision 23577)
+++ gui/newgui.h	(working copy)
@@ -94,14 +94,6 @@
 
 	bool		_stateIsSaved;
 
-	// 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
Index: engines/sword1/control.h
===================================================================
--- engines/sword1/control.h	(revision 23577)
+++ engines/sword1/control.h	(working copy)
@@ -139,8 +139,6 @@
 	uint8 *_font, *_redFont;
 	uint8 *_screenBuf;
 	uint8 _keyPressed;
-	uint8 _keyRepeat;
-	uint32 _keyRepeatTime;
 	void delay(uint32 msecs);
 	uint16 _mouseX, _mouseY, _mouseState;
 	bool _mouseDown;
Index: engines/sword1/control.cpp
===================================================================
--- engines/sword1/control.cpp	(revision 23577)
+++ engines/sword1/control.cpp	(working copy)
@@ -42,11 +42,6 @@
 
 namespace Sword1 {
 
-enum {
-	kKeyRepeatInitialDelay = 400,
-	kKeyRepeatSustainDelay = 100
-};
-
 enum LangStrings {
 	STR_PAUSED = 0,
 	STR_INSERT_CD_A,
@@ -171,8 +166,6 @@
 	_music = pMusic;
 	_sound = pSound;
 	_lStrings = _languageStrings + SwordEngine::_systemVars.language * 20;
-	_keyRepeat = 0;
-	_keyRepeatTime = 0;
 }
 
 void Control::askForCd(void) {
@@ -1051,15 +1044,9 @@
 					_keyPressed = 8;
 				else
 					_keyPressed = (byte)event.kbd.ascii;
-				_keyRepeatTime = now + kKeyRepeatInitialDelay;
-				_keyRepeat = _keyPressed;
 				// we skip the rest of the delay and return immediately
 				// to handle keyboard input
 				return;
-			case OSystem::EVENT_KEYUP:
-				_keyRepeatTime = 0;
-				_keyRepeat = 0;
-				break;
 			case OSystem::EVENT_MOUSEMOVE:
 				_mouseX = event.mouse.x;
 				_mouseY = event.mouse.y;
@@ -1091,10 +1078,6 @@
 				break;
 			}
 		}
-		if (_keyRepeatTime && now > _keyRepeatTime) {
-			_keyRepeatTime += kKeyRepeatSustainDelay;
-			_keyPressed = _keyRepeat;
-		}
 
 		_system->updateScreen();
 		_system->delayMillis(10);
Index: engines/sword2/sword2.cpp
===================================================================
--- engines/sword2/sword2.cpp	(revision 23577)
+++ engines/sword2/sword2.cpp	(working copy)
@@ -147,7 +147,6 @@
 	_debugger = NULL;
 
 	_keyboardEvent.pending = false;
-	_keyboardEvent.repeat = 0;
 	_mouseEvent.pending = false;
 
 	_wantSfxDebug = false;
@@ -504,7 +503,6 @@
 
 void Sword2Engine::clearInputEvents() {
 	_keyboardEvent.pending = false;
-	_keyboardEvent.repeat = 0;
 	_mouseEvent.pending = false;
 }
 
@@ -515,22 +513,16 @@
 void Sword2Engine::parseInputEvents() {
 	OSystem::Event event;
 
-	uint32 now = _system->getMillis();
-
 	while (_system->pollEvent(event)) {
 		switch (event.type) {
 		case OSystem::EVENT_KEYDOWN:
 			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);
@@ -579,12 +571,6 @@
 			break;
 		}
 	}
-
-	// Handle keyboard auto-repeat
-	if (!_keyboardEvent.pending && _keyboardEvent.repeat && now >= _keyboardEvent.repeat) {
-		_keyboardEvent.pending = true;
-		_keyboardEvent.repeat = now + 100;
-	}
 }
 
 void Sword2Engine::gameCycle() {
Index: engines/sword2/sword2.h
===================================================================
--- engines/sword2/sword2.h	(revision 23577)
+++ engines/sword2/sword2.h	(working copy)
@@ -72,7 +72,6 @@
 
 struct KeyboardEvent {
 	bool pending;
-	uint32 repeat;
 	uint16 ascii;
 	int keycode;
 	int modifiers;
Index: engines/kyra/kyra.cpp
===================================================================
--- engines/kyra/kyra.cpp	(revision 23577)
+++ engines/kyra/kyra.cpp	(working copy)
@@ -92,6 +92,7 @@
 	_scriptMain = 0;
 	_scriptClickData = 0;
 	_scriptClick = 0;
+	_keyPressed = 0;
 	_characterList = 0;
 	_movFacingTable = 0;
 	memset(_shapes, 0, sizeof(_shapes));
Index: engines/kyra/gui.cpp
===================================================================
--- engines/kyra/gui.cpp	(revision 23577)
+++ engines/kyra/gui.cpp	(working copy)
@@ -616,8 +616,6 @@
 		calcCoords(_menu[i]);
 
 	_menuRestoreScreen = true;
-	_keyboardEvent.pending = 0;
-	_keyboardEvent.repeat = 0;
 	_mousePressFlag = false;
 	
 	_toplevelMenu = 0;
@@ -834,13 +832,8 @@
 			_mouseWheel = 1;
 			break;
 		case OSystem::EVENT_KEYDOWN:
-			_keyboardEvent.pending = true;
-			_keyboardEvent.repeat = now + 400;
-			_keyboardEvent.ascii = event.kbd.ascii;
+			_keyPressed = event.kbd.ascii;
 			break;
-		case OSystem::EVENT_KEYUP:
-			_keyboardEvent.repeat = 0;
-			break;
 		default:
 			break;
 		}
@@ -851,10 +844,6 @@
 		lastScreenUpdate = now;
 	}
 
-	if (!_keyboardEvent.pending && _keyboardEvent.repeat && now >= _keyboardEvent.repeat) {
-		_keyboardEvent.pending = true;
-		_keyboardEvent.repeat = now + 100;
-	}
 	_system->delayMillis(3);
 }
 
@@ -1019,26 +1008,26 @@
 void KyraEngine::gui_updateSavegameString() {
 	int length;
 
-	if (_keyboardEvent.pending && _keyboardEvent.ascii) {
+	if (_keyPressed) {
 		length = strlen(_savegameName);
 
-		if (_keyboardEvent.ascii > 31 && _keyboardEvent.ascii < 127) {
+		if (_keyPressed > 31 && _keyPressed < 127) {
 			if (length < 31) {
-				_savegameName[length] = _keyboardEvent.ascii;
+				_savegameName[length] = _keyPressed;
 				_savegameName[length+1] = 0;
 				gui_redrawTextfield();
 			}
-		} else if (_keyboardEvent.ascii == 8 ||_keyboardEvent.ascii == 127) {
+		} else if (_keyPressed == 8 || _keyPressed == 127) {
 			if (length > 0) {
 				_savegameName[length-1] = 0;
 				gui_redrawTextfield();
 			}
-		} else if (_keyboardEvent.ascii == 13) {
+		} else if (_keyPressed == 13) {
 			_displaySubMenu = false;
 		}
 	}
 
-	_keyboardEvent.pending = false;
+	_keyPressed = 0;
 }
 
 int KyraEngine::gui_saveGame(Button *button) {
Index: engines/kyra/kyra.h
===================================================================
--- engines/kyra/kyra.h	(revision 23577)
+++ engines/kyra/kyra.h	(working copy)
@@ -232,12 +232,6 @@
 	MenuItem item[6];
 };
 
-struct KeyboardEvent {
-	bool pending;
-	uint32 repeat;
-	uint8 ascii;
-};
-
 class KyraEngine : public Engine {
 	friend class MusicPlayer;
 	friend class Debugger;
@@ -836,7 +830,7 @@
 	int _gameToLoad;
 	char _savegameName[31];
 	const char *_specialSavegameString;
-	KeyboardEvent _keyboardEvent;
+	uint8 _keyPressed;
 
 	struct KyragemState {
 		uint16 nextOperation;
Index: engines/saga/input.cpp
===================================================================
--- engines/saga/input.cpp	(revision 23577)
+++ engines/saga/input.cpp	(working copy)
@@ -119,9 +119,6 @@
 				break;
 			}
 			break;
-		case OSystem::EVENT_KEYUP:
-			_interface->processKeyUp(event.kbd.ascii);
-			break;
 		case OSystem::EVENT_LBUTTONUP:
 			_leftMouseButtonPressed = false;
 			break;
Index: engines/saga/interface.h
===================================================================
--- engines/saga/interface.h	(revision 23577)
+++ engines/saga/interface.h	(working copy)
@@ -222,8 +222,7 @@
 	void drawStatusBar();
 	void setVerbState(int verb, int state);
 
-	bool processAscii(uint16 ascii, bool synthetic = false);
-	void processKeyUp(uint16 ascii);
+	bool processAscii(uint16 ascii);
 
 	void keyBoss();
 	void keyBossExit();
@@ -243,8 +242,6 @@
 	}
 
 private:
-	static void textInputRepeatCallback(void *refCon);
-
 	void drawInventory(Surface *backBuffer);
 	void updateInventory(int pos);
 	void inventoryChangePos(int chg);
@@ -343,8 +340,6 @@
 	void calcOptionSaveSlider();
 	bool processTextInput(uint16 ascii);
 	void processStatusTextInput(uint16 ascii);
-	void textInputStartRepeat(uint16 ascii);
-	void textInputRepeat(void);
 
 public:
 	void converseInit(void);
@@ -452,9 +447,6 @@
 
 	uint _statusTextInputPos;
 
-	int _textInputRepeatPhase;
-	uint16 _textInputRepeatChar;
-
 	PalEntry _mapSavedPal[PAL_ENTRIES];
 	bool _mapPanelCrossHairState;
 
Index: engines/saga/interface.cpp
===================================================================
--- engines/saga/interface.cpp	(revision 23577)
+++ engines/saga/interface.cpp	(working copy)
@@ -47,7 +47,6 @@
 
 #include "common/config-manager.h"
 #include "common/system.h"
-#include "common/timer.h"
 
 namespace Saga {
 
@@ -212,7 +211,6 @@
 		error("Interface::Interface(): not enough memory");
 	}
 
-	_textInputRepeatPhase = 0;
 	_textInput = false;
 	_statusTextInput = false;
 	_statusTextInputState = kStatusTextInputFirstRun;
@@ -316,7 +314,6 @@
 		_textInput = true;
 		_textInputStringLength = strlen(_textInputString);
 		_textInputPos = _textInputStringLength + 1;
-		_textInputRepeatPhase = 0;
 		break;
 	case kPanelMap:
 		mapPanelShow();
@@ -337,14 +334,13 @@
 		_textInputString[0] = 0;
 		_textInputStringLength = 0;
 		_textInputPos = _textInputStringLength + 1;
-		_textInputRepeatPhase = 0;
 		break;
 	}
 
 	draw();
 }
 
-bool Interface::processAscii(uint16 ascii, bool synthetic) {
+bool Interface::processAscii(uint16 ascii) {
 	// TODO: Checking for Esc and Enter below is a bit hackish, and
 	// and probably only works with the English version. Maybe we should
 	// add a flag to the button so it can indicate if it's the default or
@@ -352,8 +348,6 @@
 
 	int i;
 	PanelButton *panelButton;
-	if (!synthetic)
-		_textInputRepeatPhase = 0;
 	if (_statusTextInput) {
 		processStatusTextInput(ascii);
 		return true;
@@ -536,40 +530,6 @@
 	return false;
 }
 
-#define KEYBOARD_REPEAT_DELAY1 300000L
-#define KEYBOARD_REPEAT_DELAY2 50000L
-
-void Interface::textInputRepeatCallback(void *refCon) {
-	((Interface *)refCon)->textInputRepeat();
-}
-
-void Interface::textInputStartRepeat(uint16 ascii) {
-	if (!_textInputRepeatPhase) {
-		_textInputRepeatPhase = 1;
-		Common::g_timer->removeTimerProc(&textInputRepeatCallback);
-		Common::g_timer->installTimerProc(&textInputRepeatCallback, KEYBOARD_REPEAT_DELAY1, this);
-	}
-
-	_textInputRepeatChar = ascii;
-}
-
-void Interface::textInputRepeat() {
-	if (_textInputRepeatPhase == 1) {
-		_textInputRepeatPhase = 2;
-		Common::g_timer->removeTimerProc(&textInputRepeatCallback);
-		Common::g_timer->installTimerProc(&textInputRepeatCallback, KEYBOARD_REPEAT_DELAY2, this);
-	} else if (_textInputRepeatPhase == 2) {
-		processAscii(_textInputRepeatChar, true);
-	}
-}
-
-void Interface::processKeyUp(uint16 ascii) {
-	if (_textInputRepeatPhase) {
-		Common::g_timer->removeTimerProc(&textInputRepeatCallback);
-		_textInputRepeatPhase = 0;
-	}
-}
-
 void Interface::setStatusText(const char *text, int statusColor) {
 	assert(text != NULL);
 	assert(strlen(text) < STATUS_TEXT_LEN);
@@ -928,7 +888,6 @@
 
 void Interface::processStatusTextInput(uint16 ascii) {
 
-	textInputStartRepeat(ascii);
 	switch (ascii) {
 	case 27: // esc
 		_statusTextInputState = kStatusTextInputAborted;
@@ -968,8 +927,6 @@
 	memset(tempString, 0, SAVE_TITLE_SIZE);
 	ch[1] = 0;
 
-	textInputStartRepeat(ascii);
-
 	switch (ascii) {
 	case 13:
 		return false;
Index: backends/platform/sdl/sdl.cpp
===================================================================
--- backends/platform/sdl/sdl.cpp	(revision 23577)
+++ backends/platform/sdl/sdl.cpp	(working copy)
@@ -132,6 +132,8 @@
 	// Enable unicode support if possible
 	SDL_EnableUNICODE(1);
 
+	SDL_EnableKeyRepeat(kKeyRepeatInitialDelay, kKeyRepeatSustainDelay);
+
 	_cksumValid = false;
 #if !defined(_WIN32_WCE) && !defined(__SYMBIAN32__) && !defined(DISABLE_SCALERS)
 	_mode = GFX_DOUBLESIZE;
Index: backends/platform/sdl/sdl-common.h
===================================================================
--- backends/platform/sdl/sdl-common.h	(revision 23577)
+++ backends/platform/sdl/sdl-common.h	(working copy)
@@ -54,6 +54,10 @@
 	GFX_DOTMATRIX = 11
 };
 
+enum {
+	kKeyRepeatInitialDelay = 400,
+	kKeyRepeatSustainDelay = 100
+};
 
 class OSystem_SDL : public OSystem {
 public:
