--- /dev/null
+#ifndef LIBDS_TYPES_DS_SURFACE_H
+#define LIBDS_TYPES_DS_SURFACE_H
+
+#include <pixman.h>
+#include <wayland-server.h>
+
+#include <libds/util/box.h>
+#include <libds/util/addon.h>
+#include <libds/buffer.h>
+#include <libds/surface.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_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
-#ifndef DS_ADDON_H
-#define DS_ADDON_H
+#ifndef LIBDS_UTIL_ADDON_H
+#define LIBDS_UTIL_ADDON_H
#include <wayland-util.h>
#include <assert.h>
+#include "libds/util/addon.h"
#include "util.h"
-#include "addon.h"
void
ds_addon_set_init(struct ds_addon_set *set)
#include <stdint.h>
#include <stdlib.h>
-#include <pixman.h>
#include <wayland-server.h>
#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;