// This file was generated by qtwaylandscanner
// source file is /usr/share/deepin-wayland-protocols/outputdevice.xml

#include "qwayland-server-org-kde-kwin-outputdevice.h"

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

namespace QtWaylandServer {

    int org_kde_kwin_outputdevice::deferred_destroy_global_func(void *data) {
        auto object = static_cast<org_kde_kwin_outputdevice *>(data);
        wl_global_destroy(object->m_global);
        object->m_global = nullptr;
        wl_event_source_remove(object->m_globalRemovedEvent);
        object->m_globalRemovedEvent = nullptr;
        wl_list_remove(&object->m_displayDestroyedListener.link);
        object->org_kde_kwin_outputdevice_destroy_global();
        return 0;
    }

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

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

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

    org_kde_kwin_outputdevice::org_kde_kwin_outputdevice()
        : m_resource_map()
        , m_resource(nullptr)
        , m_global(nullptr)
        , m_display(nullptr)
        , m_globalRemovedEvent(nullptr)
    {
    }

    org_kde_kwin_outputdevice::~org_kde_kwin_outputdevice()
    {
        for (auto resource : std::as_const(m_resource_map))
            resource->org_kde_kwin_outputdevice_object = nullptr;

        if (m_resource)
            m_resource->org_kde_kwin_outputdevice_object = nullptr;

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

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

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

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

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

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

    const struct wl_interface *org_kde_kwin_outputdevice::interface()
    {
        return &::org_kde_kwin_outputdevice_interface;
    }

    org_kde_kwin_outputdevice::Resource *org_kde_kwin_outputdevice::org_kde_kwin_outputdevice_allocate()
    {
        return new Resource;
    }

    void org_kde_kwin_outputdevice::org_kde_kwin_outputdevice_destroy_global()
    {
    }

    void org_kde_kwin_outputdevice::org_kde_kwin_outputdevice_bind_resource(Resource *)
    {
    }

    void org_kde_kwin_outputdevice::org_kde_kwin_outputdevice_destroy_resource(Resource *)
    {
    }

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

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

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

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


    void org_kde_kwin_outputdevice::globalRemove()
    {
        if (!m_global || m_globalRemovedEvent)
            return;

        wl_global_remove(m_global);

        struct wl_event_loop *event_loop = wl_display_get_event_loop(m_display);
        m_globalRemovedEvent = wl_event_loop_add_timer(event_loop, deferred_destroy_global_func, this);
        wl_event_source_timer_update(m_globalRemovedEvent, 10000);
    }

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

    org_kde_kwin_outputdevice::Resource *org_kde_kwin_outputdevice::bind(struct ::wl_resource *handle)
    {
        Resource *resource = org_kde_kwin_outputdevice_allocate();
        resource->org_kde_kwin_outputdevice_object = this;

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

    void org_kde_kwin_outputdevice::send_geometry(int32_t x, int32_t y, int32_t physical_width, int32_t physical_height, int32_t subpixel, const QString &make, const QString &model, int32_t transform)
    {
        Q_ASSERT_X(m_resource, "org_kde_kwin_outputdevice::geometry", "Uninitialised resource");
        if (Q_UNLIKELY(!m_resource)) {
            qWarning("could not call org_kde_kwin_outputdevice::geometry as it's not initialised");
            return;
        }
        send_geometry(
            m_resource->handle,
            x,
            y,
            physical_width,
            physical_height,
            subpixel,
            make,
            model,
            transform);
    }

    void org_kde_kwin_outputdevice::send_geometry(struct ::wl_resource *resource, int32_t x, int32_t y, int32_t physical_width, int32_t physical_height, int32_t subpixel, const QString &make, const QString &model, int32_t transform)
    {
        org_kde_kwin_outputdevice_send_geometry(
            resource,
            x,
            y,
            physical_width,
            physical_height,
            subpixel,
            make.toUtf8().constData(),
            model.toUtf8().constData(),
            transform);
    }


    void org_kde_kwin_outputdevice::send_mode(uint32_t flags, int32_t width, int32_t height, int32_t refresh, int32_t mode_id)
    {
        Q_ASSERT_X(m_resource, "org_kde_kwin_outputdevice::mode", "Uninitialised resource");
        if (Q_UNLIKELY(!m_resource)) {
            qWarning("could not call org_kde_kwin_outputdevice::mode as it's not initialised");
            return;
        }
        send_mode(
            m_resource->handle,
            flags,
            width,
            height,
            refresh,
            mode_id);
    }

    void org_kde_kwin_outputdevice::send_mode(struct ::wl_resource *resource, uint32_t flags, int32_t width, int32_t height, int32_t refresh, int32_t mode_id)
    {
        org_kde_kwin_outputdevice_send_mode(
            resource,
            flags,
            width,
            height,
            refresh,
            mode_id);
    }


    void org_kde_kwin_outputdevice::send_done()
    {
        Q_ASSERT_X(m_resource, "org_kde_kwin_outputdevice::done", "Uninitialised resource");
        if (Q_UNLIKELY(!m_resource)) {
            qWarning("could not call org_kde_kwin_outputdevice::done as it's not initialised");
            return;
        }
        send_done(
            m_resource->handle);
    }

    void org_kde_kwin_outputdevice::send_done(struct ::wl_resource *resource)
    {
        org_kde_kwin_outputdevice_send_done(
            resource);
    }


    void org_kde_kwin_outputdevice::send_scale(int32_t factor)
    {
        Q_ASSERT_X(m_resource, "org_kde_kwin_outputdevice::scale", "Uninitialised resource");
        if (Q_UNLIKELY(!m_resource)) {
            qWarning("could not call org_kde_kwin_outputdevice::scale as it's not initialised");
            return;
        }
        send_scale(
            m_resource->handle,
            factor);
    }

    void org_kde_kwin_outputdevice::send_scale(struct ::wl_resource *resource, int32_t factor)
    {
        org_kde_kwin_outputdevice_send_scale(
            resource,
            factor);
    }


    void org_kde_kwin_outputdevice::send_edid(const QString &raw)
    {
        Q_ASSERT_X(m_resource, "org_kde_kwin_outputdevice::edid", "Uninitialised resource");
        if (Q_UNLIKELY(!m_resource)) {
            qWarning("could not call org_kde_kwin_outputdevice::edid as it's not initialised");
            return;
        }
        send_edid(
            m_resource->handle,
            raw);
    }

    void org_kde_kwin_outputdevice::send_edid(struct ::wl_resource *resource, const QString &raw)
    {
        org_kde_kwin_outputdevice_send_edid(
            resource,
            raw.toUtf8().constData());
    }


    void org_kde_kwin_outputdevice::send_enabled(int32_t enabled)
    {
        Q_ASSERT_X(m_resource, "org_kde_kwin_outputdevice::enabled", "Uninitialised resource");
        if (Q_UNLIKELY(!m_resource)) {
            qWarning("could not call org_kde_kwin_outputdevice::enabled as it's not initialised");
            return;
        }
        send_enabled(
            m_resource->handle,
            enabled);
    }

    void org_kde_kwin_outputdevice::send_enabled(struct ::wl_resource *resource, int32_t enabled)
    {
        org_kde_kwin_outputdevice_send_enabled(
            resource,
            enabled);
    }


    void org_kde_kwin_outputdevice::send_uuid(const QString &uuid)
    {
        Q_ASSERT_X(m_resource, "org_kde_kwin_outputdevice::uuid", "Uninitialised resource");
        if (Q_UNLIKELY(!m_resource)) {
            qWarning("could not call org_kde_kwin_outputdevice::uuid as it's not initialised");
            return;
        }
        send_uuid(
            m_resource->handle,
            uuid);
    }

    void org_kde_kwin_outputdevice::send_uuid(struct ::wl_resource *resource, const QString &uuid)
    {
        org_kde_kwin_outputdevice_send_uuid(
            resource,
            uuid.toUtf8().constData());
    }


    void org_kde_kwin_outputdevice::send_scalef(wl_fixed_t factor)
    {
        Q_ASSERT_X(m_resource, "org_kde_kwin_outputdevice::scalef", "Uninitialised resource");
        if (Q_UNLIKELY(!m_resource)) {
            qWarning("could not call org_kde_kwin_outputdevice::scalef as it's not initialised");
            return;
        }
        send_scalef(
            m_resource->handle,
            factor);
    }

    void org_kde_kwin_outputdevice::send_scalef(struct ::wl_resource *resource, wl_fixed_t factor)
    {
        org_kde_kwin_outputdevice_send_scalef(
            resource,
            factor);
    }


    void org_kde_kwin_outputdevice::send_colorcurves(const QByteArray &red, const QByteArray &green, const QByteArray &blue)
    {
        Q_ASSERT_X(m_resource, "org_kde_kwin_outputdevice::colorcurves", "Uninitialised resource");
        if (Q_UNLIKELY(!m_resource)) {
            qWarning("could not call org_kde_kwin_outputdevice::colorcurves as it's not initialised");
            return;
        }
        send_colorcurves(
            m_resource->handle,
            red,
            green,
            blue);
    }

    void org_kde_kwin_outputdevice::send_colorcurves(struct ::wl_resource *resource, const QByteArray &red, const QByteArray &green, const QByteArray &blue)
    {
        struct wl_array red_data;
        red_data.size = red.size();
        red_data.data = static_cast<void *>(const_cast<char *>(red.constData()));
        red_data.alloc = 0;

        struct wl_array green_data;
        green_data.size = green.size();
        green_data.data = static_cast<void *>(const_cast<char *>(green.constData()));
        green_data.alloc = 0;

        struct wl_array blue_data;
        blue_data.size = blue.size();
        blue_data.data = static_cast<void *>(const_cast<char *>(blue.constData()));
        blue_data.alloc = 0;

        org_kde_kwin_outputdevice_send_colorcurves(
            resource,
            &red_data,
            &green_data,
            &blue_data);
    }


    void org_kde_kwin_outputdevice::send_serial_number(const QString &serialNumber)
    {
        Q_ASSERT_X(m_resource, "org_kde_kwin_outputdevice::serial_number", "Uninitialised resource");
        if (Q_UNLIKELY(!m_resource)) {
            qWarning("could not call org_kde_kwin_outputdevice::serial_number as it's not initialised");
            return;
        }
        send_serial_number(
            m_resource->handle,
            serialNumber);
    }

    void org_kde_kwin_outputdevice::send_serial_number(struct ::wl_resource *resource, const QString &serialNumber)
    {
        org_kde_kwin_outputdevice_send_serial_number(
            resource,
            serialNumber.toUtf8().constData());
    }


    void org_kde_kwin_outputdevice::send_eisa_id(const QString &eisaId)
    {
        Q_ASSERT_X(m_resource, "org_kde_kwin_outputdevice::eisa_id", "Uninitialised resource");
        if (Q_UNLIKELY(!m_resource)) {
            qWarning("could not call org_kde_kwin_outputdevice::eisa_id as it's not initialised");
            return;
        }
        send_eisa_id(
            m_resource->handle,
            eisaId);
    }

    void org_kde_kwin_outputdevice::send_eisa_id(struct ::wl_resource *resource, const QString &eisaId)
    {
        org_kde_kwin_outputdevice_send_eisa_id(
            resource,
            eisaId.toUtf8().constData());
    }


    void org_kde_kwin_outputdevice::send_capabilities(uint32_t flags)
    {
        Q_ASSERT_X(m_resource, "org_kde_kwin_outputdevice::capabilities", "Uninitialised resource");
        if (Q_UNLIKELY(!m_resource)) {
            qWarning("could not call org_kde_kwin_outputdevice::capabilities as it's not initialised");
            return;
        }
        send_capabilities(
            m_resource->handle,
            flags);
    }

    void org_kde_kwin_outputdevice::send_capabilities(struct ::wl_resource *resource, uint32_t flags)
    {
        org_kde_kwin_outputdevice_send_capabilities(
            resource,
            flags);
    }


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

    void org_kde_kwin_outputdevice::send_overscan(struct ::wl_resource *resource, uint32_t overscan)
    {
        org_kde_kwin_outputdevice_send_overscan(
            resource,
            overscan);
    }


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

    void org_kde_kwin_outputdevice::send_vrr_policy(struct ::wl_resource *resource, uint32_t vrr_policy)
    {
        org_kde_kwin_outputdevice_send_vrr_policy(
            resource,
            vrr_policy);
    }


    void org_kde_kwin_outputdevice::send_brightness(int32_t brightness)
    {
        Q_ASSERT_X(m_resource, "org_kde_kwin_outputdevice::brightness", "Uninitialised resource");
        if (Q_UNLIKELY(!m_resource)) {
            qWarning("could not call org_kde_kwin_outputdevice::brightness as it's not initialised");
            return;
        }
        send_brightness(
            m_resource->handle,
            brightness);
    }

    void org_kde_kwin_outputdevice::send_brightness(struct ::wl_resource *resource, int32_t brightness)
    {
        org_kde_kwin_outputdevice_send_brightness(
            resource,
            brightness);
    }


    void org_kde_kwin_outputdevice::send_ctm(int32_t red, int32_t green, int32_t blue)
    {
        Q_ASSERT_X(m_resource, "org_kde_kwin_outputdevice::ctm", "Uninitialised resource");
        if (Q_UNLIKELY(!m_resource)) {
            qWarning("could not call org_kde_kwin_outputdevice::ctm as it's not initialised");
            return;
        }
        send_ctm(
            m_resource->handle,
            red,
            green,
            blue);
    }

    void org_kde_kwin_outputdevice::send_ctm(struct ::wl_resource *resource, int32_t red, int32_t green, int32_t blue)
    {
        org_kde_kwin_outputdevice_send_ctm(
            resource,
            red,
            green,
            blue);
    }


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

    void org_kde_kwin_outputdevice::send_rgb_range(struct ::wl_resource *resource, uint32_t rgb_range)
    {
        org_kde_kwin_outputdevice_send_rgb_range(
            resource,
            rgb_range);
    }


    void org_kde_kwin_outputdevice::send_name(const QString &name)
    {
        Q_ASSERT_X(m_resource, "org_kde_kwin_outputdevice::name", "Uninitialised resource");
        if (Q_UNLIKELY(!m_resource)) {
            qWarning("could not call org_kde_kwin_outputdevice::name as it's not initialised");
            return;
        }
        send_name(
            m_resource->handle,
            name);
    }

    void org_kde_kwin_outputdevice::send_name(struct ::wl_resource *resource, const QString &name)
    {
        org_kde_kwin_outputdevice_send_name(
            resource,
            name.toUtf8().constData());
    }


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

    void org_kde_kwin_outputdevice::send_color_mode(struct ::wl_resource *resource, uint32_t color_mode)
    {
        org_kde_kwin_outputdevice_send_color_mode(
            resource,
            color_mode);
    }

}

QT_WARNING_POP
QT_END_NAMESPACE
