// This file was generated by qtwaylandscanner
// source file is /build/qt5-wayland/src/qtwayland/src/extensions/qt-texture-sharing-unstable-v1.xml

#include "qwayland-qt-texture-sharing-unstable-v1.h"

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

namespace QtWayland {

static inline void *wlRegistryBind(struct ::wl_registry *registry, uint32_t name, const struct ::wl_interface *interface, uint32_t version)
{
    const uint32_t bindOpCode = 0;
#if (WAYLAND_VERSION_MAJOR == 1 && WAYLAND_VERSION_MINOR > 10) || WAYLAND_VERSION_MAJOR > 1
    return (void *) wl_proxy_marshal_constructor_versioned((struct wl_proxy *) registry,
        bindOpCode, interface, version, name, interface->name, version, nullptr);
#else
    return (void *) wl_proxy_marshal_constructor((struct wl_proxy *) registry,
        bindOpCode, interface, name, interface->name, version, nullptr);
#endif
}

    zqt_texture_sharing_v1::zqt_texture_sharing_v1(struct ::wl_registry *registry, int id, int version)
    {
        init(registry, id, version);
    }

    zqt_texture_sharing_v1::zqt_texture_sharing_v1(struct ::zqt_texture_sharing_v1 *obj)
        : m_zqt_texture_sharing_v1(obj)
    {
        init_listener();
    }

    zqt_texture_sharing_v1::zqt_texture_sharing_v1()
        : m_zqt_texture_sharing_v1(nullptr)
    {
    }

    zqt_texture_sharing_v1::~zqt_texture_sharing_v1()
    {
    }

    void zqt_texture_sharing_v1::init(struct ::wl_registry *registry, int id, int version)
    {
        m_zqt_texture_sharing_v1 = static_cast<struct ::zqt_texture_sharing_v1 *>(wlRegistryBind(registry, id, &zqt_texture_sharing_v1_interface, version));
        init_listener();
    }

    void zqt_texture_sharing_v1::init(struct ::zqt_texture_sharing_v1 *obj)
    {
        m_zqt_texture_sharing_v1 = obj;
        init_listener();
    }

    zqt_texture_sharing_v1 *zqt_texture_sharing_v1::fromObject(struct ::zqt_texture_sharing_v1 *object)
    {
        if (wl_proxy_get_listener((struct ::wl_proxy *)object) != (void *)&m_zqt_texture_sharing_v1_listener)
            return nullptr;
        return static_cast<zqt_texture_sharing_v1 *>(zqt_texture_sharing_v1_get_user_data(object));
    }

    bool zqt_texture_sharing_v1::isInitialized() const
    {
        return m_zqt_texture_sharing_v1 != nullptr;
    }

    const struct wl_interface *zqt_texture_sharing_v1::interface()
    {
        return &::zqt_texture_sharing_v1_interface;
    }

    void zqt_texture_sharing_v1::request_image(const QString &key)
    {
        zqt_texture_sharing_v1_request_image(
            m_zqt_texture_sharing_v1,
            key.toUtf8().constData());
    }

    void zqt_texture_sharing_v1::abandon_image(const QString &key)
    {
        zqt_texture_sharing_v1_abandon_image(
            m_zqt_texture_sharing_v1,
            key.toUtf8().constData());
    }

    void zqt_texture_sharing_v1::zqt_texture_sharing_v1_image_failed(const QString &, const QString &)
    {
    }

    void zqt_texture_sharing_v1::handle_image_failed(
        void *data,
        struct ::zqt_texture_sharing_v1 *object,
        const char *key,
        const char *error_message)
    {
        Q_UNUSED(object);
        static_cast<zqt_texture_sharing_v1 *>(data)->zqt_texture_sharing_v1_image_failed(
            QString::fromUtf8(key),
            QString::fromUtf8(error_message));
    }

    void zqt_texture_sharing_v1::zqt_texture_sharing_v1_provide_buffer(struct ::qt_server_buffer *, const QString &)
    {
    }

    void zqt_texture_sharing_v1::handle_provide_buffer(
        void *data,
        struct ::zqt_texture_sharing_v1 *object,
        struct ::qt_server_buffer *buffer,
        const char *key)
    {
        Q_UNUSED(object);
        static_cast<zqt_texture_sharing_v1 *>(data)->zqt_texture_sharing_v1_provide_buffer(
            buffer,
            QString::fromUtf8(key));
    }

    const struct zqt_texture_sharing_v1_listener zqt_texture_sharing_v1::m_zqt_texture_sharing_v1_listener = {
        zqt_texture_sharing_v1::handle_image_failed,
        zqt_texture_sharing_v1::handle_provide_buffer,
    };

    void zqt_texture_sharing_v1::init_listener()
    {
        zqt_texture_sharing_v1_add_listener(m_zqt_texture_sharing_v1, &m_zqt_texture_sharing_v1_listener, this);
    }
}

QT_WARNING_POP
QT_END_NAMESPACE
