Preserve windowed resolution after manual resize
authorvitiv <nikita.utiu@gmail.com>
Sun, 30 Dec 2012 16:04:28 +0200 (2012-12-30)
changeset 8345 9d9b498cfb03
parent 8343 aa4ea3cade3c
child 8350 14b938faec69
Preserve windowed resolution after manual resize
QTfrontend/game.cpp
hedgewars/hwengine.pas
--- a/QTfrontend/game.cpp	Sat Dec 29 14:40:20 2012 +0200
+++ b/QTfrontend/game.cpp	Sun Dec 30 16:04:28 2012 +0200
@@ -23,6 +23,8 @@
 #include <QStringListModel>
 #include <QTextStream>
 
+#include "hwform.h"
+#include "ui/page/pageoptions.h"
 #include "game.h"
 #include "hwconsts.h"
 #include "gameuiconfig.h"
@@ -274,6 +276,16 @@
                 writeCampaignVar(msg.right(msg.size() - 3));
             break;
         }
+        case 'W':
+        {
+            // fetch new window resolution via IPC and save it in the settings
+            int size = msg.size();
+            QString newResolution = QString().append(msg.mid(2)).left(size - 4);
+            QStringList wh = newResolution.split('x');
+            config->Form->ui.pageOptions->windowWidthEdit->setText(wh[0]);
+            config->Form->ui.pageOptions->windowHeightEdit->setText(wh[1]);
+            break;
+        }
         default:
         {
             if (gameType == gtNet && !netSuspend)
--- a/hedgewars/hwengine.pas	Sat Dec 29 14:40:20 2012 +0200
+++ b/hedgewars/hwengine.pas	Sun Dec 30 16:04:28 2012 +0200
@@ -276,6 +276,7 @@
             ScriptOnScreenResize();
             InitCameraBorders();
             InitTouchInterface();
+            SendIPC('W' + IntToStr(cScreenWidth) + 'x' + IntToStr(cScreenHeight));
         end;
 
         CurrTime:= SDL_GetTicks();