Skip to content

Commit

Permalink
fix window resize and maximize for macOS + fix resize on linux
Browse files Browse the repository at this point in the history
  • Loading branch information
FunkyFr3sh committed Oct 3, 2024
1 parent 95a5f72 commit ca6c447
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 6 deletions.
1 change: 0 additions & 1 deletion inc/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 0 additions & 2 deletions src/config.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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"
Expand Down
4 changes: 2 additions & 2 deletions src/dd.c
Original file line number Diff line number Diff line change
Expand Up @@ -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 */
Expand Down
13 changes: 12 additions & 1 deletion src/wndproc.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit ca6c447

Please sign in to comment.