2017-09-23 08:26:01 +00:00
|
|
|
#ifndef WLR_TYPES_WLR_OUTPUT_LAYOUT_H
|
|
|
|
#define WLR_TYPES_WLR_OUTPUT_LAYOUT_H
|
|
|
|
|
2018-02-12 20:29:23 +00:00
|
|
|
#include <stdbool.h>
|
|
|
|
#include <wayland-util.h>
|
2017-12-31 11:49:06 +00:00
|
|
|
#include <wlr/types/wlr_box.h>
|
2017-08-16 15:51:22 +00:00
|
|
|
#include <wlr/types/wlr_output.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 {
|
2017-10-29 10:20:11 +00:00
|
|
|
struct wl_signal add;
|
2017-09-05 11:48:28 +00:00
|
|
|
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-10-29 10:20:11 +00:00
|
|
|
|
|
|
|
struct {
|
|
|
|
struct wl_signal destroy;
|
|
|
|
} events;
|
2017-08-16 15:51:22 +00:00
|
|
|
};
|
|
|
|
|
2018-04-05 16:22:19 +00:00
|
|
|
/**
|
|
|
|
* Creates a wlr_output_layout, which can be used to describing outputs in
|
|
|
|
* physical space relative to one another, and perform various useful operations
|
|
|
|
* on that state.
|
|
|
|
*/
|
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,
|
2018-04-01 04:17:27 +00:00
|
|
|
double lx, double ly);
|
2017-08-16 15:51:22 +00:00
|
|
|
|
|
|
|
void wlr_output_layout_add(struct wlr_output_layout *layout,
|
2018-04-01 04:17:27 +00:00
|
|
|
struct wlr_output *output, int lx, int ly);
|
2017-08-16 15:51:22 +00:00
|
|
|
|
|
|
|
void wlr_output_layout_move(struct wlr_output_layout *layout,
|
2018-04-01 04:17:27 +00:00
|
|
|
struct wlr_output *output, int lx, int ly);
|
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
|
|
|
|
|
|
|
/**
|
2018-04-01 04:17:27 +00:00
|
|
|
* Given x and y in layout coordinates, adjusts them to local output
|
2017-08-16 15:51:22 +00:00
|
|
|
* coordinates relative to the given reference output.
|
|
|
|
*/
|
|
|
|
void wlr_output_layout_output_coords(struct wlr_output_layout *layout,
|
2018-04-01 04:17:27 +00:00
|
|
|
struct wlr_output *reference, double *lx, double *ly);
|
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,
|
2018-04-01 04:17:27 +00:00
|
|
|
struct wlr_output *reference, int lx, int ly);
|
2017-08-17 14:12:36 +00:00
|
|
|
|
|
|
|
bool wlr_output_layout_intersects(struct wlr_output_layout *layout,
|
2018-04-01 04:17:27 +00:00
|
|
|
struct wlr_output *reference, const struct wlr_box *target_lbox);
|
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,
|
2018-04-01 04:17:27 +00:00
|
|
|
struct wlr_output *reference, double lx, double ly, double *dest_lx,
|
|
|
|
double *dest_ly);
|
2017-08-24 14:11:57 +00:00
|
|
|
|
2017-08-27 21:35:12 +00:00
|
|
|
/**
|
2018-04-01 04:17:27 +00:00
|
|
|
* Get the box of the layout for the given reference output in layout
|
|
|
|
* coordinates. 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-10-16 18:35:16 +00: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);
|
|
|
|
|
2018-02-17 23:48:50 +00:00
|
|
|
enum wlr_direction {
|
|
|
|
WLR_DIRECTION_UP = 0,
|
|
|
|
WLR_DIRECTION_DOWN = 1,
|
|
|
|
WLR_DIRECTION_LEFT = 2,
|
|
|
|
WLR_DIRECTION_RIGHT = 4,
|
|
|
|
};
|
|
|
|
|
2018-02-14 19:10:31 +00:00
|
|
|
/**
|
|
|
|
* Get the closest adjacent output to the reference output from the reference
|
|
|
|
* point in the given direction.
|
|
|
|
*/
|
|
|
|
struct wlr_output *wlr_output_layout_adjacent_output(
|
|
|
|
struct wlr_output_layout *layout, enum wlr_direction direction,
|
2018-04-01 04:17:27 +00:00
|
|
|
struct wlr_output *reference, double ref_lx, double ref_ly);
|
2018-02-14 19:10:31 +00:00
|
|
|
|
2017-08-16 15:51:22 +00:00
|
|
|
#endif
|