diff options
author | Simon Zeni <simon@bl4ckb0ne.ca> | 2021-07-01 16:36:01 -0400 |
---|---|---|
committer | Simon Ser <contact@emersion.fr> | 2021-07-06 21:43:17 +0200 |
commit | e192d8773181681baa5f189b3375992ff41bc5e0 (patch) | |
tree | 26c46595336cf93d3f05ed9f2522b4750617d73a /include | |
parent | d975f35bba6e128218de2696d5bce26656e3fd5f (diff) |
move wlr_box from /types to /util
Diffstat (limited to 'include')
-rw-r--r-- | include/backend/wayland.h | 1 | ||||
-rw-r--r-- | include/wlr/interfaces/wlr_output.h | 1 | ||||
-rw-r--r-- | include/wlr/render/interface.h | 4 | ||||
-rw-r--r-- | include/wlr/render/wlr_renderer.h | 3 | ||||
-rw-r--r-- | include/wlr/types/wlr_box.h | 39 | ||||
-rw-r--r-- | include/wlr/types/wlr_cursor.h | 2 | ||||
-rw-r--r-- | include/wlr/types/wlr_layer_shell_v1.h | 2 | ||||
-rw-r--r-- | include/wlr/types/wlr_matrix.h | 5 | ||||
-rw-r--r-- | include/wlr/types/wlr_output_damage.h | 3 | ||||
-rw-r--r-- | include/wlr/types/wlr_output_layout.h | 2 | ||||
-rw-r--r-- | include/wlr/types/wlr_pointer_constraints_v1.h | 1 | ||||
-rw-r--r-- | include/wlr/types/wlr_screencopy_v1.h | 2 | ||||
-rw-r--r-- | include/wlr/types/wlr_surface.h | 2 | ||||
-rw-r--r-- | include/wlr/types/wlr_xdg_shell.h | 5 | ||||
-rw-r--r-- | include/wlr/util/box.h | 42 |
15 files changed, 62 insertions, 52 deletions
diff --git a/include/backend/wayland.h b/include/backend/wayland.h index 5d69c248..6f4fa201 100644 --- a/include/backend/wayland.h +++ b/include/backend/wayland.h @@ -8,7 +8,6 @@ #include <wlr/backend/wayland.h> #include <wlr/render/wlr_renderer.h> -#include <wlr/types/wlr_box.h> #include <wlr/types/wlr_pointer.h> #include <wlr/render/drm_format_set.h> diff --git a/include/wlr/interfaces/wlr_output.h b/include/wlr/interfaces/wlr_output.h index 83a8c321..83d1b58a 100644 --- a/include/wlr/interfaces/wlr_output.h +++ b/include/wlr/interfaces/wlr_output.h @@ -11,7 +11,6 @@ #include <stdbool.h> #include <wlr/backend.h> -#include <wlr/types/wlr_box.h> #include <wlr/types/wlr_output.h> /** diff --git a/include/wlr/render/interface.h b/include/wlr/render/interface.h index 1e355d43..b3a21b0b 100644 --- a/include/wlr/render/interface.h +++ b/include/wlr/render/interface.h @@ -13,10 +13,12 @@ #include <wayland-server-core.h> #include <wlr/render/wlr_renderer.h> #include <wlr/render/wlr_texture.h> -#include <wlr/types/wlr_box.h> #include <wlr/types/wlr_output.h> #include <wlr/render/dmabuf.h> +struct wlr_box; +struct wlr_fbox; + struct wlr_renderer_impl { bool (*bind_buffer)(struct wlr_renderer *renderer, struct wlr_buffer *buffer); diff --git a/include/wlr/render/wlr_renderer.h b/include/wlr/render/wlr_renderer.h index 4a98443f..bae2fa97 100644 --- a/include/wlr/render/wlr_renderer.h +++ b/include/wlr/render/wlr_renderer.h @@ -13,7 +13,6 @@ #include <wayland-server-core.h> #include <wlr/backend.h> #include <wlr/render/wlr_texture.h> -#include <wlr/types/wlr_box.h> enum wlr_renderer_read_pixels_flags { WLR_RENDERER_READ_PIXELS_Y_INVERT = 1, @@ -22,6 +21,8 @@ enum wlr_renderer_read_pixels_flags { struct wlr_renderer_impl; struct wlr_drm_format_set; struct wlr_buffer; +struct wlr_box; +struct wlr_fbox; struct wlr_renderer { const struct wlr_renderer_impl *impl; diff --git a/include/wlr/types/wlr_box.h b/include/wlr/types/wlr_box.h index 2a407c4d..8720cef8 100644 --- a/include/wlr/types/wlr_box.h +++ b/include/wlr/types/wlr_box.h @@ -1,42 +1,7 @@ -/* - * 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 - #ifndef WLR_TYPES_WLR_BOX_H #define WLR_TYPES_WLR_BOX_H -#include <pixman.h> -#include <stdbool.h> -#include <wayland-server-protocol.h> - -struct wlr_box { - int x, y; - int width, height; -}; - -struct wlr_fbox { - double x, y; - double width, height; -}; - -void wlr_box_closest_point(const struct wlr_box *box, double x, double y, - double *dest_x, double *dest_y); - -bool wlr_box_intersection(struct wlr_box *dest, const struct wlr_box *box_a, - const struct wlr_box *box_b); - -bool wlr_box_contains_point(const struct wlr_box *box, double x, double y); - -bool wlr_box_empty(const struct wlr_box *box); - -/** - * Transforms a box inside a `width` x `height` box. - */ -void wlr_box_transform(struct wlr_box *dest, const struct wlr_box *box, - enum wl_output_transform transform, int width, int height); +#warning "wlr_box has been moved to wlr/util/box.h" +#include <wlr/util/box.h> #endif diff --git a/include/wlr/types/wlr_cursor.h b/include/wlr/types/wlr_cursor.h index 58ce8505..71eddc43 100644 --- a/include/wlr/types/wlr_cursor.h +++ b/include/wlr/types/wlr_cursor.h @@ -10,7 +10,6 @@ #define WLR_TYPES_WLR_CURSOR_H #include <wayland-server-core.h> -#include <wlr/types/wlr_box.h> #include <wlr/types/wlr_input_device.h> #include <wlr/types/wlr_output_layout.h> #include <wlr/types/wlr_output.h> @@ -26,6 +25,7 @@ * the screen, and so on. */ +struct wlr_box; struct wlr_cursor_state; struct wlr_cursor { diff --git a/include/wlr/types/wlr_layer_shell_v1.h b/include/wlr/types/wlr_layer_shell_v1.h index 3b214dc9..846b9466 100644 --- a/include/wlr/types/wlr_layer_shell_v1.h +++ b/include/wlr/types/wlr_layer_shell_v1.h @@ -8,10 +8,10 @@ #ifndef WLR_TYPES_WLR_LAYER_SHELL_V1_H #define WLR_TYPES_WLR_LAYER_SHELL_V1_H + #include <stdbool.h> #include <stdint.h> #include <wayland-server-core.h> -#include <wlr/types/wlr_box.h> #include <wlr/types/wlr_surface.h> #include "wlr-layer-shell-unstable-v1-protocol.h" diff --git a/include/wlr/types/wlr_matrix.h b/include/wlr/types/wlr_matrix.h index ede78cb1..1a8b5be5 100644 --- a/include/wlr/types/wlr_matrix.h +++ b/include/wlr/types/wlr_matrix.h @@ -16,8 +16,9 @@ #ifndef WLR_TYPES_WLR_MATRIX_H #define WLR_TYPES_WLR_MATRIX_H -#include <wayland-server-core.h> -#include <wlr/types/wlr_box.h> +#include <wayland-server-protocol.h> + +struct wlr_box; /** Writes the identity matrix into mat */ void wlr_matrix_identity(float mat[static 9]); diff --git a/include/wlr/types/wlr_output_damage.h b/include/wlr/types/wlr_output_damage.h index e4b1f862..e7c609ed 100644 --- a/include/wlr/types/wlr_output_damage.h +++ b/include/wlr/types/wlr_output_damage.h @@ -11,7 +11,6 @@ #include <pixman.h> #include <time.h> -#include <wlr/types/wlr_box.h> #include <wlr/types/wlr_output.h> /** @@ -21,6 +20,8 @@ */ #define WLR_OUTPUT_DAMAGE_PREVIOUS_LEN 2 +struct wlr_box; + /** * Tracks damage for an output. * diff --git a/include/wlr/types/wlr_output_layout.h b/include/wlr/types/wlr_output_layout.h index 4f4266e9..5cb742c6 100644 --- a/include/wlr/types/wlr_output_layout.h +++ b/include/wlr/types/wlr_output_layout.h @@ -11,9 +11,9 @@ #include <stdbool.h> #include <wayland-util.h> -#include <wlr/types/wlr_box.h> #include <wlr/types/wlr_output.h> +struct wlr_box; struct wlr_output_layout_state; /** diff --git a/include/wlr/types/wlr_pointer_constraints_v1.h b/include/wlr/types/wlr_pointer_constraints_v1.h index 0c49e3bf..90438729 100644 --- a/include/wlr/types/wlr_pointer_constraints_v1.h +++ b/include/wlr/types/wlr_pointer_constraints_v1.h @@ -12,7 +12,6 @@ #include <stdint.h> #include <wayland-server-core.h> #include <pixman.h> -#include <wlr/types/wlr_box.h> #include <wlr/types/wlr_seat.h> #include "pointer-constraints-unstable-v1-protocol.h" diff --git a/include/wlr/types/wlr_screencopy_v1.h b/include/wlr/types/wlr_screencopy_v1.h index 1c45f905..aaa300b3 100644 --- a/include/wlr/types/wlr_screencopy_v1.h +++ b/include/wlr/types/wlr_screencopy_v1.h @@ -11,7 +11,7 @@ #include <stdbool.h> #include <wayland-server-core.h> -#include <wlr/types/wlr_box.h> +#include <wlr/util/box.h> struct wlr_screencopy_manager_v1 { struct wl_global *global; diff --git a/include/wlr/types/wlr_surface.h b/include/wlr/types/wlr_surface.h index 72dc4b30..7668c83d 100644 --- a/include/wlr/types/wlr_surface.h +++ b/include/wlr/types/wlr_surface.h @@ -14,8 +14,8 @@ #include <stdint.h> #include <time.h> #include <wayland-server-core.h> -#include <wlr/types/wlr_box.h> #include <wlr/types/wlr_output.h> +#include <wlr/util/box.h> enum wlr_surface_state_field { WLR_SURFACE_STATE_BUFFER = 1 << 0, diff --git a/include/wlr/types/wlr_xdg_shell.h b/include/wlr/types/wlr_xdg_shell.h index 856648f9..f80c6685 100644 --- a/include/wlr/types/wlr_xdg_shell.h +++ b/include/wlr/types/wlr_xdg_shell.h @@ -8,9 +8,10 @@ #ifndef WLR_TYPES_WLR_XDG_SHELL_H #define WLR_TYPES_WLR_XDG_SHELL_H -#include <wlr/types/wlr_box.h> -#include <wlr/types/wlr_seat.h> + #include <wayland-server-core.h> +#include <wlr/types/wlr_seat.h> +#include <wlr/util/box.h> #include "xdg-shell-protocol.h" struct wlr_xdg_shell { diff --git a/include/wlr/util/box.h b/include/wlr/util/box.h new file mode 100644 index 00000000..2a407c4d --- /dev/null +++ b/include/wlr/util/box.h @@ -0,0 +1,42 @@ +/* + * 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 + +#ifndef WLR_TYPES_WLR_BOX_H +#define WLR_TYPES_WLR_BOX_H + +#include <pixman.h> +#include <stdbool.h> +#include <wayland-server-protocol.h> + +struct wlr_box { + int x, y; + int width, height; +}; + +struct wlr_fbox { + double x, y; + double width, height; +}; + +void wlr_box_closest_point(const struct wlr_box *box, double x, double y, + double *dest_x, double *dest_y); + +bool wlr_box_intersection(struct wlr_box *dest, const struct wlr_box *box_a, + const struct wlr_box *box_b); + +bool wlr_box_contains_point(const struct wlr_box *box, double x, double y); + +bool wlr_box_empty(const struct wlr_box *box); + +/** + * Transforms a box inside a `width` x `height` box. + */ +void wlr_box_transform(struct wlr_box *dest, const struct wlr_box *box, + enum wl_output_transform transform, int width, int height); + +#endif |