From: Rémi Bernon <rbernon@codeweavers.com> Temporarily, when we're changing roles. The client surfaces should be attached back again by win32u calling update_client_surfaces after WindowPosChanged. --- dlls/win32u/window.c | 2 +- dlls/winewayland.drv/wayland_surface.c | 6 ++---- dlls/winewayland.drv/window.c | 9 +++++---- include/wine/gdi_driver.h | 1 + 4 files changed, 9 insertions(+), 9 deletions(-) diff --git a/dlls/win32u/window.c b/dlls/win32u/window.c index f4dc335c5cf..b5136b69379 100644 --- a/dlls/win32u/window.c +++ b/dlls/win32u/window.c @@ -320,7 +320,7 @@ void detach_client_surfaces( HWND hwnd ) } } -static void update_client_surfaces( HWND hwnd ) +void update_client_surfaces( HWND hwnd ) { struct client_surface *surface, *next; diff --git a/dlls/winewayland.drv/wayland_surface.c b/dlls/winewayland.drv/wayland_surface.c index 39064b61e62..8d4dfb0f618 100644 --- a/dlls/winewayland.drv/wayland_surface.c +++ b/dlls/winewayland.drv/wayland_surface.c @@ -142,7 +142,6 @@ void wp_fractional_scale_handle_scale(void* user_data, uint32_t scale_fixed) { struct wayland_win_data *data; - struct wayland_client_surface *client; struct wayland_surface *surface; double scale = scale_fixed / 120.0; HWND hwnd = user_data; @@ -158,9 +157,8 @@ void wp_fractional_scale_handle_scale(void* user_data, surface->window.scale = scale; - /* reattach the client surface as its rect has changed */ - if ((client = data->client_surface)) - wayland_client_surface_attach(client, client->toplevel); + /* reattach client surfaces as their rects have changed */ + update_client_surfaces(hwnd); /* the subsurface rect has changed */ if (surface->role == WAYLAND_SURFACE_ROLE_SUBSURFACE) diff --git a/dlls/winewayland.drv/window.c b/dlls/winewayland.drv/window.c index de4188957bd..887e233c8ed 100644 --- a/dlls/winewayland.drv/window.c +++ b/dlls/winewayland.drv/window.c @@ -175,7 +175,6 @@ static void reapply_cursor_clipping(void) static BOOL wayland_win_data_create_wayland_surface(struct wayland_win_data *data, struct wayland_surface *owner_surface) { - struct wayland_client_surface *client = data->client_surface; struct wayland_surface *surface; enum wayland_surface_role role; BOOL visible; @@ -194,9 +193,12 @@ static BOOL wayland_win_data_create_wayland_surface(struct wayland_win_data *dat /* we can temporarily clear the role of a surface but cannot assign a different one after it's set */ if ((surface = data->wayland_surface) && role && surface->role && surface->role != role) { - if (client) wayland_client_surface_attach(client, NULL); - wayland_surface_destroy(data->wayland_surface); + /* Make sure any attached client surface is detached before we destroy the surface. + * They will be reattached when win32u updates them again after WindowPosChanged. + */ data->wayland_surface = NULL; + update_client_surfaces(data->hwnd); + wayland_surface_destroy(surface); } if (!(surface = data->wayland_surface) && !(surface = wayland_surface_create(data->hwnd))) return FALSE; @@ -225,7 +227,6 @@ static BOOL wayland_win_data_create_wayland_surface(struct wayland_win_data *dat break; } - if (visible && client) wayland_client_surface_attach(client, data->hwnd); wayland_win_data_get_config(data, &surface->window); /* Size/position changes affect the effective pointer constraint, so update diff --git a/include/wine/gdi_driver.h b/include/wine/gdi_driver.h index 630e035a589..a5ec6807cf3 100644 --- a/include/wine/gdi_driver.h +++ b/include/wine/gdi_driver.h @@ -273,6 +273,7 @@ W32KAPI void client_surface_add_ref( struct client_surface *surface ); W32KAPI void client_surface_release( struct client_surface *surface ); W32KAPI void client_surface_present( struct client_surface *surface ); W32KAPI void client_surface_update( struct client_surface *surface ); +W32KAPI void update_client_surfaces( HWND hwnd ); W32KAPI void detach_client_surfaces( HWND hwnd ); static inline const char *debugstr_client_surface( struct client_surface *surface ) -- GitLab https://gitlab.winehq.org/wine/wine/-/merge_requests/11225