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

#include "qwayland-server-dde-kvm.h"

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

namespace QtWaylandServer {

    int dde_kvm::deferred_destroy_global_func(void *data) {
        auto object = static_cast<dde_kvm *>(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->dde_kvm_destroy_global();
        return 0;
    }

    dde_kvm::dde_kvm(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);
    }

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

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

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

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

        if (m_resource)
            m_resource->dde_kvm_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 dde_kvm::init(struct ::wl_client *client, int id, int version)
    {
        m_resource = bind(client, id, version);
    }

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

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

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

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

    const struct wl_interface *dde_kvm::interface()
    {
        return &::dde_kvm_interface;
    }

    dde_kvm::Resource *dde_kvm::dde_kvm_allocate()
    {
        return new Resource;
    }

    void dde_kvm::dde_kvm_destroy_global()
    {
    }

    void dde_kvm::dde_kvm_bind_resource(Resource *)
    {
    }

    void dde_kvm::dde_kvm_destroy_resource(Resource *)
    {
    }

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

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

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

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


    void dde_kvm::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);
    }

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

    dde_kvm::Resource *dde_kvm::bind(struct ::wl_resource *handle)
    {
        Resource *resource = dde_kvm_allocate();
        resource->dde_kvm_object = this;

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

    const struct ::dde_kvm_interface dde_kvm::m_dde_kvm_interface = {
        dde_kvm::handle_get_dde_kvm_keyboard,
        dde_kvm::handle_get_dde_kvm_pointer
    };

    void dde_kvm::dde_kvm_get_dde_kvm_keyboard(Resource *, uint32_t)
    {
    }

    void dde_kvm::dde_kvm_get_dde_kvm_pointer(Resource *, uint32_t)
    {
    }


    void dde_kvm::handle_get_dde_kvm_keyboard(
        ::wl_client *client,
        struct wl_resource *resource,
        uint32_t id)
    {
        Q_UNUSED(client);
        Resource *r = Resource::fromResource(resource);
        if (Q_UNLIKELY(!r->dde_kvm_object)) {
            return;
        }
        static_cast<dde_kvm *>(r->dde_kvm_object)->dde_kvm_get_dde_kvm_keyboard(
            r,
            id);
    }

    void dde_kvm::handle_get_dde_kvm_pointer(
        ::wl_client *client,
        struct wl_resource *resource,
        uint32_t id)
    {
        Q_UNUSED(client);
        Resource *r = Resource::fromResource(resource);
        if (Q_UNLIKELY(!r->dde_kvm_object)) {
            return;
        }
        static_cast<dde_kvm *>(r->dde_kvm_object)->dde_kvm_get_dde_kvm_pointer(
            r,
            id);
    }


    int dde_kvm_pointer::deferred_destroy_global_func(void *data) {
        auto object = static_cast<dde_kvm_pointer *>(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->dde_kvm_pointer_destroy_global();
        return 0;
    }

    dde_kvm_pointer::dde_kvm_pointer(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);
    }

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

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

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

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

        if (m_resource)
            m_resource->dde_kvm_pointer_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 dde_kvm_pointer::init(struct ::wl_client *client, int id, int version)
    {
        m_resource = bind(client, id, version);
    }

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

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

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

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

    const struct wl_interface *dde_kvm_pointer::interface()
    {
        return &::dde_kvm_pointer_interface;
    }

    dde_kvm_pointer::Resource *dde_kvm_pointer::dde_kvm_pointer_allocate()
    {
        return new Resource;
    }

    void dde_kvm_pointer::dde_kvm_pointer_destroy_global()
    {
    }

    void dde_kvm_pointer::dde_kvm_pointer_bind_resource(Resource *)
    {
    }

    void dde_kvm_pointer::dde_kvm_pointer_destroy_resource(Resource *)
    {
    }

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

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

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

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


    void dde_kvm_pointer::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);
    }

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

    dde_kvm_pointer::Resource *dde_kvm_pointer::bind(struct ::wl_resource *handle)
    {
        Resource *resource = dde_kvm_pointer_allocate();
        resource->dde_kvm_pointer_object = this;

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

    const struct ::dde_kvm_pointer_interface dde_kvm_pointer::m_dde_kvm_pointer_interface = {
        dde_kvm_pointer::handle_enable_pointer,
        dde_kvm_pointer::handle_enable_cursor,
        dde_kvm_pointer::handle_set_pos
    };

    void dde_kvm_pointer::dde_kvm_pointer_enable_pointer(Resource *, uint32_t )
    {
    }

    void dde_kvm_pointer::dde_kvm_pointer_enable_cursor(Resource *, uint32_t )
    {
    }

    void dde_kvm_pointer::dde_kvm_pointer_set_pos(Resource *, wl_fixed_t , wl_fixed_t )
    {
    }


    void dde_kvm_pointer::handle_enable_pointer(
        ::wl_client *client,
        struct wl_resource *resource,
        uint32_t is_enable)
    {
        Q_UNUSED(client);
        Resource *r = Resource::fromResource(resource);
        if (Q_UNLIKELY(!r->dde_kvm_pointer_object)) {
            return;
        }
        static_cast<dde_kvm_pointer *>(r->dde_kvm_pointer_object)->dde_kvm_pointer_enable_pointer(
            r,
            is_enable);
    }

    void dde_kvm_pointer::handle_enable_cursor(
        ::wl_client *client,
        struct wl_resource *resource,
        uint32_t is_enable)
    {
        Q_UNUSED(client);
        Resource *r = Resource::fromResource(resource);
        if (Q_UNLIKELY(!r->dde_kvm_pointer_object)) {
            return;
        }
        static_cast<dde_kvm_pointer *>(r->dde_kvm_pointer_object)->dde_kvm_pointer_enable_cursor(
            r,
            is_enable);
    }

    void dde_kvm_pointer::handle_set_pos(
        ::wl_client *client,
        struct wl_resource *resource,
        wl_fixed_t x,
        wl_fixed_t y)
    {
        Q_UNUSED(client);
        Resource *r = Resource::fromResource(resource);
        if (Q_UNLIKELY(!r->dde_kvm_pointer_object)) {
            return;
        }
        static_cast<dde_kvm_pointer *>(r->dde_kvm_pointer_object)->dde_kvm_pointer_set_pos(
            r,
            x,
            y);
    }

    void dde_kvm_pointer::send_motion(uint32_t time, wl_fixed_t x, wl_fixed_t y)
    {
        Q_ASSERT_X(m_resource, "dde_kvm_pointer::motion", "Uninitialised resource");
        if (Q_UNLIKELY(!m_resource)) {
            qWarning("could not call dde_kvm_pointer::motion as it's not initialised");
            return;
        }
        send_motion(
            m_resource->handle,
            time,
            x,
            y);
    }

    void dde_kvm_pointer::send_motion(struct ::wl_resource *resource, uint32_t time, wl_fixed_t x, wl_fixed_t y)
    {
        dde_kvm_pointer_send_motion(
            resource,
            time,
            x,
            y);
    }


    void dde_kvm_pointer::send_button(uint32_t serial, uint32_t time, uint32_t state)
    {
        Q_ASSERT_X(m_resource, "dde_kvm_pointer::button", "Uninitialised resource");
        if (Q_UNLIKELY(!m_resource)) {
            qWarning("could not call dde_kvm_pointer::button as it's not initialised");
            return;
        }
        send_button(
            m_resource->handle,
            serial,
            time,
            state);
    }

    void dde_kvm_pointer::send_button(struct ::wl_resource *resource, uint32_t serial, uint32_t time, uint32_t state)
    {
        dde_kvm_pointer_send_button(
            resource,
            serial,
            time,
            state);
    }


    void dde_kvm_pointer::send_axis(uint32_t time, uint32_t type, wl_fixed_t value)
    {
        Q_ASSERT_X(m_resource, "dde_kvm_pointer::axis", "Uninitialised resource");
        if (Q_UNLIKELY(!m_resource)) {
            qWarning("could not call dde_kvm_pointer::axis as it's not initialised");
            return;
        }
        send_axis(
            m_resource->handle,
            time,
            type,
            value);
    }

    void dde_kvm_pointer::send_axis(struct ::wl_resource *resource, uint32_t time, uint32_t type, wl_fixed_t value)
    {
        dde_kvm_pointer_send_axis(
            resource,
            time,
            type,
            value);
    }



    int dde_kvm_keyboard::deferred_destroy_global_func(void *data) {
        auto object = static_cast<dde_kvm_keyboard *>(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->dde_kvm_keyboard_destroy_global();
        return 0;
    }

    dde_kvm_keyboard::dde_kvm_keyboard(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);
    }

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

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

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

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

        if (m_resource)
            m_resource->dde_kvm_keyboard_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 dde_kvm_keyboard::init(struct ::wl_client *client, int id, int version)
    {
        m_resource = bind(client, id, version);
    }

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

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

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

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

    const struct wl_interface *dde_kvm_keyboard::interface()
    {
        return &::dde_kvm_keyboard_interface;
    }

    dde_kvm_keyboard::Resource *dde_kvm_keyboard::dde_kvm_keyboard_allocate()
    {
        return new Resource;
    }

    void dde_kvm_keyboard::dde_kvm_keyboard_destroy_global()
    {
    }

    void dde_kvm_keyboard::dde_kvm_keyboard_bind_resource(Resource *)
    {
    }

    void dde_kvm_keyboard::dde_kvm_keyboard_destroy_resource(Resource *)
    {
    }

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

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

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

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


    void dde_kvm_keyboard::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);
    }

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

    dde_kvm_keyboard::Resource *dde_kvm_keyboard::bind(struct ::wl_resource *handle)
    {
        Resource *resource = dde_kvm_keyboard_allocate();
        resource->dde_kvm_keyboard_object = this;

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

    const struct ::dde_kvm_keyboard_interface dde_kvm_keyboard::m_dde_kvm_keyboard_interface = {
        dde_kvm_keyboard::handle_enable_keyboard
    };

    void dde_kvm_keyboard::dde_kvm_keyboard_enable_keyboard(Resource *, uint32_t )
    {
    }


    void dde_kvm_keyboard::handle_enable_keyboard(
        ::wl_client *client,
        struct wl_resource *resource,
        uint32_t is_enable)
    {
        Q_UNUSED(client);
        Resource *r = Resource::fromResource(resource);
        if (Q_UNLIKELY(!r->dde_kvm_keyboard_object)) {
            return;
        }
        static_cast<dde_kvm_keyboard *>(r->dde_kvm_keyboard_object)->dde_kvm_keyboard_enable_keyboard(
            r,
            is_enable);
    }

    void dde_kvm_keyboard::send_key(uint32_t serial, uint32_t time, uint32_t key, uint32_t state)
    {
        Q_ASSERT_X(m_resource, "dde_kvm_keyboard::key", "Uninitialised resource");
        if (Q_UNLIKELY(!m_resource)) {
            qWarning("could not call dde_kvm_keyboard::key as it's not initialised");
            return;
        }
        send_key(
            m_resource->handle,
            serial,
            time,
            key,
            state);
    }

    void dde_kvm_keyboard::send_key(struct ::wl_resource *resource, uint32_t serial, uint32_t time, uint32_t key, uint32_t state)
    {
        dde_kvm_keyboard_send_key(
            resource,
            serial,
            time,
            key,
            state);
    }


    void dde_kvm_keyboard::send_modifiers(uint32_t serial, uint32_t mods_depressed, uint32_t mods_latched, uint32_t mods_locked, uint32_t group)
    {
        Q_ASSERT_X(m_resource, "dde_kvm_keyboard::modifiers", "Uninitialised resource");
        if (Q_UNLIKELY(!m_resource)) {
            qWarning("could not call dde_kvm_keyboard::modifiers as it's not initialised");
            return;
        }
        send_modifiers(
            m_resource->handle,
            serial,
            mods_depressed,
            mods_latched,
            mods_locked,
            group);
    }

    void dde_kvm_keyboard::send_modifiers(struct ::wl_resource *resource, uint32_t serial, uint32_t mods_depressed, uint32_t mods_latched, uint32_t mods_locked, uint32_t group)
    {
        dde_kvm_keyboard_send_modifiers(
            resource,
            serial,
            mods_depressed,
            mods_latched,
            mods_locked,
            group);
    }

}

QT_WARNING_POP
QT_END_NAMESPACE
