hedgewars/uChat.pas
changeset 12851 e5c461729fe3
parent 12415 8b971d8944d6
child 13082 c213645ff848
--- a/hedgewars/uChat.pas	Sat Nov 25 11:28:44 2017 -0500
+++ b/hedgewars/uChat.pas	Wed Nov 29 13:54:39 2017 +0100
@@ -1098,11 +1098,18 @@
 end;
 
 procedure chChat(var s: shortstring);
+var i: Integer;
 begin
     s:= s; // avoid compiler hint
     GameState:= gsChat;
     SDL_StopTextInput();
     SDL_StartTextInput();
+    //Make REALLY sure unexpected events are flushed (1 time is insufficient as of SDL 2.0.7)
+    for i := 1 to 2 do
+    begin
+        SDL_PumpEvents();
+        SDL_FlushEvent(SDL_TEXTINPUT);
+    end;
     //SDL_EnableKeyRepeat(200,45);
     if length(s) = 0 then
         SetLine(InputStr, '', true)