On Windows, applications can disable titlebar by extending the client rect to a bigger rect which will cover the area of the titlebar from WM_NCCALCSIZE: https://learn.microsoft.com/en-us/windows/win32/dwm/customframe#removing-the... Our current x11 and Mac driver doesn't handle this case.
Attached is a test case for reproducing the issue.
[hide_caption.c](/uploads/46a725e32569a6a0a929a0f183cf9ed8/hide_caption.c)
From: Jactry Zeng jzeng@codeweavers.com
--- dlls/winex11.drv/window.c | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-)
diff --git a/dlls/winex11.drv/window.c b/dlls/winex11.drv/window.c index d109d6a744e..6628e42e2e3 100644 --- a/dlls/winex11.drv/window.c +++ b/dlls/winex11.drv/window.c @@ -432,7 +432,7 @@ static inline BOOL is_window_resizable( struct x11drv_win_data *data, DWORD styl /*********************************************************************** * get_mwm_decorations */ -static unsigned long get_mwm_decorations_for_style( DWORD style, DWORD ex_style ) +static unsigned long get_mwm_decorations_for_style( struct x11drv_win_data *data, DWORD style, DWORD ex_style ) { unsigned long ret = 0;
@@ -441,6 +441,9 @@ static unsigned long get_mwm_decorations_for_style( DWORD style, DWORD ex_style
if ((style & WS_CAPTION) == WS_CAPTION) { + if (data && ((data->rects.client.top - data->rects.window.top) < NtUserGetSystemMetrics(SM_CYCAPTION))) + return 0; + ret |= MWM_DECOR_TITLE | MWM_DECOR_BORDER; if (style & WS_SYSMENU) ret |= MWM_DECOR_MENU; if (style & WS_MINIMIZEBOX) ret |= MWM_DECOR_MINIMIZE; @@ -459,7 +462,7 @@ static unsigned long get_mwm_decorations_for_style( DWORD style, DWORD ex_style static unsigned long get_mwm_decorations( struct x11drv_win_data *data, DWORD style, DWORD ex_style ) { if (EqualRect( &data->rects.window, &data->rects.visible )) return 0; - return get_mwm_decorations_for_style( style, ex_style ); + return get_mwm_decorations_for_style( data, style, ex_style ); }
@@ -2900,10 +2903,13 @@ void X11DRV_MoveWindowBits( HWND hwnd, const struct window_rects *old_rects, */ BOOL X11DRV_GetWindowStyleMasks( HWND hwnd, UINT style, UINT ex_style, UINT *style_mask, UINT *ex_style_mask ) { - unsigned long decor = get_mwm_decorations_for_style( style, ex_style ); struct x11drv_win_data *data; + unsigned long decor;
- if ((data = get_win_data( hwnd ))) + data = get_win_data( hwnd ); + decor = get_mwm_decorations_for_style( data, style, ex_style ); + + if (data) { if (!data->managed) decor = 0; release_win_data( data );
From: Jactry Zeng jzeng@codeweavers.com
--- dlls/winemac.drv/window.c | 25 +++++++++++++++++-------- 1 file changed, 17 insertions(+), 8 deletions(-)
diff --git a/dlls/winemac.drv/window.c b/dlls/winemac.drv/window.c index 115820ec376..dd90c8ef6d9 100644 --- a/dlls/winemac.drv/window.c +++ b/dlls/winemac.drv/window.c @@ -56,7 +56,7 @@ static BOOL set_window_pos(HWND hwnd, HWND after, INT x, INT y, INT cx, INT cy, }
-static struct macdrv_window_features get_window_features_for_style(DWORD style, DWORD ex_style, BOOL shaped) +static struct macdrv_window_features get_window_features_for_style(struct macdrv_win_data *data, DWORD style, DWORD ex_style, BOOL shaped) { struct macdrv_window_features wf = {0};
@@ -67,11 +67,16 @@ static struct macdrv_window_features get_window_features_for_style(DWORD style, wf.shadow = TRUE; if (!shaped) { - wf.title_bar = TRUE; - if (style & WS_SYSMENU) wf.close_button = TRUE; - if (style & WS_MINIMIZEBOX) wf.minimize_button = TRUE; - if (style & WS_MAXIMIZEBOX) wf.maximize_button = TRUE; - if (ex_style & WS_EX_TOOLWINDOW) wf.utility = TRUE; + if (data && ((data->rects.client.top - data->rects.window.top) < NtUserGetSystemMetrics(SM_CYCAPTION))) + wf.title_bar = FALSE; + else + { + wf.title_bar = TRUE; + if (style & WS_SYSMENU) wf.close_button = TRUE; + if (style & WS_MINIMIZEBOX) wf.minimize_button = TRUE; + if (style & WS_MAXIMIZEBOX) wf.maximize_button = TRUE; + if (ex_style & WS_EX_TOOLWINDOW) wf.utility = TRUE; + } } } if (style & WS_THICKFRAME) @@ -95,7 +100,7 @@ static struct macdrv_window_features get_cocoa_window_features(struct macdrv_win if (ex_style & WS_EX_NOACTIVATE) wf.prevents_app_activation = TRUE; if (EqualRect(&data->rects.window, &data->rects.visible)) return wf;
- return get_window_features_for_style(style, ex_style, data->shaped); + return get_window_features_for_style(data, style, ex_style, data->shaped); }
@@ -1702,7 +1707,11 @@ BOOL macdrv_WindowPosChanging(HWND hwnd, UINT swp_flags, BOOL shaped, const stru */ BOOL macdrv_GetWindowStyleMasks(HWND hwnd, UINT style, UINT ex_style, UINT *style_mask, UINT *ex_style_mask) { - struct macdrv_window_features wf = get_window_features_for_style(style, ex_style, FALSE); + struct macdrv_win_data *data = get_win_data(hwnd); + struct macdrv_window_features wf; + + wf = get_window_features_for_style(data, style, ex_style, FALSE); + release_win_data(data);
*style_mask = ex_style = 0; if (wf.title_bar)
Hi,
It looks like your patch introduced the new failures shown below. Please investigate and fix them before resubmitting your patch. If they are not new, fixing them anyway would help a lot. Otherwise please ask for the known failures list to be updated.
The tests also ran into some preexisting test failures. If you know how to fix them that would be helpful. See the TestBot job for the details:
The full results can be found at: https://testbot.winehq.org/JobDetails.pl?Key=150397
Your paranoid android.
=== debian11b (64 bit WoW report) ===
user32: input.c:4305: Test succeeded inside todo block: button_down_hwnd_todo 1: got MSG_TEST_WIN hwnd 00000000017500CA, msg WM_LBUTTONDOWN, wparam 0x1, lparam 0x320032 msg.c:5631: Test failed: ShowWindow(SW_RESTORE):overlapped: 53: the msg sequence is not complete: expected msg 0000 - actual msg 0046 sysparams.c:3621: Test succeeded inside todo block: 0/0: wrong clip box win DC (0,0)-(295,303) expected (0,0)-(295,303) sysparams.c:3621: Test succeeded inside todo block: 0/1: wrong clip box win DC (0,0)-(295,303) expected (0,0)-(295,303) sysparams.c:3621: Test succeeded inside todo block: 0/2: wrong clip box win DC (0,0)-(295,303) expected (0,0)-(295,303) sysparams.c:3621: Test succeeded inside todo block: 1/0: wrong clip box win DC (0,0)-(295,303) expected (0,0)-(295,303) sysparams.c:3621: Test succeeded inside todo block: 1/1: wrong clip box win DC (0,0)-(295,303) expected (0,0)-(295,303) sysparams.c:3621: Test succeeded inside todo block: 1/2: wrong clip box win DC (0,0)-(295,303) expected (0,0)-(295,303) sysparams.c:3621: Test succeeded inside todo block: 2/0: wrong clip box win DC (0,0)-(295,303) expected (0,0)-(295,303) sysparams.c:3621: Test succeeded inside todo block: 2/1: wrong clip box win DC (0,0)-(295,303) expected (0,0)-(295,303) sysparams.c:3621: Test succeeded inside todo block: 2/2: wrong clip box win DC (0,0)-(295,303) expected (0,0)-(295,303)