From: Rémi Bernon rbernon@codeweavers.com
--- dlls/winewayland.drv/wayland_surface.c | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+)
diff --git a/dlls/winewayland.drv/wayland_surface.c b/dlls/winewayland.drv/wayland_surface.c index a2699d66e51..40d8e88f747 100644 --- a/dlls/winewayland.drv/wayland_surface.c +++ b/dlls/winewayland.drv/wayland_surface.c @@ -351,6 +351,26 @@ 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; + wayland_surface_coords_from_window(surface, win_width, win_height, + &width, &height); + + /* It is an error to specify a wp_viewporter source rectangle that + * is partially or completely outside of the wl_buffer. */ + width = min(width, surface->buffer_width); + height = min(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); + } }
/**********************************************************************