From: Rémi Bernon rbernon@codeweavers.com
--- dlls/winewayland.drv/wayland_surface.c | 17 ++++++++++++++++- dlls/winewayland.drv/waylanddrv.h | 1 + dlls/winewayland.drv/window.c | 6 +++++- 3 files changed, 22 insertions(+), 2 deletions(-)
diff --git a/dlls/winewayland.drv/wayland_surface.c b/dlls/winewayland.drv/wayland_surface.c index 27d1fde8c12..1cf5dd3f8ce 100644 --- a/dlls/winewayland.drv/wayland_surface.c +++ b/dlls/winewayland.drv/wayland_surface.c @@ -513,7 +513,11 @@ void wayland_surface_reconfigure_client(struct wayland_surface *surface, struct
TRACE("hwnd=%p subsurface=%d,%d+%dx%d\n", surface->hwnd, x, y, width, height);
- wl_subsurface_set_position(client->wl_subsurface, x, y); + if (client->wl_subsurface) + { + wl_subsurface_set_position(client->wl_subsurface, x, y); + wl_subsurface_place_above(client->wl_subsurface, surface->wl_surface); + }
if (width != 0 && height != 0) wp_viewport_set_destination(client->wp_viewport, width, height); @@ -815,6 +819,8 @@ err:
void wayland_client_surface_attach(struct wayland_client_surface *client, struct wayland_surface *surface) { + wayland_client_surface_detach(client); + client->wl_subsurface = wl_subcompositor_get_subsurface(process_wayland.wl_subcompositor, client->wl_surface, @@ -832,6 +838,15 @@ void wayland_client_surface_attach(struct wayland_client_surface *client, struct wl_surface_commit(surface->wl_surface); }
+void wayland_client_surface_detach(struct wayland_client_surface *client) +{ + if (client->wl_subsurface) + { + wl_subsurface_destroy(client->wl_subsurface); + client->wl_subsurface = NULL; + } +} + static void dummy_buffer_release(void *data, struct wl_buffer *buffer) { struct wayland_shm_buffer *shm_buffer = data; diff --git a/dlls/winewayland.drv/waylanddrv.h b/dlls/winewayland.drv/waylanddrv.h index ecefeeb77af..9de42758aa1 100644 --- a/dlls/winewayland.drv/waylanddrv.h +++ b/dlls/winewayland.drv/waylanddrv.h @@ -255,6 +255,7 @@ void wayland_surface_coords_to_window(struct wayland_surface *surface, struct wayland_client_surface *wayland_client_surface_create(HWND hwnd); BOOL wayland_client_surface_release(struct wayland_client_surface *client); void wayland_client_surface_attach(struct wayland_client_surface *client, struct wayland_surface *surface); +void wayland_client_surface_detach(struct wayland_client_surface *client); void wayland_surface_ensure_contents(struct wayland_surface *surface, struct wayland_client_surface *client); void wayland_surface_set_title(struct wayland_surface *surface, LPCWSTR title);
diff --git a/dlls/winewayland.drv/window.c b/dlls/winewayland.drv/window.c index a839c14d537..025b0ea493d 100644 --- a/dlls/winewayland.drv/window.c +++ b/dlls/winewayland.drv/window.c @@ -712,9 +712,13 @@ struct wayland_client_surface *get_client_surface(HWND hwnd, RECT *client_rect) } if (!data) return client;
+ if (surface && NtUserIsWindowVisible(hwnd)) + wayland_client_surface_attach(client, surface); + else + wayland_client_surface_detach(client); + if (!data->client_surface) { - if (surface) wayland_client_surface_attach(client, surface); InterlockedIncrement(&client->ref); data->client_surface = client; }