aboutsummaryrefslogtreecommitdiff
path: root/include/wlr
diff options
context:
space:
mode:
authorSimon Ser <contact@emersion.fr>2020-03-31 15:18:49 +0200
committerDrew DeVault <sir@cmpwn.com>2020-06-17 09:10:54 -0600
commiteb22ae97b01e26f2a64f81c0e34ef7ad1f870ac4 (patch)
treef21e8f842c9c79e15e6a004b4023119751e8169a /include/wlr
parent315bf08733f4bc132a23200df26cb2145ac629b3 (diff)
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.
Diffstat (limited to 'include/wlr')
-rw-r--r--include/wlr/types/wlr_surface.h18
1 files changed, 17 insertions, 1 deletions
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 <stdint.h>
#include <time.h>
#include <wayland-server-core.h>
+#include <wlr/types/wlr_box.h>
#include <wlr/types/wlr_output.h>
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.