2018-07-13 14:40:56 +02: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 10:26:01 +02:00
|
|
|
#ifndef WLR_TYPES_WLR_BOX_H
|
|
|
|
#define WLR_TYPES_WLR_BOX_H
|
|
|
|
|
2018-08-10 18:19:16 +02:00
|
|
|
#include <pixman.h>
|
2017-08-29 18:08:49 +02:00
|
|
|
#include <stdbool.h>
|
2019-07-27 10:53:54 +02:00
|
|
|
#include <wayland-server-protocol.h>
|
2017-08-29 18:08:49 +02:00
|
|
|
|
|
|
|
struct wlr_box {
|
|
|
|
int x, y;
|
|
|
|
int width, height;
|
|
|
|
};
|
|
|
|
|
2020-06-08 18:41:42 +02:00
|
|
|
struct wlr_fbox {
|
|
|
|
double x, y;
|
|
|
|
double width, height;
|
|
|
|
};
|
|
|
|
|
2017-12-31 12:49:06 +01:00
|
|
|
void wlr_box_closest_point(const struct wlr_box *box, double x, double y,
|
|
|
|
double *dest_x, double *dest_y);
|
2017-08-29 18:08:49 +02:00
|
|
|
|
2018-12-21 19:56:10 +01:00
|
|
|
bool wlr_box_intersection(struct wlr_box *dest, const struct wlr_box *box_a,
|
|
|
|
const struct wlr_box *box_b);
|
2017-08-29 18:08:49 +02:00
|
|
|
|
2017-12-31 12:49:06 +01:00
|
|
|
bool wlr_box_contains_point(const struct wlr_box *box, double x, double y);
|
2017-08-29 18:08:49 +02:00
|
|
|
|
2017-12-31 12:49:06 +01:00
|
|
|
bool wlr_box_empty(const struct wlr_box *box);
|
2017-08-29 18:08:49 +02:00
|
|
|
|
2018-01-26 22:11:09 +01:00
|
|
|
/**
|
|
|
|
* Transforms a box inside a `width` x `height` box.
|
|
|
|
*/
|
2018-12-21 19:56:10 +01: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 09:15:33 +01:00
|
|
|
|
2018-01-27 10:43:17 +01:00
|
|
|
/**
|
2018-03-26 21:31:08 +02:00
|
|
|
* Creates the smallest box that contains the box rotated about its center.
|
2018-01-27 10:43:17 +01:00
|
|
|
*/
|
2018-12-21 19:56:10 +01:00
|
|
|
void wlr_box_rotated_bounds(struct wlr_box *dest, const struct wlr_box *box, float rotation);
|
2018-01-27 10:43:17 +01:00
|
|
|
|
2018-12-21 19:56:10 +01:00
|
|
|
void wlr_box_from_pixman_box32(struct wlr_box *dest, const pixman_box32_t box);
|
2018-08-10 18:19:16 +02:00
|
|
|
|
2017-08-29 18:08:49 +02:00
|
|
|
#endif
|