enable keyrepeat while chatting so you can keep backspace pressed to delete a line (fix issue 111)
authorkoda
Mon, 04 Apr 2011 12:53:11 +0200
changeset 5099 ce1a761d3c1e
parent 5098 cb9cf41a208c
child 5100 951767beffc8
enable keyrepeat while chatting so you can keep backspace pressed to delete a line (fix issue #111)
hedgewars/SDLh.pas
hedgewars/uChat.pas
--- a/hedgewars/SDLh.pas	Sun Apr 03 20:07:05 2011 +0400
+++ b/hedgewars/SDLh.pas	Mon Apr 04 12:53:11 2011 +0200
@@ -726,7 +726,8 @@
 procedure SDL_Quit; cdecl; external SDLLibName;
 
 function  SDL_VideoDriverName(var namebuf; maxlen: LongInt): PChar; cdecl; external SDLLibName;
-procedure SDL_EnableUNICODE(enable: LongInt); cdecl; external SDLLibName;
+function SDL_EnableUNICODE(enable: LongInt): LongInt; cdecl; external SDLLibName;
+function SDL_EnableKeyRepeat(delay, interval: LongInt): LongInt; cdecl; external;
 
 procedure SDL_Delay(msec: Longword); cdecl; external SDLLibName;
 function  SDL_GetTicks: Longword; cdecl; external SDLLibName;
--- a/hedgewars/uChat.pas	Sun Apr 03 20:07:05 2011 +0400
+++ b/hedgewars/uChat.pas	Mon Apr 04 12:53:11 2011 +0200
@@ -278,7 +278,8 @@
                 SetLine(InputStr, '', false)
                 end;
             FreezeEnterKey;
-            GameState:= gsGame
+            SDL_EnableKeyRepeat(0,0);
+            GameState:= gsGame;
             end;
     else
     if (Key < $80) then btw:= 1
@@ -339,6 +340,7 @@
 begin
     s:= s; // avoid compiler hint
     GameState:= gsChat;
+    SDL_EnableKeyRepeat(200,45);
     if length(s) = 0 then
         KeyPressChat(27)
     else