2017-08-16 15:51:22 +00:00
|
|
|
#ifndef _WLR_TYPES_OUTPUT_LAYOUT_H
|
|
|
|
#define _WLR_TYPES_OUTPUT_LAYOUT_H
|
|
|
|
#include <wlr/types/wlr_output.h>
|
|
|
|
#include <wayland-util.h>
|
|
|
|
#include <stdbool.h>
|
|
|
|
|
2017-08-27 21:35:12 +00:00
|
|
|
struct wlr_output_layout_state;
|
|
|
|
|
2017-08-16 15:51:22 +00:00
|
|
|
struct wlr_output_layout {
|
2017-08-29 13:59:03 +00:00
|
|
|
struct wl_list outputs;
|
2017-08-27 21:35:12 +00:00
|
|
|
struct wlr_output_layout_state *state;
|
2017-09-05 11:48:28 +00:00
|
|
|
|
|
|
|
struct {
|
|
|
|
struct wl_signal change;
|
|
|
|
struct wl_signal destroy;
|
|
|
|
} events;
|
2017-08-16 15:51:22 +00:00
|
|
|
};
|
|
|
|
|
2017-08-27 21:35:12 +00:00
|
|
|
struct wlr_output_layout_output_state;
|
|
|
|
|
2017-08-16 15:51:22 +00:00
|
|
|
struct wlr_output_layout_output {
|
2017-08-29 13:59:03 +00:00
|
|
|
struct wlr_output *output;
|
|
|
|
int x, y;
|
|
|
|
struct wl_list link;
|
2017-08-27 21:35:12 +00:00
|
|
|
struct wlr_output_layout_output_state *state;
|
2017-08-16 15:51:22 +00:00
|
|
|
};
|
|
|
|
|
2017-09-05 21:53:29 +00:00
|
|
|
struct wlr_output_layout *wlr_output_layout_create();
|
2017-08-16 15:51:22 +00:00
|
|
|
|
|
|
|
void wlr_output_layout_destroy(struct wlr_output_layout *layout);
|
|
|
|
|
2017-08-16 19:00:15 +00:00
|
|
|
struct wlr_output_layout_output *wlr_output_layout_get(
|
|
|
|
struct wlr_output_layout *layout, struct wlr_output *reference);
|
|
|
|
|
2017-08-16 15:51:22 +00:00
|
|
|
struct wlr_output *wlr_output_layout_output_at(struct wlr_output_layout *layout,
|
2017-08-18 01:04:05 +00:00
|
|
|
double x, double y);
|
2017-08-16 15:51:22 +00:00
|
|
|
|
|
|
|
void wlr_output_layout_add(struct wlr_output_layout *layout,
|
2017-08-18 01:04:05 +00:00
|
|
|
struct wlr_output *output, int x, int y);
|
2017-08-16 15:51:22 +00:00
|
|
|
|
|
|
|
void wlr_output_layout_move(struct wlr_output_layout *layout,
|
2017-08-18 01:04:05 +00:00
|
|
|
struct wlr_output *output, int x, int y);
|
2017-08-16 15:51:22 +00:00
|
|
|
|
|
|
|
void wlr_output_layout_remove(struct wlr_output_layout *layout,
|
2017-08-18 01:04:05 +00:00
|
|
|
struct wlr_output *output);
|
2017-08-16 15:51:22 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Given x and y as pointers to global coordinates, adjusts them to local output
|
|
|
|
* coordinates relative to the given reference output.
|
|
|
|
*/
|
|
|
|
void wlr_output_layout_output_coords(struct wlr_output_layout *layout,
|
2017-08-24 15:46:40 +00:00
|
|
|
struct wlr_output *reference, double *x, double *y);
|
2017-08-16 15:51:22 +00:00
|
|
|
|
2017-08-17 14:12:36 +00:00
|
|
|
bool wlr_output_layout_contains_point(struct wlr_output_layout *layout,
|
2017-08-18 01:04:05 +00:00
|
|
|
struct wlr_output *reference, int x, int y);
|
2017-08-17 14:12:36 +00:00
|
|
|
|
|
|
|
bool wlr_output_layout_intersects(struct wlr_output_layout *layout,
|
2017-08-18 01:04:05 +00:00
|
|
|
struct wlr_output *reference, int x1, int y1, int x2, int y2);
|
2017-08-17 14:12:36 +00:00
|
|
|
|
2017-08-24 14:11:57 +00:00
|
|
|
/**
|
2017-08-29 16:32:17 +00:00
|
|
|
* Get the closest point on this layout from the given point from the reference
|
|
|
|
* output. If reference is NULL, gets the closest point from the entire layout.
|
2017-08-24 14:11:57 +00:00
|
|
|
*/
|
2017-08-29 16:32:17 +00:00
|
|
|
void wlr_output_layout_closest_point(struct wlr_output_layout *layout,
|
2017-08-24 16:30:34 +00:00
|
|
|
struct wlr_output *reference, double x, double y, double *dest_x,
|
|
|
|
double *dest_y);
|
2017-08-24 14:11:57 +00:00
|
|
|
|
2017-08-27 21:35:12 +00:00
|
|
|
/**
|
2017-08-29 16:08:49 +00:00
|
|
|
* Get the box of the layout for the given reference output. If `reference`
|
|
|
|
* is NULL, the box will be for the extents of the entire layout.
|
2017-08-27 21:35:12 +00:00
|
|
|
*/
|
2017-08-29 16:08:49 +00:00
|
|
|
struct wlr_box *wlr_output_layout_get_box(
|
2017-08-27 21:35:12 +00:00
|
|
|
struct wlr_output_layout *layout, struct wlr_output *reference);
|
|
|
|
|
2017-08-30 14:39:22 +00:00
|
|
|
/**
|
|
|
|
* Add an auto configured output to the layout. This will place the output in a
|
|
|
|
* sensible location in the layout. The coordinates of the output in the layout
|
|
|
|
* may adjust dynamically when the layout changes. If the output is already in
|
|
|
|
* the layout, it will become auto configured. If the position of the output is
|
|
|
|
* set such as with `wlr_output_layout_move()`, the output will become manually
|
|
|
|
* configured.
|
|
|
|
*/
|
|
|
|
void wlr_output_layout_add_auto(struct wlr_output_layout *layout,
|
|
|
|
struct wlr_output *output);
|
|
|
|
|
2017-08-16 15:51:22 +00:00
|
|
|
#endif
|