From eb22ae97b01e26f2a64f81c0e34ef7ad1f870ac4 Mon Sep 17 00:00:00 2001 From: Simon Ser Date: Tue, 31 Mar 2020 15:18:49 +0200 Subject: surface: add wlr_surface_state.viewport This field contains the viewport source and destination parameters. It's intended to be updated by a third-party protocol, for instance viewporter. --- include/wlr/types/wlr_surface.h | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) (limited to 'include') diff --git a/include/wlr/types/wlr_surface.h b/include/wlr/types/wlr_surface.h index fa9fa6d5..250d28dd 100644 --- a/include/wlr/types/wlr_surface.h +++ b/include/wlr/types/wlr_surface.h @@ -14,6 +14,7 @@ #include #include #include +#include #include enum wlr_surface_state_field { @@ -25,6 +26,7 @@ enum wlr_surface_state_field { WLR_SURFACE_STATE_TRANSFORM = 1 << 5, WLR_SURFACE_STATE_SCALE = 1 << 6, WLR_SURFACE_STATE_FRAME_CALLBACK_LIST = 1 << 7, + WLR_SURFACE_STATE_VIEWPORT = 1 << 8, }; struct wlr_surface_state { @@ -41,6 +43,21 @@ struct wlr_surface_state { int width, height; // in surface-local coordinates int buffer_width, buffer_height; + /** + * The viewport is applied after the surface transform and scale. + * + * If has_src is true, the surface content is cropped to the provided + * rectangle. If has_dst is true, the surface content is scaled to the + * provided rectangle. + */ + struct { + bool has_src, has_dst; + // In coordinates after scale/transform are applied, but before the + // destination rectangle is applied + struct wlr_fbox src; + int dst_width, dst_height; // in surface-local coordinates + } viewport; + struct wl_listener buffer_destroy; }; @@ -220,7 +237,6 @@ void wlr_surface_send_leave(struct wlr_surface *surface, void wlr_surface_send_frame_done(struct wlr_surface *surface, const struct timespec *when); -struct wlr_box; /** * Get the bounding box that contains the surface and all subsurfaces in * surface coordinates. -- cgit v1.2.3