// This file was generated by qtwaylandscanner
// source file is /scratch/jenkins-BUILDS-eSDK-2023.2_stable-pipeline-build-150_Ultra96Full/build/tmp/work/ultra96_zynqmp-xilinx-linux/qtwayland/5.15.4+gitAUTOINC+f1e6c8764d-r0/git/src/3rdparty/protocol/xdg-decoration-unstable-v1.xml

#include <QtWaylandCompositor/private/qwayland-server-xdg-decoration-unstable-v1.h>

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

namespace QtWaylandServer {
    zxdg_decoration_manager_v1::zxdg_decoration_manager_v1(struct ::wl_client *client, int id, int version)
        : m_resource_map()
        , m_resource(nullptr)
        , m_global(nullptr)
    {
        init(client, id, version);
    }

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

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

    zxdg_decoration_manager_v1::zxdg_decoration_manager_v1()
        : m_resource_map()
        , m_resource(nullptr)
        , m_global(nullptr)
    {
    }

    zxdg_decoration_manager_v1::~zxdg_decoration_manager_v1()
    {
        for (auto resource : qAsConst(m_resource_map))
            resource->zxdg_decoration_manager_v1_object = nullptr;

        if (m_resource)
            m_resource->zxdg_decoration_manager_v1_object = nullptr;

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

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

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

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

    zxdg_decoration_manager_v1::Resource *zxdg_decoration_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;
    }

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

    const struct wl_interface *zxdg_decoration_manager_v1::interface()
    {
        return &::zxdg_decoration_manager_v1_interface;
    }

    zxdg_decoration_manager_v1::Resource *zxdg_decoration_manager_v1::zxdg_decoration_manager_v1_allocate()
    {
        return new Resource;
    }

    void zxdg_decoration_manager_v1::zxdg_decoration_manager_v1_bind_resource(Resource *)
    {
    }

    void zxdg_decoration_manager_v1::zxdg_decoration_manager_v1_destroy_resource(Resource *)
    {
    }

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

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

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

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

    zxdg_decoration_manager_v1::Resource *zxdg_decoration_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, &::zxdg_decoration_manager_v1_interface, version, id);
        return bind(handle);
    }

    zxdg_decoration_manager_v1::Resource *zxdg_decoration_manager_v1::bind(struct ::wl_resource *handle)
    {
        Resource *resource = zxdg_decoration_manager_v1_allocate();
        resource->zxdg_decoration_manager_v1_object = this;

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

    const struct ::zxdg_decoration_manager_v1_interface zxdg_decoration_manager_v1::m_zxdg_decoration_manager_v1_interface = {
        zxdg_decoration_manager_v1::handle_destroy,
        zxdg_decoration_manager_v1::handle_get_toplevel_decoration
    };

    void zxdg_decoration_manager_v1::zxdg_decoration_manager_v1_destroy(Resource *)
    {
    }

    void zxdg_decoration_manager_v1::zxdg_decoration_manager_v1_get_toplevel_decoration(Resource *, uint32_t, struct ::wl_resource *)
    {
    }


    void zxdg_decoration_manager_v1::handle_destroy(
        ::wl_client *client,
        struct wl_resource *resource)
    {
        Q_UNUSED(client);
        Resource *r = Resource::fromResource(resource);
        if (Q_UNLIKELY(!r->zxdg_decoration_manager_v1_object)) {
            wl_resource_destroy(resource);
            return;
        }
        static_cast<zxdg_decoration_manager_v1 *>(r->zxdg_decoration_manager_v1_object)->zxdg_decoration_manager_v1_destroy(
            r);
    }

    void zxdg_decoration_manager_v1::handle_get_toplevel_decoration(
        ::wl_client *client,
        struct wl_resource *resource,
        uint32_t id,
        struct ::wl_resource *toplevel)
    {
        Q_UNUSED(client);
        Resource *r = Resource::fromResource(resource);
        if (Q_UNLIKELY(!r->zxdg_decoration_manager_v1_object)) {
            return;
        }
        static_cast<zxdg_decoration_manager_v1 *>(r->zxdg_decoration_manager_v1_object)->zxdg_decoration_manager_v1_get_toplevel_decoration(
            r,
            id,
            toplevel);
    }

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

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

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

    zxdg_toplevel_decoration_v1::zxdg_toplevel_decoration_v1()
        : m_resource_map()
        , m_resource(nullptr)
        , m_global(nullptr)
    {
    }

    zxdg_toplevel_decoration_v1::~zxdg_toplevel_decoration_v1()
    {
        for (auto resource : qAsConst(m_resource_map))
            resource->zxdg_toplevel_decoration_v1_object = nullptr;

        if (m_resource)
            m_resource->zxdg_toplevel_decoration_v1_object = nullptr;

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

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

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

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

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

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

    const struct wl_interface *zxdg_toplevel_decoration_v1::interface()
    {
        return &::zxdg_toplevel_decoration_v1_interface;
    }

    zxdg_toplevel_decoration_v1::Resource *zxdg_toplevel_decoration_v1::zxdg_toplevel_decoration_v1_allocate()
    {
        return new Resource;
    }

    void zxdg_toplevel_decoration_v1::zxdg_toplevel_decoration_v1_bind_resource(Resource *)
    {
    }

    void zxdg_toplevel_decoration_v1::zxdg_toplevel_decoration_v1_destroy_resource(Resource *)
    {
    }

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

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

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

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

    zxdg_toplevel_decoration_v1::Resource *zxdg_toplevel_decoration_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, &::zxdg_toplevel_decoration_v1_interface, version, id);
        return bind(handle);
    }

    zxdg_toplevel_decoration_v1::Resource *zxdg_toplevel_decoration_v1::bind(struct ::wl_resource *handle)
    {
        Resource *resource = zxdg_toplevel_decoration_v1_allocate();
        resource->zxdg_toplevel_decoration_v1_object = this;

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

    const struct ::zxdg_toplevel_decoration_v1_interface zxdg_toplevel_decoration_v1::m_zxdg_toplevel_decoration_v1_interface = {
        zxdg_toplevel_decoration_v1::handle_destroy,
        zxdg_toplevel_decoration_v1::handle_set_mode,
        zxdg_toplevel_decoration_v1::handle_unset_mode
    };

    void zxdg_toplevel_decoration_v1::zxdg_toplevel_decoration_v1_destroy(Resource *)
    {
    }

    void zxdg_toplevel_decoration_v1::zxdg_toplevel_decoration_v1_set_mode(Resource *, uint32_t )
    {
    }

    void zxdg_toplevel_decoration_v1::zxdg_toplevel_decoration_v1_unset_mode(Resource *)
    {
    }


    void zxdg_toplevel_decoration_v1::handle_destroy(
        ::wl_client *client,
        struct wl_resource *resource)
    {
        Q_UNUSED(client);
        Resource *r = Resource::fromResource(resource);
        if (Q_UNLIKELY(!r->zxdg_toplevel_decoration_v1_object)) {
            wl_resource_destroy(resource);
            return;
        }
        static_cast<zxdg_toplevel_decoration_v1 *>(r->zxdg_toplevel_decoration_v1_object)->zxdg_toplevel_decoration_v1_destroy(
            r);
    }

    void zxdg_toplevel_decoration_v1::handle_set_mode(
        ::wl_client *client,
        struct wl_resource *resource,
        uint32_t mode)
    {
        Q_UNUSED(client);
        Resource *r = Resource::fromResource(resource);
        if (Q_UNLIKELY(!r->zxdg_toplevel_decoration_v1_object)) {
            return;
        }
        static_cast<zxdg_toplevel_decoration_v1 *>(r->zxdg_toplevel_decoration_v1_object)->zxdg_toplevel_decoration_v1_set_mode(
            r,
            mode);
    }

    void zxdg_toplevel_decoration_v1::handle_unset_mode(
        ::wl_client *client,
        struct wl_resource *resource)
    {
        Q_UNUSED(client);
        Resource *r = Resource::fromResource(resource);
        if (Q_UNLIKELY(!r->zxdg_toplevel_decoration_v1_object)) {
            return;
        }
        static_cast<zxdg_toplevel_decoration_v1 *>(r->zxdg_toplevel_decoration_v1_object)->zxdg_toplevel_decoration_v1_unset_mode(
            r);
    }

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

    void zxdg_toplevel_decoration_v1::send_configure(struct ::wl_resource *resource, uint32_t mode)
    {
        zxdg_toplevel_decoration_v1_send_configure(
            resource,
            mode);
    }

}

QT_WARNING_POP
QT_END_NAMESPACE
