#include <QtWaylandClient/private/qwayland-hardware-integration.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
}

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

    qt_hardware_integration::qt_hardware_integration(struct ::qt_hardware_integration *obj)
        : m_qt_hardware_integration(obj)
    {
        init_listener();
    }

    qt_hardware_integration::qt_hardware_integration()
        : m_qt_hardware_integration(nullptr)
    {
    }

    qt_hardware_integration::~qt_hardware_integration()
    {
    }

    void qt_hardware_integration::init(struct ::wl_registry *registry, int id, int version)
    {
        m_qt_hardware_integration = static_cast<struct ::qt_hardware_integration *>(wlRegistryBind(registry, id, &qt_hardware_integration_interface, version));
        init_listener();
    }

    void qt_hardware_integration::init(struct ::qt_hardware_integration *obj)
    {
        m_qt_hardware_integration = obj;
        init_listener();
    }

    qt_hardware_integration *qt_hardware_integration::fromObject(struct ::qt_hardware_integration *object)
    {
        if (wl_proxy_get_listener((struct ::wl_proxy *)object) != (void *)&m_qt_hardware_integration_listener)
            return nullptr;
        return static_cast<qt_hardware_integration *>(qt_hardware_integration_get_user_data(object));
    }

    bool qt_hardware_integration::isInitialized() const
    {
        return m_qt_hardware_integration != nullptr;
    }

    const struct wl_interface *qt_hardware_integration::interface()
    {
        return &::qt_hardware_integration_interface;
    }

    void qt_hardware_integration::hardware_integration_client_backend(const QString &)
    {
    }

    void qt_hardware_integration::handle_client_backend(
        void *data,
        struct ::qt_hardware_integration *object,
        const char *name)
    {
        Q_UNUSED(object);
        static_cast<qt_hardware_integration *>(data)->hardware_integration_client_backend(
            QString::fromUtf8(name));
    }

    void qt_hardware_integration::hardware_integration_server_backend(const QString &)
    {
    }

    void qt_hardware_integration::handle_server_backend(
        void *data,
        struct ::qt_hardware_integration *object,
        const char *name)
    {
        Q_UNUSED(object);
        static_cast<qt_hardware_integration *>(data)->hardware_integration_server_backend(
            QString::fromUtf8(name));
    }

    const struct qt_hardware_integration_listener qt_hardware_integration::m_qt_hardware_integration_listener = {
        qt_hardware_integration::handle_client_backend,
        qt_hardware_integration::handle_server_backend
    };

    void qt_hardware_integration::init_listener()
    {
        qt_hardware_integration_add_listener(m_qt_hardware_integration, &m_qt_hardware_integration_listener, this);
    }
}

QT_WARNING_POP
QT_END_NAMESPACE
