#include "qwayland-ivi-controller.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
}

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

    ivi_controller_surface::ivi_controller_surface(struct ::ivi_controller_surface *obj)
        : m_ivi_controller_surface(obj)
    {
        init_listener();
    }

    ivi_controller_surface::ivi_controller_surface()
        : m_ivi_controller_surface(nullptr)
    {
    }

    ivi_controller_surface::~ivi_controller_surface()
    {
    }

    void ivi_controller_surface::init(struct ::wl_registry *registry, int id, int version)
    {
        m_ivi_controller_surface = static_cast<struct ::ivi_controller_surface *>(wlRegistryBind(registry, id, &ivi_controller_surface_interface, version));
        init_listener();
    }

    void ivi_controller_surface::init(struct ::ivi_controller_surface *obj)
    {
        m_ivi_controller_surface = obj;
        init_listener();
    }

    ivi_controller_surface *ivi_controller_surface::fromObject(struct ::ivi_controller_surface *object)
    {
        if (wl_proxy_get_listener((struct ::wl_proxy *)object) != (void *)&m_ivi_controller_surface_listener)
            return nullptr;
        return static_cast<ivi_controller_surface *>(ivi_controller_surface_get_user_data(object));
    }

    bool ivi_controller_surface::isInitialized() const
    {
        return m_ivi_controller_surface != nullptr;
    }

    const struct wl_interface *ivi_controller_surface::interface()
    {
        return &::ivi_controller_surface_interface;
    }

    void ivi_controller_surface::set_visibility(uint32_t visibility)
    {
        ivi_controller_surface_set_visibility(
            m_ivi_controller_surface,
            visibility);
    }

    void ivi_controller_surface::set_opacity(wl_fixed_t opacity)
    {
        ivi_controller_surface_set_opacity(
            m_ivi_controller_surface,
            opacity);
    }

    void ivi_controller_surface::set_source_rectangle(int32_t x, int32_t y, int32_t width, int32_t height)
    {
        ivi_controller_surface_set_source_rectangle(
            m_ivi_controller_surface,
            x,
            y,
            width,
            height);
    }

    void ivi_controller_surface::set_destination_rectangle(int32_t x, int32_t y, int32_t width, int32_t height)
    {
        ivi_controller_surface_set_destination_rectangle(
            m_ivi_controller_surface,
            x,
            y,
            width,
            height);
    }

    void ivi_controller_surface::set_configuration(int32_t width, int32_t height)
    {
        ivi_controller_surface_set_configuration(
            m_ivi_controller_surface,
            width,
            height);
    }

    void ivi_controller_surface::set_orientation(int32_t orientation)
    {
        ivi_controller_surface_set_orientation(
            m_ivi_controller_surface,
            orientation);
    }

    void ivi_controller_surface::screenshot(const QString &filename)
    {
        ivi_controller_surface_screenshot(
            m_ivi_controller_surface,
            filename.toUtf8().constData());
    }

    void ivi_controller_surface::send_stats()
    {
        ivi_controller_surface_send_stats(
            m_ivi_controller_surface);
    }

    void ivi_controller_surface::destroy(int32_t destroy_scene_object)
    {
        ivi_controller_surface_destroy(
            m_ivi_controller_surface,
            destroy_scene_object);
        m_ivi_controller_surface = nullptr;
    }

    void ivi_controller_surface::ivi_controller_surface_visibility(int32_t )
    {
    }

    void ivi_controller_surface::handle_visibility(
        void *data,
        struct ::ivi_controller_surface *object,
        int32_t visibility)
    {
        Q_UNUSED(object);
        static_cast<ivi_controller_surface *>(data)->ivi_controller_surface_visibility(
            visibility);
    }

    void ivi_controller_surface::ivi_controller_surface_opacity(wl_fixed_t )
    {
    }

    void ivi_controller_surface::handle_opacity(
        void *data,
        struct ::ivi_controller_surface *object,
        wl_fixed_t opacity)
    {
        Q_UNUSED(object);
        static_cast<ivi_controller_surface *>(data)->ivi_controller_surface_opacity(
            opacity);
    }

    void ivi_controller_surface::ivi_controller_surface_source_rectangle(int32_t , int32_t , int32_t , int32_t )
    {
    }

    void ivi_controller_surface::handle_source_rectangle(
        void *data,
        struct ::ivi_controller_surface *object,
        int32_t x,
        int32_t y,
        int32_t width,
        int32_t height)
    {
        Q_UNUSED(object);
        static_cast<ivi_controller_surface *>(data)->ivi_controller_surface_source_rectangle(
            x,
            y,
            width,
            height);
    }

    void ivi_controller_surface::ivi_controller_surface_destination_rectangle(int32_t , int32_t , int32_t , int32_t )
    {
    }

    void ivi_controller_surface::handle_destination_rectangle(
        void *data,
        struct ::ivi_controller_surface *object,
        int32_t x,
        int32_t y,
        int32_t width,
        int32_t height)
    {
        Q_UNUSED(object);
        static_cast<ivi_controller_surface *>(data)->ivi_controller_surface_destination_rectangle(
            x,
            y,
            width,
            height);
    }

    void ivi_controller_surface::ivi_controller_surface_configuration(int32_t , int32_t )
    {
    }

    void ivi_controller_surface::handle_configuration(
        void *data,
        struct ::ivi_controller_surface *object,
        int32_t width,
        int32_t height)
    {
        Q_UNUSED(object);
        static_cast<ivi_controller_surface *>(data)->ivi_controller_surface_configuration(
            width,
            height);
    }

    void ivi_controller_surface::ivi_controller_surface_orientation(int32_t )
    {
    }

    void ivi_controller_surface::handle_orientation(
        void *data,
        struct ::ivi_controller_surface *object,
        int32_t orientation)
    {
        Q_UNUSED(object);
        static_cast<ivi_controller_surface *>(data)->ivi_controller_surface_orientation(
            orientation);
    }

    void ivi_controller_surface::ivi_controller_surface_pixelformat(int32_t )
    {
    }

    void ivi_controller_surface::handle_pixelformat(
        void *data,
        struct ::ivi_controller_surface *object,
        int32_t pixelformat)
    {
        Q_UNUSED(object);
        static_cast<ivi_controller_surface *>(data)->ivi_controller_surface_pixelformat(
            pixelformat);
    }

    void ivi_controller_surface::ivi_controller_surface_layer(struct ::ivi_controller_layer *)
    {
    }

    void ivi_controller_surface::handle_layer(
        void *data,
        struct ::ivi_controller_surface *object,
        struct ::ivi_controller_layer *layer)
    {
        Q_UNUSED(object);
        static_cast<ivi_controller_surface *>(data)->ivi_controller_surface_layer(
            layer);
    }

    void ivi_controller_surface::ivi_controller_surface_stats(uint32_t , uint32_t , uint32_t , uint32_t , const QString &)
    {
    }

    void ivi_controller_surface::handle_stats(
        void *data,
        struct ::ivi_controller_surface *object,
        uint32_t redraw_count,
        uint32_t frame_count,
        uint32_t update_count,
        uint32_t pid,
        const char *process_name)
    {
        Q_UNUSED(object);
        static_cast<ivi_controller_surface *>(data)->ivi_controller_surface_stats(
            redraw_count,
            frame_count,
            update_count,
            pid,
            QString::fromUtf8(process_name));
    }

    void ivi_controller_surface::ivi_controller_surface_destroyed()
    {
    }

    void ivi_controller_surface::handle_destroyed(
        void *data,
        struct ::ivi_controller_surface *object)
    {
        Q_UNUSED(object);
        static_cast<ivi_controller_surface *>(data)->ivi_controller_surface_destroyed();
    }

    void ivi_controller_surface::ivi_controller_surface_content(int32_t )
    {
    }

    void ivi_controller_surface::handle_content(
        void *data,
        struct ::ivi_controller_surface *object,
        int32_t content_state)
    {
        Q_UNUSED(object);
        static_cast<ivi_controller_surface *>(data)->ivi_controller_surface_content(
            content_state);
    }

    const struct ivi_controller_surface_listener ivi_controller_surface::m_ivi_controller_surface_listener = {
        ivi_controller_surface::handle_visibility,
        ivi_controller_surface::handle_opacity,
        ivi_controller_surface::handle_source_rectangle,
        ivi_controller_surface::handle_destination_rectangle,
        ivi_controller_surface::handle_configuration,
        ivi_controller_surface::handle_orientation,
        ivi_controller_surface::handle_pixelformat,
        ivi_controller_surface::handle_layer,
        ivi_controller_surface::handle_stats,
        ivi_controller_surface::handle_destroyed,
        ivi_controller_surface::handle_content
    };

    void ivi_controller_surface::init_listener()
    {
        ivi_controller_surface_add_listener(m_ivi_controller_surface, &m_ivi_controller_surface_listener, this);
    }

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

    ivi_controller_layer::ivi_controller_layer(struct ::ivi_controller_layer *obj)
        : m_ivi_controller_layer(obj)
    {
        init_listener();
    }

    ivi_controller_layer::ivi_controller_layer()
        : m_ivi_controller_layer(nullptr)
    {
    }

    ivi_controller_layer::~ivi_controller_layer()
    {
    }

    void ivi_controller_layer::init(struct ::wl_registry *registry, int id, int version)
    {
        m_ivi_controller_layer = static_cast<struct ::ivi_controller_layer *>(wlRegistryBind(registry, id, &ivi_controller_layer_interface, version));
        init_listener();
    }

    void ivi_controller_layer::init(struct ::ivi_controller_layer *obj)
    {
        m_ivi_controller_layer = obj;
        init_listener();
    }

    ivi_controller_layer *ivi_controller_layer::fromObject(struct ::ivi_controller_layer *object)
    {
        if (wl_proxy_get_listener((struct ::wl_proxy *)object) != (void *)&m_ivi_controller_layer_listener)
            return nullptr;
        return static_cast<ivi_controller_layer *>(ivi_controller_layer_get_user_data(object));
    }

    bool ivi_controller_layer::isInitialized() const
    {
        return m_ivi_controller_layer != nullptr;
    }

    const struct wl_interface *ivi_controller_layer::interface()
    {
        return &::ivi_controller_layer_interface;
    }

    void ivi_controller_layer::set_visibility(uint32_t visibility)
    {
        ivi_controller_layer_set_visibility(
            m_ivi_controller_layer,
            visibility);
    }

    void ivi_controller_layer::set_opacity(wl_fixed_t opacity)
    {
        ivi_controller_layer_set_opacity(
            m_ivi_controller_layer,
            opacity);
    }

    void ivi_controller_layer::set_source_rectangle(int32_t x, int32_t y, int32_t width, int32_t height)
    {
        ivi_controller_layer_set_source_rectangle(
            m_ivi_controller_layer,
            x,
            y,
            width,
            height);
    }

    void ivi_controller_layer::set_destination_rectangle(int32_t x, int32_t y, int32_t width, int32_t height)
    {
        ivi_controller_layer_set_destination_rectangle(
            m_ivi_controller_layer,
            x,
            y,
            width,
            height);
    }

    void ivi_controller_layer::set_configuration(int32_t width, int32_t height)
    {
        ivi_controller_layer_set_configuration(
            m_ivi_controller_layer,
            width,
            height);
    }

    void ivi_controller_layer::set_orientation(int32_t orientation)
    {
        ivi_controller_layer_set_orientation(
            m_ivi_controller_layer,
            orientation);
    }

    void ivi_controller_layer::screenshot(const QString &filename)
    {
        ivi_controller_layer_screenshot(
            m_ivi_controller_layer,
            filename.toUtf8().constData());
    }

    void ivi_controller_layer::clear_surfaces()
    {
        ivi_controller_layer_clear_surfaces(
            m_ivi_controller_layer);
    }

    void ivi_controller_layer::add_surface(struct ::ivi_controller_surface *surface)
    {
        ivi_controller_layer_add_surface(
            m_ivi_controller_layer,
            surface);
    }

    void ivi_controller_layer::remove_surface(struct ::ivi_controller_surface *surface)
    {
        ivi_controller_layer_remove_surface(
            m_ivi_controller_layer,
            surface);
    }

    void ivi_controller_layer::set_render_order(const QByteArray &id_surfaces)
    {
        struct wl_array id_surfaces_data;
        id_surfaces_data.size = id_surfaces.size();
        id_surfaces_data.data = static_cast<void *>(const_cast<char *>(id_surfaces.constData()));
        id_surfaces_data.alloc = 0;

        ivi_controller_layer_set_render_order(
            m_ivi_controller_layer,
            &id_surfaces_data);
    }

    void ivi_controller_layer::destroy(int32_t destroy_scene_object)
    {
        ivi_controller_layer_destroy(
            m_ivi_controller_layer,
            destroy_scene_object);
        m_ivi_controller_layer = nullptr;
    }

    void ivi_controller_layer::ivi_controller_layer_visibility(int32_t )
    {
    }

    void ivi_controller_layer::handle_visibility(
        void *data,
        struct ::ivi_controller_layer *object,
        int32_t visibility)
    {
        Q_UNUSED(object);
        static_cast<ivi_controller_layer *>(data)->ivi_controller_layer_visibility(
            visibility);
    }

    void ivi_controller_layer::ivi_controller_layer_opacity(wl_fixed_t )
    {
    }

    void ivi_controller_layer::handle_opacity(
        void *data,
        struct ::ivi_controller_layer *object,
        wl_fixed_t opacity)
    {
        Q_UNUSED(object);
        static_cast<ivi_controller_layer *>(data)->ivi_controller_layer_opacity(
            opacity);
    }

    void ivi_controller_layer::ivi_controller_layer_source_rectangle(int32_t , int32_t , int32_t , int32_t )
    {
    }

    void ivi_controller_layer::handle_source_rectangle(
        void *data,
        struct ::ivi_controller_layer *object,
        int32_t x,
        int32_t y,
        int32_t width,
        int32_t height)
    {
        Q_UNUSED(object);
        static_cast<ivi_controller_layer *>(data)->ivi_controller_layer_source_rectangle(
            x,
            y,
            width,
            height);
    }

    void ivi_controller_layer::ivi_controller_layer_destination_rectangle(int32_t , int32_t , int32_t , int32_t )
    {
    }

    void ivi_controller_layer::handle_destination_rectangle(
        void *data,
        struct ::ivi_controller_layer *object,
        int32_t x,
        int32_t y,
        int32_t width,
        int32_t height)
    {
        Q_UNUSED(object);
        static_cast<ivi_controller_layer *>(data)->ivi_controller_layer_destination_rectangle(
            x,
            y,
            width,
            height);
    }

    void ivi_controller_layer::ivi_controller_layer_configuration(int32_t , int32_t )
    {
    }

    void ivi_controller_layer::handle_configuration(
        void *data,
        struct ::ivi_controller_layer *object,
        int32_t width,
        int32_t height)
    {
        Q_UNUSED(object);
        static_cast<ivi_controller_layer *>(data)->ivi_controller_layer_configuration(
            width,
            height);
    }

    void ivi_controller_layer::ivi_controller_layer_orientation(int32_t )
    {
    }

    void ivi_controller_layer::handle_orientation(
        void *data,
        struct ::ivi_controller_layer *object,
        int32_t orientation)
    {
        Q_UNUSED(object);
        static_cast<ivi_controller_layer *>(data)->ivi_controller_layer_orientation(
            orientation);
    }

    void ivi_controller_layer::ivi_controller_layer_screen(struct ::wl_output *)
    {
    }

    void ivi_controller_layer::handle_screen(
        void *data,
        struct ::ivi_controller_layer *object,
        struct ::wl_output *screen)
    {
        Q_UNUSED(object);
        static_cast<ivi_controller_layer *>(data)->ivi_controller_layer_screen(
            screen);
    }

    void ivi_controller_layer::ivi_controller_layer_destroyed()
    {
    }

    void ivi_controller_layer::handle_destroyed(
        void *data,
        struct ::ivi_controller_layer *object)
    {
        Q_UNUSED(object);
        static_cast<ivi_controller_layer *>(data)->ivi_controller_layer_destroyed();
    }

    const struct ivi_controller_layer_listener ivi_controller_layer::m_ivi_controller_layer_listener = {
        ivi_controller_layer::handle_visibility,
        ivi_controller_layer::handle_opacity,
        ivi_controller_layer::handle_source_rectangle,
        ivi_controller_layer::handle_destination_rectangle,
        ivi_controller_layer::handle_configuration,
        ivi_controller_layer::handle_orientation,
        ivi_controller_layer::handle_screen,
        ivi_controller_layer::handle_destroyed
    };

    void ivi_controller_layer::init_listener()
    {
        ivi_controller_layer_add_listener(m_ivi_controller_layer, &m_ivi_controller_layer_listener, this);
    }

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

    ivi_controller_screen::ivi_controller_screen(struct ::ivi_controller_screen *obj)
        : m_ivi_controller_screen(obj)
    {
    }

    ivi_controller_screen::ivi_controller_screen()
        : m_ivi_controller_screen(nullptr)
    {
    }

    ivi_controller_screen::~ivi_controller_screen()
    {
    }

    void ivi_controller_screen::init(struct ::wl_registry *registry, int id, int version)
    {
        m_ivi_controller_screen = static_cast<struct ::ivi_controller_screen *>(wlRegistryBind(registry, id, &ivi_controller_screen_interface, version));
    }

    void ivi_controller_screen::init(struct ::ivi_controller_screen *obj)
    {
        m_ivi_controller_screen = obj;
    }

    ivi_controller_screen *ivi_controller_screen::fromObject(struct ::ivi_controller_screen *object)
    {
        return static_cast<ivi_controller_screen *>(ivi_controller_screen_get_user_data(object));
    }

    bool ivi_controller_screen::isInitialized() const
    {
        return m_ivi_controller_screen != nullptr;
    }

    const struct wl_interface *ivi_controller_screen::interface()
    {
        return &::ivi_controller_screen_interface;
    }

    void ivi_controller_screen::destroy()
    {
        ivi_controller_screen_destroy(
            m_ivi_controller_screen);
        m_ivi_controller_screen = nullptr;
    }

    void ivi_controller_screen::clear()
    {
        ivi_controller_screen_clear(
            m_ivi_controller_screen);
    }

    void ivi_controller_screen::add_layer(struct ::ivi_controller_layer *layer)
    {
        ivi_controller_screen_add_layer(
            m_ivi_controller_screen,
            layer);
    }

    void ivi_controller_screen::screenshot(const QString &filename)
    {
        ivi_controller_screen_screenshot(
            m_ivi_controller_screen,
            filename.toUtf8().constData());
    }

    void ivi_controller_screen::set_render_order(const QByteArray &id_layers)
    {
        struct wl_array id_layers_data;
        id_layers_data.size = id_layers.size();
        id_layers_data.data = static_cast<void *>(const_cast<char *>(id_layers.constData()));
        id_layers_data.alloc = 0;

        ivi_controller_screen_set_render_order(
            m_ivi_controller_screen,
            &id_layers_data);
    }

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

    ivi_controller::ivi_controller(struct ::ivi_controller *obj)
        : m_ivi_controller(obj)
    {
        init_listener();
    }

    ivi_controller::ivi_controller()
        : m_ivi_controller(nullptr)
    {
    }

    ivi_controller::~ivi_controller()
    {
    }

    void ivi_controller::init(struct ::wl_registry *registry, int id, int version)
    {
        m_ivi_controller = static_cast<struct ::ivi_controller *>(wlRegistryBind(registry, id, &ivi_controller_interface, version));
        init_listener();
    }

    void ivi_controller::init(struct ::ivi_controller *obj)
    {
        m_ivi_controller = obj;
        init_listener();
    }

    ivi_controller *ivi_controller::fromObject(struct ::ivi_controller *object)
    {
        if (wl_proxy_get_listener((struct ::wl_proxy *)object) != (void *)&m_ivi_controller_listener)
            return nullptr;
        return static_cast<ivi_controller *>(ivi_controller_get_user_data(object));
    }

    bool ivi_controller::isInitialized() const
    {
        return m_ivi_controller != nullptr;
    }

    const struct wl_interface *ivi_controller::interface()
    {
        return &::ivi_controller_interface;
    }

    void ivi_controller::commit_changes()
    {
        ivi_controller_commit_changes(
            m_ivi_controller);
    }

    struct ::ivi_controller_layer *ivi_controller::layer_create(uint32_t id_layer, int32_t width, int32_t height)
    {
        return ivi_controller_layer_create(
            m_ivi_controller,
            id_layer,
            width,
            height);
    }

    struct ::ivi_controller_surface *ivi_controller::surface_create(uint32_t id_surface)
    {
        return ivi_controller_surface_create(
            m_ivi_controller,
            id_surface);
    }

    void ivi_controller::ivi_controller_screen(uint32_t , struct ::ivi_controller_screen *)
    {
    }

    void ivi_controller::handle_screen(
        void *data,
        struct ::ivi_controller *object,
        uint32_t id_screen,
        struct ::ivi_controller_screen *screen)
    {
        Q_UNUSED(object);
        static_cast<ivi_controller *>(data)->ivi_controller_screen(
            id_screen,
            screen);
    }

    void ivi_controller::ivi_controller_layer(uint32_t )
    {
    }

    void ivi_controller::handle_layer(
        void *data,
        struct ::ivi_controller *object,
        uint32_t id_layer)
    {
        Q_UNUSED(object);
        static_cast<ivi_controller *>(data)->ivi_controller_layer(
            id_layer);
    }

    void ivi_controller::ivi_controller_surface(uint32_t )
    {
    }

    void ivi_controller::handle_surface(
        void *data,
        struct ::ivi_controller *object,
        uint32_t id_surface)
    {
        Q_UNUSED(object);
        static_cast<ivi_controller *>(data)->ivi_controller_surface(
            id_surface);
    }

    void ivi_controller::ivi_controller_error(int32_t , int32_t , int32_t , const QString &)
    {
    }

    void ivi_controller::handle_error(
        void *data,
        struct ::ivi_controller *object,
        int32_t object_id,
        int32_t object_type,
        int32_t error_code,
        const char *error_text)
    {
        Q_UNUSED(object);
        static_cast<ivi_controller *>(data)->ivi_controller_error(
            object_id,
            object_type,
            error_code,
            QString::fromUtf8(error_text));
    }

    const struct ivi_controller_listener ivi_controller::m_ivi_controller_listener = {
        ivi_controller::handle_screen,
        ivi_controller::handle_layer,
        ivi_controller::handle_surface,
        ivi_controller::handle_error
    };

    void ivi_controller::init_listener()
    {
        ivi_controller_add_listener(m_ivi_controller, &m_ivi_controller_listener, this);
    }
}

QT_WARNING_POP
QT_END_NAMESPACE
