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

#include "qwayland-server-treeland-personalization-manager-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_personalization_manager_v1::deferred_destroy_global_func(void *data) {
        auto object = static_cast<treeland_personalization_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_personalization_manager_v1::treeland_personalization_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_personalization_manager_v1::treeland_personalization_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_personalization_manager_v1::treeland_personalization_manager_v1(struct ::wl_resource *resource)
        : m_resource_map()
        , m_resource(nullptr)
        , m_global(nullptr)
        , m_display(nullptr)
        , m_globalRemovedEvent(nullptr)
    {
        init(resource);
    }

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

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

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

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

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

    treeland_personalization_manager_v1::Resource *treeland_personalization_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_personalization_manager_v1::init(struct ::wl_display *display, int version)
    {
        m_display = display;
        m_global = wl_global_create(display, &::treeland_personalization_manager_v1_interface, version, this, bind_func);
        m_displayDestroyedListener.notify = treeland_personalization_manager_v1::display_destroy_func;
        m_displayDestroyedListener.parent = this;
        wl_display_add_destroy_listener(display, &m_displayDestroyedListener);
    }

    const struct wl_interface *treeland_personalization_manager_v1::interface()
    {
        return &::treeland_personalization_manager_v1_interface;
    }

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

    void treeland_personalization_manager_v1::destroy_global()
    {
    }

    void treeland_personalization_manager_v1::bind_resource(Resource *)
    {
    }

    void treeland_personalization_manager_v1::destroy_resource(Resource *)
    {
    }

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

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

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

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


    void treeland_personalization_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_personalization_manager_v1::Resource *treeland_personalization_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_personalization_manager_v1_interface, version, id);
        return bind(handle);
    }

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

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

    const struct ::treeland_personalization_manager_v1_interface treeland_personalization_manager_v1::m_treeland_personalization_manager_v1_interface = {
        treeland_personalization_manager_v1::handle_get_window_context,
        treeland_personalization_manager_v1::handle_get_cursor_context,
        treeland_personalization_manager_v1::handle_get_font_context,
        treeland_personalization_manager_v1::handle_get_appearance_context,
        treeland_personalization_manager_v1::handle_destroy
    };

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

    void treeland_personalization_manager_v1::get_cursor_context(Resource *resource, uint32_t id)
    {
        Q_UNUSED(resource);
        Q_UNUSED(id);
    }

    void treeland_personalization_manager_v1::get_font_context(Resource *resource, uint32_t id)
    {
        Q_UNUSED(resource);
        Q_UNUSED(id);
    }

    void treeland_personalization_manager_v1::get_appearance_context(Resource *resource, uint32_t id)
    {
        Q_UNUSED(resource);
        Q_UNUSED(id);
    }

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


    void treeland_personalization_manager_v1::handle_get_window_context(
        ::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_personalization_manager_v1_object)) {
            return;
        }
        static_cast<treeland_personalization_manager_v1 *>(qResource->treeland_personalization_manager_v1_object)->get_window_context(
            qResource,
            id,
            surface);
    }

    void treeland_personalization_manager_v1::handle_get_cursor_context(
        ::wl_client *client,
        struct wl_resource *resource,
        uint32_t id)
    {
        Q_UNUSED(client);
        Resource *qResource = Resource::fromResource(resource);
        if (Q_UNLIKELY(!qResource->treeland_personalization_manager_v1_object)) {
            return;
        }
        static_cast<treeland_personalization_manager_v1 *>(qResource->treeland_personalization_manager_v1_object)->get_cursor_context(
            qResource,
            id);
    }

    void treeland_personalization_manager_v1::handle_get_font_context(
        ::wl_client *client,
        struct wl_resource *resource,
        uint32_t id)
    {
        Q_UNUSED(client);
        Resource *qResource = Resource::fromResource(resource);
        if (Q_UNLIKELY(!qResource->treeland_personalization_manager_v1_object)) {
            return;
        }
        static_cast<treeland_personalization_manager_v1 *>(qResource->treeland_personalization_manager_v1_object)->get_font_context(
            qResource,
            id);
    }

    void treeland_personalization_manager_v1::handle_get_appearance_context(
        ::wl_client *client,
        struct wl_resource *resource,
        uint32_t id)
    {
        Q_UNUSED(client);
        Resource *qResource = Resource::fromResource(resource);
        if (Q_UNLIKELY(!qResource->treeland_personalization_manager_v1_object)) {
            return;
        }
        static_cast<treeland_personalization_manager_v1 *>(qResource->treeland_personalization_manager_v1_object)->get_appearance_context(
            qResource,
            id);
    }

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


    int treeland_personalization_cursor_context_v1::deferred_destroy_global_func(void *data) {
        auto object = static_cast<treeland_personalization_cursor_context_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_personalization_cursor_context_v1::treeland_personalization_cursor_context_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_personalization_cursor_context_v1::treeland_personalization_cursor_context_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_personalization_cursor_context_v1::treeland_personalization_cursor_context_v1(struct ::wl_resource *resource)
        : m_resource_map()
        , m_resource(nullptr)
        , m_global(nullptr)
        , m_display(nullptr)
        , m_globalRemovedEvent(nullptr)
    {
        init(resource);
    }

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

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

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

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

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

    treeland_personalization_cursor_context_v1::Resource *treeland_personalization_cursor_context_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_personalization_cursor_context_v1::init(struct ::wl_display *display, int version)
    {
        m_display = display;
        m_global = wl_global_create(display, &::treeland_personalization_cursor_context_v1_interface, version, this, bind_func);
        m_displayDestroyedListener.notify = treeland_personalization_cursor_context_v1::display_destroy_func;
        m_displayDestroyedListener.parent = this;
        wl_display_add_destroy_listener(display, &m_displayDestroyedListener);
    }

    const struct wl_interface *treeland_personalization_cursor_context_v1::interface()
    {
        return &::treeland_personalization_cursor_context_v1_interface;
    }

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

    void treeland_personalization_cursor_context_v1::destroy_global()
    {
    }

    void treeland_personalization_cursor_context_v1::bind_resource(Resource *)
    {
    }

    void treeland_personalization_cursor_context_v1::destroy_resource(Resource *)
    {
    }

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

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

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

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


    void treeland_personalization_cursor_context_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_personalization_cursor_context_v1::Resource *treeland_personalization_cursor_context_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_personalization_cursor_context_v1_interface, version, id);
        return bind(handle);
    }

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

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

    const struct ::treeland_personalization_cursor_context_v1_interface treeland_personalization_cursor_context_v1::m_treeland_personalization_cursor_context_v1_interface = {
        treeland_personalization_cursor_context_v1::handle_set_theme,
        treeland_personalization_cursor_context_v1::handle_get_theme,
        treeland_personalization_cursor_context_v1::handle_set_size,
        treeland_personalization_cursor_context_v1::handle_get_size,
        treeland_personalization_cursor_context_v1::handle_commit,
        treeland_personalization_cursor_context_v1::handle_destroy
    };

    void treeland_personalization_cursor_context_v1::set_theme(Resource *resource, const QString &name)
    {
        Q_UNUSED(resource);
        Q_UNUSED(name);
    }

    void treeland_personalization_cursor_context_v1::get_theme(Resource *resource)
    {
        Q_UNUSED(resource);
    }

    void treeland_personalization_cursor_context_v1::set_size(Resource *resource, uint32_t size)
    {
        Q_UNUSED(resource);
        Q_UNUSED(size);
    }

    void treeland_personalization_cursor_context_v1::get_size(Resource *resource)
    {
        Q_UNUSED(resource);
    }

    void treeland_personalization_cursor_context_v1::commit(Resource *resource)
    {
        Q_UNUSED(resource);
    }

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


    void treeland_personalization_cursor_context_v1::handle_set_theme(
        ::wl_client *client,
        struct wl_resource *resource,
        const char *name)
    {
        Q_UNUSED(client);
        Resource *qResource = Resource::fromResource(resource);
        if (Q_UNLIKELY(!qResource->treeland_personalization_cursor_context_v1_object)) {
            return;
        }
        static_cast<treeland_personalization_cursor_context_v1 *>(qResource->treeland_personalization_cursor_context_v1_object)->set_theme(
            qResource,
            QString::fromUtf8(name));
    }

    void treeland_personalization_cursor_context_v1::handle_get_theme(
        ::wl_client *client,
        struct wl_resource *resource)
    {
        Q_UNUSED(client);
        Resource *qResource = Resource::fromResource(resource);
        if (Q_UNLIKELY(!qResource->treeland_personalization_cursor_context_v1_object)) {
            return;
        }
        static_cast<treeland_personalization_cursor_context_v1 *>(qResource->treeland_personalization_cursor_context_v1_object)->get_theme(
            qResource);
    }

    void treeland_personalization_cursor_context_v1::handle_set_size(
        ::wl_client *client,
        struct wl_resource *resource,
        uint32_t size)
    {
        Q_UNUSED(client);
        Resource *qResource = Resource::fromResource(resource);
        if (Q_UNLIKELY(!qResource->treeland_personalization_cursor_context_v1_object)) {
            return;
        }
        static_cast<treeland_personalization_cursor_context_v1 *>(qResource->treeland_personalization_cursor_context_v1_object)->set_size(
            qResource,
            size);
    }

    void treeland_personalization_cursor_context_v1::handle_get_size(
        ::wl_client *client,
        struct wl_resource *resource)
    {
        Q_UNUSED(client);
        Resource *qResource = Resource::fromResource(resource);
        if (Q_UNLIKELY(!qResource->treeland_personalization_cursor_context_v1_object)) {
            return;
        }
        static_cast<treeland_personalization_cursor_context_v1 *>(qResource->treeland_personalization_cursor_context_v1_object)->get_size(
            qResource);
    }

    void treeland_personalization_cursor_context_v1::handle_commit(
        ::wl_client *client,
        struct wl_resource *resource)
    {
        Q_UNUSED(client);
        Resource *qResource = Resource::fromResource(resource);
        if (Q_UNLIKELY(!qResource->treeland_personalization_cursor_context_v1_object)) {
            return;
        }
        static_cast<treeland_personalization_cursor_context_v1 *>(qResource->treeland_personalization_cursor_context_v1_object)->commit(
            qResource);
    }

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

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

    void treeland_personalization_cursor_context_v1::send_verfity(struct ::wl_resource *resource, int32_t success)
    {
        treeland_personalization_cursor_context_v1_send_verfity(
            resource,
            success);
    }


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

    void treeland_personalization_cursor_context_v1::send_theme(struct ::wl_resource *resource, const QString &name)
    {
        treeland_personalization_cursor_context_v1_send_theme(
            resource,
            name.toUtf8().constData());
    }


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

    void treeland_personalization_cursor_context_v1::send_size(struct ::wl_resource *resource, uint32_t size)
    {
        treeland_personalization_cursor_context_v1_send_size(
            resource,
            size);
    }



    int treeland_personalization_window_context_v1::deferred_destroy_global_func(void *data) {
        auto object = static_cast<treeland_personalization_window_context_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_personalization_window_context_v1::treeland_personalization_window_context_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_personalization_window_context_v1::treeland_personalization_window_context_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_personalization_window_context_v1::treeland_personalization_window_context_v1(struct ::wl_resource *resource)
        : m_resource_map()
        , m_resource(nullptr)
        , m_global(nullptr)
        , m_display(nullptr)
        , m_globalRemovedEvent(nullptr)
    {
        init(resource);
    }

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

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

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

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

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

    treeland_personalization_window_context_v1::Resource *treeland_personalization_window_context_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_personalization_window_context_v1::init(struct ::wl_display *display, int version)
    {
        m_display = display;
        m_global = wl_global_create(display, &::treeland_personalization_window_context_v1_interface, version, this, bind_func);
        m_displayDestroyedListener.notify = treeland_personalization_window_context_v1::display_destroy_func;
        m_displayDestroyedListener.parent = this;
        wl_display_add_destroy_listener(display, &m_displayDestroyedListener);
    }

    const struct wl_interface *treeland_personalization_window_context_v1::interface()
    {
        return &::treeland_personalization_window_context_v1_interface;
    }

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

    void treeland_personalization_window_context_v1::destroy_global()
    {
    }

    void treeland_personalization_window_context_v1::bind_resource(Resource *)
    {
    }

    void treeland_personalization_window_context_v1::destroy_resource(Resource *)
    {
    }

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

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

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

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


    void treeland_personalization_window_context_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_personalization_window_context_v1::Resource *treeland_personalization_window_context_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_personalization_window_context_v1_interface, version, id);
        return bind(handle);
    }

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

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

    const struct ::treeland_personalization_window_context_v1_interface treeland_personalization_window_context_v1::m_treeland_personalization_window_context_v1_interface = {
        treeland_personalization_window_context_v1::handle_set_blend_mode,
        treeland_personalization_window_context_v1::handle_set_round_corner_radius,
        treeland_personalization_window_context_v1::handle_set_shadow,
        treeland_personalization_window_context_v1::handle_set_border,
        treeland_personalization_window_context_v1::handle_set_titlebar,
        treeland_personalization_window_context_v1::handle_destroy
    };

    void treeland_personalization_window_context_v1::set_blend_mode(Resource *resource, int32_t mode)
    {
        Q_UNUSED(resource);
        Q_UNUSED(mode);
    }

    void treeland_personalization_window_context_v1::set_round_corner_radius(Resource *resource, int32_t radius)
    {
        Q_UNUSED(resource);
        Q_UNUSED(radius);
    }

    void treeland_personalization_window_context_v1::set_shadow(Resource *resource, int32_t radius, int32_t offset_x, int32_t offset_y, int32_t r, int32_t g, int32_t b, int32_t a)
    {
        Q_UNUSED(resource);
        Q_UNUSED(radius);
        Q_UNUSED(offset_x);
        Q_UNUSED(offset_y);
        Q_UNUSED(r);
        Q_UNUSED(g);
        Q_UNUSED(b);
        Q_UNUSED(a);
    }

    void treeland_personalization_window_context_v1::set_border(Resource *resource, int32_t width, int32_t r, int32_t g, int32_t b, int32_t a)
    {
        Q_UNUSED(resource);
        Q_UNUSED(width);
        Q_UNUSED(r);
        Q_UNUSED(g);
        Q_UNUSED(b);
        Q_UNUSED(a);
    }

    void treeland_personalization_window_context_v1::set_titlebar(Resource *resource, int32_t mode)
    {
        Q_UNUSED(resource);
        Q_UNUSED(mode);
    }

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


    void treeland_personalization_window_context_v1::handle_set_blend_mode(
        ::wl_client *client,
        struct wl_resource *resource,
        int32_t mode)
    {
        Q_UNUSED(client);
        Resource *qResource = Resource::fromResource(resource);
        if (Q_UNLIKELY(!qResource->treeland_personalization_window_context_v1_object)) {
            return;
        }
        static_cast<treeland_personalization_window_context_v1 *>(qResource->treeland_personalization_window_context_v1_object)->set_blend_mode(
            qResource,
            mode);
    }

    void treeland_personalization_window_context_v1::handle_set_round_corner_radius(
        ::wl_client *client,
        struct wl_resource *resource,
        int32_t radius)
    {
        Q_UNUSED(client);
        Resource *qResource = Resource::fromResource(resource);
        if (Q_UNLIKELY(!qResource->treeland_personalization_window_context_v1_object)) {
            return;
        }
        static_cast<treeland_personalization_window_context_v1 *>(qResource->treeland_personalization_window_context_v1_object)->set_round_corner_radius(
            qResource,
            radius);
    }

    void treeland_personalization_window_context_v1::handle_set_shadow(
        ::wl_client *client,
        struct wl_resource *resource,
        int32_t radius,
        int32_t offset_x,
        int32_t offset_y,
        int32_t r,
        int32_t g,
        int32_t b,
        int32_t a)
    {
        Q_UNUSED(client);
        Resource *qResource = Resource::fromResource(resource);
        if (Q_UNLIKELY(!qResource->treeland_personalization_window_context_v1_object)) {
            return;
        }
        static_cast<treeland_personalization_window_context_v1 *>(qResource->treeland_personalization_window_context_v1_object)->set_shadow(
            qResource,
            radius,
            offset_x,
            offset_y,
            r,
            g,
            b,
            a);
    }

    void treeland_personalization_window_context_v1::handle_set_border(
        ::wl_client *client,
        struct wl_resource *resource,
        int32_t width,
        int32_t r,
        int32_t g,
        int32_t b,
        int32_t a)
    {
        Q_UNUSED(client);
        Resource *qResource = Resource::fromResource(resource);
        if (Q_UNLIKELY(!qResource->treeland_personalization_window_context_v1_object)) {
            return;
        }
        static_cast<treeland_personalization_window_context_v1 *>(qResource->treeland_personalization_window_context_v1_object)->set_border(
            qResource,
            width,
            r,
            g,
            b,
            a);
    }

    void treeland_personalization_window_context_v1::handle_set_titlebar(
        ::wl_client *client,
        struct wl_resource *resource,
        int32_t mode)
    {
        Q_UNUSED(client);
        Resource *qResource = Resource::fromResource(resource);
        if (Q_UNLIKELY(!qResource->treeland_personalization_window_context_v1_object)) {
            return;
        }
        static_cast<treeland_personalization_window_context_v1 *>(qResource->treeland_personalization_window_context_v1_object)->set_titlebar(
            qResource,
            mode);
    }

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


    int treeland_personalization_font_context_v1::deferred_destroy_global_func(void *data) {
        auto object = static_cast<treeland_personalization_font_context_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_personalization_font_context_v1::treeland_personalization_font_context_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_personalization_font_context_v1::treeland_personalization_font_context_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_personalization_font_context_v1::treeland_personalization_font_context_v1(struct ::wl_resource *resource)
        : m_resource_map()
        , m_resource(nullptr)
        , m_global(nullptr)
        , m_display(nullptr)
        , m_globalRemovedEvent(nullptr)
    {
        init(resource);
    }

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

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

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

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

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

    treeland_personalization_font_context_v1::Resource *treeland_personalization_font_context_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_personalization_font_context_v1::init(struct ::wl_display *display, int version)
    {
        m_display = display;
        m_global = wl_global_create(display, &::treeland_personalization_font_context_v1_interface, version, this, bind_func);
        m_displayDestroyedListener.notify = treeland_personalization_font_context_v1::display_destroy_func;
        m_displayDestroyedListener.parent = this;
        wl_display_add_destroy_listener(display, &m_displayDestroyedListener);
    }

    const struct wl_interface *treeland_personalization_font_context_v1::interface()
    {
        return &::treeland_personalization_font_context_v1_interface;
    }

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

    void treeland_personalization_font_context_v1::destroy_global()
    {
    }

    void treeland_personalization_font_context_v1::bind_resource(Resource *)
    {
    }

    void treeland_personalization_font_context_v1::destroy_resource(Resource *)
    {
    }

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

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

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

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


    void treeland_personalization_font_context_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_personalization_font_context_v1::Resource *treeland_personalization_font_context_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_personalization_font_context_v1_interface, version, id);
        return bind(handle);
    }

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

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

    const struct ::treeland_personalization_font_context_v1_interface treeland_personalization_font_context_v1::m_treeland_personalization_font_context_v1_interface = {
        treeland_personalization_font_context_v1::handle_set_font_size,
        treeland_personalization_font_context_v1::handle_get_font_size,
        treeland_personalization_font_context_v1::handle_set_font,
        treeland_personalization_font_context_v1::handle_get_font,
        treeland_personalization_font_context_v1::handle_set_monospace_font,
        treeland_personalization_font_context_v1::handle_get_monospace_font,
        treeland_personalization_font_context_v1::handle_destroy
    };

    void treeland_personalization_font_context_v1::set_font_size(Resource *resource, uint32_t size)
    {
        Q_UNUSED(resource);
        Q_UNUSED(size);
    }

    void treeland_personalization_font_context_v1::get_font_size(Resource *resource)
    {
        Q_UNUSED(resource);
    }

    void treeland_personalization_font_context_v1::set_font(Resource *resource, const QString &font_name)
    {
        Q_UNUSED(resource);
        Q_UNUSED(font_name);
    }

    void treeland_personalization_font_context_v1::get_font(Resource *resource)
    {
        Q_UNUSED(resource);
    }

    void treeland_personalization_font_context_v1::set_monospace_font(Resource *resource, const QString &font_name)
    {
        Q_UNUSED(resource);
        Q_UNUSED(font_name);
    }

    void treeland_personalization_font_context_v1::get_monospace_font(Resource *resource)
    {
        Q_UNUSED(resource);
    }

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


    void treeland_personalization_font_context_v1::handle_set_font_size(
        ::wl_client *client,
        struct wl_resource *resource,
        uint32_t size)
    {
        Q_UNUSED(client);
        Resource *qResource = Resource::fromResource(resource);
        if (Q_UNLIKELY(!qResource->treeland_personalization_font_context_v1_object)) {
            return;
        }
        static_cast<treeland_personalization_font_context_v1 *>(qResource->treeland_personalization_font_context_v1_object)->set_font_size(
            qResource,
            size);
    }

    void treeland_personalization_font_context_v1::handle_get_font_size(
        ::wl_client *client,
        struct wl_resource *resource)
    {
        Q_UNUSED(client);
        Resource *qResource = Resource::fromResource(resource);
        if (Q_UNLIKELY(!qResource->treeland_personalization_font_context_v1_object)) {
            return;
        }
        static_cast<treeland_personalization_font_context_v1 *>(qResource->treeland_personalization_font_context_v1_object)->get_font_size(
            qResource);
    }

    void treeland_personalization_font_context_v1::handle_set_font(
        ::wl_client *client,
        struct wl_resource *resource,
        const char *font_name)
    {
        Q_UNUSED(client);
        Resource *qResource = Resource::fromResource(resource);
        if (Q_UNLIKELY(!qResource->treeland_personalization_font_context_v1_object)) {
            return;
        }
        static_cast<treeland_personalization_font_context_v1 *>(qResource->treeland_personalization_font_context_v1_object)->set_font(
            qResource,
            QString::fromUtf8(font_name));
    }

    void treeland_personalization_font_context_v1::handle_get_font(
        ::wl_client *client,
        struct wl_resource *resource)
    {
        Q_UNUSED(client);
        Resource *qResource = Resource::fromResource(resource);
        if (Q_UNLIKELY(!qResource->treeland_personalization_font_context_v1_object)) {
            return;
        }
        static_cast<treeland_personalization_font_context_v1 *>(qResource->treeland_personalization_font_context_v1_object)->get_font(
            qResource);
    }

    void treeland_personalization_font_context_v1::handle_set_monospace_font(
        ::wl_client *client,
        struct wl_resource *resource,
        const char *font_name)
    {
        Q_UNUSED(client);
        Resource *qResource = Resource::fromResource(resource);
        if (Q_UNLIKELY(!qResource->treeland_personalization_font_context_v1_object)) {
            return;
        }
        static_cast<treeland_personalization_font_context_v1 *>(qResource->treeland_personalization_font_context_v1_object)->set_monospace_font(
            qResource,
            QString::fromUtf8(font_name));
    }

    void treeland_personalization_font_context_v1::handle_get_monospace_font(
        ::wl_client *client,
        struct wl_resource *resource)
    {
        Q_UNUSED(client);
        Resource *qResource = Resource::fromResource(resource);
        if (Q_UNLIKELY(!qResource->treeland_personalization_font_context_v1_object)) {
            return;
        }
        static_cast<treeland_personalization_font_context_v1 *>(qResource->treeland_personalization_font_context_v1_object)->get_monospace_font(
            qResource);
    }

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

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

    void treeland_personalization_font_context_v1::send_font(struct ::wl_resource *resource, const QString &font_name)
    {
        treeland_personalization_font_context_v1_send_font(
            resource,
            font_name.toUtf8().constData());
    }


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

    void treeland_personalization_font_context_v1::send_monospace_font(struct ::wl_resource *resource, const QString &font_name)
    {
        treeland_personalization_font_context_v1_send_monospace_font(
            resource,
            font_name.toUtf8().constData());
    }


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

    void treeland_personalization_font_context_v1::send_font_size(struct ::wl_resource *resource, uint32_t font_size)
    {
        treeland_personalization_font_context_v1_send_font_size(
            resource,
            font_size);
    }



    int treeland_personalization_appearance_context_v1::deferred_destroy_global_func(void *data) {
        auto object = static_cast<treeland_personalization_appearance_context_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_personalization_appearance_context_v1::treeland_personalization_appearance_context_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_personalization_appearance_context_v1::treeland_personalization_appearance_context_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_personalization_appearance_context_v1::treeland_personalization_appearance_context_v1(struct ::wl_resource *resource)
        : m_resource_map()
        , m_resource(nullptr)
        , m_global(nullptr)
        , m_display(nullptr)
        , m_globalRemovedEvent(nullptr)
    {
        init(resource);
    }

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

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

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

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

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

    treeland_personalization_appearance_context_v1::Resource *treeland_personalization_appearance_context_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_personalization_appearance_context_v1::init(struct ::wl_display *display, int version)
    {
        m_display = display;
        m_global = wl_global_create(display, &::treeland_personalization_appearance_context_v1_interface, version, this, bind_func);
        m_displayDestroyedListener.notify = treeland_personalization_appearance_context_v1::display_destroy_func;
        m_displayDestroyedListener.parent = this;
        wl_display_add_destroy_listener(display, &m_displayDestroyedListener);
    }

    const struct wl_interface *treeland_personalization_appearance_context_v1::interface()
    {
        return &::treeland_personalization_appearance_context_v1_interface;
    }

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

    void treeland_personalization_appearance_context_v1::destroy_global()
    {
    }

    void treeland_personalization_appearance_context_v1::bind_resource(Resource *)
    {
    }

    void treeland_personalization_appearance_context_v1::destroy_resource(Resource *)
    {
    }

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

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

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

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


    void treeland_personalization_appearance_context_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_personalization_appearance_context_v1::Resource *treeland_personalization_appearance_context_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_personalization_appearance_context_v1_interface, version, id);
        return bind(handle);
    }

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

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

    const struct ::treeland_personalization_appearance_context_v1_interface treeland_personalization_appearance_context_v1::m_treeland_personalization_appearance_context_v1_interface = {
        treeland_personalization_appearance_context_v1::handle_set_round_corner_radius,
        treeland_personalization_appearance_context_v1::handle_get_round_corner_radius,
        treeland_personalization_appearance_context_v1::handle_set_icon_theme,
        treeland_personalization_appearance_context_v1::handle_get_icon_theme,
        treeland_personalization_appearance_context_v1::handle_set_active_color,
        treeland_personalization_appearance_context_v1::handle_get_active_color,
        treeland_personalization_appearance_context_v1::handle_set_window_opacity,
        treeland_personalization_appearance_context_v1::handle_get_window_opacity,
        treeland_personalization_appearance_context_v1::handle_set_window_theme_type,
        treeland_personalization_appearance_context_v1::handle_get_window_theme_type,
        treeland_personalization_appearance_context_v1::handle_set_window_titlebar_height,
        treeland_personalization_appearance_context_v1::handle_get_window_titlebar_height,
        treeland_personalization_appearance_context_v1::handle_destroy
    };

    void treeland_personalization_appearance_context_v1::set_round_corner_radius(Resource *resource, int32_t radius)
    {
        Q_UNUSED(resource);
        Q_UNUSED(radius);
    }

    void treeland_personalization_appearance_context_v1::get_round_corner_radius(Resource *resource)
    {
        Q_UNUSED(resource);
    }

    void treeland_personalization_appearance_context_v1::set_icon_theme(Resource *resource, const QString &theme)
    {
        Q_UNUSED(resource);
        Q_UNUSED(theme);
    }

    void treeland_personalization_appearance_context_v1::get_icon_theme(Resource *resource)
    {
        Q_UNUSED(resource);
    }

    void treeland_personalization_appearance_context_v1::set_active_color(Resource *resource, const QString &color)
    {
        Q_UNUSED(resource);
        Q_UNUSED(color);
    }

    void treeland_personalization_appearance_context_v1::get_active_color(Resource *resource)
    {
        Q_UNUSED(resource);
    }

    void treeland_personalization_appearance_context_v1::set_window_opacity(Resource *resource, uint32_t opacity)
    {
        Q_UNUSED(resource);
        Q_UNUSED(opacity);
    }

    void treeland_personalization_appearance_context_v1::get_window_opacity(Resource *resource)
    {
        Q_UNUSED(resource);
    }

    void treeland_personalization_appearance_context_v1::set_window_theme_type(Resource *resource, uint32_t type)
    {
        Q_UNUSED(resource);
        Q_UNUSED(type);
    }

    void treeland_personalization_appearance_context_v1::get_window_theme_type(Resource *resource)
    {
        Q_UNUSED(resource);
    }

    void treeland_personalization_appearance_context_v1::set_window_titlebar_height(Resource *resource, uint32_t height)
    {
        Q_UNUSED(resource);
        Q_UNUSED(height);
    }

    void treeland_personalization_appearance_context_v1::get_window_titlebar_height(Resource *resource)
    {
        Q_UNUSED(resource);
    }

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


    void treeland_personalization_appearance_context_v1::handle_set_round_corner_radius(
        ::wl_client *client,
        struct wl_resource *resource,
        int32_t radius)
    {
        Q_UNUSED(client);
        Resource *qResource = Resource::fromResource(resource);
        if (Q_UNLIKELY(!qResource->treeland_personalization_appearance_context_v1_object)) {
            return;
        }
        static_cast<treeland_personalization_appearance_context_v1 *>(qResource->treeland_personalization_appearance_context_v1_object)->set_round_corner_radius(
            qResource,
            radius);
    }

    void treeland_personalization_appearance_context_v1::handle_get_round_corner_radius(
        ::wl_client *client,
        struct wl_resource *resource)
    {
        Q_UNUSED(client);
        Resource *qResource = Resource::fromResource(resource);
        if (Q_UNLIKELY(!qResource->treeland_personalization_appearance_context_v1_object)) {
            return;
        }
        static_cast<treeland_personalization_appearance_context_v1 *>(qResource->treeland_personalization_appearance_context_v1_object)->get_round_corner_radius(
            qResource);
    }

    void treeland_personalization_appearance_context_v1::handle_set_icon_theme(
        ::wl_client *client,
        struct wl_resource *resource,
        const char *theme)
    {
        Q_UNUSED(client);
        Resource *qResource = Resource::fromResource(resource);
        if (Q_UNLIKELY(!qResource->treeland_personalization_appearance_context_v1_object)) {
            return;
        }
        static_cast<treeland_personalization_appearance_context_v1 *>(qResource->treeland_personalization_appearance_context_v1_object)->set_icon_theme(
            qResource,
            QString::fromUtf8(theme));
    }

    void treeland_personalization_appearance_context_v1::handle_get_icon_theme(
        ::wl_client *client,
        struct wl_resource *resource)
    {
        Q_UNUSED(client);
        Resource *qResource = Resource::fromResource(resource);
        if (Q_UNLIKELY(!qResource->treeland_personalization_appearance_context_v1_object)) {
            return;
        }
        static_cast<treeland_personalization_appearance_context_v1 *>(qResource->treeland_personalization_appearance_context_v1_object)->get_icon_theme(
            qResource);
    }

    void treeland_personalization_appearance_context_v1::handle_set_active_color(
        ::wl_client *client,
        struct wl_resource *resource,
        const char *color)
    {
        Q_UNUSED(client);
        Resource *qResource = Resource::fromResource(resource);
        if (Q_UNLIKELY(!qResource->treeland_personalization_appearance_context_v1_object)) {
            return;
        }
        static_cast<treeland_personalization_appearance_context_v1 *>(qResource->treeland_personalization_appearance_context_v1_object)->set_active_color(
            qResource,
            QString::fromUtf8(color));
    }

    void treeland_personalization_appearance_context_v1::handle_get_active_color(
        ::wl_client *client,
        struct wl_resource *resource)
    {
        Q_UNUSED(client);
        Resource *qResource = Resource::fromResource(resource);
        if (Q_UNLIKELY(!qResource->treeland_personalization_appearance_context_v1_object)) {
            return;
        }
        static_cast<treeland_personalization_appearance_context_v1 *>(qResource->treeland_personalization_appearance_context_v1_object)->get_active_color(
            qResource);
    }

    void treeland_personalization_appearance_context_v1::handle_set_window_opacity(
        ::wl_client *client,
        struct wl_resource *resource,
        uint32_t opacity)
    {
        Q_UNUSED(client);
        Resource *qResource = Resource::fromResource(resource);
        if (Q_UNLIKELY(!qResource->treeland_personalization_appearance_context_v1_object)) {
            return;
        }
        static_cast<treeland_personalization_appearance_context_v1 *>(qResource->treeland_personalization_appearance_context_v1_object)->set_window_opacity(
            qResource,
            opacity);
    }

    void treeland_personalization_appearance_context_v1::handle_get_window_opacity(
        ::wl_client *client,
        struct wl_resource *resource)
    {
        Q_UNUSED(client);
        Resource *qResource = Resource::fromResource(resource);
        if (Q_UNLIKELY(!qResource->treeland_personalization_appearance_context_v1_object)) {
            return;
        }
        static_cast<treeland_personalization_appearance_context_v1 *>(qResource->treeland_personalization_appearance_context_v1_object)->get_window_opacity(
            qResource);
    }

    void treeland_personalization_appearance_context_v1::handle_set_window_theme_type(
        ::wl_client *client,
        struct wl_resource *resource,
        uint32_t type)
    {
        Q_UNUSED(client);
        Resource *qResource = Resource::fromResource(resource);
        if (Q_UNLIKELY(!qResource->treeland_personalization_appearance_context_v1_object)) {
            return;
        }
        static_cast<treeland_personalization_appearance_context_v1 *>(qResource->treeland_personalization_appearance_context_v1_object)->set_window_theme_type(
            qResource,
            type);
    }

    void treeland_personalization_appearance_context_v1::handle_get_window_theme_type(
        ::wl_client *client,
        struct wl_resource *resource)
    {
        Q_UNUSED(client);
        Resource *qResource = Resource::fromResource(resource);
        if (Q_UNLIKELY(!qResource->treeland_personalization_appearance_context_v1_object)) {
            return;
        }
        static_cast<treeland_personalization_appearance_context_v1 *>(qResource->treeland_personalization_appearance_context_v1_object)->get_window_theme_type(
            qResource);
    }

    void treeland_personalization_appearance_context_v1::handle_set_window_titlebar_height(
        ::wl_client *client,
        struct wl_resource *resource,
        uint32_t height)
    {
        Q_UNUSED(client);
        Resource *qResource = Resource::fromResource(resource);
        if (Q_UNLIKELY(!qResource->treeland_personalization_appearance_context_v1_object)) {
            return;
        }
        static_cast<treeland_personalization_appearance_context_v1 *>(qResource->treeland_personalization_appearance_context_v1_object)->set_window_titlebar_height(
            qResource,
            height);
    }

    void treeland_personalization_appearance_context_v1::handle_get_window_titlebar_height(
        ::wl_client *client,
        struct wl_resource *resource)
    {
        Q_UNUSED(client);
        Resource *qResource = Resource::fromResource(resource);
        if (Q_UNLIKELY(!qResource->treeland_personalization_appearance_context_v1_object)) {
            return;
        }
        static_cast<treeland_personalization_appearance_context_v1 *>(qResource->treeland_personalization_appearance_context_v1_object)->get_window_titlebar_height(
            qResource);
    }

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

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

    void treeland_personalization_appearance_context_v1::send_round_corner_radius(struct ::wl_resource *resource, int32_t radius)
    {
        treeland_personalization_appearance_context_v1_send_round_corner_radius(
            resource,
            radius);
    }


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

    void treeland_personalization_appearance_context_v1::send_icon_theme(struct ::wl_resource *resource, const QString &theme_name)
    {
        treeland_personalization_appearance_context_v1_send_icon_theme(
            resource,
            theme_name.toUtf8().constData());
    }


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

    void treeland_personalization_appearance_context_v1::send_active_color(struct ::wl_resource *resource, const QString &active_color)
    {
        treeland_personalization_appearance_context_v1_send_active_color(
            resource,
            active_color.toUtf8().constData());
    }


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

    void treeland_personalization_appearance_context_v1::send_window_opacity(struct ::wl_resource *resource, uint32_t opacity)
    {
        treeland_personalization_appearance_context_v1_send_window_opacity(
            resource,
            opacity);
    }


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

    void treeland_personalization_appearance_context_v1::send_window_theme_type(struct ::wl_resource *resource, uint32_t type)
    {
        treeland_personalization_appearance_context_v1_send_window_theme_type(
            resource,
            type);
    }


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

    void treeland_personalization_appearance_context_v1::send_window_titlebar_height(struct ::wl_resource *resource, uint32_t height)
    {
        treeland_personalization_appearance_context_v1_send_window_titlebar_height(
            resource,
            height);
    }

}

QT_WARNING_POP
QT_END_NAMESPACE
