From: Rémi Bernon rbernon@codeweavers.com
--- dlls/winewayland.drv/waylanddrv.h | 3 +-- dlls/winewayland.drv/window.c | 13 ++---------- dlls/winewayland.drv/window_surface.c | 30 ++++++++------------------- 3 files changed, 12 insertions(+), 34 deletions(-)
diff --git a/dlls/winewayland.drv/waylanddrv.h b/dlls/winewayland.drv/waylanddrv.h index fc2a0918b3d..636424230be 100644 --- a/dlls/winewayland.drv/waylanddrv.h +++ b/dlls/winewayland.drv/waylanddrv.h @@ -271,8 +271,7 @@ void wayland_shm_buffer_unref(struct wayland_shm_buffer *shm_buffer); * Wayland window surface */
-void wayland_window_surface_update_wayland_surface(struct window_surface *surface, const RECT *visible_rect, - struct wayland_surface *wayland_surface); +void wayland_window_surface_set_visible_rect(struct window_surface *surface, const RECT *visible_rect);
/********************************************************************** * Wayland Window diff --git a/dlls/winewayland.drv/window.c b/dlls/winewayland.drv/window.c index 816ab843b91..e0f3f235cac 100644 --- a/dlls/winewayland.drv/window.c +++ b/dlls/winewayland.drv/window.c @@ -119,11 +119,7 @@ static void wayland_win_data_destroy(struct wayland_win_data *data)
pthread_mutex_unlock(&win_data_mutex);
- if (data->window_surface) - { - wayland_window_surface_update_wayland_surface(data->window_surface, NULL, NULL); - window_surface_release(data->window_surface); - } + if (data->window_surface) window_surface_release(data->window_surface); if (data->wayland_surface) wayland_surface_destroy(data->wayland_surface); if (data->window_contents) wayland_shm_buffer_unref(data->window_contents); free(data); @@ -210,8 +206,6 @@ static void wayland_win_data_update_wayland_surface(struct wayland_win_data *dat /* We don't want wayland surfaces for child windows. */ if (parent != NtUserGetDesktopWindow() && parent != 0) { - if (data->window_surface) - wayland_window_surface_update_wayland_surface(data->window_surface, NULL, NULL); if (surface) wayland_surface_destroy(surface); surface = NULL; goto out; @@ -248,10 +242,6 @@ 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, - &data->rects.visible, surface); - /* Size/position changes affect the effective pointer constraint, so update * it as needed. */ if (data->hwnd == NtUserGetForegroundWindow()) reapply_cursor_clipping(); @@ -466,6 +456,7 @@ void WAYLAND_WindowPosChanged(HWND hwnd, HWND insert_after, UINT swp_flags, cons data->window_surface = surface;
wayland_win_data_update_wayland_surface(data); + if (surface) wayland_window_surface_set_visible_rect(surface, &data->rects.visible); if (data->wayland_surface) wayland_win_data_update_wayland_state(data);
wayland_win_data_release(data); diff --git a/dlls/winewayland.drv/window_surface.c b/dlls/winewayland.drv/window_surface.c index 4e5ea3d366d..5131d6043cf 100644 --- a/dlls/winewayland.drv/window_surface.c +++ b/dlls/winewayland.drv/window_surface.c @@ -43,7 +43,6 @@ struct wayland_buffer_queue struct wayland_window_surface { struct window_surface header; - struct wayland_surface *wayland_surface; struct wayland_buffer_queue *wayland_buffer_queue; };
@@ -329,10 +328,9 @@ static BOOL wayland_window_surface_flush(struct window_surface *window_surface, HRGN surface_damage_region = NULL; HRGN copy_from_window_region;
- if (!wws->wayland_surface || !wws->wayland_buffer_queue) + if (!wws->wayland_buffer_queue) { - ERR("missing wayland surface=%p or buffer_queue=%p, returning\n", - wws->wayland_surface, wws->wayland_buffer_queue); + ERR("missing buffer_queue=%p, returning\n", wws->wayland_buffer_queue); goto done; }
@@ -444,9 +442,9 @@ static struct window_surface *wayland_window_surface_create(HWND hwnd, const REC /*********************************************************************** * wayland_window_surface_update_wayland_surface */ -void wayland_window_surface_update_wayland_surface(struct window_surface *window_surface, const RECT *visible_rect, - struct wayland_surface *wayland_surface) +void wayland_window_surface_set_visible_rect(struct window_surface *window_surface, const RECT *visible_rect) { + UINT width = visible_rect->right - visible_rect->left, height = visible_rect->bottom - visible_rect->top; struct wayland_window_surface *wws;
/* ignore calls with the dummy surface */ @@ -455,23 +453,13 @@ void wayland_window_surface_update_wayland_surface(struct window_surface *window wws = wayland_window_surface_cast(window_surface); window_surface_lock(window_surface);
- TRACE("surface=%p hwnd=%p visible_rect=%s wayland_surface=%p\n", wws, window_surface->hwnd, - wine_dbgstr_rect(visible_rect), wayland_surface); + TRACE("surface=%p hwnd=%p visible_rect=%s\n", wws, window_surface->hwnd, wine_dbgstr_rect(visible_rect));
- wws->wayland_surface = wayland_surface; - - if (wws->wayland_buffer_queue) - { - wayland_buffer_queue_destroy(wws->wayland_buffer_queue); - wws->wayland_buffer_queue = NULL; - } - - /* We only need a buffer queue if we have a surface to commit to. */ - if (wws->wayland_surface) + if (!wws->wayland_buffer_queue || wws->wayland_buffer_queue->width != width || + wws->wayland_buffer_queue->height != height) { - wws->wayland_buffer_queue = - wayland_buffer_queue_create(visible_rect->right - visible_rect->left, - visible_rect->bottom - visible_rect->top); + if (wws->wayland_buffer_queue) wayland_buffer_queue_destroy(wws->wayland_buffer_queue); + wws->wayland_buffer_queue = wayland_buffer_queue_create(width, height); }
window_surface_unlock(window_surface);