From: Rémi Bernon rbernon@codeweavers.com
--- dlls/winewayland.drv/wayland_surface.c | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-)
diff --git a/dlls/winewayland.drv/wayland_surface.c b/dlls/winewayland.drv/wayland_surface.c index cfeb44508e8..5ca8b010746 100644 --- a/dlls/winewayland.drv/wayland_surface.c +++ b/dlls/winewayland.drv/wayland_surface.c @@ -352,8 +352,22 @@ void wayland_surface_attach_shm(struct wayland_surface *surface, free(surface_damage); }
- surface->content_width = shm_buffer->width; - surface->content_height = shm_buffer->height; + win_width = surface->window.rect.right - surface->window.rect.left; + win_height = surface->window.rect.bottom - surface->window.rect.top; + + /* It is an error to specify a wp_viewporter source rectangle that + * is partially or completely outside of the wl_buffe. + * 0 is also an invalid width / height value so use 1x1 instead. + */ + win_width = max(1, min(win_width, shm_buffer->width)); + win_height = max(1, min(win_height, shm_buffer->height)); + + wp_viewport_set_source(surface->wp_viewport, 0, 0, + wl_fixed_from_int(win_width), + wl_fixed_from_int(win_height)); + + surface->content_width = win_width; + surface->content_height = win_height; }
/**********************************************************************