From 0427622e3a91274bace6dd7223a9d61aebd14ed9 Mon Sep 17 00:00:00 2001 From: gewlitys Date: Thu, 2 Jan 2003 16:58:59 +0000 Subject: [PATCH] Key repeat is now enabled when typing text, some little cleanups, from slayne git-svn-id: svn://svn.code.sf.net/p/sc2/code/trunk@521 8092fc87-c524-0410-9efc-e669fe64eaf9 --- sc2/ChangeLog | 1 + sc2/src/sc2code/libs/input/sdl/input.c | 14 +++++++++----- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/sc2/ChangeLog b/sc2/ChangeLog index 2baf93fb4..b81d928a6 100644 --- a/sc2/ChangeLog +++ b/sc2/ChangeLog @@ -1,4 +1,5 @@ 0.2: +- Key repeat is now enabled when typing text, from slayne - Capital letter bug in new input code fixed, from slayne - Oscilloscope now reacts to music when speech is disabled (OpenAL) -Mika - Rewritten input code (better and adds joystick/pad support), from slayne diff --git a/sc2/src/sc2code/libs/input/sdl/input.c b/sc2/src/sc2code/libs/input/sdl/input.c index 28f202c53..a01c91e50 100644 --- a/sc2/src/sc2code/libs/input/sdl/input.c +++ b/sc2/src/sc2code/libs/input/sdl/input.c @@ -49,6 +49,7 @@ TFB_InitInput (int driver, int flags) atexit (TFB_UninitInput); SDL_EnableUNICODE(1); + SDL_EnableKeyRepeat(SDL_DEFAULT_REPEAT_DELAY, SDL_DEFAULT_REPEAT_INTERVAL); if ((SDL_InitSubSystem(SDL_INIT_JOYSTICK)) == -1) { @@ -116,7 +117,7 @@ ProcessKeyboardEvent(const SDL_Event *Event) if (Event->type == SDL_KEYDOWN) { if (Event->key.keysym.unicode != 0) - kbdbuf[kbdtail] = Event->key.keysym.unicode; + kbdbuf[kbdtail] = (UNICODE) Event->key.keysym.unicode; else kbdbuf[kbdtail] = KBDToUNICODE(k); kbdtail = (kbdtail + 1) & (KBDBUFSIZE - 1); @@ -401,18 +402,21 @@ _get_pause_exit_state (void) return (InputState); } -// Status: Unimplemented INPUT_STATE _get_serial_keyboard_state (INPUT_REF ref, INPUT_STATE InputState) - // I hope these are defined somewhere... { Uint16 key; (void) ref; if ((key = GetUNICODEKey ()) == '\r') key = '\n'; - SetInputUNICODE (&InputState, key); - SetInputDevType (&InputState, KEYBOARD_DEVICE); + if (key != 0) + { + SetInputUNICODE (&InputState, key); + SetInputDevType (&InputState, KEYBOARD_DEVICE); + } + else + InputState = 0; return (InputState); }