1
0
mirror of https://github.com/FunkyFr3sh/cnc-ddraw.git synced 2025-03-15 06:04:49 +01:00

yet another unity/gnome3 hack - Fixes random window repositioning

This commit is contained in:
FunkyFr3sh 2018-08-14 15:43:48 +02:00
parent 5188a68964
commit 7661a589bb
3 changed files with 22 additions and 4 deletions

View File

@ -2,7 +2,7 @@
#define vxstr(a,b,c,d) str(a##.##b##.##c##.##d)
#define str(s) #s
#define VERSION 1,1,8,5
#define VERSION 1,1,8,6
1 VERSIONINFO
FILEVERSION VERSION

View File

@ -25,6 +25,7 @@
#define CUTSCENE_HEIGHT 400
#define WM_AUTORENDERER WM_USER+111
#define WM_WINEFULLSCREEN WM_USER+112
extern char OpenglVersion[];

View File

@ -545,6 +545,26 @@ LRESULT CALLBACK WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
switch(uMsg)
{
case WM_WINDOWPOSCHANGED:
{
WINDOWPOS *pos = (WINDOWPOS *)lParam;
if (ddraw->wine && !ddraw->windowed && (pos->x > 0 || pos->y > 0) && LastSetWindowPosTick + 500 < timeGetTime())
PostMessage(ddraw->hWnd, WM_WINEFULLSCREEN, 0, 0);
break;
}
case WM_WINEFULLSCREEN:
{
if (!ddraw->windowed)
{
LastSetWindowPosTick = timeGetTime();
SetWindowPos(ddraw->hWnd, HWND_TOPMOST, 1, 1, ddraw->render.width, ddraw->render.height, SWP_SHOWWINDOW);
SetWindowPos(ddraw->hWnd, HWND_TOPMOST, 0, 0, ddraw->render.width, ddraw->render.height, SWP_SHOWWINDOW);
}
return 0;
}
case WM_SIZE:
return DefWindowProc(hWnd, uMsg, wParam, lParam); /* Carmageddon fix */
case WM_MOVE:
@ -596,10 +616,7 @@ LRESULT CALLBACK WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
mouse_unlock();
if (ddraw->wine && LastSetWindowPosTick + 500 > timeGetTime())
{
LastSetWindowPosTick = 0;
return 0;
}
/* minimize our window on defocus when in fullscreen */
if (!ddraw->windowed)