From 9e702e9cfe73f5aae665b5847cf470e66714e64a Mon Sep 17 00:00:00 2001 From: Simon Ser Date: Wed, 3 May 2023 12:32:44 +0200 Subject: [PATCH] util/transform: move over wl_output_transform helpers These aren't really tied to wlr_output. --- backend/drm/drm.c | 1 + examples/fullscreen-shell.c | 1 + include/wlr/types/wlr_output.h | 15 --------------- include/wlr/util/transform.h | 28 ++++++++++++++++++++++++++++ render/gles2/pass.c | 1 + types/meson.build | 1 - types/output/cursor.c | 1 + types/scene/surface.c | 1 + types/scene/wlr_scene.c | 1 + types/wlr_compositor.c | 1 + types/wlr_screencopy_v1.c | 1 + util/meson.build | 2 +- {types/output => util}/transform.c | 2 +- 13 files changed, 38 insertions(+), 18 deletions(-) create mode 100644 include/wlr/util/transform.h rename {types/output => util}/transform.c (95%) diff --git a/backend/drm/drm.c b/backend/drm/drm.c index dc442f66..5fbcf32f 100644 --- a/backend/drm/drm.c +++ b/backend/drm/drm.c @@ -19,6 +19,7 @@ #include #include #include +#include #include #include #include "backend/drm/drm.h" diff --git a/examples/fullscreen-shell.c b/examples/fullscreen-shell.c index 70b7f676..5c36b8b1 100644 --- a/examples/fullscreen-shell.c +++ b/examples/fullscreen-shell.c @@ -16,6 +16,7 @@ #include #include #include +#include /** * A minimal fullscreen-shell server. It only supports rendering. diff --git a/include/wlr/types/wlr_output.h b/include/wlr/types/wlr_output.h index 28a5ebcb..47c7672e 100644 --- a/include/wlr/types/wlr_output.h +++ b/include/wlr/types/wlr_output.h @@ -729,19 +729,4 @@ bool wlr_output_configure_primary_swapchain(struct wlr_output *output, struct wlr_render_pass *wlr_output_begin_render_pass(struct wlr_output *output, struct wlr_output_state *state, int *buffer_age, struct wlr_render_timer *timer); - -/** - * Returns the transform that, when composed with `tr`, gives - * `WL_OUTPUT_TRANSFORM_NORMAL`. - */ -enum wl_output_transform wlr_output_transform_invert( - enum wl_output_transform tr); - -/** - * Returns a transform that, when applied, has the same effect as applying - * sequentially `tr_a` and `tr_b`. - */ -enum wl_output_transform wlr_output_transform_compose( - enum wl_output_transform tr_a, enum wl_output_transform tr_b); - #endif diff --git a/include/wlr/util/transform.h b/include/wlr/util/transform.h new file mode 100644 index 00000000..d0ec5f53 --- /dev/null +++ b/include/wlr/util/transform.h @@ -0,0 +1,28 @@ +/* + * 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_UTIL_TRANSFORM_H +#define WLR_UTIL_TRANSFORM_H + +#include + +/** + * Returns the transform that, when composed with `tr`, gives + * `WL_OUTPUT_TRANSFORM_NORMAL`. + */ +enum wl_output_transform wlr_output_transform_invert( + enum wl_output_transform tr); + +/** + * Returns a transform that, when applied, has the same effect as applying + * sequentially `tr_a` and `tr_b`. + */ +enum wl_output_transform wlr_output_transform_compose( + enum wl_output_transform tr_a, enum wl_output_transform tr_b); + +#endif diff --git a/render/gles2/pass.c b/render/gles2/pass.c index 768e81de..4adad49f 100644 --- a/render/gles2/pass.c +++ b/render/gles2/pass.c @@ -4,6 +4,7 @@ #include #include #include +#include #include "render/gles2.h" #include "types/wlr_matrix.h" diff --git a/types/meson.build b/types/meson.build index e358cc33..8ae21b56 100644 --- a/types/meson.build +++ b/types/meson.build @@ -8,7 +8,6 @@ wlr_files += files( 'output/render.c', 'output/state.c', 'output/swapchain.c', - 'output/transform.c', 'scene/drag_icon.c', 'scene/subsurface_tree.c', 'scene/surface.c', diff --git a/types/output/cursor.c b/types/output/cursor.c index 278b0d8a..8433b65d 100644 --- a/types/output/cursor.c +++ b/types/output/cursor.c @@ -8,6 +8,7 @@ #include #include #include +#include #include "render/allocator/allocator.h" #include "types/wlr_buffer.h" #include "types/wlr_output.h" diff --git a/types/scene/surface.c b/types/scene/surface.c index b9f52211..4741dd6c 100644 --- a/types/scene/surface.c +++ b/types/scene/surface.c @@ -4,6 +4,7 @@ #include #include #include +#include #include "types/wlr_scene.h" static void handle_scene_buffer_outputs_update( diff --git a/types/scene/wlr_scene.c b/types/scene/wlr_scene.c index f81a8613..d8c7b841 100644 --- a/types/scene/wlr_scene.c +++ b/types/scene/wlr_scene.c @@ -13,6 +13,7 @@ #include #include #include +#include #include "types/wlr_buffer.h" #include "types/wlr_output.h" #include "types/wlr_scene.h" diff --git a/types/wlr_compositor.c b/types/wlr_compositor.c index 70c1f9cc..755d3760 100644 --- a/types/wlr_compositor.c +++ b/types/wlr_compositor.c @@ -10,6 +10,7 @@ #include #include #include +#include #include "types/wlr_buffer.h" #include "types/wlr_region.h" #include "types/wlr_subcompositor.h" diff --git a/types/wlr_screencopy_v1.c b/types/wlr_screencopy_v1.c index 99ed7696..0e91abe1 100644 --- a/types/wlr_screencopy_v1.c +++ b/types/wlr_screencopy_v1.c @@ -9,6 +9,7 @@ #include #include #include +#include #include "wlr-screencopy-unstable-v1-protocol.h" #include "render/pixel_format.h" #include "render/wlr_renderer.h" diff --git a/util/meson.build b/util/meson.build index 5af2254f..053e2c5e 100644 --- a/util/meson.build +++ b/util/meson.build @@ -11,6 +11,6 @@ wlr_files += files( 'shm.c', 'time.c', 'token.c', + 'transform.c', 'utf8.c', ) - diff --git a/types/output/transform.c b/util/transform.c similarity index 95% rename from types/output/transform.c rename to util/transform.c index 2b18d487..4cc725fd 100644 --- a/types/output/transform.c +++ b/util/transform.c @@ -1,4 +1,4 @@ -#include +#include enum wl_output_transform wlr_output_transform_invert( enum wl_output_transform tr) {