From: Rémi Bernon rbernon@codeweavers.com
--- dlls/winewayland.drv/wayland_surface.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+)
diff --git a/dlls/winewayland.drv/wayland_surface.c b/dlls/winewayland.drv/wayland_surface.c index a2699d66e51..bf65edd77fb 100644 --- a/dlls/winewayland.drv/wayland_surface.c +++ b/dlls/winewayland.drv/wayland_surface.c @@ -351,6 +351,24 @@ void wayland_surface_attach_shm(struct wayland_surface *surface,
surface->buffer_width = shm_buffer->width; surface->buffer_height = shm_buffer->height; + + if (surface->wp_viewport) + { + int win_width, win_height, width, 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_buffer. */ + width = min(win_width, surface->buffer_width); + height = min(win_height, surface->buffer_height); + + if (width != 0 && height != 0) + wp_viewport_set_source(surface->wp_viewport, 0, 0, width << 8, height << 8); + else + wp_viewport_set_source(surface->wp_viewport, -1, -1, -1, -1); + } }
/**********************************************************************