From c1a14a31d533a9023b463554296c553d9a492d66 Mon Sep 17 00:00:00 2001 From: FunkyFr3sh Date: Fri, 24 May 2024 02:26:46 +0200 Subject: [PATCH] add new setting to enable (very bugged) resize in wine --- inc/config.h | 1 + src/config.c | 2 ++ src/dd.c | 2 +- src/wndproc.c | 13 ++++++------- 4 files changed, 10 insertions(+), 8 deletions(-) diff --git a/inc/config.h b/inc/config.h index 33b5b7c240..135f0dfc54 100644 --- a/inc/config.h +++ b/inc/config.h @@ -77,6 +77,7 @@ typedef struct CNCDDRAWCONFIG BOOL direct3d_passthrough; BOOL center_cursor_fix; char fake_mode[128]; + BOOL wine_allow_resize; /* Hotkeys */ diff --git a/src/config.c b/src/config.c index 94bcdc641a..5af9fa03a3 100644 --- a/src/config.c +++ b/src/config.c @@ -90,6 +90,7 @@ void cfg_load() GET_BOOL(g_config.direct3d_passthrough, "direct3d_passthrough", FALSE); GET_BOOL(g_config.center_cursor_fix, "center_cursor_fix", FALSE); GET_STRING("fake_mode", "", g_config.fake_mode, sizeof(g_config.fake_mode)); + GET_BOOL(g_config.wine_allow_resize, "wine_allow_resize", FALSE); /* Hotkeys */ @@ -303,6 +304,7 @@ static void cfg_create_ini() "direct3d_passthrough=false\n" "center_cursor_fix=false\n" ";fake_mode=640x480x32\n" + "wine_allow_resize=false\n" "\n" "\n" "\n" diff --git a/src/dd.c b/src/dd.c index 599e8c4e4b..41aa9aad34 100644 --- a/src/dd.c +++ b/src/dd.c @@ -938,7 +938,7 @@ HRESULT dd_SetDisplayMode(DWORD dwWidth, DWORD dwHeight, DWORD dwBPP, DWORD dwFl real_SetWindowLongA(g_ddraw.hwnd, GWL_EXSTYLE, exstyle & ~(WS_EX_CLIENTEDGE)); } - if (IsWine()) + if (!g_config.wine_allow_resize && IsWine()) { real_SetWindowLongA( g_ddraw.hwnd, diff --git a/src/wndproc.c b/src/wndproc.c index 69e9d4bb53..4f53765708 100644 --- a/src/wndproc.c +++ b/src/wndproc.c @@ -431,15 +431,14 @@ LRESULT CALLBACK fake_WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam g_config.window_rect.right = LOWORD(lParam); g_config.window_rect.bottom = HIWORD(lParam); } - /* - else if (g_ddraw.wine) + else if (!in_size_move && !g_config.fullscreen && g_config.wine_allow_resize && IsLinux()) { - WindowRect.right = LOWORD(lParam); - WindowRect.bottom = HIWORD(lParam); - if (WindowRect.right != g_ddraw.render.width || WindowRect.bottom != g_ddraw.render.height) - dd_SetDisplayMode(g_ddraw.width, g_ddraw.height, g_ddraw.bpp); + g_config.window_rect.right = LOWORD(lParam); + g_config.window_rect.bottom = HIWORD(lParam); + + if (g_config.window_rect.right != g_ddraw.render.width || g_config.window_rect.bottom != g_ddraw.render.height) + dd_SetDisplayMode(g_ddraw.width, g_ddraw.height, g_ddraw.bpp, 0); } - */ } }