--- a/hedgewars/hwengine.pas Tue Sep 20 16:00:20 2011 -0400
+++ b/hedgewars/hwengine.pas Tue Sep 20 23:43:52 2011 +0200
@@ -154,6 +154,7 @@
{$WARNINGS ON}
var PrevTime, CurrTime: Longword;
prevFocusState: boolean;
+ previousGameState: TGameState;
begin
PrevTime:= SDL_GetTicks;
while isTerminated = false do
@@ -175,6 +176,15 @@
begin
cHasFocus:= true;
onFocusStateChanged()
+ end
+ else if event.window.event = SDL_WINDOWEVENT_MINIMIZED then
+ begin
+ previousGameState:= GameState;
+ GameState:= gsSuspend;
+ end
+ else if event.window.event = SDL_WINDOWEVENT_RESTORED then
+ begin
+ GameState:= previousGameState;
end;
{$ELSE}
KeyPressChat(event.key.keysym.unicode);