// This file was generated by qtwaylandscanner
// source file is linux-dmabuf-unstable-v1.xml

#ifndef QT_WAYLAND_SERVER_LINUX_DMABUF_UNSTABLE_V1
#define QT_WAYLAND_SERVER_LINUX_DMABUF_UNSTABLE_V1

#include "wayland-server-core.h"
#include "wayland-linux-dmabuf-unstable-v1-server-protocol.h"
#include <QByteArray>
#include <QMultiMap>
#include <QString>

#include <unistd.h>

#ifndef WAYLAND_VERSION_CHECK
#define WAYLAND_VERSION_CHECK(major, minor, micro) \
    ((WAYLAND_VERSION_MAJOR > (major)) || \
    (WAYLAND_VERSION_MAJOR == (major) && WAYLAND_VERSION_MINOR > (minor)) || \
    (WAYLAND_VERSION_MAJOR == (major) && WAYLAND_VERSION_MINOR == (minor) && WAYLAND_VERSION_MICRO >= (micro)))
#endif

QT_BEGIN_NAMESPACE
QT_WARNING_PUSH
QT_WARNING_DISABLE_GCC("-Wmissing-field-initializers")
QT_WARNING_DISABLE_CLANG("-Wmissing-field-initializers")

namespace QtWaylandServer {
    class  zwp_linux_dmabuf_v1
    {
    public:
        zwp_linux_dmabuf_v1(struct ::wl_client *client, int id, int version);
        zwp_linux_dmabuf_v1(struct ::wl_display *display, int version);
        zwp_linux_dmabuf_v1(struct ::wl_resource *resource);
        zwp_linux_dmabuf_v1();

        virtual ~zwp_linux_dmabuf_v1();

        class Resource
        {
        public:
            Resource() : zwp_linux_dmabuf_v1_object(nullptr), handle(nullptr) {}
            virtual ~Resource() {}

            zwp_linux_dmabuf_v1 *zwp_linux_dmabuf_v1_object;
            zwp_linux_dmabuf_v1 *object() { return zwp_linux_dmabuf_v1_object; } 
            struct ::wl_resource *handle;

            struct ::wl_client *client() const { return wl_resource_get_client(handle); }
            int version() const { return wl_resource_get_version(handle); }

            static Resource *fromResource(struct ::wl_resource *resource);
        };

        void init(struct ::wl_client *client, int id, int version);
        void init(struct ::wl_display *display, int version);
        void init(struct ::wl_resource *resource);

        Resource *add(struct ::wl_client *client, int version);
        Resource *add(struct ::wl_client *client, int id, int version);
        Resource *add(struct wl_list *resource_list, struct ::wl_client *client, int id, int version);

        Resource *resource() { return m_resource; }
        const Resource *resource() const { return m_resource; }

        QMultiMap<struct ::wl_client*, Resource*> resourceMap() { return m_resource_map; }
        const QMultiMap<struct ::wl_client*, Resource*> resourceMap() const { return m_resource_map; }

        bool isGlobalRemoved() const { return m_globalRemovedEvent; }
        void globalRemove();

        bool isGlobal() const { return m_global != nullptr; }
        bool isResource() const { return m_resource != nullptr; }

        static const struct ::wl_interface *interface();
        static QByteArray interfaceName() { return interface()->name; }
        static int interfaceVersion() { return interface()->version; }


        void send_format(uint32_t format);
        void send_format(struct ::wl_resource *resource, uint32_t format);
        void send_modifier(uint32_t format, uint32_t modifier_hi, uint32_t modifier_lo);
        void send_modifier(struct ::wl_resource *resource, uint32_t format, uint32_t modifier_hi, uint32_t modifier_lo);

    protected:
        virtual Resource *zwp_linux_dmabuf_v1_allocate();

        virtual void zwp_linux_dmabuf_v1_destroy_global();

        virtual void zwp_linux_dmabuf_v1_bind_resource(Resource *resource);
        virtual void zwp_linux_dmabuf_v1_destroy_resource(Resource *resource);

        virtual void zwp_linux_dmabuf_v1_destroy(Resource *resource);
        virtual void zwp_linux_dmabuf_v1_create_params(Resource *resource, uint32_t params_id);
        virtual void zwp_linux_dmabuf_v1_get_default_feedback(Resource *resource, uint32_t id);
        virtual void zwp_linux_dmabuf_v1_get_surface_feedback(Resource *resource, uint32_t id, struct ::wl_resource *surface);

    private:
        static void bind_func(struct ::wl_client *client, void *data, uint32_t version, uint32_t id);
        static void destroy_func(struct ::wl_resource *client_resource);
        static void display_destroy_func(struct ::wl_listener *listener, void *data);
        static int deferred_destroy_global_func(void *data);

        Resource *bind(struct ::wl_client *client, uint32_t id, int version);
        Resource *bind(struct ::wl_resource *handle);

        static const struct ::zwp_linux_dmabuf_v1_interface m_zwp_linux_dmabuf_v1_interface;

        static void handle_destroy(
            ::wl_client *client,
            struct wl_resource *resource);
        static void handle_create_params(
            ::wl_client *client,
            struct wl_resource *resource,
            uint32_t params_id);
        static void handle_get_default_feedback(
            ::wl_client *client,
            struct wl_resource *resource,
            uint32_t id);
        static void handle_get_surface_feedback(
            ::wl_client *client,
            struct wl_resource *resource,
            uint32_t id,
            struct ::wl_resource *surface);

        QMultiMap<struct ::wl_client*, Resource*> m_resource_map;
        Resource *m_resource;
        struct ::wl_global *m_global;
        struct ::wl_display *m_display;
        struct wl_event_source *m_globalRemovedEvent;
        struct DisplayDestroyedListener : ::wl_listener {
            zwp_linux_dmabuf_v1 *parent;
        };
        DisplayDestroyedListener m_displayDestroyedListener;
    };

    class  zwp_linux_buffer_params_v1
    {
    public:
        zwp_linux_buffer_params_v1(struct ::wl_client *client, int id, int version);
        zwp_linux_buffer_params_v1(struct ::wl_display *display, int version);
        zwp_linux_buffer_params_v1(struct ::wl_resource *resource);
        zwp_linux_buffer_params_v1();

        virtual ~zwp_linux_buffer_params_v1();

        class Resource
        {
        public:
            Resource() : zwp_linux_buffer_params_v1_object(nullptr), handle(nullptr) {}
            virtual ~Resource() {}

            zwp_linux_buffer_params_v1 *zwp_linux_buffer_params_v1_object;
            zwp_linux_buffer_params_v1 *object() { return zwp_linux_buffer_params_v1_object; } 
            struct ::wl_resource *handle;

            struct ::wl_client *client() const { return wl_resource_get_client(handle); }
            int version() const { return wl_resource_get_version(handle); }

            static Resource *fromResource(struct ::wl_resource *resource);
        };

        void init(struct ::wl_client *client, int id, int version);
        void init(struct ::wl_display *display, int version);
        void init(struct ::wl_resource *resource);

        Resource *add(struct ::wl_client *client, int version);
        Resource *add(struct ::wl_client *client, int id, int version);
        Resource *add(struct wl_list *resource_list, struct ::wl_client *client, int id, int version);

        Resource *resource() { return m_resource; }
        const Resource *resource() const { return m_resource; }

        QMultiMap<struct ::wl_client*, Resource*> resourceMap() { return m_resource_map; }
        const QMultiMap<struct ::wl_client*, Resource*> resourceMap() const { return m_resource_map; }

        bool isGlobalRemoved() const { return m_globalRemovedEvent; }
        void globalRemove();

        bool isGlobal() const { return m_global != nullptr; }
        bool isResource() const { return m_resource != nullptr; }

        static const struct ::wl_interface *interface();
        static QByteArray interfaceName() { return interface()->name; }
        static int interfaceVersion() { return interface()->version; }


        enum error {
            error_already_used = 0, // the dmabuf_batch object has already been used to create a wl_buffer
            error_plane_idx = 1, // plane index out of bounds
            error_plane_set = 2, // the plane index was already set
            error_incomplete = 3, // missing or too many planes to create a buffer
            error_invalid_format = 4, // format not supported
            error_invalid_dimensions = 5, // invalid width or height
            error_out_of_bounds = 6, // offset + stride * height goes out of dmabuf bounds
            error_invalid_wl_buffer = 7, // invalid wl_buffer resulted from importing dmabufs via                the create_immed request on given buffer_params
        };

        enum flags {
            flags_y_invert = 1, // contents are y-inverted
            flags_interlaced = 2, // content is interlaced
            flags_bottom_first = 4, // bottom field first
        };

        void send_created(struct ::wl_resource *buffer);
        void send_created(struct ::wl_resource *resource, struct ::wl_resource *buffer);
        void send_failed();
        void send_failed(struct ::wl_resource *resource);

    protected:
        virtual Resource *zwp_linux_buffer_params_v1_allocate();

        virtual void zwp_linux_buffer_params_v1_destroy_global();

        virtual void zwp_linux_buffer_params_v1_bind_resource(Resource *resource);
        virtual void zwp_linux_buffer_params_v1_destroy_resource(Resource *resource);

        virtual void zwp_linux_buffer_params_v1_destroy(Resource *resource);
        virtual void zwp_linux_buffer_params_v1_add(Resource *resource, int32_t fd, uint32_t plane_idx, uint32_t offset, uint32_t stride, uint32_t modifier_hi, uint32_t modifier_lo);
        virtual void zwp_linux_buffer_params_v1_create(Resource *resource, int32_t width, int32_t height, uint32_t format, uint32_t flags);
        virtual void zwp_linux_buffer_params_v1_create_immed(Resource *resource, uint32_t buffer_id, int32_t width, int32_t height, uint32_t format, uint32_t flags);

    private:
        static void bind_func(struct ::wl_client *client, void *data, uint32_t version, uint32_t id);
        static void destroy_func(struct ::wl_resource *client_resource);
        static void display_destroy_func(struct ::wl_listener *listener, void *data);
        static int deferred_destroy_global_func(void *data);

        Resource *bind(struct ::wl_client *client, uint32_t id, int version);
        Resource *bind(struct ::wl_resource *handle);

        static const struct ::zwp_linux_buffer_params_v1_interface m_zwp_linux_buffer_params_v1_interface;

        static void handle_destroy(
            ::wl_client *client,
            struct wl_resource *resource);
        static void handle_add(
            ::wl_client *client,
            struct wl_resource *resource,
            int32_t fd,
            uint32_t plane_idx,
            uint32_t offset,
            uint32_t stride,
            uint32_t modifier_hi,
            uint32_t modifier_lo);
        static void handle_create(
            ::wl_client *client,
            struct wl_resource *resource,
            int32_t width,
            int32_t height,
            uint32_t format,
            uint32_t flags);
        static void handle_create_immed(
            ::wl_client *client,
            struct wl_resource *resource,
            uint32_t buffer_id,
            int32_t width,
            int32_t height,
            uint32_t format,
            uint32_t flags);

        QMultiMap<struct ::wl_client*, Resource*> m_resource_map;
        Resource *m_resource;
        struct ::wl_global *m_global;
        struct ::wl_display *m_display;
        struct wl_event_source *m_globalRemovedEvent;
        struct DisplayDestroyedListener : ::wl_listener {
            zwp_linux_buffer_params_v1 *parent;
        };
        DisplayDestroyedListener m_displayDestroyedListener;
    };

    class  zwp_linux_dmabuf_feedback_v1
    {
    public:
        zwp_linux_dmabuf_feedback_v1(struct ::wl_client *client, int id, int version);
        zwp_linux_dmabuf_feedback_v1(struct ::wl_display *display, int version);
        zwp_linux_dmabuf_feedback_v1(struct ::wl_resource *resource);
        zwp_linux_dmabuf_feedback_v1();

        virtual ~zwp_linux_dmabuf_feedback_v1();

        class Resource
        {
        public:
            Resource() : zwp_linux_dmabuf_feedback_v1_object(nullptr), handle(nullptr) {}
            virtual ~Resource() {}

            zwp_linux_dmabuf_feedback_v1 *zwp_linux_dmabuf_feedback_v1_object;
            zwp_linux_dmabuf_feedback_v1 *object() { return zwp_linux_dmabuf_feedback_v1_object; } 
            struct ::wl_resource *handle;

            struct ::wl_client *client() const { return wl_resource_get_client(handle); }
            int version() const { return wl_resource_get_version(handle); }

            static Resource *fromResource(struct ::wl_resource *resource);
        };

        void init(struct ::wl_client *client, int id, int version);
        void init(struct ::wl_display *display, int version);
        void init(struct ::wl_resource *resource);

        Resource *add(struct ::wl_client *client, int version);
        Resource *add(struct ::wl_client *client, int id, int version);
        Resource *add(struct wl_list *resource_list, struct ::wl_client *client, int id, int version);

        Resource *resource() { return m_resource; }
        const Resource *resource() const { return m_resource; }

        QMultiMap<struct ::wl_client*, Resource*> resourceMap() { return m_resource_map; }
        const QMultiMap<struct ::wl_client*, Resource*> resourceMap() const { return m_resource_map; }

        bool isGlobalRemoved() const { return m_globalRemovedEvent; }
        void globalRemove();

        bool isGlobal() const { return m_global != nullptr; }
        bool isResource() const { return m_resource != nullptr; }

        static const struct ::wl_interface *interface();
        static QByteArray interfaceName() { return interface()->name; }
        static int interfaceVersion() { return interface()->version; }


        enum tranche_flags {
            tranche_flags_scanout = 1, // direct scan-out tranche
        };

        void send_done();
        void send_done(struct ::wl_resource *resource);
        void send_format_table(int32_t fd, uint32_t size);
        void send_format_table(struct ::wl_resource *resource, int32_t fd, uint32_t size);
        void send_main_device(const QByteArray &device);
        void send_main_device(struct ::wl_resource *resource, const QByteArray &device);
        void send_tranche_done();
        void send_tranche_done(struct ::wl_resource *resource);
        void send_tranche_target_device(const QByteArray &device);
        void send_tranche_target_device(struct ::wl_resource *resource, const QByteArray &device);
        void send_tranche_formats(const QByteArray &indices);
        void send_tranche_formats(struct ::wl_resource *resource, const QByteArray &indices);
        void send_tranche_flags(uint32_t flags);
        void send_tranche_flags(struct ::wl_resource *resource, uint32_t flags);

    protected:
        virtual Resource *zwp_linux_dmabuf_feedback_v1_allocate();

        virtual void zwp_linux_dmabuf_feedback_v1_destroy_global();

        virtual void zwp_linux_dmabuf_feedback_v1_bind_resource(Resource *resource);
        virtual void zwp_linux_dmabuf_feedback_v1_destroy_resource(Resource *resource);

        virtual void zwp_linux_dmabuf_feedback_v1_destroy(Resource *resource);

    private:
        static void bind_func(struct ::wl_client *client, void *data, uint32_t version, uint32_t id);
        static void destroy_func(struct ::wl_resource *client_resource);
        static void display_destroy_func(struct ::wl_listener *listener, void *data);
        static int deferred_destroy_global_func(void *data);

        Resource *bind(struct ::wl_client *client, uint32_t id, int version);
        Resource *bind(struct ::wl_resource *handle);

        static const struct ::zwp_linux_dmabuf_feedback_v1_interface m_zwp_linux_dmabuf_feedback_v1_interface;

        static void handle_destroy(
            ::wl_client *client,
            struct wl_resource *resource);

        QMultiMap<struct ::wl_client*, Resource*> m_resource_map;
        Resource *m_resource;
        struct ::wl_global *m_global;
        struct ::wl_display *m_display;
        struct wl_event_source *m_globalRemovedEvent;
        struct DisplayDestroyedListener : ::wl_listener {
            zwp_linux_dmabuf_feedback_v1 *parent;
        };
        DisplayDestroyedListener m_displayDestroyedListener;
    };
}

QT_WARNING_POP
QT_END_NAMESPACE

#endif
