From: Alexandros Frantzis <alexandros.frantzis(a)collabora.com> This allows wayland_win_data_update_wayland_surface() to be called outside of WAYLAND_WindowPosChange, which will be needed in upcoming commits. --- dlls/winewayland.drv/waylanddrv.h | 5 +---- dlls/winewayland.drv/window.c | 26 ++++++++++++-------------- 2 files changed, 13 insertions(+), 18 deletions(-) diff --git a/dlls/winewayland.drv/waylanddrv.h b/dlls/winewayland.drv/waylanddrv.h index 5bde94a0ac9..3ac3865efd2 100644 --- a/dlls/winewayland.drv/waylanddrv.h +++ b/dlls/winewayland.drv/waylanddrv.h @@ -290,10 +290,7 @@ struct wayland_win_data struct wayland_surface *wayland_surface; /* wine window_surface backing this window */ struct window_surface *window_surface; - /* USER window rectangle relative to win32 parent window client area */ - RECT window_rect; - /* USER client rectangle relative to win32 parent window client area */ - RECT client_rect; + struct window_rects rects; BOOL managed; }; diff --git a/dlls/winewayland.drv/window.c b/dlls/winewayland.drv/window.c index 233ca0e5a62..9e228b779f9 100644 --- a/dlls/winewayland.drv/window.c +++ b/dlls/winewayland.drv/window.c @@ -76,9 +76,7 @@ static struct rb_tree win_data_rb = { wayland_win_data_cmp_rb }; * * Create a data window structure for an existing window. */ -static struct wayland_win_data *wayland_win_data_create(HWND hwnd, - const RECT *window_rect, - const RECT *client_rect) +static struct wayland_win_data *wayland_win_data_create(HWND hwnd, struct window_rects *rects) { struct wayland_win_data *data; struct rb_entry *rb_entry; @@ -92,8 +90,7 @@ static struct wayland_win_data *wayland_win_data_create(HWND hwnd, if (!(data = calloc(1, sizeof(*data)))) return NULL; data->hwnd = hwnd; - data->window_rect = *window_rect; - data->client_rect = *client_rect; + data->rects = *rects; pthread_mutex_lock(&win_data_mutex); @@ -167,8 +164,8 @@ static void wayland_win_data_get_config(struct wayland_win_data *data, enum wayland_surface_config_state window_state = 0; DWORD style; - conf->rect = data->window_rect; - conf->client_rect = data->client_rect; + conf->rect = data->rects.window; + conf->client_rect = data->rects.client; style = NtUserGetWindowLongW(data->hwnd, GWL_STYLE); TRACE("window=%s style=%#lx\n", wine_dbgstr_rect(&conf->rect), (long)style); @@ -200,14 +197,14 @@ static void reapply_cursor_clipping(void) NtUserSetThreadDpiAwarenessContext(context); } -static void wayland_win_data_update_wayland_surface(struct wayland_win_data *data, const RECT *visible_rect) +static void wayland_win_data_update_wayland_surface(struct wayland_win_data *data) { struct wayland_surface *surface = data->wayland_surface; HWND parent = NtUserGetAncestor(data->hwnd, GA_PARENT); BOOL visible, xdg_visible; WCHAR text[1024]; - TRACE("hwnd=%p, rect=%s\n", data->hwnd, wine_dbgstr_rect(visible_rect)); + TRACE("hwnd=%p\n", data->hwnd); /* We don't want wayland surfaces for child windows. */ if (parent != NtUserGetDesktopWindow() && parent != 0) @@ -251,7 +248,8 @@ static void wayland_win_data_update_wayland_surface(struct wayland_win_data *dat pthread_mutex_unlock(&surface->mutex); if (data->window_surface) - wayland_window_surface_update_wayland_surface(data->window_surface, visible_rect, surface); + wayland_window_surface_update_wayland_surface(data->window_surface, + &data->rects.visible, surface); /* Size/position changes affect the effective pointer constraint, so update * it as needed. */ @@ -433,7 +431,8 @@ BOOL WAYLAND_WindowPosChanging(HWND hwnd, UINT swp_flags, BOOL shaped, struct wi TRACE("hwnd %p, swp_flags %04x, shaped %u, rects %s\n", hwnd, swp_flags, shaped, debugstr_window_rects(rects)); - if (!data && !(data = wayland_win_data_create(hwnd, &rects->window, &rects->client))) return FALSE; /* use default surface */ + if (!data && !(data = wayland_win_data_create(hwnd, rects))) return FALSE; + wayland_win_data_release(data); return TRUE; @@ -458,15 +457,14 @@ void WAYLAND_WindowPosChanged(HWND hwnd, HWND insert_after, UINT swp_flags, cons if (!(data = wayland_win_data_get(hwnd))) return; - data->window_rect = new_rects->window; - data->client_rect = new_rects->client; + data->rects = *new_rects; data->managed = managed; if (surface) window_surface_add_ref(surface); if (data->window_surface) window_surface_release(data->window_surface); data->window_surface = surface; - wayland_win_data_update_wayland_surface(data, &new_rects->visible); + wayland_win_data_update_wayland_surface(data); if (data->wayland_surface) wayland_win_data_update_wayland_state(data); wayland_win_data_release(data); -- GitLab https://gitlab.winehq.org/wine/wine/-/merge_requests/6107