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

fix resizable window on wine

This commit is contained in:
FunkyFr3sh 2018-11-05 14:05:32 +01:00
parent 72a86a9f78
commit e59043f43f

View File

@ -572,15 +572,15 @@ HRESULT __stdcall ddraw_SetDisplayMode(IDirectDrawImpl *This, DWORD width, DWORD
if (!This->border)
{
SetWindowLong(This->hWnd, GWL_STYLE, GetWindowLong(This->hWnd, GWL_STYLE) & ~(WS_CAPTION | WS_THICKFRAME | WS_MINIMIZE | WS_MAXIMIZE | WS_SYSMENU));
if (ddraw->wine)
SetWindowLong(This->hWnd, GWL_STYLE, GetWindowLong(This->hWnd, GWL_STYLE) | WS_MINIMIZEBOX);
}
else
{
SetWindowLong(This->hWnd, GWL_STYLE, GetWindowLong(This->hWnd, GWL_STYLE) | WS_OVERLAPPEDWINDOW);
}
if (ddraw->wine)
SetWindowLong(This->hWnd, GWL_STYLE, (GetWindowLong(This->hWnd, GWL_STYLE) | WS_MINIMIZEBOX) & ~WS_MAXIMIZEBOX);
/* center the window with correct dimensions */
int x = (WindowRect.left != -32000) ? WindowRect.left : (This->mode.dmPelsWidth / 2) - (This->render.width / 2);
int y = (WindowRect.top != -32000) ? WindowRect.top : (This->mode.dmPelsHeight / 2) - (This->render.height / 2);
@ -865,10 +865,19 @@ LRESULT CALLBACK WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
if (ddraw->windowed)
{
if (wParam == SIZE_RESTORED && inSizeMove && !ddraw->render.thread)
if (wParam == SIZE_RESTORED)
{
WindowRect.right = LOWORD(lParam);
WindowRect.bottom = HIWORD(lParam);
if (inSizeMove && !ddraw->render.thread)
{
WindowRect.right = LOWORD(lParam);
WindowRect.bottom = HIWORD(lParam);
}
else if (ddraw->wine)
{
WindowRect.right = LOWORD(lParam);
WindowRect.bottom = HIWORD(lParam);
ddraw_SetDisplayMode(ddraw, ddraw->width, ddraw->height, ddraw->bpp);
}
}
}
return DefWindowProc(hWnd, uMsg, wParam, lParam); /* Carmageddon fix */