2017-09-23 10:26:01 +02:00
|
|
|
#ifndef WLR_TYPES_WLR_OUTPUT_H
|
|
|
|
#define WLR_TYPES_WLR_OUTPUT_H
|
|
|
|
|
2017-11-01 20:08:15 +01:00
|
|
|
#include <stdbool.h>
|
2018-01-18 19:47:21 +01:00
|
|
|
#include <pixman.h>
|
2017-10-14 22:33:00 +02:00
|
|
|
#include <wayland-util.h>
|
2017-06-20 00:41:02 +02:00
|
|
|
#include <wayland-server.h>
|
|
|
|
|
|
|
|
struct wlr_output_mode {
|
|
|
|
uint32_t flags; // enum wl_output_mode
|
|
|
|
int32_t width, height;
|
|
|
|
int32_t refresh; // mHz
|
2017-10-15 12:32:37 +02:00
|
|
|
struct wl_list link;
|
2017-06-20 00:41:02 +02:00
|
|
|
};
|
|
|
|
|
2017-10-29 09:09:21 +01:00
|
|
|
struct wlr_output_cursor {
|
|
|
|
struct wlr_output *output;
|
2017-11-04 06:35:12 +01:00
|
|
|
double x, y;
|
2017-11-02 11:37:43 +01:00
|
|
|
bool enabled;
|
2017-12-08 14:23:33 +01:00
|
|
|
bool visible;
|
2017-10-29 17:43:26 +01:00
|
|
|
uint32_t width, height;
|
2017-10-29 09:09:21 +01:00
|
|
|
int32_t hotspot_x, hotspot_y;
|
|
|
|
struct wl_list link;
|
|
|
|
|
2017-11-02 11:37:43 +01:00
|
|
|
// only when using a software cursor without a surface
|
2017-10-29 09:09:21 +01:00
|
|
|
struct wlr_renderer *renderer;
|
|
|
|
struct wlr_texture *texture;
|
|
|
|
|
|
|
|
// only when using a cursor surface
|
|
|
|
struct wlr_surface *surface;
|
|
|
|
struct wl_listener surface_commit;
|
|
|
|
struct wl_listener surface_destroy;
|
|
|
|
};
|
|
|
|
|
2017-06-20 00:41:02 +02:00
|
|
|
struct wlr_output_impl;
|
|
|
|
|
|
|
|
struct wlr_output {
|
|
|
|
const struct wlr_output_impl *impl;
|
2017-10-21 06:37:25 +02:00
|
|
|
struct wlr_backend *backend;
|
2018-01-04 12:46:15 +01:00
|
|
|
struct wl_display *display;
|
2017-08-13 16:51:50 +02:00
|
|
|
|
2017-06-22 20:26:02 +02:00
|
|
|
struct wl_global *wl_global;
|
2017-06-23 21:10:52 +02:00
|
|
|
struct wl_list wl_resources;
|
2017-06-20 00:41:02 +02:00
|
|
|
|
|
|
|
char name[16];
|
|
|
|
char make[48];
|
|
|
|
char model[16];
|
2017-11-11 19:09:34 +01:00
|
|
|
char serial[16];
|
2017-06-20 00:41:02 +02:00
|
|
|
int32_t phys_width, phys_height; // mm
|
2018-01-04 12:46:15 +01:00
|
|
|
|
|
|
|
bool enabled;
|
|
|
|
float scale;
|
2017-11-01 20:08:15 +01:00
|
|
|
enum wl_output_subpixel subpixel;
|
|
|
|
enum wl_output_transform transform;
|
2017-06-20 00:41:02 +02:00
|
|
|
|
2018-01-19 11:20:27 +01:00
|
|
|
pixman_region32_t damage, previous_damage;
|
2017-06-20 00:41:02 +02:00
|
|
|
float transform_matrix[16];
|
|
|
|
|
2017-12-31 13:00:35 +01:00
|
|
|
// Note: some backends may have zero modes
|
2017-10-15 12:32:37 +02:00
|
|
|
struct wl_list modes;
|
2017-06-20 00:41:02 +02:00
|
|
|
struct wlr_output_mode *current_mode;
|
2018-01-04 12:46:15 +01:00
|
|
|
int32_t width, height;
|
|
|
|
int32_t refresh; // mHz
|
2017-06-20 00:41:02 +02:00
|
|
|
|
|
|
|
struct {
|
|
|
|
struct wl_signal frame;
|
2017-10-07 12:01:21 +02:00
|
|
|
struct wl_signal swap_buffers;
|
2018-01-04 14:51:36 +01:00
|
|
|
struct wl_signal enable;
|
2018-01-06 12:42:32 +01:00
|
|
|
struct wl_signal mode;
|
2017-12-12 21:58:00 +01:00
|
|
|
struct wl_signal scale;
|
|
|
|
struct wl_signal transform;
|
2017-08-30 19:28:50 +02:00
|
|
|
struct wl_signal destroy;
|
2017-06-20 00:41:02 +02:00
|
|
|
} events;
|
2017-06-26 07:34:15 +02:00
|
|
|
|
2017-11-20 17:27:36 +01:00
|
|
|
struct wlr_surface *fullscreen_surface;
|
|
|
|
struct wl_listener fullscreen_surface_commit;
|
|
|
|
struct wl_listener fullscreen_surface_destroy;
|
|
|
|
|
2017-10-29 09:09:21 +01:00
|
|
|
struct wl_list cursors; // wlr_output_cursor::link
|
|
|
|
struct wlr_output_cursor *hardware_cursor;
|
2017-08-11 20:23:53 +02:00
|
|
|
|
2017-10-19 18:57:45 +02:00
|
|
|
// the output position in layout space reported to clients
|
|
|
|
int32_t lx, ly;
|
|
|
|
|
2017-12-07 01:12:04 +01:00
|
|
|
struct wl_listener display_destroy;
|
|
|
|
|
2017-08-11 20:23:53 +02:00
|
|
|
void *data;
|
2017-06-20 00:41:02 +02:00
|
|
|
};
|
|
|
|
|
2017-10-08 21:21:06 +02:00
|
|
|
struct wlr_surface;
|
|
|
|
|
2017-06-20 00:41:02 +02:00
|
|
|
void wlr_output_enable(struct wlr_output *output, bool enable);
|
|
|
|
bool wlr_output_set_mode(struct wlr_output *output,
|
2017-10-08 21:21:06 +02:00
|
|
|
struct wlr_output_mode *mode);
|
2017-12-11 12:14:23 +01:00
|
|
|
bool wlr_output_set_custom_mode(struct wlr_output *output, int32_t width,
|
|
|
|
int32_t height, int32_t refresh);
|
2017-12-12 21:58:00 +01:00
|
|
|
void wlr_output_set_transform(struct wlr_output *output,
|
2017-10-08 21:21:06 +02:00
|
|
|
enum wl_output_transform transform);
|
2017-10-19 18:57:45 +02:00
|
|
|
void wlr_output_set_position(struct wlr_output *output, int32_t lx, int32_t ly);
|
2017-12-15 01:00:03 +01:00
|
|
|
void wlr_output_set_scale(struct wlr_output *output, float scale);
|
2017-06-20 00:41:02 +02:00
|
|
|
void wlr_output_destroy(struct wlr_output *output);
|
|
|
|
void wlr_output_effective_resolution(struct wlr_output *output,
|
2017-10-08 21:21:06 +02:00
|
|
|
int *width, int *height);
|
2017-06-26 07:34:15 +02:00
|
|
|
void wlr_output_make_current(struct wlr_output *output);
|
|
|
|
void wlr_output_swap_buffers(struct wlr_output *output);
|
2017-09-06 17:34:09 +02:00
|
|
|
void wlr_output_set_gamma(struct wlr_output *output,
|
2017-10-22 12:30:45 +02:00
|
|
|
uint32_t size, uint16_t *r, uint16_t *g, uint16_t *b);
|
|
|
|
uint32_t wlr_output_get_gamma_size(struct wlr_output *output);
|
2017-11-20 17:27:36 +01:00
|
|
|
void wlr_output_set_fullscreen_surface(struct wlr_output *output,
|
|
|
|
struct wlr_surface *surface);
|
2017-10-07 19:01:11 +02:00
|
|
|
|
2017-10-29 09:09:21 +01:00
|
|
|
struct wlr_output_cursor *wlr_output_cursor_create(struct wlr_output *output);
|
2017-12-08 14:23:33 +01:00
|
|
|
/**
|
|
|
|
* Sets the cursor image. The image must be already scaled for the output.
|
|
|
|
*/
|
2017-10-29 09:09:21 +01:00
|
|
|
bool wlr_output_cursor_set_image(struct wlr_output_cursor *cursor,
|
|
|
|
const uint8_t *pixels, int32_t stride, uint32_t width, uint32_t height,
|
|
|
|
int32_t hotspot_x, int32_t hotspot_y);
|
|
|
|
void wlr_output_cursor_set_surface(struct wlr_output_cursor *cursor,
|
|
|
|
struct wlr_surface *surface, int32_t hotspot_x, int32_t hotspot_y);
|
2017-11-04 06:35:12 +01:00
|
|
|
bool wlr_output_cursor_move(struct wlr_output_cursor *cursor,
|
|
|
|
double x, double y);
|
2017-10-29 09:09:21 +01:00
|
|
|
void wlr_output_cursor_destroy(struct wlr_output_cursor *cursor);
|
|
|
|
|
2017-12-27 11:17:25 +01:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Returns the transform that, when composed with `tr`, gives
|
|
|
|
* `WL_OUTPUT_TRANSFORM_NORMAL`.
|
|
|
|
*/
|
2017-12-26 18:16:37 +01:00
|
|
|
enum wl_output_transform wlr_output_transform_invert(
|
|
|
|
enum wl_output_transform tr);
|
2017-12-27 11:17:25 +01:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Returns a transform that, when applied, has the same effect as applying
|
|
|
|
* sequentially `tr_a` and `tr_b`.
|
|
|
|
*/
|
2017-12-26 18:16:37 +01:00
|
|
|
enum wl_output_transform wlr_output_transform_compose(
|
|
|
|
enum wl_output_transform tr_a, enum wl_output_transform tr_b);
|
2017-11-30 23:58:12 +01:00
|
|
|
|
2017-06-20 00:41:02 +02:00
|
|
|
#endif
|