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

#include "qwayland-server-linux-dmabuf-unstable-v1.h"

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

namespace QtWaylandServer {

    int zwp_linux_dmabuf_v1::deferred_destroy_global_func(void *data) {
        auto object = static_cast<zwp_linux_dmabuf_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->zwp_linux_dmabuf_v1_destroy_global();
        return 0;
    }

    zwp_linux_dmabuf_v1::zwp_linux_dmabuf_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);
    }

    zwp_linux_dmabuf_v1::zwp_linux_dmabuf_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);
    }

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

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

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

        if (m_resource)
            m_resource->zwp_linux_dmabuf_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 zwp_linux_dmabuf_v1::init(struct ::wl_client *client, int id, int version)
    {
        m_resource = bind(client, id, version);
    }

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

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

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

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

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

    const struct wl_interface *zwp_linux_dmabuf_v1::interface()
    {
        return &::zwp_linux_dmabuf_v1_interface;
    }

    zwp_linux_dmabuf_v1::Resource *zwp_linux_dmabuf_v1::zwp_linux_dmabuf_v1_allocate()
    {
        return new Resource;
    }

    void zwp_linux_dmabuf_v1::zwp_linux_dmabuf_v1_destroy_global()
    {
    }

    void zwp_linux_dmabuf_v1::zwp_linux_dmabuf_v1_bind_resource(Resource *)
    {
    }

    void zwp_linux_dmabuf_v1::zwp_linux_dmabuf_v1_destroy_resource(Resource *)
    {
    }

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

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

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

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


    void zwp_linux_dmabuf_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);
    }

    zwp_linux_dmabuf_v1::Resource *zwp_linux_dmabuf_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, &::zwp_linux_dmabuf_v1_interface, version, id);
        return bind(handle);
    }

    zwp_linux_dmabuf_v1::Resource *zwp_linux_dmabuf_v1::bind(struct ::wl_resource *handle)
    {
        Resource *resource = zwp_linux_dmabuf_v1_allocate();
        resource->zwp_linux_dmabuf_v1_object = this;

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

    const struct ::zwp_linux_dmabuf_v1_interface zwp_linux_dmabuf_v1::m_zwp_linux_dmabuf_v1_interface = {
        zwp_linux_dmabuf_v1::handle_destroy,
        zwp_linux_dmabuf_v1::handle_create_params,
        zwp_linux_dmabuf_v1::handle_get_default_feedback,
        zwp_linux_dmabuf_v1::handle_get_surface_feedback
    };

    void zwp_linux_dmabuf_v1::zwp_linux_dmabuf_v1_destroy(Resource *)
    {
    }

    void zwp_linux_dmabuf_v1::zwp_linux_dmabuf_v1_create_params(Resource *, uint32_t)
    {
    }

    void zwp_linux_dmabuf_v1::zwp_linux_dmabuf_v1_get_default_feedback(Resource *, uint32_t)
    {
    }

    void zwp_linux_dmabuf_v1::zwp_linux_dmabuf_v1_get_surface_feedback(Resource *, uint32_t, struct ::wl_resource *)
    {
    }


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

    void zwp_linux_dmabuf_v1::handle_create_params(
        ::wl_client *client,
        struct wl_resource *resource,
        uint32_t params_id)
    {
        Q_UNUSED(client);
        Resource *qtResource = Resource::fromResource(resource);
        if (Q_UNLIKELY(!qtResource->zwp_linux_dmabuf_v1_object)) {
            return;
        }
        static_cast<zwp_linux_dmabuf_v1 *>(qtResource->zwp_linux_dmabuf_v1_object)->zwp_linux_dmabuf_v1_create_params(
            qtResource,
            params_id);
    }

    void zwp_linux_dmabuf_v1::handle_get_default_feedback(
        ::wl_client *client,
        struct wl_resource *resource,
        uint32_t id)
    {
        Q_UNUSED(client);
        Resource *qtResource = Resource::fromResource(resource);
        if (Q_UNLIKELY(!qtResource->zwp_linux_dmabuf_v1_object)) {
            return;
        }
        static_cast<zwp_linux_dmabuf_v1 *>(qtResource->zwp_linux_dmabuf_v1_object)->zwp_linux_dmabuf_v1_get_default_feedback(
            qtResource,
            id);
    }

    void zwp_linux_dmabuf_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->zwp_linux_dmabuf_v1_object)) {
            return;
        }
        static_cast<zwp_linux_dmabuf_v1 *>(qtResource->zwp_linux_dmabuf_v1_object)->zwp_linux_dmabuf_v1_get_surface_feedback(
            qtResource,
            id,
            surface);
    }

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

    void zwp_linux_dmabuf_v1::send_format(struct ::wl_resource *resource, uint32_t format)
    {
        zwp_linux_dmabuf_v1_send_format(
            resource,
            format);
    }


    void zwp_linux_dmabuf_v1::send_modifier(uint32_t format, uint32_t modifier_hi, uint32_t modifier_lo)
    {
        Q_ASSERT_X(m_resource, "zwp_linux_dmabuf_v1::modifier", "Uninitialised resource");
        if (Q_UNLIKELY(!m_resource)) {
            qWarning("could not call zwp_linux_dmabuf_v1::modifier as it's not initialised");
            return;
        }
        send_modifier(
            m_resource->handle,
            format,
            modifier_hi,
            modifier_lo);
    }

    void zwp_linux_dmabuf_v1::send_modifier(struct ::wl_resource *resource, uint32_t format, uint32_t modifier_hi, uint32_t modifier_lo)
    {
        zwp_linux_dmabuf_v1_send_modifier(
            resource,
            format,
            modifier_hi,
            modifier_lo);
    }



    int zwp_linux_buffer_params_v1::deferred_destroy_global_func(void *data) {
        auto object = static_cast<zwp_linux_buffer_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->zwp_linux_buffer_params_v1_destroy_global();
        return 0;
    }

    zwp_linux_buffer_params_v1::zwp_linux_buffer_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);
    }

    zwp_linux_buffer_params_v1::zwp_linux_buffer_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);
    }

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

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

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

        if (m_resource)
            m_resource->zwp_linux_buffer_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 zwp_linux_buffer_params_v1::init(struct ::wl_client *client, int id, int version)
    {
        m_resource = bind(client, id, version);
    }

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

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

    zwp_linux_buffer_params_v1::Resource *zwp_linux_buffer_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;
    }

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

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

    const struct wl_interface *zwp_linux_buffer_params_v1::interface()
    {
        return &::zwp_linux_buffer_params_v1_interface;
    }

    zwp_linux_buffer_params_v1::Resource *zwp_linux_buffer_params_v1::zwp_linux_buffer_params_v1_allocate()
    {
        return new Resource;
    }

    void zwp_linux_buffer_params_v1::zwp_linux_buffer_params_v1_destroy_global()
    {
    }

    void zwp_linux_buffer_params_v1::zwp_linux_buffer_params_v1_bind_resource(Resource *)
    {
    }

    void zwp_linux_buffer_params_v1::zwp_linux_buffer_params_v1_destroy_resource(Resource *)
    {
    }

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

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

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

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


    void zwp_linux_buffer_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);
    }

    zwp_linux_buffer_params_v1::Resource *zwp_linux_buffer_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, &::zwp_linux_buffer_params_v1_interface, version, id);
        return bind(handle);
    }

    zwp_linux_buffer_params_v1::Resource *zwp_linux_buffer_params_v1::bind(struct ::wl_resource *handle)
    {
        Resource *resource = zwp_linux_buffer_params_v1_allocate();
        resource->zwp_linux_buffer_params_v1_object = this;

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

    const struct ::zwp_linux_buffer_params_v1_interface zwp_linux_buffer_params_v1::m_zwp_linux_buffer_params_v1_interface = {
        zwp_linux_buffer_params_v1::handle_destroy,
        zwp_linux_buffer_params_v1::handle_add,
        zwp_linux_buffer_params_v1::handle_create,
        zwp_linux_buffer_params_v1::handle_create_immed
    };

    void zwp_linux_buffer_params_v1::zwp_linux_buffer_params_v1_destroy(Resource *)
    {
    }

    void zwp_linux_buffer_params_v1::zwp_linux_buffer_params_v1_add(Resource *, int32_t , uint32_t , uint32_t , uint32_t , uint32_t , uint32_t )
    {
    }

    void zwp_linux_buffer_params_v1::zwp_linux_buffer_params_v1_create(Resource *, int32_t , int32_t , uint32_t , uint32_t )
    {
    }

    void zwp_linux_buffer_params_v1::zwp_linux_buffer_params_v1_create_immed(Resource *, uint32_t, int32_t , int32_t , uint32_t , uint32_t )
    {
    }


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

    void zwp_linux_buffer_params_v1::handle_add(
        ::wl_client *client,
        struct wl_resource *resource,
        int32_t fd,
        uint32_t plane_idx,
        uint32_t offset,
        uint32_t stride,
        uint32_t modifier_hi,
        uint32_t modifier_lo)
    {
        Q_UNUSED(client);
        Resource *qtResource = Resource::fromResource(resource);
        if (Q_UNLIKELY(!qtResource->zwp_linux_buffer_params_v1_object)) {
        close(fd);
            return;
        }
        static_cast<zwp_linux_buffer_params_v1 *>(qtResource->zwp_linux_buffer_params_v1_object)->zwp_linux_buffer_params_v1_add(
            qtResource,
            fd,
            plane_idx,
            offset,
            stride,
            modifier_hi,
            modifier_lo);
    }

    void zwp_linux_buffer_params_v1::handle_create(
        ::wl_client *client,
        struct wl_resource *resource,
        int32_t width,
        int32_t height,
        uint32_t format,
        uint32_t flags)
    {
        Q_UNUSED(client);
        Resource *qtResource = Resource::fromResource(resource);
        if (Q_UNLIKELY(!qtResource->zwp_linux_buffer_params_v1_object)) {
            return;
        }
        static_cast<zwp_linux_buffer_params_v1 *>(qtResource->zwp_linux_buffer_params_v1_object)->zwp_linux_buffer_params_v1_create(
            qtResource,
            width,
            height,
            format,
            flags);
    }

    void zwp_linux_buffer_params_v1::handle_create_immed(
        ::wl_client *client,
        struct wl_resource *resource,
        uint32_t buffer_id,
        int32_t width,
        int32_t height,
        uint32_t format,
        uint32_t flags)
    {
        Q_UNUSED(client);
        Resource *qtResource = Resource::fromResource(resource);
        if (Q_UNLIKELY(!qtResource->zwp_linux_buffer_params_v1_object)) {
            return;
        }
        static_cast<zwp_linux_buffer_params_v1 *>(qtResource->zwp_linux_buffer_params_v1_object)->zwp_linux_buffer_params_v1_create_immed(
            qtResource,
            buffer_id,
            width,
            height,
            format,
            flags);
    }

    void zwp_linux_buffer_params_v1::send_created(struct ::wl_resource *buffer)
    {
        Q_ASSERT_X(m_resource, "zwp_linux_buffer_params_v1::created", "Uninitialised resource");
        if (Q_UNLIKELY(!m_resource)) {
            qWarning("could not call zwp_linux_buffer_params_v1::created as it's not initialised");
            return;
        }
        send_created(
            m_resource->handle,
            buffer);
    }

    void zwp_linux_buffer_params_v1::send_created(struct ::wl_resource *resource, struct ::wl_resource *buffer)
    {
        zwp_linux_buffer_params_v1_send_created(
            resource,
            buffer);
    }


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

    void zwp_linux_buffer_params_v1::send_failed(struct ::wl_resource *resource)
    {
        zwp_linux_buffer_params_v1_send_failed(
            resource);
    }



    int zwp_linux_dmabuf_feedback_v1::deferred_destroy_global_func(void *data) {
        auto object = static_cast<zwp_linux_dmabuf_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->zwp_linux_dmabuf_feedback_v1_destroy_global();
        return 0;
    }

    zwp_linux_dmabuf_feedback_v1::zwp_linux_dmabuf_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);
    }

    zwp_linux_dmabuf_feedback_v1::zwp_linux_dmabuf_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);
    }

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

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

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

        if (m_resource)
            m_resource->zwp_linux_dmabuf_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 zwp_linux_dmabuf_feedback_v1::init(struct ::wl_client *client, int id, int version)
    {
        m_resource = bind(client, id, version);
    }

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

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

    zwp_linux_dmabuf_feedback_v1::Resource *zwp_linux_dmabuf_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;
    }

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

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

    const struct wl_interface *zwp_linux_dmabuf_feedback_v1::interface()
    {
        return &::zwp_linux_dmabuf_feedback_v1_interface;
    }

    zwp_linux_dmabuf_feedback_v1::Resource *zwp_linux_dmabuf_feedback_v1::zwp_linux_dmabuf_feedback_v1_allocate()
    {
        return new Resource;
    }

    void zwp_linux_dmabuf_feedback_v1::zwp_linux_dmabuf_feedback_v1_destroy_global()
    {
    }

    void zwp_linux_dmabuf_feedback_v1::zwp_linux_dmabuf_feedback_v1_bind_resource(Resource *)
    {
    }

    void zwp_linux_dmabuf_feedback_v1::zwp_linux_dmabuf_feedback_v1_destroy_resource(Resource *)
    {
    }

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

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

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

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


    void zwp_linux_dmabuf_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);
    }

    zwp_linux_dmabuf_feedback_v1::Resource *zwp_linux_dmabuf_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, &::zwp_linux_dmabuf_feedback_v1_interface, version, id);
        return bind(handle);
    }

    zwp_linux_dmabuf_feedback_v1::Resource *zwp_linux_dmabuf_feedback_v1::bind(struct ::wl_resource *handle)
    {
        Resource *resource = zwp_linux_dmabuf_feedback_v1_allocate();
        resource->zwp_linux_dmabuf_feedback_v1_object = this;

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

    const struct ::zwp_linux_dmabuf_feedback_v1_interface zwp_linux_dmabuf_feedback_v1::m_zwp_linux_dmabuf_feedback_v1_interface = {
        zwp_linux_dmabuf_feedback_v1::handle_destroy
    };

    void zwp_linux_dmabuf_feedback_v1::zwp_linux_dmabuf_feedback_v1_destroy(Resource *)
    {
    }


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

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

    void zwp_linux_dmabuf_feedback_v1::send_done(struct ::wl_resource *resource)
    {
        zwp_linux_dmabuf_feedback_v1_send_done(
            resource);
    }


    void zwp_linux_dmabuf_feedback_v1::send_format_table(int32_t fd, uint32_t size)
    {
        Q_ASSERT_X(m_resource, "zwp_linux_dmabuf_feedback_v1::format_table", "Uninitialised resource");
        if (Q_UNLIKELY(!m_resource)) {
            qWarning("could not call zwp_linux_dmabuf_feedback_v1::format_table as it's not initialised");
            return;
        }
        send_format_table(
            m_resource->handle,
            fd,
            size);
    }

    void zwp_linux_dmabuf_feedback_v1::send_format_table(struct ::wl_resource *resource, int32_t fd, uint32_t size)
    {
        zwp_linux_dmabuf_feedback_v1_send_format_table(
            resource,
            fd,
            size);
    }


    void zwp_linux_dmabuf_feedback_v1::send_main_device(const QByteArray &device)
    {
        Q_ASSERT_X(m_resource, "zwp_linux_dmabuf_feedback_v1::main_device", "Uninitialised resource");
        if (Q_UNLIKELY(!m_resource)) {
            qWarning("could not call zwp_linux_dmabuf_feedback_v1::main_device as it's not initialised");
            return;
        }
        send_main_device(
            m_resource->handle,
            device);
    }

    void zwp_linux_dmabuf_feedback_v1::send_main_device(struct ::wl_resource *resource, const QByteArray &device)
    {
        struct wl_array device_data;
        device_data.size = device.size();
        device_data.data = static_cast<void *>(const_cast<char *>(device.constData()));
        device_data.alloc = 0;

        zwp_linux_dmabuf_feedback_v1_send_main_device(
            resource,
            &device_data);
    }


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

    void zwp_linux_dmabuf_feedback_v1::send_tranche_done(struct ::wl_resource *resource)
    {
        zwp_linux_dmabuf_feedback_v1_send_tranche_done(
            resource);
    }


    void zwp_linux_dmabuf_feedback_v1::send_tranche_target_device(const QByteArray &device)
    {
        Q_ASSERT_X(m_resource, "zwp_linux_dmabuf_feedback_v1::tranche_target_device", "Uninitialised resource");
        if (Q_UNLIKELY(!m_resource)) {
            qWarning("could not call zwp_linux_dmabuf_feedback_v1::tranche_target_device as it's not initialised");
            return;
        }
        send_tranche_target_device(
            m_resource->handle,
            device);
    }

    void zwp_linux_dmabuf_feedback_v1::send_tranche_target_device(struct ::wl_resource *resource, const QByteArray &device)
    {
        struct wl_array device_data;
        device_data.size = device.size();
        device_data.data = static_cast<void *>(const_cast<char *>(device.constData()));
        device_data.alloc = 0;

        zwp_linux_dmabuf_feedback_v1_send_tranche_target_device(
            resource,
            &device_data);
    }


    void zwp_linux_dmabuf_feedback_v1::send_tranche_formats(const QByteArray &indices)
    {
        Q_ASSERT_X(m_resource, "zwp_linux_dmabuf_feedback_v1::tranche_formats", "Uninitialised resource");
        if (Q_UNLIKELY(!m_resource)) {
            qWarning("could not call zwp_linux_dmabuf_feedback_v1::tranche_formats as it's not initialised");
            return;
        }
        send_tranche_formats(
            m_resource->handle,
            indices);
    }

    void zwp_linux_dmabuf_feedback_v1::send_tranche_formats(struct ::wl_resource *resource, const QByteArray &indices)
    {
        struct wl_array indices_data;
        indices_data.size = indices.size();
        indices_data.data = static_cast<void *>(const_cast<char *>(indices.constData()));
        indices_data.alloc = 0;

        zwp_linux_dmabuf_feedback_v1_send_tranche_formats(
            resource,
            &indices_data);
    }


    void zwp_linux_dmabuf_feedback_v1::send_tranche_flags(uint32_t flags)
    {
        Q_ASSERT_X(m_resource, "zwp_linux_dmabuf_feedback_v1::tranche_flags", "Uninitialised resource");
        if (Q_UNLIKELY(!m_resource)) {
            qWarning("could not call zwp_linux_dmabuf_feedback_v1::tranche_flags as it's not initialised");
            return;
        }
        send_tranche_flags(
            m_resource->handle,
            flags);
    }

    void zwp_linux_dmabuf_feedback_v1::send_tranche_flags(struct ::wl_resource *resource, uint32_t flags)
    {
        zwp_linux_dmabuf_feedback_v1_send_tranche_flags(
            resource,
            flags);
    }

}

QT_WARNING_POP
QT_END_NAMESPACE
