1
0
mirror of https://github.com/FunkyFr3sh/cnc-ddraw.git synced 2025-03-16 06:18:53 +01:00

fix maximize button on linux

This commit is contained in:
FunkyFr3sh 2024-10-03 13:49:57 +02:00
parent 5c853ca487
commit f1316407d1
2 changed files with 24 additions and 14 deletions

@ -1093,14 +1093,6 @@ HRESULT dd_SetDisplayMode(DWORD dwWidth, DWORD dwHeight, DWORD dwBPP, DWORD dwFl
real_SetWindowLongA(g_ddraw.hwnd, GWL_EXSTYLE, exstyle & ~(WS_EX_CLIENTEDGE));
}
if (IsLinux())
{
real_SetWindowLongA(
g_ddraw.hwnd,
GWL_STYLE,
(real_GetWindowLongA(g_ddraw.hwnd, GWL_STYLE) | WS_MINIMIZEBOX) & ~(WS_MAXIMIZEBOX));
}
/* center the window with correct dimensions */
int cy = g_ddraw.mode.dmPelsWidth ? g_ddraw.mode.dmPelsWidth : g_ddraw.render.width;
int cx = g_ddraw.mode.dmPelsHeight ? g_ddraw.mode.dmPelsHeight : g_ddraw.render.height;

@ -441,6 +441,9 @@ LRESULT CALLBACK fake_WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam
{
if (g_config.windowed)
{
WORD width = LOWORD(lParam);
WORD height = HIWORD(lParam);
if (wParam == SIZE_RESTORED)
{
/* macOS maximize hack */
@ -457,19 +460,34 @@ LRESULT CALLBACK fake_WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam
if (in_size_move && !g_ddraw.render.thread)
{
g_config.window_rect.right = LOWORD(lParam);
g_config.window_rect.bottom = HIWORD(lParam);
g_config.window_rect.right = width;
g_config.window_rect.bottom = height;
}
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);
if (width != g_ddraw.render.width || height != g_ddraw.render.height)
{
g_config.window_rect.right = width;
g_config.window_rect.bottom = height;
if (g_config.window_rect.right != g_ddraw.render.width || g_config.window_rect.bottom != g_ddraw.render.height)
dd_SetDisplayMode(0, 0, 0, 0);
}
}
}
else if (wParam == SIZE_MAXIMIZED)
{
if (!in_size_move && g_ddraw.render.thread && !g_config.fullscreen && IsLinux())
{
if (width != g_ddraw.render.width || height != g_ddraw.render.height)
{
g_config.window_rect.right = width;
g_config.window_rect.bottom = height;
dd_SetDisplayMode(0, 0, 0, 0);
}
}
}
}
if (g_ddraw.got_child_windows)
{
@ -532,7 +550,7 @@ LRESULT CALLBACK fake_WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam
}
}
if (wParam == SC_MAXIMIZE)
if (wParam == SC_MAXIMIZE && !IsWine())
{
if (g_config.resizable)
{