From 1b4382bf9a3963ea53a0cf83862c2ee02b00c1af Mon Sep 17 00:00:00 2001 From: Seunghun Lee Date: Wed, 22 Feb 2023 14:10:00 +0900 Subject: [PATCH] Expose ds_surface as ABI Change-Id: I43ee7c7423915ead7ac0b0f924436e9e84ac9c48 --- include/libds/types/ds_surface.h | 91 +++++++++++++++++++++++++++++++++++++ {src => include/libds/util}/addon.h | 4 +- src/addon.c | 2 +- src/compositor/compositor_private.h | 84 +--------------------------------- 4 files changed, 96 insertions(+), 85 deletions(-) create mode 100644 include/libds/types/ds_surface.h rename {src => include/libds/util}/addon.h (92%) diff --git a/include/libds/types/ds_surface.h b/include/libds/types/ds_surface.h new file mode 100644 index 0000000..1447a2e --- /dev/null +++ b/include/libds/types/ds_surface.h @@ -0,0 +1,91 @@ +#ifndef LIBDS_TYPES_DS_SURFACE_H +#define LIBDS_TYPES_DS_SURFACE_H + +#include +#include + +#include +#include +#include +#include + +enum ds_surface_state_field +{ + DS_SURFACE_STATE_BUFFER = 1 << 0, + DS_SURFACE_STATE_SURFACE_DAMAGE = 1 << 1, + DS_SURFACE_STATE_BUFFER_DAMAGE = 1 << 2, + DS_SURFACE_STATE_OPAQUE_REGION = 1 << 3, + DS_SURFACE_STATE_INPUT_REGION = 1 << 4, + DS_SURFACE_STATE_TRANSFORM = 1 << 5, + DS_SURFACE_STATE_SCALE = 1 << 6, + DS_SURFACE_STATE_FRAME_CALLBACK_LIST = 1 << 7, + DS_SURFACE_STATE_VIEWPORT = 1 << 8, +}; + +struct ds_surface_state +{ + enum ds_surface_state_field committed; + + struct ds_buffer *buffer; + int32_t dx, dy; + pixman_region32_t surface_damage, buffer_damage; + pixman_region32_t opaque, input; + enum wl_output_transform transform; + int32_t scale; + struct wl_list frame_callback_list; + + int width, height; + int buffer_width, buffer_height; + + struct wl_list subsurfaces_below; + struct wl_list subsurfaces_above; + + /** + * The viewport is applied after the surface transform and scale. + * + * If has_src is true, the surface content is cropped to the provided + * rectangle. If has_dst is true, the surface content is scaled to the + * provided rectangle. + */ + struct { + bool has_src, has_dst; + // In coordinates alter scale/transform are applied, but before the + // destination rectangle is applied + struct ds_fbox src; + int dst_width, dst_height; + } viewport; +}; + +struct ds_surface_viewport +{ + bool taken; +}; + +struct ds_surface +{ + struct wl_resource *resource; + + struct ds_buffer *buffer; + + pixman_region32_t buffer_damage; + pixman_region32_t opaque_region; + pixman_region32_t input_region; + + struct ds_surface_state current, pending; + struct ds_surface_viewport viewport_handle; + + const struct ds_surface_role *role; + void *role_data; + + int sx, sy; + + struct { + struct wl_signal commit; + struct wl_signal new_subsurface; + struct wl_signal destroy; + } events; + + struct ds_addon_set addons; +}; + +#endif diff --git a/src/addon.h b/include/libds/util/addon.h similarity index 92% rename from src/addon.h rename to include/libds/util/addon.h index 2e7b0e1..7a5c798 100644 --- a/src/addon.h +++ b/include/libds/util/addon.h @@ -1,5 +1,5 @@ -#ifndef DS_ADDON_H -#define DS_ADDON_H +#ifndef LIBDS_UTIL_ADDON_H +#define LIBDS_UTIL_ADDON_H #include diff --git a/src/addon.c b/src/addon.c index 0deac7a..0d23a24 100644 --- a/src/addon.c +++ b/src/addon.c @@ -1,7 +1,7 @@ #include +#include "libds/util/addon.h" #include "util.h" -#include "addon.h" void ds_addon_set_init(struct ds_addon_set *set) diff --git a/src/compositor/compositor_private.h b/src/compositor/compositor_private.h index 3020939..1860be3 100644 --- a/src/compositor/compositor_private.h +++ b/src/compositor/compositor_private.h @@ -4,101 +4,21 @@ #include #include -#include #include #include "libds/log.h" #include "libds/util/defs.h" #include "libds/util/box.h" -#include "addon.h" -#include "buffer.h" +#include "libds/util/addon.h" +#include "libds/types/ds_surface.h" #include "surface.h" #include "util.h" -enum ds_surface_state_field -{ - DS_SURFACE_STATE_BUFFER = 1 << 0, - DS_SURFACE_STATE_SURFACE_DAMAGE = 1 << 1, - DS_SURFACE_STATE_BUFFER_DAMAGE = 1 << 2, - DS_SURFACE_STATE_OPAQUE_REGION = 1 << 3, - DS_SURFACE_STATE_INPUT_REGION = 1 << 4, - DS_SURFACE_STATE_TRANSFORM = 1 << 5, - DS_SURFACE_STATE_SCALE = 1 << 6, - DS_SURFACE_STATE_FRAME_CALLBACK_LIST = 1 << 7, - DS_SURFACE_STATE_VIEWPORT = 1 << 8, -}; - struct ds_subcompositor { struct wl_global *global; }; -struct ds_surface_state -{ - enum ds_surface_state_field committed; - - struct ds_buffer *buffer; - int32_t dx, dy; - pixman_region32_t surface_damage, buffer_damage; - pixman_region32_t opaque, input; - enum wl_output_transform transform; - int32_t scale; - struct wl_list frame_callback_list; - - int width, height; - int buffer_width, buffer_height; - - struct wl_list subsurfaces_below; - struct wl_list subsurfaces_above; - - /** - * The viewport is applied after the surface transform and scale. - * - * If has_src is true, the surface content is cropped to the provided - * rectangle. If has_dst is true, the surface content is scaled to the - * provided rectangle. - */ - struct { - bool has_src, has_dst; - // In coordinates alter scale/transform are applied, but before the - // destination rectangle is applied - struct ds_fbox src; - int dst_width, dst_height; - } viewport; -}; - -struct ds_surface_viewport -{ - bool taken; -}; - -struct ds_surface -{ - struct wl_resource *resource; - - struct ds_buffer *buffer; - - pixman_region32_t buffer_damage; - pixman_region32_t opaque_region; - pixman_region32_t input_region; - - struct ds_surface_state current, pending; - struct ds_surface_viewport viewport_handle; - - const struct ds_surface_role *role; - void *role_data; - - int sx, sy; - - struct { - struct wl_signal commit; - struct wl_signal new_subsurface; - struct wl_signal destroy; - } events; - - struct ds_addon_set addons; -}; - struct ds_subsurface_parent_state { int32_t x, y; -- 2.7.4