Several applications -Steam, Battle.net for instance- handle the WM_NCCALCSIZE message to override the non-client areas size and make the client area cover the whole window, instead of changing the styles.
In winex11.drv, in decorated mode, we adjust the window rect according to the window style to hide the unwanted decorations behind the frame, but when client and window rects are equals, there's nothing to hide and the actual window styles are irrelevant and can safely be ignored.
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=40930 Signed-off-by: Rémi Bernon rbernon@codeweavers.com ---
v2: Use the new window and client rectangles from within the X11DRV_WindowPosChanging callback.
dlls/winex11.drv/window.c | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-)
diff --git a/dlls/winex11.drv/window.c b/dlls/winex11.drv/window.c index 99e4094ebd9..4676b099358 100644 --- a/dlls/winex11.drv/window.c +++ b/dlls/winex11.drv/window.c @@ -280,13 +280,16 @@ static inline BOOL is_window_resizable( struct x11drv_win_data *data, DWORD styl * get_mwm_decorations */ static unsigned long get_mwm_decorations( struct x11drv_win_data *data, - DWORD style, DWORD ex_style ) + DWORD style, DWORD ex_style, + const RECT *window_rect, + const RECT *client_rect ) { unsigned long ret = 0;
if (!decorated_mode) return 0;
- if (IsRectEmpty( &data->window_rect )) return 0; + if (EqualRect( window_rect, client_rect )) return 0; + if (IsRectEmpty( window_rect )) return 0; if (data->shaped) return 0;
if (ex_style & WS_EX_TOOLWINDOW) return 0; @@ -712,7 +715,7 @@ static void set_mwm_hints( struct x11drv_win_data *data, DWORD style, DWORD ex_s } else { - mwm_hints.decorations = get_mwm_decorations( data, style, ex_style ); + mwm_hints.decorations = get_mwm_decorations( data, style, ex_style, &data->window_rect, &data->client_rect ); mwm_hints.functions = MWM_FUNC_MOVE; if (is_window_resizable( data, style )) mwm_hints.functions |= MWM_FUNC_RESIZE; if (!(style & WS_DISABLED)) @@ -1157,7 +1160,8 @@ void make_window_embedded( struct x11drv_win_data *data ) * * Convert a rect from client to X window coordinates */ -static void X11DRV_window_to_X_rect( struct x11drv_win_data *data, RECT *rect ) +static void X11DRV_window_to_X_rect( struct x11drv_win_data *data, RECT *rect, + const RECT *window_rect, const RECT *client_rect ) { DWORD style, ex_style, style_mask = 0, ex_style_mask = 0; unsigned long decor; @@ -1168,7 +1172,7 @@ static void X11DRV_window_to_X_rect( struct x11drv_win_data *data, RECT *rect )
style = GetWindowLongW( data->hwnd, GWL_STYLE ); ex_style = GetWindowLongW( data->hwnd, GWL_EXSTYLE ); - decor = get_mwm_decorations( data, style, ex_style ); + decor = get_mwm_decorations( data, style, ex_style, window_rect, client_rect );
if (decor & MWM_DECOR_TITLE) style_mask |= WS_CAPTION; if (decor & MWM_DECOR_BORDER) @@ -2274,7 +2278,7 @@ void CDECL X11DRV_WindowPosChanging( HWND hwnd, HWND insert_after, UINT swp_flag }
*visible_rect = *window_rect; - X11DRV_window_to_X_rect( data, visible_rect ); + X11DRV_window_to_X_rect( data, visible_rect, window_rect, client_rect );
/* create the window surface if necessary */
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=46857 Signed-off-by: Rémi Bernon rbernon@codeweavers.com ---
This is even more theoretical since the changes are bigger than the previous version and as I did't setup a MacOS cross build environment yet.
dlls/winemac.drv/window.c | 34 ++++++++++++++++++++-------------- 1 file changed, 20 insertions(+), 14 deletions(-)
diff --git a/dlls/winemac.drv/window.c b/dlls/winemac.drv/window.c index 605c0c87f16..066eb553f76 100644 --- a/dlls/winemac.drv/window.c +++ b/dlls/winemac.drv/window.c @@ -57,12 +57,15 @@ static DWORD activate_on_focus_time; */ static void get_cocoa_window_features(struct macdrv_win_data *data, DWORD style, DWORD ex_style, - struct macdrv_window_features* wf) + struct macdrv_window_features* wf, + const RECT *window_rect, + const RECT *client_rect) { memset(wf, 0, sizeof(*wf));
if (disable_window_decorations) return; - if (IsRectEmpty(&data->window_rect)) return; + if (IsRectEmpty(window_rect)) return; + if (EqualRect(window_rect, client_rect)) return;
if ((style & WS_CAPTION) == WS_CAPTION && !(ex_style & WS_EX_LAYERED)) { @@ -130,7 +133,8 @@ static void get_cocoa_window_state(struct macdrv_win_data *data, * * Helper for macdrv_window_to_mac_rect and macdrv_mac_to_window_rect. */ -static void get_mac_rect_offset(struct macdrv_win_data *data, DWORD style, RECT *rect) +static void get_mac_rect_offset(struct macdrv_win_data *data, DWORD style, RECT *rect, + const RECT *window_rect, const RECT *client_rect) { DWORD ex_style, style_mask = 0, ex_style_mask = 0;
@@ -141,7 +145,7 @@ static void get_mac_rect_offset(struct macdrv_win_data *data, DWORD style, RECT if (!data->shaped) { struct macdrv_window_features wf; - get_cocoa_window_features(data, style, ex_style, &wf); + get_cocoa_window_features(data, style, ex_style, &wf, window_rect, client_rect);
if (wf.title_bar) { @@ -167,14 +171,15 @@ static void get_mac_rect_offset(struct macdrv_win_data *data, DWORD style, RECT * * Convert a rect from client to Mac window coordinates */ -static void macdrv_window_to_mac_rect(struct macdrv_win_data *data, DWORD style, RECT *rect) +static void macdrv_window_to_mac_rect(struct macdrv_win_data *data, DWORD style, RECT *rect, + const RECT *window_rect, const RECT *client_rect) { RECT rc;
if ((style & (WS_POPUP|WS_CHILD)) == WS_CHILD) return; if (IsRectEmpty(rect)) return;
- get_mac_rect_offset(data, style, &rc); + get_mac_rect_offset(data, style, &rc, window_rect, client_rect);
rect->left -= rc.left; rect->right -= rc.right; @@ -198,7 +203,7 @@ static void macdrv_mac_to_window_rect(struct macdrv_win_data *data, RECT *rect) if ((style & (WS_POPUP|WS_CHILD)) == WS_CHILD) return; if (IsRectEmpty(rect)) return;
- get_mac_rect_offset(data, style, &rc); + get_mac_rect_offset(data, style, &rc, &data->window_rect, &data->client_rect);
rect->left += rc.left; rect->right += rc.right; @@ -351,7 +356,7 @@ static void set_cocoa_window_properties(struct macdrv_win_data *data) owner_win = macdrv_get_cocoa_window(owner, TRUE); macdrv_set_cocoa_parent_window(data->cocoa_window, owner_win);
- get_cocoa_window_features(data, style, ex_style, &wf); + get_cocoa_window_features(data, style, ex_style, &wf, &data->window_rect, &data->client_rect); macdrv_set_cocoa_window_features(data->cocoa_window, &wf);
get_cocoa_window_state(data, style, ex_style, &state); @@ -620,7 +625,7 @@ static void sync_window_min_max_info(HWND hwnd) CGSize min_size, max_size;
SetRect(&min_rect, 0, 0, minmax.ptMinTrackSize.x, minmax.ptMinTrackSize.y); - macdrv_window_to_mac_rect(data, style, &min_rect); + macdrv_window_to_mac_rect(data, style, &min_rect, &data->window_rect, &data->client_rect); min_size = CGSizeMake(min_rect.right - min_rect.left, min_rect.bottom - min_rect.top);
if (minmax.ptMaxTrackSize.x == GetSystemMetrics(SM_CXMAXTRACK) && @@ -629,7 +634,7 @@ static void sync_window_min_max_info(HWND hwnd) else { SetRect(&max_rect, 0, 0, minmax.ptMaxTrackSize.x, minmax.ptMaxTrackSize.y); - macdrv_window_to_mac_rect(data, style, &max_rect); + macdrv_window_to_mac_rect(data, style, &max_rect, &data->window_rect, &data->client_rect); max_size = CGSizeMake(max_rect.right - max_rect.left, max_rect.bottom - max_rect.top); }
@@ -691,9 +696,9 @@ static void create_cocoa_window(struct macdrv_win_data *data) ex_style = GetWindowLongW(data->hwnd, GWL_EXSTYLE);
data->whole_rect = data->window_rect; - macdrv_window_to_mac_rect(data, style, &data->whole_rect); + macdrv_window_to_mac_rect(data, style, &data->whole_rect, &data->window_rect, &data->client_rect);
- get_cocoa_window_features(data, style, ex_style, &wf); + get_cocoa_window_features(data, style, ex_style, &wf, &data->window_rect, &data->client_rect);
frame = cgrect_from_rect(data->whole_rect); constrain_window_frame(&frame); @@ -2063,7 +2068,7 @@ void CDECL macdrv_WindowPosChanging(HWND hwnd, HWND insert_after, UINT swp_flags if (!data && !(data = macdrv_create_win_data(hwnd, window_rect, client_rect))) return;
*visible_rect = *window_rect; - macdrv_window_to_mac_rect(data, style, visible_rect); + macdrv_window_to_mac_rect(data, style, visible_rect, window_rect, client_rect); TRACE("visible_rect %s -> %s\n", wine_dbgstr_rect(window_rect), wine_dbgstr_rect(visible_rect));
@@ -2845,7 +2850,8 @@ BOOL query_resize_size(HWND hwnd, macdrv_query *query)
if (SendMessageW(hwnd, WM_SIZING, corner, (LPARAM)&rect)) { - macdrv_window_to_mac_rect(data, GetWindowLongW(hwnd, GWL_STYLE), &rect); + macdrv_window_to_mac_rect(data, GetWindowLongW(hwnd, GWL_STYLE), &rect, + &data->window_rect, &data->client_rect); query->resize_size.rect = cgrect_from_rect(rect); ret = TRUE; }
Signed-off-by: Ken Thomases ken@codeweavers.com