Skip to content

Commit

Permalink
fix maximize button on linux
Browse files Browse the repository at this point in the history
  • Loading branch information
FunkyFr3sh committed Oct 3, 2024
1 parent 5c853ca commit f131640
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 14 deletions.
8 changes: 0 additions & 8 deletions src/dd.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
30 changes: 24 additions & 6 deletions src/wndproc.c
Original file line number Diff line number Diff line change
Expand Up @@ -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 */
Expand All @@ -457,16 +460,31 @@ 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);
}
}
}
}
Expand Down Expand Up @@ -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)
{
Expand Down

0 comments on commit f131640

Please sign in to comment.