1
0
mirror of https://github.com/FunkyFr3sh/cnc-ddraw.git synced 2025-03-14 22:03:27 +01:00

fix window resize and maximize for macOS + fix resize on linux

This commit is contained in:
FunkyFr3sh 2024-10-03 03:57:10 +02:00
parent 95a5f7231e
commit ca6c447ae6
4 changed files with 14 additions and 6 deletions

View File

@ -65,7 +65,6 @@ typedef struct CNCDDRAWCONFIG
BOOL fix_alt_key_stuck;
BOOL fix_not_responding;
BOOL no_compat_warning;
BOOL wine_allow_resize;
int guard_lines;
int max_resolutions;
BOOL lock_surfaces;

View File

@ -78,7 +78,6 @@ void cfg_load()
GET_BOOL(GameHandlesClose, "game_handles_close", FALSE);
GET_BOOL(g_config.fix_not_responding, "fix_not_responding", FALSE);
GET_BOOL(g_config.no_compat_warning, "no_compat_warning", FALSE);
GET_BOOL(g_config.wine_allow_resize, "wine_allow_resize", FALSE);
GET_INT(g_config.guard_lines, "guard_lines", 200);
GET_INT(g_config.max_resolutions, "max_resolutions", 0);
GET_BOOL(g_config.lock_surfaces, "lock_surfaces", FALSE);
@ -314,7 +313,6 @@ static void cfg_create_ini()
"game_handles_close=false\n"
"fix_not_responding=false\n"
"no_compat_warning=false\n"
"wine_allow_resize=false\n"
"guard_lines=200\n"
"max_resolutions=0\n"
"lock_surfaces=false\n"

View File

@ -1093,12 +1093,12 @@ HRESULT dd_SetDisplayMode(DWORD dwWidth, DWORD dwHeight, DWORD dwBPP, DWORD dwFl
real_SetWindowLongA(g_ddraw.hwnd, GWL_EXSTYLE, exstyle & ~(WS_EX_CLIENTEDGE));
}
if (!g_config.wine_allow_resize && IsWine())
if (IsLinux())
{
real_SetWindowLongA(
g_ddraw.hwnd,
GWL_STYLE,
(real_GetWindowLongA(g_ddraw.hwnd, GWL_STYLE) | WS_MINIMIZEBOX) & ~(WS_MAXIMIZEBOX | WS_THICKFRAME));
(real_GetWindowLongA(g_ddraw.hwnd, GWL_STYLE) | WS_MINIMIZEBOX) & ~(WS_MAXIMIZEBOX));
}
/* center the window with correct dimensions */

View File

@ -443,12 +443,23 @@ LRESULT CALLBACK fake_WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam
{
if (wParam == SIZE_RESTORED)
{
if (in_size_move && g_ddraw.render.thread && IsMacOS())
{
EnterCriticalSection(&g_ddraw.cs);
g_ddraw.render.run = FALSE;
ReleaseSemaphore(g_ddraw.render.sem, 1, NULL);
LeaveCriticalSection(&g_ddraw.cs);
WaitForSingleObject(g_ddraw.render.thread, INFINITE);
g_ddraw.render.thread = NULL;
}
if (in_size_move && !g_ddraw.render.thread)
{
g_config.window_rect.right = LOWORD(lParam);
g_config.window_rect.bottom = HIWORD(lParam);
}
else if (!in_size_move && g_ddraw.render.thread && !g_config.fullscreen && g_config.wine_allow_resize && IsLinux())
else if (!in_size_move && g_ddraw.render.thread && !g_config.fullscreen && IsLinux())
{
g_config.window_rect.right = LOWORD(lParam);
g_config.window_rect.bottom = HIWORD(lParam);