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; }