// This file was generated by qtwaylandscanner
// source file is /usr/share/treeland-protocols/treeland-dde-shell-v1.xml

#include "qwayland-server-treeland-dde-shell-v1.h"

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

namespace QtWaylandServer {

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

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

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

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

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

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

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

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

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

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

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

    const struct wl_interface *treeland_dde_shell_manager_v1::interface()
    {
        return &::treeland_dde_shell_manager_v1_interface;
    }

    treeland_dde_shell_manager_v1::Resource *treeland_dde_shell_manager_v1::allocate()
    {
        return new Resource;
    }

    void treeland_dde_shell_manager_v1::destroy_global()
    {
    }

    void treeland_dde_shell_manager_v1::bind_resource(Resource *)
    {
    }

    void treeland_dde_shell_manager_v1::destroy_resource(Resource *)
    {
    }

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

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

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

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


    void treeland_dde_shell_manager_v1::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, 5000);
    }

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

    treeland_dde_shell_manager_v1::Resource *treeland_dde_shell_manager_v1::bind(struct ::wl_resource *handle)
    {
        Resource *resource = allocate();
        resource->treeland_dde_shell_manager_v1_object = this;

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

    const struct ::treeland_dde_shell_manager_v1_interface treeland_dde_shell_manager_v1::m_treeland_dde_shell_manager_v1_interface = {
        treeland_dde_shell_manager_v1::handle_get_window_overlap_checker,
        treeland_dde_shell_manager_v1::handle_get_shell_surface,
        treeland_dde_shell_manager_v1::handle_get_treeland_dde_active,
        treeland_dde_shell_manager_v1::handle_get_treeland_multitaskview,
        treeland_dde_shell_manager_v1::handle_get_treeland_window_picker,
        treeland_dde_shell_manager_v1::handle_get_treeland_lockscreen,
        treeland_dde_shell_manager_v1::handle_set_xwindow_position_relative,
        treeland_dde_shell_manager_v1::handle_destroy
    };

    void treeland_dde_shell_manager_v1::get_window_overlap_checker(Resource *resource, uint32_t id)
    {
        Q_UNUSED(resource);
        Q_UNUSED(id);
    }

    void treeland_dde_shell_manager_v1::get_shell_surface(Resource *resource, uint32_t id, struct ::wl_resource *surface)
    {
        Q_UNUSED(resource);
        Q_UNUSED(id);
        Q_UNUSED(surface);
    }

    void treeland_dde_shell_manager_v1::get_treeland_dde_active(Resource *resource, uint32_t id, struct ::wl_resource *seat)
    {
        Q_UNUSED(resource);
        Q_UNUSED(id);
        Q_UNUSED(seat);
    }

    void treeland_dde_shell_manager_v1::get_treeland_multitaskview(Resource *resource, uint32_t id)
    {
        Q_UNUSED(resource);
        Q_UNUSED(id);
    }

    void treeland_dde_shell_manager_v1::get_treeland_window_picker(Resource *resource, uint32_t id)
    {
        Q_UNUSED(resource);
        Q_UNUSED(id);
    }

    void treeland_dde_shell_manager_v1::get_treeland_lockscreen(Resource *resource, uint32_t id)
    {
        Q_UNUSED(resource);
        Q_UNUSED(id);
    }

    void treeland_dde_shell_manager_v1::set_xwindow_position_relative(Resource *resource, uint32_t callback, uint32_t wid, struct ::wl_resource *anchor, wl_fixed_t dx, wl_fixed_t dy)
    {
        Q_UNUSED(resource);
        Q_UNUSED(callback);
        Q_UNUSED(wid);
        Q_UNUSED(anchor);
        Q_UNUSED(dx);
        Q_UNUSED(dy);
    }

    void treeland_dde_shell_manager_v1::destroy(Resource *resource)
    {
        Q_UNUSED(resource);
    }


    void treeland_dde_shell_manager_v1::handle_get_window_overlap_checker(
        ::wl_client *client,
        struct wl_resource *resource,
        uint32_t id)
    {
        Q_UNUSED(client);
        Resource *qResource = Resource::fromResource(resource);
        if (Q_UNLIKELY(!qResource->treeland_dde_shell_manager_v1_object)) {
            return;
        }
        static_cast<treeland_dde_shell_manager_v1 *>(qResource->treeland_dde_shell_manager_v1_object)->get_window_overlap_checker(
            qResource,
            id);
    }

    void treeland_dde_shell_manager_v1::handle_get_shell_surface(
        ::wl_client *client,
        struct wl_resource *resource,
        uint32_t id,
        struct ::wl_resource *surface)
    {
        Q_UNUSED(client);
        Resource *qResource = Resource::fromResource(resource);
        if (Q_UNLIKELY(!qResource->treeland_dde_shell_manager_v1_object)) {
            return;
        }
        static_cast<treeland_dde_shell_manager_v1 *>(qResource->treeland_dde_shell_manager_v1_object)->get_shell_surface(
            qResource,
            id,
            surface);
    }

    void treeland_dde_shell_manager_v1::handle_get_treeland_dde_active(
        ::wl_client *client,
        struct wl_resource *resource,
        uint32_t id,
        struct ::wl_resource *seat)
    {
        Q_UNUSED(client);
        Resource *qResource = Resource::fromResource(resource);
        if (Q_UNLIKELY(!qResource->treeland_dde_shell_manager_v1_object)) {
            return;
        }
        static_cast<treeland_dde_shell_manager_v1 *>(qResource->treeland_dde_shell_manager_v1_object)->get_treeland_dde_active(
            qResource,
            id,
            seat);
    }

    void treeland_dde_shell_manager_v1::handle_get_treeland_multitaskview(
        ::wl_client *client,
        struct wl_resource *resource,
        uint32_t id)
    {
        Q_UNUSED(client);
        Resource *qResource = Resource::fromResource(resource);
        if (Q_UNLIKELY(!qResource->treeland_dde_shell_manager_v1_object)) {
            return;
        }
        static_cast<treeland_dde_shell_manager_v1 *>(qResource->treeland_dde_shell_manager_v1_object)->get_treeland_multitaskview(
            qResource,
            id);
    }

    void treeland_dde_shell_manager_v1::handle_get_treeland_window_picker(
        ::wl_client *client,
        struct wl_resource *resource,
        uint32_t id)
    {
        Q_UNUSED(client);
        Resource *qResource = Resource::fromResource(resource);
        if (Q_UNLIKELY(!qResource->treeland_dde_shell_manager_v1_object)) {
            return;
        }
        static_cast<treeland_dde_shell_manager_v1 *>(qResource->treeland_dde_shell_manager_v1_object)->get_treeland_window_picker(
            qResource,
            id);
    }

    void treeland_dde_shell_manager_v1::handle_get_treeland_lockscreen(
        ::wl_client *client,
        struct wl_resource *resource,
        uint32_t id)
    {
        Q_UNUSED(client);
        Resource *qResource = Resource::fromResource(resource);
        if (Q_UNLIKELY(!qResource->treeland_dde_shell_manager_v1_object)) {
            return;
        }
        static_cast<treeland_dde_shell_manager_v1 *>(qResource->treeland_dde_shell_manager_v1_object)->get_treeland_lockscreen(
            qResource,
            id);
    }

    void treeland_dde_shell_manager_v1::handle_set_xwindow_position_relative(
        ::wl_client *client,
        struct wl_resource *resource,
        uint32_t callback,
        uint32_t wid,
        struct ::wl_resource *anchor,
        wl_fixed_t dx,
        wl_fixed_t dy)
    {
        Q_UNUSED(client);
        Resource *qResource = Resource::fromResource(resource);
        if (Q_UNLIKELY(!qResource->treeland_dde_shell_manager_v1_object)) {
            return;
        }
        static_cast<treeland_dde_shell_manager_v1 *>(qResource->treeland_dde_shell_manager_v1_object)->set_xwindow_position_relative(
            qResource,
            callback,
            wid,
            anchor,
            dx,
            dy);
    }

    void treeland_dde_shell_manager_v1::handle_destroy(
        ::wl_client *client,
        struct wl_resource *resource)
    {
        Q_UNUSED(client);
        Resource *qResource = Resource::fromResource(resource);
        if (Q_UNLIKELY(!qResource->treeland_dde_shell_manager_v1_object)) {
            wl_resource_destroy(resource);
            return;
        }
        static_cast<treeland_dde_shell_manager_v1 *>(qResource->treeland_dde_shell_manager_v1_object)->destroy(
            qResource);
    }


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

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

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

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

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

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

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

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

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

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

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

    const struct wl_interface *treeland_window_overlap_checker::interface()
    {
        return &::treeland_window_overlap_checker_interface;
    }

    treeland_window_overlap_checker::Resource *treeland_window_overlap_checker::allocate()
    {
        return new Resource;
    }

    void treeland_window_overlap_checker::destroy_global()
    {
    }

    void treeland_window_overlap_checker::bind_resource(Resource *)
    {
    }

    void treeland_window_overlap_checker::destroy_resource(Resource *)
    {
    }

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

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

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

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


    void treeland_window_overlap_checker::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, 5000);
    }

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

    treeland_window_overlap_checker::Resource *treeland_window_overlap_checker::bind(struct ::wl_resource *handle)
    {
        Resource *resource = allocate();
        resource->treeland_window_overlap_checker_object = this;

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

    const struct ::treeland_window_overlap_checker_interface treeland_window_overlap_checker::m_treeland_window_overlap_checker_interface = {
        treeland_window_overlap_checker::handle_update,
        treeland_window_overlap_checker::handle_destroy
    };

    void treeland_window_overlap_checker::update(Resource *resource, int32_t width, int32_t height, uint32_t anchor, struct ::wl_resource *output)
    {
        Q_UNUSED(resource);
        Q_UNUSED(width);
        Q_UNUSED(height);
        Q_UNUSED(anchor);
        Q_UNUSED(output);
    }

    void treeland_window_overlap_checker::destroy(Resource *resource)
    {
        Q_UNUSED(resource);
    }


    void treeland_window_overlap_checker::handle_update(
        ::wl_client *client,
        struct wl_resource *resource,
        int32_t width,
        int32_t height,
        uint32_t anchor,
        struct ::wl_resource *output)
    {
        Q_UNUSED(client);
        Resource *qResource = Resource::fromResource(resource);
        if (Q_UNLIKELY(!qResource->treeland_window_overlap_checker_object)) {
            return;
        }
        static_cast<treeland_window_overlap_checker *>(qResource->treeland_window_overlap_checker_object)->update(
            qResource,
            width,
            height,
            anchor,
            output);
    }

    void treeland_window_overlap_checker::handle_destroy(
        ::wl_client *client,
        struct wl_resource *resource)
    {
        Q_UNUSED(client);
        Resource *qResource = Resource::fromResource(resource);
        if (Q_UNLIKELY(!qResource->treeland_window_overlap_checker_object)) {
            wl_resource_destroy(resource);
            return;
        }
        static_cast<treeland_window_overlap_checker *>(qResource->treeland_window_overlap_checker_object)->destroy(
            qResource);
    }

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

    void treeland_window_overlap_checker::send_enter(struct ::wl_resource *resource)
    {
        treeland_window_overlap_checker_send_enter(
            resource);
    }


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

    void treeland_window_overlap_checker::send_leave(struct ::wl_resource *resource)
    {
        treeland_window_overlap_checker_send_leave(
            resource);
    }



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

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

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

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

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

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

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

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

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

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

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

    const struct wl_interface *treeland_dde_shell_surface_v1::interface()
    {
        return &::treeland_dde_shell_surface_v1_interface;
    }

    treeland_dde_shell_surface_v1::Resource *treeland_dde_shell_surface_v1::allocate()
    {
        return new Resource;
    }

    void treeland_dde_shell_surface_v1::destroy_global()
    {
    }

    void treeland_dde_shell_surface_v1::bind_resource(Resource *)
    {
    }

    void treeland_dde_shell_surface_v1::destroy_resource(Resource *)
    {
    }

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

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

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

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


    void treeland_dde_shell_surface_v1::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, 5000);
    }

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

    treeland_dde_shell_surface_v1::Resource *treeland_dde_shell_surface_v1::bind(struct ::wl_resource *handle)
    {
        Resource *resource = allocate();
        resource->treeland_dde_shell_surface_v1_object = this;

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

    const struct ::treeland_dde_shell_surface_v1_interface treeland_dde_shell_surface_v1::m_treeland_dde_shell_surface_v1_interface = {
        treeland_dde_shell_surface_v1::handle_destroy,
        treeland_dde_shell_surface_v1::handle_set_surface_position,
        treeland_dde_shell_surface_v1::handle_set_role,
        treeland_dde_shell_surface_v1::handle_set_auto_placement,
        treeland_dde_shell_surface_v1::handle_set_skip_switcher,
        treeland_dde_shell_surface_v1::handle_set_skip_dock_preview,
        treeland_dde_shell_surface_v1::handle_set_skip_muti_task_view,
        treeland_dde_shell_surface_v1::handle_set_accept_keyboard_focus
    };

    void treeland_dde_shell_surface_v1::destroy(Resource *resource)
    {
        Q_UNUSED(resource);
    }

    void treeland_dde_shell_surface_v1::set_surface_position(Resource *resource, int32_t x, int32_t y)
    {
        Q_UNUSED(resource);
        Q_UNUSED(x);
        Q_UNUSED(y);
    }

    void treeland_dde_shell_surface_v1::set_role(Resource *resource, uint32_t role)
    {
        Q_UNUSED(resource);
        Q_UNUSED(role);
    }

    void treeland_dde_shell_surface_v1::set_auto_placement(Resource *resource, uint32_t y_offset)
    {
        Q_UNUSED(resource);
        Q_UNUSED(y_offset);
    }

    void treeland_dde_shell_surface_v1::set_skip_switcher(Resource *resource, uint32_t skip)
    {
        Q_UNUSED(resource);
        Q_UNUSED(skip);
    }

    void treeland_dde_shell_surface_v1::set_skip_dock_preview(Resource *resource, uint32_t skip)
    {
        Q_UNUSED(resource);
        Q_UNUSED(skip);
    }

    void treeland_dde_shell_surface_v1::set_skip_muti_task_view(Resource *resource, uint32_t skip)
    {
        Q_UNUSED(resource);
        Q_UNUSED(skip);
    }

    void treeland_dde_shell_surface_v1::set_accept_keyboard_focus(Resource *resource, uint32_t accept)
    {
        Q_UNUSED(resource);
        Q_UNUSED(accept);
    }


    void treeland_dde_shell_surface_v1::handle_destroy(
        ::wl_client *client,
        struct wl_resource *resource)
    {
        Q_UNUSED(client);
        Resource *qResource = Resource::fromResource(resource);
        if (Q_UNLIKELY(!qResource->treeland_dde_shell_surface_v1_object)) {
            wl_resource_destroy(resource);
            return;
        }
        static_cast<treeland_dde_shell_surface_v1 *>(qResource->treeland_dde_shell_surface_v1_object)->destroy(
            qResource);
    }

    void treeland_dde_shell_surface_v1::handle_set_surface_position(
        ::wl_client *client,
        struct wl_resource *resource,
        int32_t x,
        int32_t y)
    {
        Q_UNUSED(client);
        Resource *qResource = Resource::fromResource(resource);
        if (Q_UNLIKELY(!qResource->treeland_dde_shell_surface_v1_object)) {
            return;
        }
        static_cast<treeland_dde_shell_surface_v1 *>(qResource->treeland_dde_shell_surface_v1_object)->set_surface_position(
            qResource,
            x,
            y);
    }

    void treeland_dde_shell_surface_v1::handle_set_role(
        ::wl_client *client,
        struct wl_resource *resource,
        uint32_t role)
    {
        Q_UNUSED(client);
        Resource *qResource = Resource::fromResource(resource);
        if (Q_UNLIKELY(!qResource->treeland_dde_shell_surface_v1_object)) {
            return;
        }
        static_cast<treeland_dde_shell_surface_v1 *>(qResource->treeland_dde_shell_surface_v1_object)->set_role(
            qResource,
            role);
    }

    void treeland_dde_shell_surface_v1::handle_set_auto_placement(
        ::wl_client *client,
        struct wl_resource *resource,
        uint32_t y_offset)
    {
        Q_UNUSED(client);
        Resource *qResource = Resource::fromResource(resource);
        if (Q_UNLIKELY(!qResource->treeland_dde_shell_surface_v1_object)) {
            return;
        }
        static_cast<treeland_dde_shell_surface_v1 *>(qResource->treeland_dde_shell_surface_v1_object)->set_auto_placement(
            qResource,
            y_offset);
    }

    void treeland_dde_shell_surface_v1::handle_set_skip_switcher(
        ::wl_client *client,
        struct wl_resource *resource,
        uint32_t skip)
    {
        Q_UNUSED(client);
        Resource *qResource = Resource::fromResource(resource);
        if (Q_UNLIKELY(!qResource->treeland_dde_shell_surface_v1_object)) {
            return;
        }
        static_cast<treeland_dde_shell_surface_v1 *>(qResource->treeland_dde_shell_surface_v1_object)->set_skip_switcher(
            qResource,
            skip);
    }

    void treeland_dde_shell_surface_v1::handle_set_skip_dock_preview(
        ::wl_client *client,
        struct wl_resource *resource,
        uint32_t skip)
    {
        Q_UNUSED(client);
        Resource *qResource = Resource::fromResource(resource);
        if (Q_UNLIKELY(!qResource->treeland_dde_shell_surface_v1_object)) {
            return;
        }
        static_cast<treeland_dde_shell_surface_v1 *>(qResource->treeland_dde_shell_surface_v1_object)->set_skip_dock_preview(
            qResource,
            skip);
    }

    void treeland_dde_shell_surface_v1::handle_set_skip_muti_task_view(
        ::wl_client *client,
        struct wl_resource *resource,
        uint32_t skip)
    {
        Q_UNUSED(client);
        Resource *qResource = Resource::fromResource(resource);
        if (Q_UNLIKELY(!qResource->treeland_dde_shell_surface_v1_object)) {
            return;
        }
        static_cast<treeland_dde_shell_surface_v1 *>(qResource->treeland_dde_shell_surface_v1_object)->set_skip_muti_task_view(
            qResource,
            skip);
    }

    void treeland_dde_shell_surface_v1::handle_set_accept_keyboard_focus(
        ::wl_client *client,
        struct wl_resource *resource,
        uint32_t accept)
    {
        Q_UNUSED(client);
        Resource *qResource = Resource::fromResource(resource);
        if (Q_UNLIKELY(!qResource->treeland_dde_shell_surface_v1_object)) {
            return;
        }
        static_cast<treeland_dde_shell_surface_v1 *>(qResource->treeland_dde_shell_surface_v1_object)->set_accept_keyboard_focus(
            qResource,
            accept);
    }


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

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

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

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

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

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

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

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

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

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

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

    const struct wl_interface *treeland_dde_active_v1::interface()
    {
        return &::treeland_dde_active_v1_interface;
    }

    treeland_dde_active_v1::Resource *treeland_dde_active_v1::allocate()
    {
        return new Resource;
    }

    void treeland_dde_active_v1::destroy_global()
    {
    }

    void treeland_dde_active_v1::bind_resource(Resource *)
    {
    }

    void treeland_dde_active_v1::destroy_resource(Resource *)
    {
    }

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

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

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

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


    void treeland_dde_active_v1::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, 5000);
    }

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

    treeland_dde_active_v1::Resource *treeland_dde_active_v1::bind(struct ::wl_resource *handle)
    {
        Resource *resource = allocate();
        resource->treeland_dde_active_v1_object = this;

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

    const struct ::treeland_dde_active_v1_interface treeland_dde_active_v1::m_treeland_dde_active_v1_interface = {
        treeland_dde_active_v1::handle_destroy
    };

    void treeland_dde_active_v1::destroy(Resource *resource)
    {
        Q_UNUSED(resource);
    }


    void treeland_dde_active_v1::handle_destroy(
        ::wl_client *client,
        struct wl_resource *resource)
    {
        Q_UNUSED(client);
        Resource *qResource = Resource::fromResource(resource);
        if (Q_UNLIKELY(!qResource->treeland_dde_active_v1_object)) {
            wl_resource_destroy(resource);
            return;
        }
        static_cast<treeland_dde_active_v1 *>(qResource->treeland_dde_active_v1_object)->destroy(
            qResource);
    }

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

    void treeland_dde_active_v1::send_active_in(struct ::wl_resource *resource, uint32_t reason)
    {
        treeland_dde_active_v1_send_active_in(
            resource,
            reason);
    }


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

    void treeland_dde_active_v1::send_active_out(struct ::wl_resource *resource, uint32_t reason)
    {
        treeland_dde_active_v1_send_active_out(
            resource,
            reason);
    }


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

    void treeland_dde_active_v1::send_start_drag(struct ::wl_resource *resource)
    {
        treeland_dde_active_v1_send_start_drag(
            resource);
    }


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

    void treeland_dde_active_v1::send_drop(struct ::wl_resource *resource)
    {
        treeland_dde_active_v1_send_drop(
            resource);
    }



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

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

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

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

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

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

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

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

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

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

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

    const struct wl_interface *treeland_multitaskview_v1::interface()
    {
        return &::treeland_multitaskview_v1_interface;
    }

    treeland_multitaskview_v1::Resource *treeland_multitaskview_v1::allocate()
    {
        return new Resource;
    }

    void treeland_multitaskview_v1::destroy_global()
    {
    }

    void treeland_multitaskview_v1::bind_resource(Resource *)
    {
    }

    void treeland_multitaskview_v1::destroy_resource(Resource *)
    {
    }

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

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

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

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


    void treeland_multitaskview_v1::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, 5000);
    }

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

    treeland_multitaskview_v1::Resource *treeland_multitaskview_v1::bind(struct ::wl_resource *handle)
    {
        Resource *resource = allocate();
        resource->treeland_multitaskview_v1_object = this;

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

    const struct ::treeland_multitaskview_v1_interface treeland_multitaskview_v1::m_treeland_multitaskview_v1_interface = {
        treeland_multitaskview_v1::handle_destroy,
        treeland_multitaskview_v1::handle_toggle
    };

    void treeland_multitaskview_v1::destroy(Resource *resource)
    {
        Q_UNUSED(resource);
    }

    void treeland_multitaskview_v1::toggle(Resource *resource)
    {
        Q_UNUSED(resource);
    }


    void treeland_multitaskview_v1::handle_destroy(
        ::wl_client *client,
        struct wl_resource *resource)
    {
        Q_UNUSED(client);
        Resource *qResource = Resource::fromResource(resource);
        if (Q_UNLIKELY(!qResource->treeland_multitaskview_v1_object)) {
            wl_resource_destroy(resource);
            return;
        }
        static_cast<treeland_multitaskview_v1 *>(qResource->treeland_multitaskview_v1_object)->destroy(
            qResource);
    }

    void treeland_multitaskview_v1::handle_toggle(
        ::wl_client *client,
        struct wl_resource *resource)
    {
        Q_UNUSED(client);
        Resource *qResource = Resource::fromResource(resource);
        if (Q_UNLIKELY(!qResource->treeland_multitaskview_v1_object)) {
            return;
        }
        static_cast<treeland_multitaskview_v1 *>(qResource->treeland_multitaskview_v1_object)->toggle(
            qResource);
    }


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

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

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

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

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

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

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

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

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

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

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

    const struct wl_interface *treeland_window_picker_v1::interface()
    {
        return &::treeland_window_picker_v1_interface;
    }

    treeland_window_picker_v1::Resource *treeland_window_picker_v1::allocate()
    {
        return new Resource;
    }

    void treeland_window_picker_v1::destroy_global()
    {
    }

    void treeland_window_picker_v1::bind_resource(Resource *)
    {
    }

    void treeland_window_picker_v1::destroy_resource(Resource *)
    {
    }

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

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

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

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


    void treeland_window_picker_v1::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, 5000);
    }

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

    treeland_window_picker_v1::Resource *treeland_window_picker_v1::bind(struct ::wl_resource *handle)
    {
        Resource *resource = allocate();
        resource->treeland_window_picker_v1_object = this;

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

    const struct ::treeland_window_picker_v1_interface treeland_window_picker_v1::m_treeland_window_picker_v1_interface = {
        treeland_window_picker_v1::handle_destroy,
        treeland_window_picker_v1::handle_pick
    };

    void treeland_window_picker_v1::destroy(Resource *resource)
    {
        Q_UNUSED(resource);
    }

    void treeland_window_picker_v1::pick(Resource *resource, const QString &hint)
    {
        Q_UNUSED(resource);
        Q_UNUSED(hint);
    }


    void treeland_window_picker_v1::handle_destroy(
        ::wl_client *client,
        struct wl_resource *resource)
    {
        Q_UNUSED(client);
        Resource *qResource = Resource::fromResource(resource);
        if (Q_UNLIKELY(!qResource->treeland_window_picker_v1_object)) {
            wl_resource_destroy(resource);
            return;
        }
        static_cast<treeland_window_picker_v1 *>(qResource->treeland_window_picker_v1_object)->destroy(
            qResource);
    }

    void treeland_window_picker_v1::handle_pick(
        ::wl_client *client,
        struct wl_resource *resource,
        const char *hint)
    {
        Q_UNUSED(client);
        Resource *qResource = Resource::fromResource(resource);
        if (Q_UNLIKELY(!qResource->treeland_window_picker_v1_object)) {
            return;
        }
        static_cast<treeland_window_picker_v1 *>(qResource->treeland_window_picker_v1_object)->pick(
            qResource,
            QString::fromUtf8(hint));
    }

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

    void treeland_window_picker_v1::send_window(struct ::wl_resource *resource, int32_t pid)
    {
        treeland_window_picker_v1_send_window(
            resource,
            pid);
    }



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

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

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

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

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

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

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

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

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

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

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

    const struct wl_interface *treeland_lockscreen_v1::interface()
    {
        return &::treeland_lockscreen_v1_interface;
    }

    treeland_lockscreen_v1::Resource *treeland_lockscreen_v1::allocate()
    {
        return new Resource;
    }

    void treeland_lockscreen_v1::destroy_global()
    {
    }

    void treeland_lockscreen_v1::bind_resource(Resource *)
    {
    }

    void treeland_lockscreen_v1::destroy_resource(Resource *)
    {
    }

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

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

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

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


    void treeland_lockscreen_v1::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, 5000);
    }

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

    treeland_lockscreen_v1::Resource *treeland_lockscreen_v1::bind(struct ::wl_resource *handle)
    {
        Resource *resource = allocate();
        resource->treeland_lockscreen_v1_object = this;

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

    const struct ::treeland_lockscreen_v1_interface treeland_lockscreen_v1::m_treeland_lockscreen_v1_interface = {
        treeland_lockscreen_v1::handle_destroy,
        treeland_lockscreen_v1::handle_lock,
        treeland_lockscreen_v1::handle_shutdown,
        treeland_lockscreen_v1::handle_switch_user
    };

    void treeland_lockscreen_v1::destroy(Resource *resource)
    {
        Q_UNUSED(resource);
    }

    void treeland_lockscreen_v1::lock(Resource *resource)
    {
        Q_UNUSED(resource);
    }

    void treeland_lockscreen_v1::shutdown(Resource *resource)
    {
        Q_UNUSED(resource);
    }

    void treeland_lockscreen_v1::switch_user(Resource *resource)
    {
        Q_UNUSED(resource);
    }


    void treeland_lockscreen_v1::handle_destroy(
        ::wl_client *client,
        struct wl_resource *resource)
    {
        Q_UNUSED(client);
        Resource *qResource = Resource::fromResource(resource);
        if (Q_UNLIKELY(!qResource->treeland_lockscreen_v1_object)) {
            wl_resource_destroy(resource);
            return;
        }
        static_cast<treeland_lockscreen_v1 *>(qResource->treeland_lockscreen_v1_object)->destroy(
            qResource);
    }

    void treeland_lockscreen_v1::handle_lock(
        ::wl_client *client,
        struct wl_resource *resource)
    {
        Q_UNUSED(client);
        Resource *qResource = Resource::fromResource(resource);
        if (Q_UNLIKELY(!qResource->treeland_lockscreen_v1_object)) {
            return;
        }
        static_cast<treeland_lockscreen_v1 *>(qResource->treeland_lockscreen_v1_object)->lock(
            qResource);
    }

    void treeland_lockscreen_v1::handle_shutdown(
        ::wl_client *client,
        struct wl_resource *resource)
    {
        Q_UNUSED(client);
        Resource *qResource = Resource::fromResource(resource);
        if (Q_UNLIKELY(!qResource->treeland_lockscreen_v1_object)) {
            return;
        }
        static_cast<treeland_lockscreen_v1 *>(qResource->treeland_lockscreen_v1_object)->shutdown(
            qResource);
    }

    void treeland_lockscreen_v1::handle_switch_user(
        ::wl_client *client,
        struct wl_resource *resource)
    {
        Q_UNUSED(client);
        Resource *qResource = Resource::fromResource(resource);
        if (Q_UNLIKELY(!qResource->treeland_lockscreen_v1_object)) {
            return;
        }
        static_cast<treeland_lockscreen_v1 *>(qResource->treeland_lockscreen_v1_object)->switch_user(
            qResource);
    }
}

QT_WARNING_POP
QT_END_NAMESPACE
