From: Rémi Bernon rbernon@codeweavers.com
--- dlls/winewayland.drv/wayland_surface.c | 1 + dlls/winewayland.drv/window.c | 15 ++++++++------- 2 files changed, 9 insertions(+), 7 deletions(-)
diff --git a/dlls/winewayland.drv/wayland_surface.c b/dlls/winewayland.drv/wayland_surface.c index c58aeca7286..4f72150949b 100644 --- a/dlls/winewayland.drv/wayland_surface.c +++ b/dlls/winewayland.drv/wayland_surface.c @@ -850,6 +850,7 @@ void wayland_client_surface_attach(struct wayland_client_surface *client, HWND t }
NtUserGetClientRect(client->hwnd, &client_rect, get_win_monitor_dpi(client->hwnd)); + NtUserMapWindowPoints(client->hwnd, toplevel, (POINT *)&client_rect, 2, get_win_monitor_dpi(client->hwnd));
wayland_surface_reconfigure_client(surface, client, &client_rect); /* Commit to apply subsurface positioning. */ diff --git a/dlls/winewayland.drv/window.c b/dlls/winewayland.drv/window.c index b0b8f1a549b..2a9f4ff8036 100644 --- a/dlls/winewayland.drv/window.c +++ b/dlls/winewayland.drv/window.c @@ -434,6 +434,7 @@ BOOL WAYLAND_WindowPosChanging(HWND hwnd, UINT swp_flags, BOOL shaped, const str void WAYLAND_WindowPosChanged(HWND hwnd, HWND insert_after, UINT swp_flags, BOOL fullscreen, const struct window_rects *new_rects, struct window_surface *surface) { + HWND toplevel = NtUserGetAncestor(hwnd, GA_ROOT); struct wayland_client_surface *client; struct wayland_win_data *data; BOOL managed; @@ -455,7 +456,10 @@ void WAYLAND_WindowPosChanged(HWND hwnd, HWND insert_after, UINT swp_flags, BOOL { if ((client = data->client_surface)) { - wayland_client_surface_detach(client); + if (toplevel && NtUserIsWindowVisible(hwnd)) + wayland_client_surface_attach(client, toplevel); + else + wayland_client_surface_detach(client); }
if (data->wayland_surface) @@ -710,21 +714,18 @@ LRESULT WAYLAND_SysCommand(HWND hwnd, WPARAM wparam, LPARAM lparam) */ struct wayland_client_surface *get_client_surface(HWND hwnd) { + HWND toplevel = NtUserGetAncestor(hwnd, GA_ROOT); struct wayland_client_surface *client; - struct wayland_surface *surface; struct wayland_win_data *data;
if ((data = wayland_win_data_get(hwnd))) { - surface = data->wayland_surface; - /* ownership is shared with one of the callers, the last caller to release * its reference will also destroy it and clear our pointer. */ if ((client = data->client_surface)) InterlockedIncrement(&client->ref); } else { - surface = NULL; client = NULL; }
@@ -735,8 +736,8 @@ struct wayland_client_surface *get_client_surface(HWND hwnd) } if (!data) return client;
- if (surface && NtUserIsWindowVisible(hwnd)) - wayland_client_surface_attach(client, data->hwnd); + if (toplevel && NtUserIsWindowVisible(hwnd)) + wayland_client_surface_attach(client, toplevel); else wayland_client_surface_detach(client);