// This file was generated by qtwaylandscanner
// source file is color-management-v1.xml

#include "qwayland-server-color-management-v1.h"

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

namespace QtWaylandServer {

    int wp_color_manager_v1::deferred_destroy_global_func(void *data) {
        auto object = static_cast<wp_color_manager_v1 *>(data);
        wl_global_destroy(object->m_global);
        object->m_global = nullptr;
        wl_event_source_remove(object->m_globalRemovedEvent);
        object->m_globalRemovedEvent = nullptr;
        wl_list_remove(&object->m_displayDestroyedListener.link);
        object->wp_color_manager_v1_destroy_global();
        return 0;
    }

    wp_color_manager_v1::wp_color_manager_v1(struct ::wl_client *client, int id, int version)
        : m_resource_map()
        , m_resource(nullptr)
        , m_global(nullptr)
        , m_display(nullptr)
        , m_globalRemovedEvent(nullptr)
    {
        init(client, id, version);
    }

    wp_color_manager_v1::wp_color_manager_v1(struct ::wl_display *display, int version)
        : m_resource_map()
        , m_resource(nullptr)
        , m_global(nullptr)
        , m_display(nullptr)
        , m_globalRemovedEvent(nullptr)
    {
        init(display, version);
    }

    wp_color_manager_v1::wp_color_manager_v1(struct ::wl_resource *resource)
        : m_resource_map()
        , m_resource(nullptr)
        , m_global(nullptr)
        , m_display(nullptr)
        , m_globalRemovedEvent(nullptr)
    {
        init(resource);
    }

    wp_color_manager_v1::wp_color_manager_v1()
        : m_resource_map()
        , m_resource(nullptr)
        , m_global(nullptr)
        , m_display(nullptr)
        , m_globalRemovedEvent(nullptr)
    {
    }

    wp_color_manager_v1::~wp_color_manager_v1()
    {
        for (auto resource : std::as_const(m_resource_map))
            resource->wp_color_manager_v1_object = nullptr;

        if (m_resource)
            m_resource->wp_color_manager_v1_object = nullptr;

        if (m_global) {
            if (m_globalRemovedEvent)
                wl_event_source_remove(m_globalRemovedEvent);
            wl_global_destroy(m_global);
            wl_list_remove(&m_displayDestroyedListener.link);
        }
    }

    void wp_color_manager_v1::init(struct ::wl_client *client, int id, int version)
    {
        m_resource = bind(client, id, version);
    }

    void wp_color_manager_v1::init(struct ::wl_resource *resource)
    {
        m_resource = bind(resource);
    }

    wp_color_manager_v1::Resource *wp_color_manager_v1::add(struct ::wl_client *client, int version)
    {
        Resource *resource = bind(client, 0, version);
        m_resource_map.insert(client, resource);
        return resource;
    }

    wp_color_manager_v1::Resource *wp_color_manager_v1::add(struct ::wl_client *client, int id, int version)
    {
        Resource *resource = bind(client, id, version);
        m_resource_map.insert(client, resource);
        return resource;
    }

    wp_color_manager_v1::Resource *wp_color_manager_v1::add(struct ::wl_resource *resource)
    {
        return *m_resource_map.insert(wl_resource_get_client(resource), bind(resource));
    }

    void wp_color_manager_v1::init(struct ::wl_display *display, int version)
    {
        m_display = display;
        m_global = wl_global_create(display, &::wp_color_manager_v1_interface, version, this, bind_func);
        m_displayDestroyedListener.notify = wp_color_manager_v1::display_destroy_func;
        m_displayDestroyedListener.parent = this;
        wl_display_add_destroy_listener(display, &m_displayDestroyedListener);
    }

    const struct wl_interface *wp_color_manager_v1::interface()
    {
        return &::wp_color_manager_v1_interface;
    }

    wp_color_manager_v1::Resource *wp_color_manager_v1::wp_color_manager_v1_allocate()
    {
        return new Resource;
    }

    void wp_color_manager_v1::wp_color_manager_v1_destroy_global()
    {
    }

    void wp_color_manager_v1::wp_color_manager_v1_bind_resource(Resource *)
    {
    }

    void wp_color_manager_v1::wp_color_manager_v1_destroy_resource(Resource *)
    {
    }

    void wp_color_manager_v1::bind_func(struct ::wl_client *client, void *data, uint32_t version, uint32_t id)
    {
        wp_color_manager_v1 *that = static_cast<wp_color_manager_v1 *>(data);
        that->add(client, id, version);
    }

    void wp_color_manager_v1::display_destroy_func(struct ::wl_listener *listener, void *data)
    {
        Q_UNUSED(data);
        wp_color_manager_v1 *that = static_cast<wp_color_manager_v1::DisplayDestroyedListener *>(listener)->parent;
        that->m_global = nullptr;
        that->m_globalRemovedEvent = nullptr;
    }

    void wp_color_manager_v1::destroy_func(struct ::wl_resource *client_resource)
    {
        Resource *resource = Resource::fromResource(client_resource);
        Q_ASSERT(resource);
        wp_color_manager_v1 *that = resource->wp_color_manager_v1_object;
        if (Q_LIKELY(that)) {
            that->m_resource_map.remove(resource->client(), resource);
            that->wp_color_manager_v1_destroy_resource(resource);

            that = resource->wp_color_manager_v1_object;
            if (that && that->m_resource == resource)
                that->m_resource = nullptr;
        }
        delete resource;
    }


    void wp_color_manager_v1::globalRemove()
    {
        if (!m_global || m_globalRemovedEvent)
            return;

        wl_global_remove(m_global);

        struct wl_event_loop *event_loop = wl_display_get_event_loop(m_display);
        m_globalRemovedEvent = wl_event_loop_add_timer(event_loop, deferred_destroy_global_func, this);
        wl_event_source_timer_update(m_globalRemovedEvent, 300000);
    }

    wp_color_manager_v1::Resource *wp_color_manager_v1::bind(struct ::wl_client *client, uint32_t id, int version)
    {
        Q_ASSERT_X(!wl_client_get_object(client, id), "QWaylandObject bind", QStringLiteral("binding to object %1 more than once").arg(id).toLocal8Bit().constData());
        struct ::wl_resource *handle = wl_resource_create(client, &::wp_color_manager_v1_interface, version, id);
        return bind(handle);
    }

    wp_color_manager_v1::Resource *wp_color_manager_v1::bind(struct ::wl_resource *handle)
    {
        Resource *resource = wp_color_manager_v1_allocate();
        resource->wp_color_manager_v1_object = this;

        wl_resource_set_implementation(handle, &m_wp_color_manager_v1_interface, resource, destroy_func);
        resource->handle = handle;
        wp_color_manager_v1_bind_resource(resource);
        return resource;
    }
    wp_color_manager_v1::Resource *wp_color_manager_v1::Resource::fromResource(struct ::wl_resource *resource)
    {
        if (Q_UNLIKELY(!resource))
            return nullptr;
        if (wl_resource_instance_of(resource, &::wp_color_manager_v1_interface, &m_wp_color_manager_v1_interface))
            return static_cast<Resource *>(wl_resource_get_user_data(resource));
        return nullptr;
    }

    const struct ::wp_color_manager_v1_interface wp_color_manager_v1::m_wp_color_manager_v1_interface = {
        wp_color_manager_v1::handle_destroy,
        wp_color_manager_v1::handle_get_output,
        wp_color_manager_v1::handle_get_surface,
        wp_color_manager_v1::handle_get_surface_feedback,
        wp_color_manager_v1::handle_create_icc_creator,
        wp_color_manager_v1::handle_create_parametric_creator,
        wp_color_manager_v1::handle_create_windows_scrgb,
        wp_color_manager_v1::handle_get_image_description,
        wp_color_manager_v1::handle_create_windows_bt2100
    };

    void wp_color_manager_v1::wp_color_manager_v1_destroy(Resource *)
    {
    }

    void wp_color_manager_v1::wp_color_manager_v1_get_output(Resource *, uint32_t, struct ::wl_resource *)
    {
    }

    void wp_color_manager_v1::wp_color_manager_v1_get_surface(Resource *, uint32_t, struct ::wl_resource *)
    {
    }

    void wp_color_manager_v1::wp_color_manager_v1_get_surface_feedback(Resource *, uint32_t, struct ::wl_resource *)
    {
    }

    void wp_color_manager_v1::wp_color_manager_v1_create_icc_creator(Resource *, uint32_t)
    {
    }

    void wp_color_manager_v1::wp_color_manager_v1_create_parametric_creator(Resource *, uint32_t)
    {
    }

    void wp_color_manager_v1::wp_color_manager_v1_create_windows_scrgb(Resource *, uint32_t)
    {
    }

    void wp_color_manager_v1::wp_color_manager_v1_get_image_description(Resource *, uint32_t, struct ::wl_resource *)
    {
    }

    void wp_color_manager_v1::wp_color_manager_v1_create_windows_bt2100(Resource *, uint32_t)
    {
    }


    void wp_color_manager_v1::handle_destroy(
        ::wl_client *client,
        struct wl_resource *resource)
    {
        Q_UNUSED(client);
        Resource *qtResource = Resource::fromResource(resource);
        if (Q_UNLIKELY(!qtResource->wp_color_manager_v1_object)) {
            wl_resource_destroy(resource);
            return;
        }
        static_cast<wp_color_manager_v1 *>(qtResource->wp_color_manager_v1_object)->wp_color_manager_v1_destroy(
            qtResource);
    }

    void wp_color_manager_v1::handle_get_output(
        ::wl_client *client,
        struct wl_resource *resource,
        uint32_t id,
        struct ::wl_resource *output)
    {
        Q_UNUSED(client);
        Resource *qtResource = Resource::fromResource(resource);
        if (Q_UNLIKELY(!qtResource->wp_color_manager_v1_object)) {
            return;
        }
        static_cast<wp_color_manager_v1 *>(qtResource->wp_color_manager_v1_object)->wp_color_manager_v1_get_output(
            qtResource,
            id,
            output);
    }

    void wp_color_manager_v1::handle_get_surface(
        ::wl_client *client,
        struct wl_resource *resource,
        uint32_t id,
        struct ::wl_resource *surface)
    {
        Q_UNUSED(client);
        Resource *qtResource = Resource::fromResource(resource);
        if (Q_UNLIKELY(!qtResource->wp_color_manager_v1_object)) {
            return;
        }
        static_cast<wp_color_manager_v1 *>(qtResource->wp_color_manager_v1_object)->wp_color_manager_v1_get_surface(
            qtResource,
            id,
            surface);
    }

    void wp_color_manager_v1::handle_get_surface_feedback(
        ::wl_client *client,
        struct wl_resource *resource,
        uint32_t id,
        struct ::wl_resource *surface)
    {
        Q_UNUSED(client);
        Resource *qtResource = Resource::fromResource(resource);
        if (Q_UNLIKELY(!qtResource->wp_color_manager_v1_object)) {
            return;
        }
        static_cast<wp_color_manager_v1 *>(qtResource->wp_color_manager_v1_object)->wp_color_manager_v1_get_surface_feedback(
            qtResource,
            id,
            surface);
    }

    void wp_color_manager_v1::handle_create_icc_creator(
        ::wl_client *client,
        struct wl_resource *resource,
        uint32_t obj)
    {
        Q_UNUSED(client);
        Resource *qtResource = Resource::fromResource(resource);
        if (Q_UNLIKELY(!qtResource->wp_color_manager_v1_object)) {
            return;
        }
        static_cast<wp_color_manager_v1 *>(qtResource->wp_color_manager_v1_object)->wp_color_manager_v1_create_icc_creator(
            qtResource,
            obj);
    }

    void wp_color_manager_v1::handle_create_parametric_creator(
        ::wl_client *client,
        struct wl_resource *resource,
        uint32_t obj)
    {
        Q_UNUSED(client);
        Resource *qtResource = Resource::fromResource(resource);
        if (Q_UNLIKELY(!qtResource->wp_color_manager_v1_object)) {
            return;
        }
        static_cast<wp_color_manager_v1 *>(qtResource->wp_color_manager_v1_object)->wp_color_manager_v1_create_parametric_creator(
            qtResource,
            obj);
    }

    void wp_color_manager_v1::handle_create_windows_scrgb(
        ::wl_client *client,
        struct wl_resource *resource,
        uint32_t image_description)
    {
        Q_UNUSED(client);
        Resource *qtResource = Resource::fromResource(resource);
        if (Q_UNLIKELY(!qtResource->wp_color_manager_v1_object)) {
            return;
        }
        static_cast<wp_color_manager_v1 *>(qtResource->wp_color_manager_v1_object)->wp_color_manager_v1_create_windows_scrgb(
            qtResource,
            image_description);
    }

    void wp_color_manager_v1::handle_get_image_description(
        ::wl_client *client,
        struct wl_resource *resource,
        uint32_t image_description,
        struct ::wl_resource *reference)
    {
        Q_UNUSED(client);
        Resource *qtResource = Resource::fromResource(resource);
        if (Q_UNLIKELY(!qtResource->wp_color_manager_v1_object)) {
            return;
        }
        static_cast<wp_color_manager_v1 *>(qtResource->wp_color_manager_v1_object)->wp_color_manager_v1_get_image_description(
            qtResource,
            image_description,
            reference);
    }

    void wp_color_manager_v1::handle_create_windows_bt2100(
        ::wl_client *client,
        struct wl_resource *resource,
        uint32_t image_description)
    {
        Q_UNUSED(client);
        Resource *qtResource = Resource::fromResource(resource);
        if (Q_UNLIKELY(!qtResource->wp_color_manager_v1_object)) {
            return;
        }
        static_cast<wp_color_manager_v1 *>(qtResource->wp_color_manager_v1_object)->wp_color_manager_v1_create_windows_bt2100(
            qtResource,
            image_description);
    }

    void wp_color_manager_v1::send_supported_intent(uint32_t render_intent)
    {
        Q_ASSERT_X(m_resource, "wp_color_manager_v1::supported_intent", "Uninitialised resource");
        if (Q_UNLIKELY(!m_resource)) {
            qWarning("could not call wp_color_manager_v1::supported_intent as it's not initialised");
            return;
        }
        send_supported_intent(
            m_resource->handle,
            render_intent);
    }

    void wp_color_manager_v1::send_supported_intent(struct ::wl_resource *resource, uint32_t render_intent)
    {
        wp_color_manager_v1_send_supported_intent(
            resource,
            render_intent);
    }


    void wp_color_manager_v1::send_supported_feature(uint32_t feature)
    {
        Q_ASSERT_X(m_resource, "wp_color_manager_v1::supported_feature", "Uninitialised resource");
        if (Q_UNLIKELY(!m_resource)) {
            qWarning("could not call wp_color_manager_v1::supported_feature as it's not initialised");
            return;
        }
        send_supported_feature(
            m_resource->handle,
            feature);
    }

    void wp_color_manager_v1::send_supported_feature(struct ::wl_resource *resource, uint32_t feature)
    {
        wp_color_manager_v1_send_supported_feature(
            resource,
            feature);
    }


    void wp_color_manager_v1::send_supported_tf_named(uint32_t tf)
    {
        Q_ASSERT_X(m_resource, "wp_color_manager_v1::supported_tf_named", "Uninitialised resource");
        if (Q_UNLIKELY(!m_resource)) {
            qWarning("could not call wp_color_manager_v1::supported_tf_named as it's not initialised");
            return;
        }
        send_supported_tf_named(
            m_resource->handle,
            tf);
    }

    void wp_color_manager_v1::send_supported_tf_named(struct ::wl_resource *resource, uint32_t tf)
    {
        wp_color_manager_v1_send_supported_tf_named(
            resource,
            tf);
    }


    void wp_color_manager_v1::send_supported_primaries_named(uint32_t primaries)
    {
        Q_ASSERT_X(m_resource, "wp_color_manager_v1::supported_primaries_named", "Uninitialised resource");
        if (Q_UNLIKELY(!m_resource)) {
            qWarning("could not call wp_color_manager_v1::supported_primaries_named as it's not initialised");
            return;
        }
        send_supported_primaries_named(
            m_resource->handle,
            primaries);
    }

    void wp_color_manager_v1::send_supported_primaries_named(struct ::wl_resource *resource, uint32_t primaries)
    {
        wp_color_manager_v1_send_supported_primaries_named(
            resource,
            primaries);
    }


    void wp_color_manager_v1::send_done()
    {
        Q_ASSERT_X(m_resource, "wp_color_manager_v1::done", "Uninitialised resource");
        if (Q_UNLIKELY(!m_resource)) {
            qWarning("could not call wp_color_manager_v1::done as it's not initialised");
            return;
        }
        send_done(
            m_resource->handle);
    }

    void wp_color_manager_v1::send_done(struct ::wl_resource *resource)
    {
        wp_color_manager_v1_send_done(
            resource);
    }



    int wp_color_management_output_v1::deferred_destroy_global_func(void *data) {
        auto object = static_cast<wp_color_management_output_v1 *>(data);
        wl_global_destroy(object->m_global);
        object->m_global = nullptr;
        wl_event_source_remove(object->m_globalRemovedEvent);
        object->m_globalRemovedEvent = nullptr;
        wl_list_remove(&object->m_displayDestroyedListener.link);
        object->wp_color_management_output_v1_destroy_global();
        return 0;
    }

    wp_color_management_output_v1::wp_color_management_output_v1(struct ::wl_client *client, int id, int version)
        : m_resource_map()
        , m_resource(nullptr)
        , m_global(nullptr)
        , m_display(nullptr)
        , m_globalRemovedEvent(nullptr)
    {
        init(client, id, version);
    }

    wp_color_management_output_v1::wp_color_management_output_v1(struct ::wl_display *display, int version)
        : m_resource_map()
        , m_resource(nullptr)
        , m_global(nullptr)
        , m_display(nullptr)
        , m_globalRemovedEvent(nullptr)
    {
        init(display, version);
    }

    wp_color_management_output_v1::wp_color_management_output_v1(struct ::wl_resource *resource)
        : m_resource_map()
        , m_resource(nullptr)
        , m_global(nullptr)
        , m_display(nullptr)
        , m_globalRemovedEvent(nullptr)
    {
        init(resource);
    }

    wp_color_management_output_v1::wp_color_management_output_v1()
        : m_resource_map()
        , m_resource(nullptr)
        , m_global(nullptr)
        , m_display(nullptr)
        , m_globalRemovedEvent(nullptr)
    {
    }

    wp_color_management_output_v1::~wp_color_management_output_v1()
    {
        for (auto resource : std::as_const(m_resource_map))
            resource->wp_color_management_output_v1_object = nullptr;

        if (m_resource)
            m_resource->wp_color_management_output_v1_object = nullptr;

        if (m_global) {
            if (m_globalRemovedEvent)
                wl_event_source_remove(m_globalRemovedEvent);
            wl_global_destroy(m_global);
            wl_list_remove(&m_displayDestroyedListener.link);
        }
    }

    void wp_color_management_output_v1::init(struct ::wl_client *client, int id, int version)
    {
        m_resource = bind(client, id, version);
    }

    void wp_color_management_output_v1::init(struct ::wl_resource *resource)
    {
        m_resource = bind(resource);
    }

    wp_color_management_output_v1::Resource *wp_color_management_output_v1::add(struct ::wl_client *client, int version)
    {
        Resource *resource = bind(client, 0, version);
        m_resource_map.insert(client, resource);
        return resource;
    }

    wp_color_management_output_v1::Resource *wp_color_management_output_v1::add(struct ::wl_client *client, int id, int version)
    {
        Resource *resource = bind(client, id, version);
        m_resource_map.insert(client, resource);
        return resource;
    }

    wp_color_management_output_v1::Resource *wp_color_management_output_v1::add(struct ::wl_resource *resource)
    {
        return *m_resource_map.insert(wl_resource_get_client(resource), bind(resource));
    }

    void wp_color_management_output_v1::init(struct ::wl_display *display, int version)
    {
        m_display = display;
        m_global = wl_global_create(display, &::wp_color_management_output_v1_interface, version, this, bind_func);
        m_displayDestroyedListener.notify = wp_color_management_output_v1::display_destroy_func;
        m_displayDestroyedListener.parent = this;
        wl_display_add_destroy_listener(display, &m_displayDestroyedListener);
    }

    const struct wl_interface *wp_color_management_output_v1::interface()
    {
        return &::wp_color_management_output_v1_interface;
    }

    wp_color_management_output_v1::Resource *wp_color_management_output_v1::wp_color_management_output_v1_allocate()
    {
        return new Resource;
    }

    void wp_color_management_output_v1::wp_color_management_output_v1_destroy_global()
    {
    }

    void wp_color_management_output_v1::wp_color_management_output_v1_bind_resource(Resource *)
    {
    }

    void wp_color_management_output_v1::wp_color_management_output_v1_destroy_resource(Resource *)
    {
    }

    void wp_color_management_output_v1::bind_func(struct ::wl_client *client, void *data, uint32_t version, uint32_t id)
    {
        wp_color_management_output_v1 *that = static_cast<wp_color_management_output_v1 *>(data);
        that->add(client, id, version);
    }

    void wp_color_management_output_v1::display_destroy_func(struct ::wl_listener *listener, void *data)
    {
        Q_UNUSED(data);
        wp_color_management_output_v1 *that = static_cast<wp_color_management_output_v1::DisplayDestroyedListener *>(listener)->parent;
        that->m_global = nullptr;
        that->m_globalRemovedEvent = nullptr;
    }

    void wp_color_management_output_v1::destroy_func(struct ::wl_resource *client_resource)
    {
        Resource *resource = Resource::fromResource(client_resource);
        Q_ASSERT(resource);
        wp_color_management_output_v1 *that = resource->wp_color_management_output_v1_object;
        if (Q_LIKELY(that)) {
            that->m_resource_map.remove(resource->client(), resource);
            that->wp_color_management_output_v1_destroy_resource(resource);

            that = resource->wp_color_management_output_v1_object;
            if (that && that->m_resource == resource)
                that->m_resource = nullptr;
        }
        delete resource;
    }


    void wp_color_management_output_v1::globalRemove()
    {
        if (!m_global || m_globalRemovedEvent)
            return;

        wl_global_remove(m_global);

        struct wl_event_loop *event_loop = wl_display_get_event_loop(m_display);
        m_globalRemovedEvent = wl_event_loop_add_timer(event_loop, deferred_destroy_global_func, this);
        wl_event_source_timer_update(m_globalRemovedEvent, 300000);
    }

    wp_color_management_output_v1::Resource *wp_color_management_output_v1::bind(struct ::wl_client *client, uint32_t id, int version)
    {
        Q_ASSERT_X(!wl_client_get_object(client, id), "QWaylandObject bind", QStringLiteral("binding to object %1 more than once").arg(id).toLocal8Bit().constData());
        struct ::wl_resource *handle = wl_resource_create(client, &::wp_color_management_output_v1_interface, version, id);
        return bind(handle);
    }

    wp_color_management_output_v1::Resource *wp_color_management_output_v1::bind(struct ::wl_resource *handle)
    {
        Resource *resource = wp_color_management_output_v1_allocate();
        resource->wp_color_management_output_v1_object = this;

        wl_resource_set_implementation(handle, &m_wp_color_management_output_v1_interface, resource, destroy_func);
        resource->handle = handle;
        wp_color_management_output_v1_bind_resource(resource);
        return resource;
    }
    wp_color_management_output_v1::Resource *wp_color_management_output_v1::Resource::fromResource(struct ::wl_resource *resource)
    {
        if (Q_UNLIKELY(!resource))
            return nullptr;
        if (wl_resource_instance_of(resource, &::wp_color_management_output_v1_interface, &m_wp_color_management_output_v1_interface))
            return static_cast<Resource *>(wl_resource_get_user_data(resource));
        return nullptr;
    }

    const struct ::wp_color_management_output_v1_interface wp_color_management_output_v1::m_wp_color_management_output_v1_interface = {
        wp_color_management_output_v1::handle_destroy,
        wp_color_management_output_v1::handle_get_image_description
    };

    void wp_color_management_output_v1::wp_color_management_output_v1_destroy(Resource *)
    {
    }

    void wp_color_management_output_v1::wp_color_management_output_v1_get_image_description(Resource *, uint32_t)
    {
    }


    void wp_color_management_output_v1::handle_destroy(
        ::wl_client *client,
        struct wl_resource *resource)
    {
        Q_UNUSED(client);
        Resource *qtResource = Resource::fromResource(resource);
        if (Q_UNLIKELY(!qtResource->wp_color_management_output_v1_object)) {
            wl_resource_destroy(resource);
            return;
        }
        static_cast<wp_color_management_output_v1 *>(qtResource->wp_color_management_output_v1_object)->wp_color_management_output_v1_destroy(
            qtResource);
    }

    void wp_color_management_output_v1::handle_get_image_description(
        ::wl_client *client,
        struct wl_resource *resource,
        uint32_t image_description)
    {
        Q_UNUSED(client);
        Resource *qtResource = Resource::fromResource(resource);
        if (Q_UNLIKELY(!qtResource->wp_color_management_output_v1_object)) {
            return;
        }
        static_cast<wp_color_management_output_v1 *>(qtResource->wp_color_management_output_v1_object)->wp_color_management_output_v1_get_image_description(
            qtResource,
            image_description);
    }

    void wp_color_management_output_v1::send_image_description_changed()
    {
        Q_ASSERT_X(m_resource, "wp_color_management_output_v1::image_description_changed", "Uninitialised resource");
        if (Q_UNLIKELY(!m_resource)) {
            qWarning("could not call wp_color_management_output_v1::image_description_changed as it's not initialised");
            return;
        }
        send_image_description_changed(
            m_resource->handle);
    }

    void wp_color_management_output_v1::send_image_description_changed(struct ::wl_resource *resource)
    {
        wp_color_management_output_v1_send_image_description_changed(
            resource);
    }



    int wp_color_management_surface_v1::deferred_destroy_global_func(void *data) {
        auto object = static_cast<wp_color_management_surface_v1 *>(data);
        wl_global_destroy(object->m_global);
        object->m_global = nullptr;
        wl_event_source_remove(object->m_globalRemovedEvent);
        object->m_globalRemovedEvent = nullptr;
        wl_list_remove(&object->m_displayDestroyedListener.link);
        object->wp_color_management_surface_v1_destroy_global();
        return 0;
    }

    wp_color_management_surface_v1::wp_color_management_surface_v1(struct ::wl_client *client, int id, int version)
        : m_resource_map()
        , m_resource(nullptr)
        , m_global(nullptr)
        , m_display(nullptr)
        , m_globalRemovedEvent(nullptr)
    {
        init(client, id, version);
    }

    wp_color_management_surface_v1::wp_color_management_surface_v1(struct ::wl_display *display, int version)
        : m_resource_map()
        , m_resource(nullptr)
        , m_global(nullptr)
        , m_display(nullptr)
        , m_globalRemovedEvent(nullptr)
    {
        init(display, version);
    }

    wp_color_management_surface_v1::wp_color_management_surface_v1(struct ::wl_resource *resource)
        : m_resource_map()
        , m_resource(nullptr)
        , m_global(nullptr)
        , m_display(nullptr)
        , m_globalRemovedEvent(nullptr)
    {
        init(resource);
    }

    wp_color_management_surface_v1::wp_color_management_surface_v1()
        : m_resource_map()
        , m_resource(nullptr)
        , m_global(nullptr)
        , m_display(nullptr)
        , m_globalRemovedEvent(nullptr)
    {
    }

    wp_color_management_surface_v1::~wp_color_management_surface_v1()
    {
        for (auto resource : std::as_const(m_resource_map))
            resource->wp_color_management_surface_v1_object = nullptr;

        if (m_resource)
            m_resource->wp_color_management_surface_v1_object = nullptr;

        if (m_global) {
            if (m_globalRemovedEvent)
                wl_event_source_remove(m_globalRemovedEvent);
            wl_global_destroy(m_global);
            wl_list_remove(&m_displayDestroyedListener.link);
        }
    }

    void wp_color_management_surface_v1::init(struct ::wl_client *client, int id, int version)
    {
        m_resource = bind(client, id, version);
    }

    void wp_color_management_surface_v1::init(struct ::wl_resource *resource)
    {
        m_resource = bind(resource);
    }

    wp_color_management_surface_v1::Resource *wp_color_management_surface_v1::add(struct ::wl_client *client, int version)
    {
        Resource *resource = bind(client, 0, version);
        m_resource_map.insert(client, resource);
        return resource;
    }

    wp_color_management_surface_v1::Resource *wp_color_management_surface_v1::add(struct ::wl_client *client, int id, int version)
    {
        Resource *resource = bind(client, id, version);
        m_resource_map.insert(client, resource);
        return resource;
    }

    wp_color_management_surface_v1::Resource *wp_color_management_surface_v1::add(struct ::wl_resource *resource)
    {
        return *m_resource_map.insert(wl_resource_get_client(resource), bind(resource));
    }

    void wp_color_management_surface_v1::init(struct ::wl_display *display, int version)
    {
        m_display = display;
        m_global = wl_global_create(display, &::wp_color_management_surface_v1_interface, version, this, bind_func);
        m_displayDestroyedListener.notify = wp_color_management_surface_v1::display_destroy_func;
        m_displayDestroyedListener.parent = this;
        wl_display_add_destroy_listener(display, &m_displayDestroyedListener);
    }

    const struct wl_interface *wp_color_management_surface_v1::interface()
    {
        return &::wp_color_management_surface_v1_interface;
    }

    wp_color_management_surface_v1::Resource *wp_color_management_surface_v1::wp_color_management_surface_v1_allocate()
    {
        return new Resource;
    }

    void wp_color_management_surface_v1::wp_color_management_surface_v1_destroy_global()
    {
    }

    void wp_color_management_surface_v1::wp_color_management_surface_v1_bind_resource(Resource *)
    {
    }

    void wp_color_management_surface_v1::wp_color_management_surface_v1_destroy_resource(Resource *)
    {
    }

    void wp_color_management_surface_v1::bind_func(struct ::wl_client *client, void *data, uint32_t version, uint32_t id)
    {
        wp_color_management_surface_v1 *that = static_cast<wp_color_management_surface_v1 *>(data);
        that->add(client, id, version);
    }

    void wp_color_management_surface_v1::display_destroy_func(struct ::wl_listener *listener, void *data)
    {
        Q_UNUSED(data);
        wp_color_management_surface_v1 *that = static_cast<wp_color_management_surface_v1::DisplayDestroyedListener *>(listener)->parent;
        that->m_global = nullptr;
        that->m_globalRemovedEvent = nullptr;
    }

    void wp_color_management_surface_v1::destroy_func(struct ::wl_resource *client_resource)
    {
        Resource *resource = Resource::fromResource(client_resource);
        Q_ASSERT(resource);
        wp_color_management_surface_v1 *that = resource->wp_color_management_surface_v1_object;
        if (Q_LIKELY(that)) {
            that->m_resource_map.remove(resource->client(), resource);
            that->wp_color_management_surface_v1_destroy_resource(resource);

            that = resource->wp_color_management_surface_v1_object;
            if (that && that->m_resource == resource)
                that->m_resource = nullptr;
        }
        delete resource;
    }


    void wp_color_management_surface_v1::globalRemove()
    {
        if (!m_global || m_globalRemovedEvent)
            return;

        wl_global_remove(m_global);

        struct wl_event_loop *event_loop = wl_display_get_event_loop(m_display);
        m_globalRemovedEvent = wl_event_loop_add_timer(event_loop, deferred_destroy_global_func, this);
        wl_event_source_timer_update(m_globalRemovedEvent, 300000);
    }

    wp_color_management_surface_v1::Resource *wp_color_management_surface_v1::bind(struct ::wl_client *client, uint32_t id, int version)
    {
        Q_ASSERT_X(!wl_client_get_object(client, id), "QWaylandObject bind", QStringLiteral("binding to object %1 more than once").arg(id).toLocal8Bit().constData());
        struct ::wl_resource *handle = wl_resource_create(client, &::wp_color_management_surface_v1_interface, version, id);
        return bind(handle);
    }

    wp_color_management_surface_v1::Resource *wp_color_management_surface_v1::bind(struct ::wl_resource *handle)
    {
        Resource *resource = wp_color_management_surface_v1_allocate();
        resource->wp_color_management_surface_v1_object = this;

        wl_resource_set_implementation(handle, &m_wp_color_management_surface_v1_interface, resource, destroy_func);
        resource->handle = handle;
        wp_color_management_surface_v1_bind_resource(resource);
        return resource;
    }
    wp_color_management_surface_v1::Resource *wp_color_management_surface_v1::Resource::fromResource(struct ::wl_resource *resource)
    {
        if (Q_UNLIKELY(!resource))
            return nullptr;
        if (wl_resource_instance_of(resource, &::wp_color_management_surface_v1_interface, &m_wp_color_management_surface_v1_interface))
            return static_cast<Resource *>(wl_resource_get_user_data(resource));
        return nullptr;
    }

    const struct ::wp_color_management_surface_v1_interface wp_color_management_surface_v1::m_wp_color_management_surface_v1_interface = {
        wp_color_management_surface_v1::handle_destroy,
        wp_color_management_surface_v1::handle_set_image_description,
        wp_color_management_surface_v1::handle_unset_image_description
    };

    void wp_color_management_surface_v1::wp_color_management_surface_v1_destroy(Resource *)
    {
    }

    void wp_color_management_surface_v1::wp_color_management_surface_v1_set_image_description(Resource *, struct ::wl_resource *, uint32_t )
    {
    }

    void wp_color_management_surface_v1::wp_color_management_surface_v1_unset_image_description(Resource *)
    {
    }


    void wp_color_management_surface_v1::handle_destroy(
        ::wl_client *client,
        struct wl_resource *resource)
    {
        Q_UNUSED(client);
        Resource *qtResource = Resource::fromResource(resource);
        if (Q_UNLIKELY(!qtResource->wp_color_management_surface_v1_object)) {
            wl_resource_destroy(resource);
            return;
        }
        static_cast<wp_color_management_surface_v1 *>(qtResource->wp_color_management_surface_v1_object)->wp_color_management_surface_v1_destroy(
            qtResource);
    }

    void wp_color_management_surface_v1::handle_set_image_description(
        ::wl_client *client,
        struct wl_resource *resource,
        struct ::wl_resource *image_description,
        uint32_t render_intent)
    {
        Q_UNUSED(client);
        Resource *qtResource = Resource::fromResource(resource);
        if (Q_UNLIKELY(!qtResource->wp_color_management_surface_v1_object)) {
            return;
        }
        static_cast<wp_color_management_surface_v1 *>(qtResource->wp_color_management_surface_v1_object)->wp_color_management_surface_v1_set_image_description(
            qtResource,
            image_description,
            render_intent);
    }

    void wp_color_management_surface_v1::handle_unset_image_description(
        ::wl_client *client,
        struct wl_resource *resource)
    {
        Q_UNUSED(client);
        Resource *qtResource = Resource::fromResource(resource);
        if (Q_UNLIKELY(!qtResource->wp_color_management_surface_v1_object)) {
            return;
        }
        static_cast<wp_color_management_surface_v1 *>(qtResource->wp_color_management_surface_v1_object)->wp_color_management_surface_v1_unset_image_description(
            qtResource);
    }


    int wp_color_management_surface_feedback_v1::deferred_destroy_global_func(void *data) {
        auto object = static_cast<wp_color_management_surface_feedback_v1 *>(data);
        wl_global_destroy(object->m_global);
        object->m_global = nullptr;
        wl_event_source_remove(object->m_globalRemovedEvent);
        object->m_globalRemovedEvent = nullptr;
        wl_list_remove(&object->m_displayDestroyedListener.link);
        object->wp_color_management_surface_feedback_v1_destroy_global();
        return 0;
    }

    wp_color_management_surface_feedback_v1::wp_color_management_surface_feedback_v1(struct ::wl_client *client, int id, int version)
        : m_resource_map()
        , m_resource(nullptr)
        , m_global(nullptr)
        , m_display(nullptr)
        , m_globalRemovedEvent(nullptr)
    {
        init(client, id, version);
    }

    wp_color_management_surface_feedback_v1::wp_color_management_surface_feedback_v1(struct ::wl_display *display, int version)
        : m_resource_map()
        , m_resource(nullptr)
        , m_global(nullptr)
        , m_display(nullptr)
        , m_globalRemovedEvent(nullptr)
    {
        init(display, version);
    }

    wp_color_management_surface_feedback_v1::wp_color_management_surface_feedback_v1(struct ::wl_resource *resource)
        : m_resource_map()
        , m_resource(nullptr)
        , m_global(nullptr)
        , m_display(nullptr)
        , m_globalRemovedEvent(nullptr)
    {
        init(resource);
    }

    wp_color_management_surface_feedback_v1::wp_color_management_surface_feedback_v1()
        : m_resource_map()
        , m_resource(nullptr)
        , m_global(nullptr)
        , m_display(nullptr)
        , m_globalRemovedEvent(nullptr)
    {
    }

    wp_color_management_surface_feedback_v1::~wp_color_management_surface_feedback_v1()
    {
        for (auto resource : std::as_const(m_resource_map))
            resource->wp_color_management_surface_feedback_v1_object = nullptr;

        if (m_resource)
            m_resource->wp_color_management_surface_feedback_v1_object = nullptr;

        if (m_global) {
            if (m_globalRemovedEvent)
                wl_event_source_remove(m_globalRemovedEvent);
            wl_global_destroy(m_global);
            wl_list_remove(&m_displayDestroyedListener.link);
        }
    }

    void wp_color_management_surface_feedback_v1::init(struct ::wl_client *client, int id, int version)
    {
        m_resource = bind(client, id, version);
    }

    void wp_color_management_surface_feedback_v1::init(struct ::wl_resource *resource)
    {
        m_resource = bind(resource);
    }

    wp_color_management_surface_feedback_v1::Resource *wp_color_management_surface_feedback_v1::add(struct ::wl_client *client, int version)
    {
        Resource *resource = bind(client, 0, version);
        m_resource_map.insert(client, resource);
        return resource;
    }

    wp_color_management_surface_feedback_v1::Resource *wp_color_management_surface_feedback_v1::add(struct ::wl_client *client, int id, int version)
    {
        Resource *resource = bind(client, id, version);
        m_resource_map.insert(client, resource);
        return resource;
    }

    wp_color_management_surface_feedback_v1::Resource *wp_color_management_surface_feedback_v1::add(struct ::wl_resource *resource)
    {
        return *m_resource_map.insert(wl_resource_get_client(resource), bind(resource));
    }

    void wp_color_management_surface_feedback_v1::init(struct ::wl_display *display, int version)
    {
        m_display = display;
        m_global = wl_global_create(display, &::wp_color_management_surface_feedback_v1_interface, version, this, bind_func);
        m_displayDestroyedListener.notify = wp_color_management_surface_feedback_v1::display_destroy_func;
        m_displayDestroyedListener.parent = this;
        wl_display_add_destroy_listener(display, &m_displayDestroyedListener);
    }

    const struct wl_interface *wp_color_management_surface_feedback_v1::interface()
    {
        return &::wp_color_management_surface_feedback_v1_interface;
    }

    wp_color_management_surface_feedback_v1::Resource *wp_color_management_surface_feedback_v1::wp_color_management_surface_feedback_v1_allocate()
    {
        return new Resource;
    }

    void wp_color_management_surface_feedback_v1::wp_color_management_surface_feedback_v1_destroy_global()
    {
    }

    void wp_color_management_surface_feedback_v1::wp_color_management_surface_feedback_v1_bind_resource(Resource *)
    {
    }

    void wp_color_management_surface_feedback_v1::wp_color_management_surface_feedback_v1_destroy_resource(Resource *)
    {
    }

    void wp_color_management_surface_feedback_v1::bind_func(struct ::wl_client *client, void *data, uint32_t version, uint32_t id)
    {
        wp_color_management_surface_feedback_v1 *that = static_cast<wp_color_management_surface_feedback_v1 *>(data);
        that->add(client, id, version);
    }

    void wp_color_management_surface_feedback_v1::display_destroy_func(struct ::wl_listener *listener, void *data)
    {
        Q_UNUSED(data);
        wp_color_management_surface_feedback_v1 *that = static_cast<wp_color_management_surface_feedback_v1::DisplayDestroyedListener *>(listener)->parent;
        that->m_global = nullptr;
        that->m_globalRemovedEvent = nullptr;
    }

    void wp_color_management_surface_feedback_v1::destroy_func(struct ::wl_resource *client_resource)
    {
        Resource *resource = Resource::fromResource(client_resource);
        Q_ASSERT(resource);
        wp_color_management_surface_feedback_v1 *that = resource->wp_color_management_surface_feedback_v1_object;
        if (Q_LIKELY(that)) {
            that->m_resource_map.remove(resource->client(), resource);
            that->wp_color_management_surface_feedback_v1_destroy_resource(resource);

            that = resource->wp_color_management_surface_feedback_v1_object;
            if (that && that->m_resource == resource)
                that->m_resource = nullptr;
        }
        delete resource;
    }


    void wp_color_management_surface_feedback_v1::globalRemove()
    {
        if (!m_global || m_globalRemovedEvent)
            return;

        wl_global_remove(m_global);

        struct wl_event_loop *event_loop = wl_display_get_event_loop(m_display);
        m_globalRemovedEvent = wl_event_loop_add_timer(event_loop, deferred_destroy_global_func, this);
        wl_event_source_timer_update(m_globalRemovedEvent, 300000);
    }

    wp_color_management_surface_feedback_v1::Resource *wp_color_management_surface_feedback_v1::bind(struct ::wl_client *client, uint32_t id, int version)
    {
        Q_ASSERT_X(!wl_client_get_object(client, id), "QWaylandObject bind", QStringLiteral("binding to object %1 more than once").arg(id).toLocal8Bit().constData());
        struct ::wl_resource *handle = wl_resource_create(client, &::wp_color_management_surface_feedback_v1_interface, version, id);
        return bind(handle);
    }

    wp_color_management_surface_feedback_v1::Resource *wp_color_management_surface_feedback_v1::bind(struct ::wl_resource *handle)
    {
        Resource *resource = wp_color_management_surface_feedback_v1_allocate();
        resource->wp_color_management_surface_feedback_v1_object = this;

        wl_resource_set_implementation(handle, &m_wp_color_management_surface_feedback_v1_interface, resource, destroy_func);
        resource->handle = handle;
        wp_color_management_surface_feedback_v1_bind_resource(resource);
        return resource;
    }
    wp_color_management_surface_feedback_v1::Resource *wp_color_management_surface_feedback_v1::Resource::fromResource(struct ::wl_resource *resource)
    {
        if (Q_UNLIKELY(!resource))
            return nullptr;
        if (wl_resource_instance_of(resource, &::wp_color_management_surface_feedback_v1_interface, &m_wp_color_management_surface_feedback_v1_interface))
            return static_cast<Resource *>(wl_resource_get_user_data(resource));
        return nullptr;
    }

    const struct ::wp_color_management_surface_feedback_v1_interface wp_color_management_surface_feedback_v1::m_wp_color_management_surface_feedback_v1_interface = {
        wp_color_management_surface_feedback_v1::handle_destroy,
        wp_color_management_surface_feedback_v1::handle_get_preferred,
        wp_color_management_surface_feedback_v1::handle_get_preferred_parametric
    };

    void wp_color_management_surface_feedback_v1::wp_color_management_surface_feedback_v1_destroy(Resource *)
    {
    }

    void wp_color_management_surface_feedback_v1::wp_color_management_surface_feedback_v1_get_preferred(Resource *, uint32_t)
    {
    }

    void wp_color_management_surface_feedback_v1::wp_color_management_surface_feedback_v1_get_preferred_parametric(Resource *, uint32_t)
    {
    }


    void wp_color_management_surface_feedback_v1::handle_destroy(
        ::wl_client *client,
        struct wl_resource *resource)
    {
        Q_UNUSED(client);
        Resource *qtResource = Resource::fromResource(resource);
        if (Q_UNLIKELY(!qtResource->wp_color_management_surface_feedback_v1_object)) {
            wl_resource_destroy(resource);
            return;
        }
        static_cast<wp_color_management_surface_feedback_v1 *>(qtResource->wp_color_management_surface_feedback_v1_object)->wp_color_management_surface_feedback_v1_destroy(
            qtResource);
    }

    void wp_color_management_surface_feedback_v1::handle_get_preferred(
        ::wl_client *client,
        struct wl_resource *resource,
        uint32_t image_description)
    {
        Q_UNUSED(client);
        Resource *qtResource = Resource::fromResource(resource);
        if (Q_UNLIKELY(!qtResource->wp_color_management_surface_feedback_v1_object)) {
            return;
        }
        static_cast<wp_color_management_surface_feedback_v1 *>(qtResource->wp_color_management_surface_feedback_v1_object)->wp_color_management_surface_feedback_v1_get_preferred(
            qtResource,
            image_description);
    }

    void wp_color_management_surface_feedback_v1::handle_get_preferred_parametric(
        ::wl_client *client,
        struct wl_resource *resource,
        uint32_t image_description)
    {
        Q_UNUSED(client);
        Resource *qtResource = Resource::fromResource(resource);
        if (Q_UNLIKELY(!qtResource->wp_color_management_surface_feedback_v1_object)) {
            return;
        }
        static_cast<wp_color_management_surface_feedback_v1 *>(qtResource->wp_color_management_surface_feedback_v1_object)->wp_color_management_surface_feedback_v1_get_preferred_parametric(
            qtResource,
            image_description);
    }

    void wp_color_management_surface_feedback_v1::send_preferred_changed(uint32_t identity)
    {
        Q_ASSERT_X(m_resource, "wp_color_management_surface_feedback_v1::preferred_changed", "Uninitialised resource");
        if (Q_UNLIKELY(!m_resource)) {
            qWarning("could not call wp_color_management_surface_feedback_v1::preferred_changed as it's not initialised");
            return;
        }
        send_preferred_changed(
            m_resource->handle,
            identity);
    }

    void wp_color_management_surface_feedback_v1::send_preferred_changed(struct ::wl_resource *resource, uint32_t identity)
    {
        wp_color_management_surface_feedback_v1_send_preferred_changed(
            resource,
            identity);
    }


    void wp_color_management_surface_feedback_v1::send_preferred_changed2(uint32_t identity_hi, uint32_t identity_lo)
    {
        Q_ASSERT_X(m_resource, "wp_color_management_surface_feedback_v1::preferred_changed2", "Uninitialised resource");
        if (Q_UNLIKELY(!m_resource)) {
            qWarning("could not call wp_color_management_surface_feedback_v1::preferred_changed2 as it's not initialised");
            return;
        }
        send_preferred_changed2(
            m_resource->handle,
            identity_hi,
            identity_lo);
    }

    void wp_color_management_surface_feedback_v1::send_preferred_changed2(struct ::wl_resource *resource, uint32_t identity_hi, uint32_t identity_lo)
    {
        wp_color_management_surface_feedback_v1_send_preferred_changed2(
            resource,
            identity_hi,
            identity_lo);
    }



    int wp_image_description_creator_icc_v1::deferred_destroy_global_func(void *data) {
        auto object = static_cast<wp_image_description_creator_icc_v1 *>(data);
        wl_global_destroy(object->m_global);
        object->m_global = nullptr;
        wl_event_source_remove(object->m_globalRemovedEvent);
        object->m_globalRemovedEvent = nullptr;
        wl_list_remove(&object->m_displayDestroyedListener.link);
        object->wp_image_description_creator_icc_v1_destroy_global();
        return 0;
    }

    wp_image_description_creator_icc_v1::wp_image_description_creator_icc_v1(struct ::wl_client *client, int id, int version)
        : m_resource_map()
        , m_resource(nullptr)
        , m_global(nullptr)
        , m_display(nullptr)
        , m_globalRemovedEvent(nullptr)
    {
        init(client, id, version);
    }

    wp_image_description_creator_icc_v1::wp_image_description_creator_icc_v1(struct ::wl_display *display, int version)
        : m_resource_map()
        , m_resource(nullptr)
        , m_global(nullptr)
        , m_display(nullptr)
        , m_globalRemovedEvent(nullptr)
    {
        init(display, version);
    }

    wp_image_description_creator_icc_v1::wp_image_description_creator_icc_v1(struct ::wl_resource *resource)
        : m_resource_map()
        , m_resource(nullptr)
        , m_global(nullptr)
        , m_display(nullptr)
        , m_globalRemovedEvent(nullptr)
    {
        init(resource);
    }

    wp_image_description_creator_icc_v1::wp_image_description_creator_icc_v1()
        : m_resource_map()
        , m_resource(nullptr)
        , m_global(nullptr)
        , m_display(nullptr)
        , m_globalRemovedEvent(nullptr)
    {
    }

    wp_image_description_creator_icc_v1::~wp_image_description_creator_icc_v1()
    {
        for (auto resource : std::as_const(m_resource_map))
            resource->wp_image_description_creator_icc_v1_object = nullptr;

        if (m_resource)
            m_resource->wp_image_description_creator_icc_v1_object = nullptr;

        if (m_global) {
            if (m_globalRemovedEvent)
                wl_event_source_remove(m_globalRemovedEvent);
            wl_global_destroy(m_global);
            wl_list_remove(&m_displayDestroyedListener.link);
        }
    }

    void wp_image_description_creator_icc_v1::init(struct ::wl_client *client, int id, int version)
    {
        m_resource = bind(client, id, version);
    }

    void wp_image_description_creator_icc_v1::init(struct ::wl_resource *resource)
    {
        m_resource = bind(resource);
    }

    wp_image_description_creator_icc_v1::Resource *wp_image_description_creator_icc_v1::add(struct ::wl_client *client, int version)
    {
        Resource *resource = bind(client, 0, version);
        m_resource_map.insert(client, resource);
        return resource;
    }

    wp_image_description_creator_icc_v1::Resource *wp_image_description_creator_icc_v1::add(struct ::wl_client *client, int id, int version)
    {
        Resource *resource = bind(client, id, version);
        m_resource_map.insert(client, resource);
        return resource;
    }

    wp_image_description_creator_icc_v1::Resource *wp_image_description_creator_icc_v1::add(struct ::wl_resource *resource)
    {
        return *m_resource_map.insert(wl_resource_get_client(resource), bind(resource));
    }

    void wp_image_description_creator_icc_v1::init(struct ::wl_display *display, int version)
    {
        m_display = display;
        m_global = wl_global_create(display, &::wp_image_description_creator_icc_v1_interface, version, this, bind_func);
        m_displayDestroyedListener.notify = wp_image_description_creator_icc_v1::display_destroy_func;
        m_displayDestroyedListener.parent = this;
        wl_display_add_destroy_listener(display, &m_displayDestroyedListener);
    }

    const struct wl_interface *wp_image_description_creator_icc_v1::interface()
    {
        return &::wp_image_description_creator_icc_v1_interface;
    }

    wp_image_description_creator_icc_v1::Resource *wp_image_description_creator_icc_v1::wp_image_description_creator_icc_v1_allocate()
    {
        return new Resource;
    }

    void wp_image_description_creator_icc_v1::wp_image_description_creator_icc_v1_destroy_global()
    {
    }

    void wp_image_description_creator_icc_v1::wp_image_description_creator_icc_v1_bind_resource(Resource *)
    {
    }

    void wp_image_description_creator_icc_v1::wp_image_description_creator_icc_v1_destroy_resource(Resource *)
    {
    }

    void wp_image_description_creator_icc_v1::bind_func(struct ::wl_client *client, void *data, uint32_t version, uint32_t id)
    {
        wp_image_description_creator_icc_v1 *that = static_cast<wp_image_description_creator_icc_v1 *>(data);
        that->add(client, id, version);
    }

    void wp_image_description_creator_icc_v1::display_destroy_func(struct ::wl_listener *listener, void *data)
    {
        Q_UNUSED(data);
        wp_image_description_creator_icc_v1 *that = static_cast<wp_image_description_creator_icc_v1::DisplayDestroyedListener *>(listener)->parent;
        that->m_global = nullptr;
        that->m_globalRemovedEvent = nullptr;
    }

    void wp_image_description_creator_icc_v1::destroy_func(struct ::wl_resource *client_resource)
    {
        Resource *resource = Resource::fromResource(client_resource);
        Q_ASSERT(resource);
        wp_image_description_creator_icc_v1 *that = resource->wp_image_description_creator_icc_v1_object;
        if (Q_LIKELY(that)) {
            that->m_resource_map.remove(resource->client(), resource);
            that->wp_image_description_creator_icc_v1_destroy_resource(resource);

            that = resource->wp_image_description_creator_icc_v1_object;
            if (that && that->m_resource == resource)
                that->m_resource = nullptr;
        }
        delete resource;
    }


    void wp_image_description_creator_icc_v1::globalRemove()
    {
        if (!m_global || m_globalRemovedEvent)
            return;

        wl_global_remove(m_global);

        struct wl_event_loop *event_loop = wl_display_get_event_loop(m_display);
        m_globalRemovedEvent = wl_event_loop_add_timer(event_loop, deferred_destroy_global_func, this);
        wl_event_source_timer_update(m_globalRemovedEvent, 300000);
    }

    wp_image_description_creator_icc_v1::Resource *wp_image_description_creator_icc_v1::bind(struct ::wl_client *client, uint32_t id, int version)
    {
        Q_ASSERT_X(!wl_client_get_object(client, id), "QWaylandObject bind", QStringLiteral("binding to object %1 more than once").arg(id).toLocal8Bit().constData());
        struct ::wl_resource *handle = wl_resource_create(client, &::wp_image_description_creator_icc_v1_interface, version, id);
        return bind(handle);
    }

    wp_image_description_creator_icc_v1::Resource *wp_image_description_creator_icc_v1::bind(struct ::wl_resource *handle)
    {
        Resource *resource = wp_image_description_creator_icc_v1_allocate();
        resource->wp_image_description_creator_icc_v1_object = this;

        wl_resource_set_implementation(handle, &m_wp_image_description_creator_icc_v1_interface, resource, destroy_func);
        resource->handle = handle;
        wp_image_description_creator_icc_v1_bind_resource(resource);
        return resource;
    }
    wp_image_description_creator_icc_v1::Resource *wp_image_description_creator_icc_v1::Resource::fromResource(struct ::wl_resource *resource)
    {
        if (Q_UNLIKELY(!resource))
            return nullptr;
        if (wl_resource_instance_of(resource, &::wp_image_description_creator_icc_v1_interface, &m_wp_image_description_creator_icc_v1_interface))
            return static_cast<Resource *>(wl_resource_get_user_data(resource));
        return nullptr;
    }

    const struct ::wp_image_description_creator_icc_v1_interface wp_image_description_creator_icc_v1::m_wp_image_description_creator_icc_v1_interface = {
        wp_image_description_creator_icc_v1::handle_create,
        wp_image_description_creator_icc_v1::handle_set_icc_file
    };

    void wp_image_description_creator_icc_v1::wp_image_description_creator_icc_v1_create(Resource *, uint32_t)
    {
    }

    void wp_image_description_creator_icc_v1::wp_image_description_creator_icc_v1_set_icc_file(Resource *, int32_t , uint32_t , uint32_t )
    {
    }


    void wp_image_description_creator_icc_v1::handle_create(
        ::wl_client *client,
        struct wl_resource *resource,
        uint32_t image_description)
    {
        Q_UNUSED(client);
        Resource *qtResource = Resource::fromResource(resource);
        if (Q_UNLIKELY(!qtResource->wp_image_description_creator_icc_v1_object)) {
            wl_resource_destroy(resource);
            return;
        }
        static_cast<wp_image_description_creator_icc_v1 *>(qtResource->wp_image_description_creator_icc_v1_object)->wp_image_description_creator_icc_v1_create(
            qtResource,
            image_description);
    }

    void wp_image_description_creator_icc_v1::handle_set_icc_file(
        ::wl_client *client,
        struct wl_resource *resource,
        int32_t icc_profile,
        uint32_t offset,
        uint32_t length)
    {
        Q_UNUSED(client);
        Resource *qtResource = Resource::fromResource(resource);
        if (Q_UNLIKELY(!qtResource->wp_image_description_creator_icc_v1_object)) {
        close(icc_profile);
            return;
        }
        static_cast<wp_image_description_creator_icc_v1 *>(qtResource->wp_image_description_creator_icc_v1_object)->wp_image_description_creator_icc_v1_set_icc_file(
            qtResource,
            icc_profile,
            offset,
            length);
    }


    int wp_image_description_creator_params_v1::deferred_destroy_global_func(void *data) {
        auto object = static_cast<wp_image_description_creator_params_v1 *>(data);
        wl_global_destroy(object->m_global);
        object->m_global = nullptr;
        wl_event_source_remove(object->m_globalRemovedEvent);
        object->m_globalRemovedEvent = nullptr;
        wl_list_remove(&object->m_displayDestroyedListener.link);
        object->wp_image_description_creator_params_v1_destroy_global();
        return 0;
    }

    wp_image_description_creator_params_v1::wp_image_description_creator_params_v1(struct ::wl_client *client, int id, int version)
        : m_resource_map()
        , m_resource(nullptr)
        , m_global(nullptr)
        , m_display(nullptr)
        , m_globalRemovedEvent(nullptr)
    {
        init(client, id, version);
    }

    wp_image_description_creator_params_v1::wp_image_description_creator_params_v1(struct ::wl_display *display, int version)
        : m_resource_map()
        , m_resource(nullptr)
        , m_global(nullptr)
        , m_display(nullptr)
        , m_globalRemovedEvent(nullptr)
    {
        init(display, version);
    }

    wp_image_description_creator_params_v1::wp_image_description_creator_params_v1(struct ::wl_resource *resource)
        : m_resource_map()
        , m_resource(nullptr)
        , m_global(nullptr)
        , m_display(nullptr)
        , m_globalRemovedEvent(nullptr)
    {
        init(resource);
    }

    wp_image_description_creator_params_v1::wp_image_description_creator_params_v1()
        : m_resource_map()
        , m_resource(nullptr)
        , m_global(nullptr)
        , m_display(nullptr)
        , m_globalRemovedEvent(nullptr)
    {
    }

    wp_image_description_creator_params_v1::~wp_image_description_creator_params_v1()
    {
        for (auto resource : std::as_const(m_resource_map))
            resource->wp_image_description_creator_params_v1_object = nullptr;

        if (m_resource)
            m_resource->wp_image_description_creator_params_v1_object = nullptr;

        if (m_global) {
            if (m_globalRemovedEvent)
                wl_event_source_remove(m_globalRemovedEvent);
            wl_global_destroy(m_global);
            wl_list_remove(&m_displayDestroyedListener.link);
        }
    }

    void wp_image_description_creator_params_v1::init(struct ::wl_client *client, int id, int version)
    {
        m_resource = bind(client, id, version);
    }

    void wp_image_description_creator_params_v1::init(struct ::wl_resource *resource)
    {
        m_resource = bind(resource);
    }

    wp_image_description_creator_params_v1::Resource *wp_image_description_creator_params_v1::add(struct ::wl_client *client, int version)
    {
        Resource *resource = bind(client, 0, version);
        m_resource_map.insert(client, resource);
        return resource;
    }

    wp_image_description_creator_params_v1::Resource *wp_image_description_creator_params_v1::add(struct ::wl_client *client, int id, int version)
    {
        Resource *resource = bind(client, id, version);
        m_resource_map.insert(client, resource);
        return resource;
    }

    wp_image_description_creator_params_v1::Resource *wp_image_description_creator_params_v1::add(struct ::wl_resource *resource)
    {
        return *m_resource_map.insert(wl_resource_get_client(resource), bind(resource));
    }

    void wp_image_description_creator_params_v1::init(struct ::wl_display *display, int version)
    {
        m_display = display;
        m_global = wl_global_create(display, &::wp_image_description_creator_params_v1_interface, version, this, bind_func);
        m_displayDestroyedListener.notify = wp_image_description_creator_params_v1::display_destroy_func;
        m_displayDestroyedListener.parent = this;
        wl_display_add_destroy_listener(display, &m_displayDestroyedListener);
    }

    const struct wl_interface *wp_image_description_creator_params_v1::interface()
    {
        return &::wp_image_description_creator_params_v1_interface;
    }

    wp_image_description_creator_params_v1::Resource *wp_image_description_creator_params_v1::wp_image_description_creator_params_v1_allocate()
    {
        return new Resource;
    }

    void wp_image_description_creator_params_v1::wp_image_description_creator_params_v1_destroy_global()
    {
    }

    void wp_image_description_creator_params_v1::wp_image_description_creator_params_v1_bind_resource(Resource *)
    {
    }

    void wp_image_description_creator_params_v1::wp_image_description_creator_params_v1_destroy_resource(Resource *)
    {
    }

    void wp_image_description_creator_params_v1::bind_func(struct ::wl_client *client, void *data, uint32_t version, uint32_t id)
    {
        wp_image_description_creator_params_v1 *that = static_cast<wp_image_description_creator_params_v1 *>(data);
        that->add(client, id, version);
    }

    void wp_image_description_creator_params_v1::display_destroy_func(struct ::wl_listener *listener, void *data)
    {
        Q_UNUSED(data);
        wp_image_description_creator_params_v1 *that = static_cast<wp_image_description_creator_params_v1::DisplayDestroyedListener *>(listener)->parent;
        that->m_global = nullptr;
        that->m_globalRemovedEvent = nullptr;
    }

    void wp_image_description_creator_params_v1::destroy_func(struct ::wl_resource *client_resource)
    {
        Resource *resource = Resource::fromResource(client_resource);
        Q_ASSERT(resource);
        wp_image_description_creator_params_v1 *that = resource->wp_image_description_creator_params_v1_object;
        if (Q_LIKELY(that)) {
            that->m_resource_map.remove(resource->client(), resource);
            that->wp_image_description_creator_params_v1_destroy_resource(resource);

            that = resource->wp_image_description_creator_params_v1_object;
            if (that && that->m_resource == resource)
                that->m_resource = nullptr;
        }
        delete resource;
    }


    void wp_image_description_creator_params_v1::globalRemove()
    {
        if (!m_global || m_globalRemovedEvent)
            return;

        wl_global_remove(m_global);

        struct wl_event_loop *event_loop = wl_display_get_event_loop(m_display);
        m_globalRemovedEvent = wl_event_loop_add_timer(event_loop, deferred_destroy_global_func, this);
        wl_event_source_timer_update(m_globalRemovedEvent, 300000);
    }

    wp_image_description_creator_params_v1::Resource *wp_image_description_creator_params_v1::bind(struct ::wl_client *client, uint32_t id, int version)
    {
        Q_ASSERT_X(!wl_client_get_object(client, id), "QWaylandObject bind", QStringLiteral("binding to object %1 more than once").arg(id).toLocal8Bit().constData());
        struct ::wl_resource *handle = wl_resource_create(client, &::wp_image_description_creator_params_v1_interface, version, id);
        return bind(handle);
    }

    wp_image_description_creator_params_v1::Resource *wp_image_description_creator_params_v1::bind(struct ::wl_resource *handle)
    {
        Resource *resource = wp_image_description_creator_params_v1_allocate();
        resource->wp_image_description_creator_params_v1_object = this;

        wl_resource_set_implementation(handle, &m_wp_image_description_creator_params_v1_interface, resource, destroy_func);
        resource->handle = handle;
        wp_image_description_creator_params_v1_bind_resource(resource);
        return resource;
    }
    wp_image_description_creator_params_v1::Resource *wp_image_description_creator_params_v1::Resource::fromResource(struct ::wl_resource *resource)
    {
        if (Q_UNLIKELY(!resource))
            return nullptr;
        if (wl_resource_instance_of(resource, &::wp_image_description_creator_params_v1_interface, &m_wp_image_description_creator_params_v1_interface))
            return static_cast<Resource *>(wl_resource_get_user_data(resource));
        return nullptr;
    }

    const struct ::wp_image_description_creator_params_v1_interface wp_image_description_creator_params_v1::m_wp_image_description_creator_params_v1_interface = {
        wp_image_description_creator_params_v1::handle_create,
        wp_image_description_creator_params_v1::handle_set_tf_named,
        wp_image_description_creator_params_v1::handle_set_tf_power,
        wp_image_description_creator_params_v1::handle_set_primaries_named,
        wp_image_description_creator_params_v1::handle_set_primaries,
        wp_image_description_creator_params_v1::handle_set_luminances,
        wp_image_description_creator_params_v1::handle_set_mastering_display_primaries,
        wp_image_description_creator_params_v1::handle_set_mastering_luminance,
        wp_image_description_creator_params_v1::handle_set_max_cll,
        wp_image_description_creator_params_v1::handle_set_max_fall
    };

    void wp_image_description_creator_params_v1::wp_image_description_creator_params_v1_create(Resource *, uint32_t)
    {
    }

    void wp_image_description_creator_params_v1::wp_image_description_creator_params_v1_set_tf_named(Resource *, uint32_t )
    {
    }

    void wp_image_description_creator_params_v1::wp_image_description_creator_params_v1_set_tf_power(Resource *, uint32_t )
    {
    }

    void wp_image_description_creator_params_v1::wp_image_description_creator_params_v1_set_primaries_named(Resource *, uint32_t )
    {
    }

    void wp_image_description_creator_params_v1::wp_image_description_creator_params_v1_set_primaries(Resource *, int32_t , int32_t , int32_t , int32_t , int32_t , int32_t , int32_t , int32_t )
    {
    }

    void wp_image_description_creator_params_v1::wp_image_description_creator_params_v1_set_luminances(Resource *, uint32_t , uint32_t , uint32_t )
    {
    }

    void wp_image_description_creator_params_v1::wp_image_description_creator_params_v1_set_mastering_display_primaries(Resource *, int32_t , int32_t , int32_t , int32_t , int32_t , int32_t , int32_t , int32_t )
    {
    }

    void wp_image_description_creator_params_v1::wp_image_description_creator_params_v1_set_mastering_luminance(Resource *, uint32_t , uint32_t )
    {
    }

    void wp_image_description_creator_params_v1::wp_image_description_creator_params_v1_set_max_cll(Resource *, uint32_t )
    {
    }

    void wp_image_description_creator_params_v1::wp_image_description_creator_params_v1_set_max_fall(Resource *, uint32_t )
    {
    }


    void wp_image_description_creator_params_v1::handle_create(
        ::wl_client *client,
        struct wl_resource *resource,
        uint32_t image_description)
    {
        Q_UNUSED(client);
        Resource *qtResource = Resource::fromResource(resource);
        if (Q_UNLIKELY(!qtResource->wp_image_description_creator_params_v1_object)) {
            wl_resource_destroy(resource);
            return;
        }
        static_cast<wp_image_description_creator_params_v1 *>(qtResource->wp_image_description_creator_params_v1_object)->wp_image_description_creator_params_v1_create(
            qtResource,
            image_description);
    }

    void wp_image_description_creator_params_v1::handle_set_tf_named(
        ::wl_client *client,
        struct wl_resource *resource,
        uint32_t tf)
    {
        Q_UNUSED(client);
        Resource *qtResource = Resource::fromResource(resource);
        if (Q_UNLIKELY(!qtResource->wp_image_description_creator_params_v1_object)) {
            return;
        }
        static_cast<wp_image_description_creator_params_v1 *>(qtResource->wp_image_description_creator_params_v1_object)->wp_image_description_creator_params_v1_set_tf_named(
            qtResource,
            tf);
    }

    void wp_image_description_creator_params_v1::handle_set_tf_power(
        ::wl_client *client,
        struct wl_resource *resource,
        uint32_t eexp)
    {
        Q_UNUSED(client);
        Resource *qtResource = Resource::fromResource(resource);
        if (Q_UNLIKELY(!qtResource->wp_image_description_creator_params_v1_object)) {
            return;
        }
        static_cast<wp_image_description_creator_params_v1 *>(qtResource->wp_image_description_creator_params_v1_object)->wp_image_description_creator_params_v1_set_tf_power(
            qtResource,
            eexp);
    }

    void wp_image_description_creator_params_v1::handle_set_primaries_named(
        ::wl_client *client,
        struct wl_resource *resource,
        uint32_t primaries)
    {
        Q_UNUSED(client);
        Resource *qtResource = Resource::fromResource(resource);
        if (Q_UNLIKELY(!qtResource->wp_image_description_creator_params_v1_object)) {
            return;
        }
        static_cast<wp_image_description_creator_params_v1 *>(qtResource->wp_image_description_creator_params_v1_object)->wp_image_description_creator_params_v1_set_primaries_named(
            qtResource,
            primaries);
    }

    void wp_image_description_creator_params_v1::handle_set_primaries(
        ::wl_client *client,
        struct wl_resource *resource,
        int32_t r_x,
        int32_t r_y,
        int32_t g_x,
        int32_t g_y,
        int32_t b_x,
        int32_t b_y,
        int32_t w_x,
        int32_t w_y)
    {
        Q_UNUSED(client);
        Resource *qtResource = Resource::fromResource(resource);
        if (Q_UNLIKELY(!qtResource->wp_image_description_creator_params_v1_object)) {
            return;
        }
        static_cast<wp_image_description_creator_params_v1 *>(qtResource->wp_image_description_creator_params_v1_object)->wp_image_description_creator_params_v1_set_primaries(
            qtResource,
            r_x,
            r_y,
            g_x,
            g_y,
            b_x,
            b_y,
            w_x,
            w_y);
    }

    void wp_image_description_creator_params_v1::handle_set_luminances(
        ::wl_client *client,
        struct wl_resource *resource,
        uint32_t min_lum,
        uint32_t max_lum,
        uint32_t reference_lum)
    {
        Q_UNUSED(client);
        Resource *qtResource = Resource::fromResource(resource);
        if (Q_UNLIKELY(!qtResource->wp_image_description_creator_params_v1_object)) {
            return;
        }
        static_cast<wp_image_description_creator_params_v1 *>(qtResource->wp_image_description_creator_params_v1_object)->wp_image_description_creator_params_v1_set_luminances(
            qtResource,
            min_lum,
            max_lum,
            reference_lum);
    }

    void wp_image_description_creator_params_v1::handle_set_mastering_display_primaries(
        ::wl_client *client,
        struct wl_resource *resource,
        int32_t r_x,
        int32_t r_y,
        int32_t g_x,
        int32_t g_y,
        int32_t b_x,
        int32_t b_y,
        int32_t w_x,
        int32_t w_y)
    {
        Q_UNUSED(client);
        Resource *qtResource = Resource::fromResource(resource);
        if (Q_UNLIKELY(!qtResource->wp_image_description_creator_params_v1_object)) {
            return;
        }
        static_cast<wp_image_description_creator_params_v1 *>(qtResource->wp_image_description_creator_params_v1_object)->wp_image_description_creator_params_v1_set_mastering_display_primaries(
            qtResource,
            r_x,
            r_y,
            g_x,
            g_y,
            b_x,
            b_y,
            w_x,
            w_y);
    }

    void wp_image_description_creator_params_v1::handle_set_mastering_luminance(
        ::wl_client *client,
        struct wl_resource *resource,
        uint32_t min_lum,
        uint32_t max_lum)
    {
        Q_UNUSED(client);
        Resource *qtResource = Resource::fromResource(resource);
        if (Q_UNLIKELY(!qtResource->wp_image_description_creator_params_v1_object)) {
            return;
        }
        static_cast<wp_image_description_creator_params_v1 *>(qtResource->wp_image_description_creator_params_v1_object)->wp_image_description_creator_params_v1_set_mastering_luminance(
            qtResource,
            min_lum,
            max_lum);
    }

    void wp_image_description_creator_params_v1::handle_set_max_cll(
        ::wl_client *client,
        struct wl_resource *resource,
        uint32_t max_cll)
    {
        Q_UNUSED(client);
        Resource *qtResource = Resource::fromResource(resource);
        if (Q_UNLIKELY(!qtResource->wp_image_description_creator_params_v1_object)) {
            return;
        }
        static_cast<wp_image_description_creator_params_v1 *>(qtResource->wp_image_description_creator_params_v1_object)->wp_image_description_creator_params_v1_set_max_cll(
            qtResource,
            max_cll);
    }

    void wp_image_description_creator_params_v1::handle_set_max_fall(
        ::wl_client *client,
        struct wl_resource *resource,
        uint32_t max_fall)
    {
        Q_UNUSED(client);
        Resource *qtResource = Resource::fromResource(resource);
        if (Q_UNLIKELY(!qtResource->wp_image_description_creator_params_v1_object)) {
            return;
        }
        static_cast<wp_image_description_creator_params_v1 *>(qtResource->wp_image_description_creator_params_v1_object)->wp_image_description_creator_params_v1_set_max_fall(
            qtResource,
            max_fall);
    }


    int wp_image_description_v1::deferred_destroy_global_func(void *data) {
        auto object = static_cast<wp_image_description_v1 *>(data);
        wl_global_destroy(object->m_global);
        object->m_global = nullptr;
        wl_event_source_remove(object->m_globalRemovedEvent);
        object->m_globalRemovedEvent = nullptr;
        wl_list_remove(&object->m_displayDestroyedListener.link);
        object->wp_image_description_v1_destroy_global();
        return 0;
    }

    wp_image_description_v1::wp_image_description_v1(struct ::wl_client *client, int id, int version)
        : m_resource_map()
        , m_resource(nullptr)
        , m_global(nullptr)
        , m_display(nullptr)
        , m_globalRemovedEvent(nullptr)
    {
        init(client, id, version);
    }

    wp_image_description_v1::wp_image_description_v1(struct ::wl_display *display, int version)
        : m_resource_map()
        , m_resource(nullptr)
        , m_global(nullptr)
        , m_display(nullptr)
        , m_globalRemovedEvent(nullptr)
    {
        init(display, version);
    }

    wp_image_description_v1::wp_image_description_v1(struct ::wl_resource *resource)
        : m_resource_map()
        , m_resource(nullptr)
        , m_global(nullptr)
        , m_display(nullptr)
        , m_globalRemovedEvent(nullptr)
    {
        init(resource);
    }

    wp_image_description_v1::wp_image_description_v1()
        : m_resource_map()
        , m_resource(nullptr)
        , m_global(nullptr)
        , m_display(nullptr)
        , m_globalRemovedEvent(nullptr)
    {
    }

    wp_image_description_v1::~wp_image_description_v1()
    {
        for (auto resource : std::as_const(m_resource_map))
            resource->wp_image_description_v1_object = nullptr;

        if (m_resource)
            m_resource->wp_image_description_v1_object = nullptr;

        if (m_global) {
            if (m_globalRemovedEvent)
                wl_event_source_remove(m_globalRemovedEvent);
            wl_global_destroy(m_global);
            wl_list_remove(&m_displayDestroyedListener.link);
        }
    }

    void wp_image_description_v1::init(struct ::wl_client *client, int id, int version)
    {
        m_resource = bind(client, id, version);
    }

    void wp_image_description_v1::init(struct ::wl_resource *resource)
    {
        m_resource = bind(resource);
    }

    wp_image_description_v1::Resource *wp_image_description_v1::add(struct ::wl_client *client, int version)
    {
        Resource *resource = bind(client, 0, version);
        m_resource_map.insert(client, resource);
        return resource;
    }

    wp_image_description_v1::Resource *wp_image_description_v1::add(struct ::wl_client *client, int id, int version)
    {
        Resource *resource = bind(client, id, version);
        m_resource_map.insert(client, resource);
        return resource;
    }

    wp_image_description_v1::Resource *wp_image_description_v1::add(struct ::wl_resource *resource)
    {
        return *m_resource_map.insert(wl_resource_get_client(resource), bind(resource));
    }

    void wp_image_description_v1::init(struct ::wl_display *display, int version)
    {
        m_display = display;
        m_global = wl_global_create(display, &::wp_image_description_v1_interface, version, this, bind_func);
        m_displayDestroyedListener.notify = wp_image_description_v1::display_destroy_func;
        m_displayDestroyedListener.parent = this;
        wl_display_add_destroy_listener(display, &m_displayDestroyedListener);
    }

    const struct wl_interface *wp_image_description_v1::interface()
    {
        return &::wp_image_description_v1_interface;
    }

    wp_image_description_v1::Resource *wp_image_description_v1::wp_image_description_v1_allocate()
    {
        return new Resource;
    }

    void wp_image_description_v1::wp_image_description_v1_destroy_global()
    {
    }

    void wp_image_description_v1::wp_image_description_v1_bind_resource(Resource *)
    {
    }

    void wp_image_description_v1::wp_image_description_v1_destroy_resource(Resource *)
    {
    }

    void wp_image_description_v1::bind_func(struct ::wl_client *client, void *data, uint32_t version, uint32_t id)
    {
        wp_image_description_v1 *that = static_cast<wp_image_description_v1 *>(data);
        that->add(client, id, version);
    }

    void wp_image_description_v1::display_destroy_func(struct ::wl_listener *listener, void *data)
    {
        Q_UNUSED(data);
        wp_image_description_v1 *that = static_cast<wp_image_description_v1::DisplayDestroyedListener *>(listener)->parent;
        that->m_global = nullptr;
        that->m_globalRemovedEvent = nullptr;
    }

    void wp_image_description_v1::destroy_func(struct ::wl_resource *client_resource)
    {
        Resource *resource = Resource::fromResource(client_resource);
        Q_ASSERT(resource);
        wp_image_description_v1 *that = resource->wp_image_description_v1_object;
        if (Q_LIKELY(that)) {
            that->m_resource_map.remove(resource->client(), resource);
            that->wp_image_description_v1_destroy_resource(resource);

            that = resource->wp_image_description_v1_object;
            if (that && that->m_resource == resource)
                that->m_resource = nullptr;
        }
        delete resource;
    }


    void wp_image_description_v1::globalRemove()
    {
        if (!m_global || m_globalRemovedEvent)
            return;

        wl_global_remove(m_global);

        struct wl_event_loop *event_loop = wl_display_get_event_loop(m_display);
        m_globalRemovedEvent = wl_event_loop_add_timer(event_loop, deferred_destroy_global_func, this);
        wl_event_source_timer_update(m_globalRemovedEvent, 300000);
    }

    wp_image_description_v1::Resource *wp_image_description_v1::bind(struct ::wl_client *client, uint32_t id, int version)
    {
        Q_ASSERT_X(!wl_client_get_object(client, id), "QWaylandObject bind", QStringLiteral("binding to object %1 more than once").arg(id).toLocal8Bit().constData());
        struct ::wl_resource *handle = wl_resource_create(client, &::wp_image_description_v1_interface, version, id);
        return bind(handle);
    }

    wp_image_description_v1::Resource *wp_image_description_v1::bind(struct ::wl_resource *handle)
    {
        Resource *resource = wp_image_description_v1_allocate();
        resource->wp_image_description_v1_object = this;

        wl_resource_set_implementation(handle, &m_wp_image_description_v1_interface, resource, destroy_func);
        resource->handle = handle;
        wp_image_description_v1_bind_resource(resource);
        return resource;
    }
    wp_image_description_v1::Resource *wp_image_description_v1::Resource::fromResource(struct ::wl_resource *resource)
    {
        if (Q_UNLIKELY(!resource))
            return nullptr;
        if (wl_resource_instance_of(resource, &::wp_image_description_v1_interface, &m_wp_image_description_v1_interface))
            return static_cast<Resource *>(wl_resource_get_user_data(resource));
        return nullptr;
    }

    const struct ::wp_image_description_v1_interface wp_image_description_v1::m_wp_image_description_v1_interface = {
        wp_image_description_v1::handle_destroy,
        wp_image_description_v1::handle_get_information
    };

    void wp_image_description_v1::wp_image_description_v1_destroy(Resource *)
    {
    }

    void wp_image_description_v1::wp_image_description_v1_get_information(Resource *, uint32_t)
    {
    }


    void wp_image_description_v1::handle_destroy(
        ::wl_client *client,
        struct wl_resource *resource)
    {
        Q_UNUSED(client);
        Resource *qtResource = Resource::fromResource(resource);
        if (Q_UNLIKELY(!qtResource->wp_image_description_v1_object)) {
            wl_resource_destroy(resource);
            return;
        }
        static_cast<wp_image_description_v1 *>(qtResource->wp_image_description_v1_object)->wp_image_description_v1_destroy(
            qtResource);
    }

    void wp_image_description_v1::handle_get_information(
        ::wl_client *client,
        struct wl_resource *resource,
        uint32_t information)
    {
        Q_UNUSED(client);
        Resource *qtResource = Resource::fromResource(resource);
        if (Q_UNLIKELY(!qtResource->wp_image_description_v1_object)) {
            return;
        }
        static_cast<wp_image_description_v1 *>(qtResource->wp_image_description_v1_object)->wp_image_description_v1_get_information(
            qtResource,
            information);
    }

    void wp_image_description_v1::send_failed(uint32_t cause, const QString &msg)
    {
        Q_ASSERT_X(m_resource, "wp_image_description_v1::failed", "Uninitialised resource");
        if (Q_UNLIKELY(!m_resource)) {
            qWarning("could not call wp_image_description_v1::failed as it's not initialised");
            return;
        }
        send_failed(
            m_resource->handle,
            cause,
            msg);
    }

    void wp_image_description_v1::send_failed(struct ::wl_resource *resource, uint32_t cause, const QString &msg)
    {
        wp_image_description_v1_send_failed(
            resource,
            cause,
            msg.toUtf8().constData());
    }


    void wp_image_description_v1::send_ready(uint32_t identity)
    {
        Q_ASSERT_X(m_resource, "wp_image_description_v1::ready", "Uninitialised resource");
        if (Q_UNLIKELY(!m_resource)) {
            qWarning("could not call wp_image_description_v1::ready as it's not initialised");
            return;
        }
        send_ready(
            m_resource->handle,
            identity);
    }

    void wp_image_description_v1::send_ready(struct ::wl_resource *resource, uint32_t identity)
    {
        wp_image_description_v1_send_ready(
            resource,
            identity);
    }


    void wp_image_description_v1::send_ready2(uint32_t identity_hi, uint32_t identity_lo)
    {
        Q_ASSERT_X(m_resource, "wp_image_description_v1::ready2", "Uninitialised resource");
        if (Q_UNLIKELY(!m_resource)) {
            qWarning("could not call wp_image_description_v1::ready2 as it's not initialised");
            return;
        }
        send_ready2(
            m_resource->handle,
            identity_hi,
            identity_lo);
    }

    void wp_image_description_v1::send_ready2(struct ::wl_resource *resource, uint32_t identity_hi, uint32_t identity_lo)
    {
        wp_image_description_v1_send_ready2(
            resource,
            identity_hi,
            identity_lo);
    }



    int wp_image_description_info_v1::deferred_destroy_global_func(void *data) {
        auto object = static_cast<wp_image_description_info_v1 *>(data);
        wl_global_destroy(object->m_global);
        object->m_global = nullptr;
        wl_event_source_remove(object->m_globalRemovedEvent);
        object->m_globalRemovedEvent = nullptr;
        wl_list_remove(&object->m_displayDestroyedListener.link);
        object->wp_image_description_info_v1_destroy_global();
        return 0;
    }

    wp_image_description_info_v1::wp_image_description_info_v1(struct ::wl_client *client, int id, int version)
        : m_resource_map()
        , m_resource(nullptr)
        , m_global(nullptr)
        , m_display(nullptr)
        , m_globalRemovedEvent(nullptr)
    {
        init(client, id, version);
    }

    wp_image_description_info_v1::wp_image_description_info_v1(struct ::wl_display *display, int version)
        : m_resource_map()
        , m_resource(nullptr)
        , m_global(nullptr)
        , m_display(nullptr)
        , m_globalRemovedEvent(nullptr)
    {
        init(display, version);
    }

    wp_image_description_info_v1::wp_image_description_info_v1(struct ::wl_resource *resource)
        : m_resource_map()
        , m_resource(nullptr)
        , m_global(nullptr)
        , m_display(nullptr)
        , m_globalRemovedEvent(nullptr)
    {
        init(resource);
    }

    wp_image_description_info_v1::wp_image_description_info_v1()
        : m_resource_map()
        , m_resource(nullptr)
        , m_global(nullptr)
        , m_display(nullptr)
        , m_globalRemovedEvent(nullptr)
    {
    }

    wp_image_description_info_v1::~wp_image_description_info_v1()
    {
        for (auto resource : std::as_const(m_resource_map))
            resource->wp_image_description_info_v1_object = nullptr;

        if (m_resource)
            m_resource->wp_image_description_info_v1_object = nullptr;

        if (m_global) {
            if (m_globalRemovedEvent)
                wl_event_source_remove(m_globalRemovedEvent);
            wl_global_destroy(m_global);
            wl_list_remove(&m_displayDestroyedListener.link);
        }
    }

    void wp_image_description_info_v1::init(struct ::wl_client *client, int id, int version)
    {
        m_resource = bind(client, id, version);
    }

    void wp_image_description_info_v1::init(struct ::wl_resource *resource)
    {
        m_resource = bind(resource);
    }

    wp_image_description_info_v1::Resource *wp_image_description_info_v1::add(struct ::wl_client *client, int version)
    {
        Resource *resource = bind(client, 0, version);
        m_resource_map.insert(client, resource);
        return resource;
    }

    wp_image_description_info_v1::Resource *wp_image_description_info_v1::add(struct ::wl_client *client, int id, int version)
    {
        Resource *resource = bind(client, id, version);
        m_resource_map.insert(client, resource);
        return resource;
    }

    wp_image_description_info_v1::Resource *wp_image_description_info_v1::add(struct ::wl_resource *resource)
    {
        return *m_resource_map.insert(wl_resource_get_client(resource), bind(resource));
    }

    void wp_image_description_info_v1::init(struct ::wl_display *display, int version)
    {
        m_display = display;
        m_global = wl_global_create(display, &::wp_image_description_info_v1_interface, version, this, bind_func);
        m_displayDestroyedListener.notify = wp_image_description_info_v1::display_destroy_func;
        m_displayDestroyedListener.parent = this;
        wl_display_add_destroy_listener(display, &m_displayDestroyedListener);
    }

    const struct wl_interface *wp_image_description_info_v1::interface()
    {
        return &::wp_image_description_info_v1_interface;
    }

    wp_image_description_info_v1::Resource *wp_image_description_info_v1::wp_image_description_info_v1_allocate()
    {
        return new Resource;
    }

    void wp_image_description_info_v1::wp_image_description_info_v1_destroy_global()
    {
    }

    void wp_image_description_info_v1::wp_image_description_info_v1_bind_resource(Resource *)
    {
    }

    void wp_image_description_info_v1::wp_image_description_info_v1_destroy_resource(Resource *)
    {
    }

    void wp_image_description_info_v1::bind_func(struct ::wl_client *client, void *data, uint32_t version, uint32_t id)
    {
        wp_image_description_info_v1 *that = static_cast<wp_image_description_info_v1 *>(data);
        that->add(client, id, version);
    }

    void wp_image_description_info_v1::display_destroy_func(struct ::wl_listener *listener, void *data)
    {
        Q_UNUSED(data);
        wp_image_description_info_v1 *that = static_cast<wp_image_description_info_v1::DisplayDestroyedListener *>(listener)->parent;
        that->m_global = nullptr;
        that->m_globalRemovedEvent = nullptr;
    }

    void wp_image_description_info_v1::destroy_func(struct ::wl_resource *client_resource)
    {
        Resource *resource = Resource::fromResource(client_resource);
        Q_ASSERT(resource);
        wp_image_description_info_v1 *that = resource->wp_image_description_info_v1_object;
        if (Q_LIKELY(that)) {
            that->m_resource_map.remove(resource->client(), resource);
            that->wp_image_description_info_v1_destroy_resource(resource);

            that = resource->wp_image_description_info_v1_object;
            if (that && that->m_resource == resource)
                that->m_resource = nullptr;
        }
        delete resource;
    }


    void wp_image_description_info_v1::globalRemove()
    {
        if (!m_global || m_globalRemovedEvent)
            return;

        wl_global_remove(m_global);

        struct wl_event_loop *event_loop = wl_display_get_event_loop(m_display);
        m_globalRemovedEvent = wl_event_loop_add_timer(event_loop, deferred_destroy_global_func, this);
        wl_event_source_timer_update(m_globalRemovedEvent, 300000);
    }

    wp_image_description_info_v1::Resource *wp_image_description_info_v1::bind(struct ::wl_client *client, uint32_t id, int version)
    {
        Q_ASSERT_X(!wl_client_get_object(client, id), "QWaylandObject bind", QStringLiteral("binding to object %1 more than once").arg(id).toLocal8Bit().constData());
        struct ::wl_resource *handle = wl_resource_create(client, &::wp_image_description_info_v1_interface, version, id);
        return bind(handle);
    }

    wp_image_description_info_v1::Resource *wp_image_description_info_v1::bind(struct ::wl_resource *handle)
    {
        Resource *resource = wp_image_description_info_v1_allocate();
        resource->wp_image_description_info_v1_object = this;

        wl_resource_set_implementation(handle, nullptr, resource, destroy_func);
        resource->handle = handle;
        wp_image_description_info_v1_bind_resource(resource);
        return resource;
    }
    wp_image_description_info_v1::Resource *wp_image_description_info_v1::Resource::fromResource(struct ::wl_resource *resource)
    {
        if (Q_UNLIKELY(!resource))
            return nullptr;
        if (wl_resource_instance_of(resource, &::wp_image_description_info_v1_interface, nullptr))
            return static_cast<Resource *>(wl_resource_get_user_data(resource));
        return nullptr;
    }

    void wp_image_description_info_v1::send_done()
    {
        Q_ASSERT_X(m_resource, "wp_image_description_info_v1::done", "Uninitialised resource");
        if (Q_UNLIKELY(!m_resource)) {
            qWarning("could not call wp_image_description_info_v1::done as it's not initialised");
            return;
        }
        send_done(
            m_resource->handle);
    }

    void wp_image_description_info_v1::send_done(struct ::wl_resource *resource)
    {
        wp_image_description_info_v1_send_done(
            resource);
    }


    void wp_image_description_info_v1::send_icc_file(int32_t icc, uint32_t icc_size)
    {
        Q_ASSERT_X(m_resource, "wp_image_description_info_v1::icc_file", "Uninitialised resource");
        if (Q_UNLIKELY(!m_resource)) {
            qWarning("could not call wp_image_description_info_v1::icc_file as it's not initialised");
            return;
        }
        send_icc_file(
            m_resource->handle,
            icc,
            icc_size);
    }

    void wp_image_description_info_v1::send_icc_file(struct ::wl_resource *resource, int32_t icc, uint32_t icc_size)
    {
        wp_image_description_info_v1_send_icc_file(
            resource,
            icc,
            icc_size);
    }


    void wp_image_description_info_v1::send_primaries(int32_t r_x, int32_t r_y, int32_t g_x, int32_t g_y, int32_t b_x, int32_t b_y, int32_t w_x, int32_t w_y)
    {
        Q_ASSERT_X(m_resource, "wp_image_description_info_v1::primaries", "Uninitialised resource");
        if (Q_UNLIKELY(!m_resource)) {
            qWarning("could not call wp_image_description_info_v1::primaries as it's not initialised");
            return;
        }
        send_primaries(
            m_resource->handle,
            r_x,
            r_y,
            g_x,
            g_y,
            b_x,
            b_y,
            w_x,
            w_y);
    }

    void wp_image_description_info_v1::send_primaries(struct ::wl_resource *resource, int32_t r_x, int32_t r_y, int32_t g_x, int32_t g_y, int32_t b_x, int32_t b_y, int32_t w_x, int32_t w_y)
    {
        wp_image_description_info_v1_send_primaries(
            resource,
            r_x,
            r_y,
            g_x,
            g_y,
            b_x,
            b_y,
            w_x,
            w_y);
    }


    void wp_image_description_info_v1::send_primaries_named(uint32_t primaries)
    {
        Q_ASSERT_X(m_resource, "wp_image_description_info_v1::primaries_named", "Uninitialised resource");
        if (Q_UNLIKELY(!m_resource)) {
            qWarning("could not call wp_image_description_info_v1::primaries_named as it's not initialised");
            return;
        }
        send_primaries_named(
            m_resource->handle,
            primaries);
    }

    void wp_image_description_info_v1::send_primaries_named(struct ::wl_resource *resource, uint32_t primaries)
    {
        wp_image_description_info_v1_send_primaries_named(
            resource,
            primaries);
    }


    void wp_image_description_info_v1::send_tf_power(uint32_t eexp)
    {
        Q_ASSERT_X(m_resource, "wp_image_description_info_v1::tf_power", "Uninitialised resource");
        if (Q_UNLIKELY(!m_resource)) {
            qWarning("could not call wp_image_description_info_v1::tf_power as it's not initialised");
            return;
        }
        send_tf_power(
            m_resource->handle,
            eexp);
    }

    void wp_image_description_info_v1::send_tf_power(struct ::wl_resource *resource, uint32_t eexp)
    {
        wp_image_description_info_v1_send_tf_power(
            resource,
            eexp);
    }


    void wp_image_description_info_v1::send_tf_named(uint32_t tf)
    {
        Q_ASSERT_X(m_resource, "wp_image_description_info_v1::tf_named", "Uninitialised resource");
        if (Q_UNLIKELY(!m_resource)) {
            qWarning("could not call wp_image_description_info_v1::tf_named as it's not initialised");
            return;
        }
        send_tf_named(
            m_resource->handle,
            tf);
    }

    void wp_image_description_info_v1::send_tf_named(struct ::wl_resource *resource, uint32_t tf)
    {
        wp_image_description_info_v1_send_tf_named(
            resource,
            tf);
    }


    void wp_image_description_info_v1::send_luminances(uint32_t min_lum, uint32_t max_lum, uint32_t reference_lum)
    {
        Q_ASSERT_X(m_resource, "wp_image_description_info_v1::luminances", "Uninitialised resource");
        if (Q_UNLIKELY(!m_resource)) {
            qWarning("could not call wp_image_description_info_v1::luminances as it's not initialised");
            return;
        }
        send_luminances(
            m_resource->handle,
            min_lum,
            max_lum,
            reference_lum);
    }

    void wp_image_description_info_v1::send_luminances(struct ::wl_resource *resource, uint32_t min_lum, uint32_t max_lum, uint32_t reference_lum)
    {
        wp_image_description_info_v1_send_luminances(
            resource,
            min_lum,
            max_lum,
            reference_lum);
    }


    void wp_image_description_info_v1::send_target_primaries(int32_t r_x, int32_t r_y, int32_t g_x, int32_t g_y, int32_t b_x, int32_t b_y, int32_t w_x, int32_t w_y)
    {
        Q_ASSERT_X(m_resource, "wp_image_description_info_v1::target_primaries", "Uninitialised resource");
        if (Q_UNLIKELY(!m_resource)) {
            qWarning("could not call wp_image_description_info_v1::target_primaries as it's not initialised");
            return;
        }
        send_target_primaries(
            m_resource->handle,
            r_x,
            r_y,
            g_x,
            g_y,
            b_x,
            b_y,
            w_x,
            w_y);
    }

    void wp_image_description_info_v1::send_target_primaries(struct ::wl_resource *resource, int32_t r_x, int32_t r_y, int32_t g_x, int32_t g_y, int32_t b_x, int32_t b_y, int32_t w_x, int32_t w_y)
    {
        wp_image_description_info_v1_send_target_primaries(
            resource,
            r_x,
            r_y,
            g_x,
            g_y,
            b_x,
            b_y,
            w_x,
            w_y);
    }


    void wp_image_description_info_v1::send_target_luminance(uint32_t min_lum, uint32_t max_lum)
    {
        Q_ASSERT_X(m_resource, "wp_image_description_info_v1::target_luminance", "Uninitialised resource");
        if (Q_UNLIKELY(!m_resource)) {
            qWarning("could not call wp_image_description_info_v1::target_luminance as it's not initialised");
            return;
        }
        send_target_luminance(
            m_resource->handle,
            min_lum,
            max_lum);
    }

    void wp_image_description_info_v1::send_target_luminance(struct ::wl_resource *resource, uint32_t min_lum, uint32_t max_lum)
    {
        wp_image_description_info_v1_send_target_luminance(
            resource,
            min_lum,
            max_lum);
    }


    void wp_image_description_info_v1::send_target_max_cll(uint32_t max_cll)
    {
        Q_ASSERT_X(m_resource, "wp_image_description_info_v1::target_max_cll", "Uninitialised resource");
        if (Q_UNLIKELY(!m_resource)) {
            qWarning("could not call wp_image_description_info_v1::target_max_cll as it's not initialised");
            return;
        }
        send_target_max_cll(
            m_resource->handle,
            max_cll);
    }

    void wp_image_description_info_v1::send_target_max_cll(struct ::wl_resource *resource, uint32_t max_cll)
    {
        wp_image_description_info_v1_send_target_max_cll(
            resource,
            max_cll);
    }


    void wp_image_description_info_v1::send_target_max_fall(uint32_t max_fall)
    {
        Q_ASSERT_X(m_resource, "wp_image_description_info_v1::target_max_fall", "Uninitialised resource");
        if (Q_UNLIKELY(!m_resource)) {
            qWarning("could not call wp_image_description_info_v1::target_max_fall as it's not initialised");
            return;
        }
        send_target_max_fall(
            m_resource->handle,
            max_fall);
    }

    void wp_image_description_info_v1::send_target_max_fall(struct ::wl_resource *resource, uint32_t max_fall)
    {
        wp_image_description_info_v1_send_target_max_fall(
            resource,
            max_fall);
    }



    int wp_image_description_reference_v1::deferred_destroy_global_func(void *data) {
        auto object = static_cast<wp_image_description_reference_v1 *>(data);
        wl_global_destroy(object->m_global);
        object->m_global = nullptr;
        wl_event_source_remove(object->m_globalRemovedEvent);
        object->m_globalRemovedEvent = nullptr;
        wl_list_remove(&object->m_displayDestroyedListener.link);
        object->wp_image_description_reference_v1_destroy_global();
        return 0;
    }

    wp_image_description_reference_v1::wp_image_description_reference_v1(struct ::wl_client *client, int id, int version)
        : m_resource_map()
        , m_resource(nullptr)
        , m_global(nullptr)
        , m_display(nullptr)
        , m_globalRemovedEvent(nullptr)
    {
        init(client, id, version);
    }

    wp_image_description_reference_v1::wp_image_description_reference_v1(struct ::wl_display *display, int version)
        : m_resource_map()
        , m_resource(nullptr)
        , m_global(nullptr)
        , m_display(nullptr)
        , m_globalRemovedEvent(nullptr)
    {
        init(display, version);
    }

    wp_image_description_reference_v1::wp_image_description_reference_v1(struct ::wl_resource *resource)
        : m_resource_map()
        , m_resource(nullptr)
        , m_global(nullptr)
        , m_display(nullptr)
        , m_globalRemovedEvent(nullptr)
    {
        init(resource);
    }

    wp_image_description_reference_v1::wp_image_description_reference_v1()
        : m_resource_map()
        , m_resource(nullptr)
        , m_global(nullptr)
        , m_display(nullptr)
        , m_globalRemovedEvent(nullptr)
    {
    }

    wp_image_description_reference_v1::~wp_image_description_reference_v1()
    {
        for (auto resource : std::as_const(m_resource_map))
            resource->wp_image_description_reference_v1_object = nullptr;

        if (m_resource)
            m_resource->wp_image_description_reference_v1_object = nullptr;

        if (m_global) {
            if (m_globalRemovedEvent)
                wl_event_source_remove(m_globalRemovedEvent);
            wl_global_destroy(m_global);
            wl_list_remove(&m_displayDestroyedListener.link);
        }
    }

    void wp_image_description_reference_v1::init(struct ::wl_client *client, int id, int version)
    {
        m_resource = bind(client, id, version);
    }

    void wp_image_description_reference_v1::init(struct ::wl_resource *resource)
    {
        m_resource = bind(resource);
    }

    wp_image_description_reference_v1::Resource *wp_image_description_reference_v1::add(struct ::wl_client *client, int version)
    {
        Resource *resource = bind(client, 0, version);
        m_resource_map.insert(client, resource);
        return resource;
    }

    wp_image_description_reference_v1::Resource *wp_image_description_reference_v1::add(struct ::wl_client *client, int id, int version)
    {
        Resource *resource = bind(client, id, version);
        m_resource_map.insert(client, resource);
        return resource;
    }

    wp_image_description_reference_v1::Resource *wp_image_description_reference_v1::add(struct ::wl_resource *resource)
    {
        return *m_resource_map.insert(wl_resource_get_client(resource), bind(resource));
    }

    void wp_image_description_reference_v1::init(struct ::wl_display *display, int version)
    {
        m_display = display;
        m_global = wl_global_create(display, &::wp_image_description_reference_v1_interface, version, this, bind_func);
        m_displayDestroyedListener.notify = wp_image_description_reference_v1::display_destroy_func;
        m_displayDestroyedListener.parent = this;
        wl_display_add_destroy_listener(display, &m_displayDestroyedListener);
    }

    const struct wl_interface *wp_image_description_reference_v1::interface()
    {
        return &::wp_image_description_reference_v1_interface;
    }

    wp_image_description_reference_v1::Resource *wp_image_description_reference_v1::wp_image_description_reference_v1_allocate()
    {
        return new Resource;
    }

    void wp_image_description_reference_v1::wp_image_description_reference_v1_destroy_global()
    {
    }

    void wp_image_description_reference_v1::wp_image_description_reference_v1_bind_resource(Resource *)
    {
    }

    void wp_image_description_reference_v1::wp_image_description_reference_v1_destroy_resource(Resource *)
    {
    }

    void wp_image_description_reference_v1::bind_func(struct ::wl_client *client, void *data, uint32_t version, uint32_t id)
    {
        wp_image_description_reference_v1 *that = static_cast<wp_image_description_reference_v1 *>(data);
        that->add(client, id, version);
    }

    void wp_image_description_reference_v1::display_destroy_func(struct ::wl_listener *listener, void *data)
    {
        Q_UNUSED(data);
        wp_image_description_reference_v1 *that = static_cast<wp_image_description_reference_v1::DisplayDestroyedListener *>(listener)->parent;
        that->m_global = nullptr;
        that->m_globalRemovedEvent = nullptr;
    }

    void wp_image_description_reference_v1::destroy_func(struct ::wl_resource *client_resource)
    {
        Resource *resource = Resource::fromResource(client_resource);
        Q_ASSERT(resource);
        wp_image_description_reference_v1 *that = resource->wp_image_description_reference_v1_object;
        if (Q_LIKELY(that)) {
            that->m_resource_map.remove(resource->client(), resource);
            that->wp_image_description_reference_v1_destroy_resource(resource);

            that = resource->wp_image_description_reference_v1_object;
            if (that && that->m_resource == resource)
                that->m_resource = nullptr;
        }
        delete resource;
    }


    void wp_image_description_reference_v1::globalRemove()
    {
        if (!m_global || m_globalRemovedEvent)
            return;

        wl_global_remove(m_global);

        struct wl_event_loop *event_loop = wl_display_get_event_loop(m_display);
        m_globalRemovedEvent = wl_event_loop_add_timer(event_loop, deferred_destroy_global_func, this);
        wl_event_source_timer_update(m_globalRemovedEvent, 300000);
    }

    wp_image_description_reference_v1::Resource *wp_image_description_reference_v1::bind(struct ::wl_client *client, uint32_t id, int version)
    {
        Q_ASSERT_X(!wl_client_get_object(client, id), "QWaylandObject bind", QStringLiteral("binding to object %1 more than once").arg(id).toLocal8Bit().constData());
        struct ::wl_resource *handle = wl_resource_create(client, &::wp_image_description_reference_v1_interface, version, id);
        return bind(handle);
    }

    wp_image_description_reference_v1::Resource *wp_image_description_reference_v1::bind(struct ::wl_resource *handle)
    {
        Resource *resource = wp_image_description_reference_v1_allocate();
        resource->wp_image_description_reference_v1_object = this;

        wl_resource_set_implementation(handle, &m_wp_image_description_reference_v1_interface, resource, destroy_func);
        resource->handle = handle;
        wp_image_description_reference_v1_bind_resource(resource);
        return resource;
    }
    wp_image_description_reference_v1::Resource *wp_image_description_reference_v1::Resource::fromResource(struct ::wl_resource *resource)
    {
        if (Q_UNLIKELY(!resource))
            return nullptr;
        if (wl_resource_instance_of(resource, &::wp_image_description_reference_v1_interface, &m_wp_image_description_reference_v1_interface))
            return static_cast<Resource *>(wl_resource_get_user_data(resource));
        return nullptr;
    }

    const struct ::wp_image_description_reference_v1_interface wp_image_description_reference_v1::m_wp_image_description_reference_v1_interface = {
        wp_image_description_reference_v1::handle_destroy
    };

    void wp_image_description_reference_v1::wp_image_description_reference_v1_destroy(Resource *)
    {
    }


    void wp_image_description_reference_v1::handle_destroy(
        ::wl_client *client,
        struct wl_resource *resource)
    {
        Q_UNUSED(client);
        Resource *qtResource = Resource::fromResource(resource);
        if (Q_UNLIKELY(!qtResource->wp_image_description_reference_v1_object)) {
            wl_resource_destroy(resource);
            return;
        }
        static_cast<wp_image_description_reference_v1 *>(qtResource->wp_image_description_reference_v1_object)->wp_image_description_reference_v1_destroy(
            qtResource);
    }
}

QT_WARNING_POP
QT_END_NAMESPACE
