2017-08-09 15:58:10 +02:00
|
|
|
#ifndef _WLR_TYPES_WLR_SURFACE_H
|
|
|
|
#define _WLR_TYPES_WLR_SURFACE_H
|
2017-08-09 15:33:30 +02:00
|
|
|
#include <wayland-server.h>
|
2017-08-10 05:34:50 +02:00
|
|
|
#include <pixman.h>
|
|
|
|
#include <stdint.h>
|
2017-09-22 04:17:29 +02:00
|
|
|
#include <stdbool.h>
|
2017-08-09 15:33:30 +02:00
|
|
|
|
2017-08-09 21:58:41 +02:00
|
|
|
struct wlr_frame_callback {
|
|
|
|
struct wl_resource *resource;
|
|
|
|
struct wl_list link;
|
|
|
|
};
|
|
|
|
|
2017-08-10 05:34:50 +02:00
|
|
|
#define WLR_SURFACE_INVALID_BUFFER 1
|
|
|
|
#define WLR_SURFACE_INVALID_SURFACE_DAMAGE 2
|
|
|
|
#define WLR_SURFACE_INVALID_BUFFER_DAMAGE 4
|
|
|
|
#define WLR_SURFACE_INVALID_OPAQUE_REGION 8
|
|
|
|
#define WLR_SURFACE_INVALID_INPUT_REGION 16
|
2017-08-11 20:30:42 +02:00
|
|
|
#define WLR_SURFACE_INVALID_TRANSFORM 32
|
|
|
|
#define WLR_SURFACE_INVALID_SCALE 64
|
2017-08-10 05:34:50 +02:00
|
|
|
|
|
|
|
struct wlr_surface_state {
|
|
|
|
uint32_t invalid;
|
|
|
|
struct wl_resource *buffer;
|
|
|
|
int32_t sx, sy;
|
|
|
|
pixman_region32_t surface_damage, buffer_damage;
|
|
|
|
pixman_region32_t opaque, input;
|
2017-08-14 22:30:53 +02:00
|
|
|
enum wl_output_transform transform;
|
2017-08-10 05:34:50 +02:00
|
|
|
int32_t scale;
|
2017-08-15 14:17:17 +02:00
|
|
|
int width, height;
|
|
|
|
int buffer_width, buffer_height;
|
2017-08-10 05:34:50 +02:00
|
|
|
};
|
2017-08-09 15:33:30 +02:00
|
|
|
|
2017-08-10 05:34:50 +02:00
|
|
|
struct wlr_surface {
|
|
|
|
struct wl_resource *resource;
|
2017-08-11 04:15:37 +02:00
|
|
|
struct wlr_renderer *renderer;
|
2017-08-09 15:33:30 +02:00
|
|
|
struct wlr_texture *texture;
|
2017-08-10 05:34:50 +02:00
|
|
|
struct wlr_surface_state current, pending;
|
2017-08-09 15:33:30 +02:00
|
|
|
const char *role; // the lifetime-bound role or null
|
2017-08-10 05:34:50 +02:00
|
|
|
|
|
|
|
float buffer_to_surface_matrix[16];
|
|
|
|
float surface_to_buffer_matrix[16];
|
2017-08-17 17:29:58 +02:00
|
|
|
bool reupload_buffer;
|
2017-08-09 15:33:30 +02:00
|
|
|
|
|
|
|
struct {
|
|
|
|
struct wl_signal commit;
|
2017-09-11 19:01:53 +02:00
|
|
|
struct wl_signal destroy;
|
2017-08-09 15:33:30 +02:00
|
|
|
} signals;
|
2017-08-09 21:58:41 +02:00
|
|
|
|
|
|
|
struct wl_list frame_callback_list; // wl_surface.frame
|
2017-08-10 12:42:35 +02:00
|
|
|
|
|
|
|
struct wl_listener compositor_listener; // destroy listener used by compositor
|
|
|
|
void *compositor_data;
|
2017-08-11 20:23:53 +02:00
|
|
|
|
|
|
|
void *data;
|
2017-08-09 15:33:30 +02:00
|
|
|
};
|
|
|
|
|
2017-08-09 15:58:10 +02:00
|
|
|
struct wlr_renderer;
|
2017-08-09 15:33:30 +02:00
|
|
|
struct wlr_surface *wlr_surface_create(struct wl_resource *res,
|
|
|
|
struct wlr_renderer *renderer);
|
2017-08-10 14:26:16 +02:00
|
|
|
void wlr_surface_flush_damage(struct wlr_surface *surface);
|
2017-08-15 14:52:30 +02:00
|
|
|
/**
|
|
|
|
* Gets a matrix you can pass into wlr_render_with_matrix to display this
|
|
|
|
* surface. `matrix` is the output matrix, `projection` is the wlr_output
|
|
|
|
* projection matrix, and `transform` is any additional transformations you want
|
|
|
|
* to perform on the surface (or NULL/the identity matrix if you don't).
|
|
|
|
* `transform` is used before the surface is scaled, so its geometry extends
|
|
|
|
* from 0 to 1 in both dimensions.
|
|
|
|
*/
|
|
|
|
void wlr_surface_get_matrix(struct wlr_surface *surface,
|
|
|
|
float (*matrix)[16],
|
|
|
|
const float (*projection)[16],
|
|
|
|
const float (*transform)[16]);
|
2017-08-09 15:33:30 +02:00
|
|
|
|
2017-09-12 00:06:19 +02:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Set the lifetime role for this surface. Returns 0 on success or -1 if the
|
|
|
|
* role cannot be set.
|
|
|
|
*/
|
|
|
|
int wlr_surface_set_role(struct wlr_surface *surface, const char *role,
|
|
|
|
struct wl_resource *error_resource, uint32_t error_code);
|
|
|
|
|
2017-08-09 15:33:30 +02:00
|
|
|
#endif
|