// This file was generated by qtwaylandscanner
// source file is /build/qt6-wayland/src/qtwayland-everywhere-src-6.4.0/src/client/../extensions/surface-extension.xml

#include <QtWaylandClient/private/wayland-wayland-client-protocol.h>
#include <QtWaylandClient/private/qwayland-surface-extension.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;
    return (void *) wl_proxy_marshal_constructor_versioned((struct wl_proxy *) registry,
    bindOpCode, interface, version, name, interface->name, version, nullptr);
}

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

    qt_surface_extension::qt_surface_extension(struct ::qt_surface_extension *obj)
        : m_qt_surface_extension(obj)
    {
    }

    qt_surface_extension::qt_surface_extension()
        : m_qt_surface_extension(nullptr)
    {
    }

    qt_surface_extension::~qt_surface_extension()
    {
    }

    void qt_surface_extension::init(struct ::wl_registry *registry, uint32_t id, int version)
    {
        m_qt_surface_extension = static_cast<struct ::qt_surface_extension *>(wlRegistryBind(registry, id, &qt_surface_extension_interface, version));
    }

    void qt_surface_extension::init(struct ::qt_surface_extension *obj)
    {
        m_qt_surface_extension = obj;
    }

    qt_surface_extension *qt_surface_extension::fromObject(struct ::qt_surface_extension *object)
    {
        return static_cast<qt_surface_extension *>(qt_surface_extension_get_user_data(object));
    }

    bool qt_surface_extension::isInitialized() const
    {
        return m_qt_surface_extension != nullptr;
    }

    uint32_t qt_surface_extension::version() const
    {
        return wl_proxy_get_version(reinterpret_cast<wl_proxy*>(m_qt_surface_extension));
    }

    const struct wl_interface *qt_surface_extension::interface()
    {
        return &::qt_surface_extension_interface;
    }

    struct ::qt_extended_surface *qt_surface_extension::get_extended_surface(struct ::wl_surface *surface)
    {
        return ::qt_surface_extension_get_extended_surface(
            m_qt_surface_extension,
            surface);
    }

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

    qt_extended_surface::qt_extended_surface(struct ::qt_extended_surface *obj)
        : m_qt_extended_surface(obj)
    {
        init_listener();
    }

    qt_extended_surface::qt_extended_surface()
        : m_qt_extended_surface(nullptr)
    {
    }

    qt_extended_surface::~qt_extended_surface()
    {
    }

    void qt_extended_surface::init(struct ::wl_registry *registry, uint32_t id, int version)
    {
        m_qt_extended_surface = static_cast<struct ::qt_extended_surface *>(wlRegistryBind(registry, id, &qt_extended_surface_interface, version));
        init_listener();
    }

    void qt_extended_surface::init(struct ::qt_extended_surface *obj)
    {
        m_qt_extended_surface = obj;
        init_listener();
    }

    qt_extended_surface *qt_extended_surface::fromObject(struct ::qt_extended_surface *object)
    {
        if (wl_proxy_get_listener((struct ::wl_proxy *)object) != (void *)&m_qt_extended_surface_listener)
            return nullptr;
        return static_cast<qt_extended_surface *>(qt_extended_surface_get_user_data(object));
    }

    bool qt_extended_surface::isInitialized() const
    {
        return m_qt_extended_surface != nullptr;
    }

    uint32_t qt_extended_surface::version() const
    {
        return wl_proxy_get_version(reinterpret_cast<wl_proxy*>(m_qt_extended_surface));
    }

    const struct wl_interface *qt_extended_surface::interface()
    {
        return &::qt_extended_surface_interface;
    }

    void qt_extended_surface::update_generic_property(const QString &name, const QByteArray &value)
    {
        struct wl_array value_data;
        value_data.size = value.size();
        value_data.data = static_cast<void *>(const_cast<char *>(value.constData()));
        value_data.alloc = 0;

        ::qt_extended_surface_update_generic_property(
            m_qt_extended_surface,
            name.toUtf8().constData(),
            &value_data);
    }

    void qt_extended_surface::set_content_orientation_mask(int32_t orientation)
    {
        ::qt_extended_surface_set_content_orientation_mask(
            m_qt_extended_surface,
            orientation);
    }

    void qt_extended_surface::set_window_flags(int32_t flags)
    {
        ::qt_extended_surface_set_window_flags(
            m_qt_extended_surface,
            flags);
    }

    void qt_extended_surface::raise()
    {
        ::qt_extended_surface_raise(
            m_qt_extended_surface);
    }

    void qt_extended_surface::lower()
    {
        ::qt_extended_surface_lower(
            m_qt_extended_surface);
    }

    void qt_extended_surface::extended_surface_onscreen_visibility(int32_t )
    {
    }

    void qt_extended_surface::handle_onscreen_visibility(
        void *data,
        struct ::qt_extended_surface *object,
        int32_t visible)
    {
        Q_UNUSED(object);
        static_cast<qt_extended_surface *>(data)->extended_surface_onscreen_visibility(
            visible);
    }

    void qt_extended_surface::extended_surface_set_generic_property(const QString &, wl_array *)
    {
    }

    void qt_extended_surface::handle_set_generic_property(
        void *data,
        struct ::qt_extended_surface *object,
        const char *name,
        wl_array *value)
    {
        Q_UNUSED(object);
        static_cast<qt_extended_surface *>(data)->extended_surface_set_generic_property(
            QString::fromUtf8(name),
            value);
    }

    void qt_extended_surface::extended_surface_close()
    {
    }

    void qt_extended_surface::handle_close(
        void *data,
        struct ::qt_extended_surface *object)
    {
        Q_UNUSED(object);
        static_cast<qt_extended_surface *>(data)->extended_surface_close();
    }

    const struct qt_extended_surface_listener qt_extended_surface::m_qt_extended_surface_listener = {
        qt_extended_surface::handle_onscreen_visibility,
        qt_extended_surface::handle_set_generic_property,
        qt_extended_surface::handle_close,
    };

    void qt_extended_surface::init_listener()
    {
        qt_extended_surface_add_listener(m_qt_extended_surface, &m_qt_extended_surface_listener, this);
    }
}

QT_WARNING_POP
QT_END_NAMESPACE
