2018-07-13 12:40:56 +00:00
|
|
|
/*
|
|
|
|
* This an unstable interface of wlroots. No guarantees are made regarding the
|
|
|
|
* future consistency of this API.
|
|
|
|
*/
|
|
|
|
#ifndef WLR_USE_UNSTABLE
|
|
|
|
#error "Add -DWLR_USE_UNSTABLE to enable unstable wlroots features"
|
|
|
|
#endif
|
|
|
|
|
2017-09-23 08:26:01 +00:00
|
|
|
#ifndef WLR_TYPES_WLR_BOX_H
|
|
|
|
#define WLR_TYPES_WLR_BOX_H
|
|
|
|
|
2018-08-10 16:19:16 +00:00
|
|
|
#include <pixman.h>
|
2017-08-29 16:08:49 +00:00
|
|
|
#include <stdbool.h>
|
2019-07-27 08:53:54 +00:00
|
|
|
#include <wayland-server-protocol.h>
|
2017-08-29 16:08:49 +00:00
|
|
|
|
|
|
|
struct wlr_box {
|
|
|
|
int x, y;
|
|
|
|
int width, height;
|
|
|
|
};
|
|
|
|
|
2017-12-31 11:49:06 +00:00
|
|
|
void wlr_box_closest_point(const struct wlr_box *box, double x, double y,
|
|
|
|
double *dest_x, double *dest_y);
|
2017-08-29 16:08:49 +00:00
|
|
|
|
2018-12-21 18:56:10 +00:00
|
|
|
bool wlr_box_intersection(struct wlr_box *dest, const struct wlr_box *box_a,
|
|
|
|
const struct wlr_box *box_b);
|
2017-08-29 16:08:49 +00:00
|
|
|
|
2017-12-31 11:49:06 +00:00
|
|
|
bool wlr_box_contains_point(const struct wlr_box *box, double x, double y);
|
2017-08-29 16:08:49 +00:00
|
|
|
|
2017-12-31 11:49:06 +00:00
|
|
|
bool wlr_box_empty(const struct wlr_box *box);
|
2017-08-29 16:08:49 +00:00
|
|
|
|
2018-01-26 21:11:09 +00:00
|
|
|
/**
|
|
|
|
* Transforms a box inside a `width` x `height` box.
|
|
|
|
*/
|
2018-12-21 18:56:10 +00:00
|
|
|
void wlr_box_transform(struct wlr_box *dest, const struct wlr_box *box,
|
|
|
|
enum wl_output_transform transform, int width, int height);
|
2017-12-01 08:15:33 +00:00
|
|
|
|
2018-01-27 09:43:17 +00:00
|
|
|
/**
|
2018-03-26 19:31:08 +00:00
|
|
|
* Creates the smallest box that contains the box rotated about its center.
|
2018-01-27 09:43:17 +00:00
|
|
|
*/
|
2018-12-21 18:56:10 +00:00
|
|
|
void wlr_box_rotated_bounds(struct wlr_box *dest, const struct wlr_box *box, float rotation);
|
2018-01-27 09:43:17 +00:00
|
|
|
|
2018-12-21 18:56:10 +00:00
|
|
|
void wlr_box_from_pixman_box32(struct wlr_box *dest, const pixman_box32_t box);
|
2018-08-10 16:19:16 +00:00
|
|
|
|
2017-08-29 16:08:49 +00:00
|
|
|
#endif
|