# HG changeset patch
# User koda
# Date 1314096827 -7200
# Node ID e01f0b6f1969fb1154fcd1ddc084e77a082b11fa
# Parent  36c1d1b789b85526a654eb018fc0250524b1786c
enable window resizing (tested only on linux) - fix issue 103

diff -r 36c1d1b789b8 -r e01f0b6f1969 hedgewars/SDLh.pas
--- a/hedgewars/SDLh.pas	Tue Aug 23 10:19:33 2011 +0200
+++ b/hedgewars/SDLh.pas	Tue Aug 23 12:53:47 2011 +0200
@@ -211,7 +211,7 @@
     SDL_JOYBUTTONDOWN   = 10;
     SDL_JOYBUTTONUP     = 11;
     SDL_QUITEV          = 12;
-    SDL_VIDEORESIZE     = 16; // TODO: outdated? no longer in SDL 1.3?
+    SDL_VIDEORESIZE     = 16;
 
     // SDL_Surface flags
     SDL_SWSURFACE   = $00000000;
@@ -608,7 +608,7 @@
             SDL_JOYBUTTONUP: (jbutton: TSDL_JoyButtonEvent);
             SDL_QUITEV: (quit: TSDL_QuitEvent);
             //SDL_SYSWMEVENT,SDL_EVENT_RESERVEDA,SDL_EVENT_RESERVEDB
-            //SDL_VIDEORESIZE: (resize: TSDL_ResizeEvent);
+            SDL_VIDEORESIZE: (resize: TSDL_ResizeEvent);
 {$ENDIF}
         end;
 
diff -r 36c1d1b789b8 -r e01f0b6f1969 hedgewars/hwengine.pas
--- a/hedgewars/hwengine.pas	Tue Aug 23 10:19:33 2011 +0200
+++ b/hedgewars/hwengine.pas	Tue Aug 23 12:53:47 2011 +0200
@@ -175,6 +175,15 @@
                         if prevFocusState xor cHasFocus then
                             onFocusStateChanged()
                         end;
+                SDL_VIDEORESIZE: begin
+                    // using lower values causes widget overlap and video issues
+                    if event.resize.w > 768 then cScreenWidth:= event.resize.w
+                    else cScreenWidth:= 768;
+                    if event.resize.h > 576 then cScreenHeight:= event.resize.h
+                    else cScreenHeight:= 576;
+                    ParseCommand('fullscr '+intToStr(LongInt(cFullScreen)), true);
+                    WriteLnToConsole('window resize');
+                    end;
 {$ENDIF}
                 SDL_JOYAXISMOTION: ControllerAxisEvent(event.jaxis.which, event.jaxis.axis, event.jaxis.value);
                 SDL_JOYHATMOTION: ControllerHatEvent(event.jhat.which, event.jhat.hat, event.jhat.value);
diff -r 36c1d1b789b8 -r e01f0b6f1969 hedgewars/uStore.pas
--- a/hedgewars/uStore.pas	Tue Aug 23 10:19:33 2011 +0200
+++ b/hedgewars/uStore.pas	Tue Aug 23 12:53:47 2011 +0200
@@ -1009,7 +1009,7 @@
     SDLwindow:= SDL_CreateWindow('Hedgewars', x, y, cScreenWidth, cScreenHeight, flags);
     SDLTry(SDLwindow <> nil, true);
 {$ELSE}
-    flags:= SDL_OPENGL;// or SDL_RESIZABLE;
+    flags:= SDL_OPENGL or SDL_RESIZABLE;
     if cFullScreen then
         flags:= flags or SDL_FULLSCREEN;