2017-09-23 10:26:01 +02:00
|
|
|
#ifndef WLR_TYPES_WLR_OUTPUT_LAYOUT_H
|
|
|
|
#define WLR_TYPES_WLR_OUTPUT_LAYOUT_H
|
|
|
|
|
2017-08-16 17:51:22 +02:00
|
|
|
#include <wlr/types/wlr_output.h>
|
|
|
|
#include <wayland-util.h>
|
|
|
|
#include <stdbool.h>
|
|
|
|
|
2017-08-27 23:35:12 +02:00
|
|
|
struct wlr_output_layout_state;
|
|
|
|
|
2017-08-16 17:51:22 +02:00
|
|
|
struct wlr_output_layout {
|
2017-08-29 15:59:03 +02:00
|
|
|
struct wl_list outputs;
|
2017-08-27 23:35:12 +02:00
|
|
|
struct wlr_output_layout_state *state;
|
2017-09-05 13:48:28 +02:00
|
|
|
|
|
|
|
struct {
|
2017-10-29 11:20:11 +01:00
|
|
|
struct wl_signal add;
|
2017-09-05 13:48:28 +02:00
|
|
|
struct wl_signal change;
|
|
|
|
struct wl_signal destroy;
|
|
|
|
} events;
|
2017-08-16 17:51:22 +02:00
|
|
|
};
|
|
|
|
|
2017-08-27 23:35:12 +02:00
|
|
|
struct wlr_output_layout_output_state;
|
|
|
|
|
2017-08-16 17:51:22 +02:00
|
|
|
struct wlr_output_layout_output {
|
2017-08-29 15:59:03 +02:00
|
|
|
struct wlr_output *output;
|
|
|
|
int x, y;
|
|
|
|
struct wl_list link;
|
2017-08-27 23:35:12 +02:00
|
|
|
struct wlr_output_layout_output_state *state;
|
2017-10-29 11:20:11 +01:00
|
|
|
|
|
|
|
struct {
|
|
|
|
struct wl_signal destroy;
|
|
|
|
} events;
|
2017-08-16 17:51:22 +02:00
|
|
|
};
|
|
|
|
|
2017-09-05 23:53:29 +02:00
|
|
|
struct wlr_output_layout *wlr_output_layout_create();
|
2017-08-16 17:51:22 +02:00
|
|
|
|
|
|
|
void wlr_output_layout_destroy(struct wlr_output_layout *layout);
|
|
|
|
|
2017-08-16 21:00:15 +02:00
|
|
|
struct wlr_output_layout_output *wlr_output_layout_get(
|
|
|
|
struct wlr_output_layout *layout, struct wlr_output *reference);
|
|
|
|
|
2017-08-16 17:51:22 +02:00
|
|
|
struct wlr_output *wlr_output_layout_output_at(struct wlr_output_layout *layout,
|
2017-08-18 03:04:05 +02:00
|
|
|
double x, double y);
|
2017-08-16 17:51:22 +02:00
|
|
|
|
|
|
|
void wlr_output_layout_add(struct wlr_output_layout *layout,
|
2017-08-18 03:04:05 +02:00
|
|
|
struct wlr_output *output, int x, int y);
|
2017-08-16 17:51:22 +02:00
|
|
|
|
|
|
|
void wlr_output_layout_move(struct wlr_output_layout *layout,
|
2017-08-18 03:04:05 +02:00
|
|
|
struct wlr_output *output, int x, int y);
|
2017-08-16 17:51:22 +02:00
|
|
|
|
|
|
|
void wlr_output_layout_remove(struct wlr_output_layout *layout,
|
2017-08-18 03:04:05 +02:00
|
|
|
struct wlr_output *output);
|
2017-08-16 17:51:22 +02: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 17:46:40 +02:00
|
|
|
struct wlr_output *reference, double *x, double *y);
|
2017-08-16 17:51:22 +02:00
|
|
|
|
2017-08-17 16:12:36 +02:00
|
|
|
bool wlr_output_layout_contains_point(struct wlr_output_layout *layout,
|
2017-08-18 03:04:05 +02:00
|
|
|
struct wlr_output *reference, int x, int y);
|
2017-08-17 16:12:36 +02:00
|
|
|
|
|
|
|
bool wlr_output_layout_intersects(struct wlr_output_layout *layout,
|
2017-08-18 03:04:05 +02:00
|
|
|
struct wlr_output *reference, int x1, int y1, int x2, int y2);
|
2017-08-17 16:12:36 +02:00
|
|
|
|
2017-08-24 16:11:57 +02:00
|
|
|
/**
|
2017-08-29 18:32:17 +02: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 16:11:57 +02:00
|
|
|
*/
|
2017-08-29 18:32:17 +02:00
|
|
|
void wlr_output_layout_closest_point(struct wlr_output_layout *layout,
|
2017-08-24 18:30:34 +02:00
|
|
|
struct wlr_output *reference, double x, double y, double *dest_x,
|
|
|
|
double *dest_y);
|
2017-08-24 16:11:57 +02:00
|
|
|
|
2017-08-27 23:35:12 +02:00
|
|
|
/**
|
2017-08-29 18:08:49 +02: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 23:35:12 +02:00
|
|
|
*/
|
2017-08-29 18:08:49 +02:00
|
|
|
struct wlr_box *wlr_output_layout_get_box(
|
2017-08-27 23:35:12 +02:00
|
|
|
struct wlr_output_layout *layout, struct wlr_output *reference);
|
|
|
|
|
2017-08-30 16:39:22 +02: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-10-16 20:35:16 +02:00
|
|
|
/**
|
|
|
|
* Get the output closest to the center of the layout extents.
|
|
|
|
*/
|
|
|
|
struct wlr_output *wlr_output_layout_get_center_output(
|
|
|
|
struct wlr_output_layout *layout);
|
|
|
|
|
2017-08-16 17:51:22 +02:00
|
|
|
#endif
|