// This file was generated by qtwaylandscanner
// source file is text-input-unstable-v3.xml

#include "qwayland-server-text-input-unstable-v3.h"

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

namespace QtWaylandServer {

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

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

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

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

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

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

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

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

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

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

    zwp_text_input_v3::Resource *zwp_text_input_v3::add(struct ::wl_resource *resource)
    {
        return *m_resource_map.insert(wl_resource_get_client(resource), bind(resource));
    }

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

    const struct wl_interface *zwp_text_input_v3::interface()
    {
        return &::zwp_text_input_v3_interface;
    }

    zwp_text_input_v3::Resource *zwp_text_input_v3::zwp_text_input_v3_allocate()
    {
        return new Resource;
    }

    void zwp_text_input_v3::zwp_text_input_v3_destroy_global()
    {
    }

    void zwp_text_input_v3::zwp_text_input_v3_bind_resource(Resource *)
    {
    }

    void zwp_text_input_v3::zwp_text_input_v3_destroy_resource(Resource *)
    {
    }

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

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

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

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


    void zwp_text_input_v3::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, 300000);
    }

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

    zwp_text_input_v3::Resource *zwp_text_input_v3::bind(struct ::wl_resource *handle)
    {
        Resource *resource = zwp_text_input_v3_allocate();
        resource->zwp_text_input_v3_object = this;

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

    const struct ::zwp_text_input_v3_interface zwp_text_input_v3::m_zwp_text_input_v3_interface = {
        zwp_text_input_v3::handle_destroy,
        zwp_text_input_v3::handle_enable,
        zwp_text_input_v3::handle_disable,
        zwp_text_input_v3::handle_set_surrounding_text,
        zwp_text_input_v3::handle_set_text_change_cause,
        zwp_text_input_v3::handle_set_content_type,
        zwp_text_input_v3::handle_set_cursor_rectangle,
        zwp_text_input_v3::handle_commit,
        zwp_text_input_v3::handle_set_available_actions,
        zwp_text_input_v3::handle_show_input_panel,
        zwp_text_input_v3::handle_hide_input_panel
    };

    void zwp_text_input_v3::zwp_text_input_v3_destroy(Resource *)
    {
    }

    void zwp_text_input_v3::zwp_text_input_v3_enable(Resource *)
    {
    }

    void zwp_text_input_v3::zwp_text_input_v3_disable(Resource *)
    {
    }

    void zwp_text_input_v3::zwp_text_input_v3_set_surrounding_text(Resource *, const QString &, int32_t , int32_t )
    {
    }

    void zwp_text_input_v3::zwp_text_input_v3_set_text_change_cause(Resource *, uint32_t )
    {
    }

    void zwp_text_input_v3::zwp_text_input_v3_set_content_type(Resource *, uint32_t , uint32_t )
    {
    }

    void zwp_text_input_v3::zwp_text_input_v3_set_cursor_rectangle(Resource *, int32_t , int32_t , int32_t , int32_t )
    {
    }

    void zwp_text_input_v3::zwp_text_input_v3_commit(Resource *)
    {
    }

    void zwp_text_input_v3::zwp_text_input_v3_set_available_actions(Resource *, wl_array *)
    {
    }

    void zwp_text_input_v3::zwp_text_input_v3_show_input_panel(Resource *)
    {
    }

    void zwp_text_input_v3::zwp_text_input_v3_hide_input_panel(Resource *)
    {
    }


    void zwp_text_input_v3::handle_destroy(
        ::wl_client *client,
        struct wl_resource *resource)
    {
        Q_UNUSED(client);
        Resource *qtResource = Resource::fromResource(resource);
        if (Q_UNLIKELY(!qtResource->zwp_text_input_v3_object)) {
            wl_resource_destroy(resource);
            return;
        }
        static_cast<zwp_text_input_v3 *>(qtResource->zwp_text_input_v3_object)->zwp_text_input_v3_destroy(
            qtResource);
    }

    void zwp_text_input_v3::handle_enable(
        ::wl_client *client,
        struct wl_resource *resource)
    {
        Q_UNUSED(client);
        Resource *qtResource = Resource::fromResource(resource);
        if (Q_UNLIKELY(!qtResource->zwp_text_input_v3_object)) {
            return;
        }
        static_cast<zwp_text_input_v3 *>(qtResource->zwp_text_input_v3_object)->zwp_text_input_v3_enable(
            qtResource);
    }

    void zwp_text_input_v3::handle_disable(
        ::wl_client *client,
        struct wl_resource *resource)
    {
        Q_UNUSED(client);
        Resource *qtResource = Resource::fromResource(resource);
        if (Q_UNLIKELY(!qtResource->zwp_text_input_v3_object)) {
            return;
        }
        static_cast<zwp_text_input_v3 *>(qtResource->zwp_text_input_v3_object)->zwp_text_input_v3_disable(
            qtResource);
    }

    void zwp_text_input_v3::handle_set_surrounding_text(
        ::wl_client *client,
        struct wl_resource *resource,
        const char *text,
        int32_t cursor,
        int32_t anchor)
    {
        Q_UNUSED(client);
        Resource *qtResource = Resource::fromResource(resource);
        if (Q_UNLIKELY(!qtResource->zwp_text_input_v3_object)) {
            return;
        }
        static_cast<zwp_text_input_v3 *>(qtResource->zwp_text_input_v3_object)->zwp_text_input_v3_set_surrounding_text(
            qtResource,
            QString::fromUtf8(text),
            cursor,
            anchor);
    }

    void zwp_text_input_v3::handle_set_text_change_cause(
        ::wl_client *client,
        struct wl_resource *resource,
        uint32_t cause)
    {
        Q_UNUSED(client);
        Resource *qtResource = Resource::fromResource(resource);
        if (Q_UNLIKELY(!qtResource->zwp_text_input_v3_object)) {
            return;
        }
        static_cast<zwp_text_input_v3 *>(qtResource->zwp_text_input_v3_object)->zwp_text_input_v3_set_text_change_cause(
            qtResource,
            cause);
    }

    void zwp_text_input_v3::handle_set_content_type(
        ::wl_client *client,
        struct wl_resource *resource,
        uint32_t hint,
        uint32_t purpose)
    {
        Q_UNUSED(client);
        Resource *qtResource = Resource::fromResource(resource);
        if (Q_UNLIKELY(!qtResource->zwp_text_input_v3_object)) {
            return;
        }
        static_cast<zwp_text_input_v3 *>(qtResource->zwp_text_input_v3_object)->zwp_text_input_v3_set_content_type(
            qtResource,
            hint,
            purpose);
    }

    void zwp_text_input_v3::handle_set_cursor_rectangle(
        ::wl_client *client,
        struct wl_resource *resource,
        int32_t x,
        int32_t y,
        int32_t width,
        int32_t height)
    {
        Q_UNUSED(client);
        Resource *qtResource = Resource::fromResource(resource);
        if (Q_UNLIKELY(!qtResource->zwp_text_input_v3_object)) {
            return;
        }
        static_cast<zwp_text_input_v3 *>(qtResource->zwp_text_input_v3_object)->zwp_text_input_v3_set_cursor_rectangle(
            qtResource,
            x,
            y,
            width,
            height);
    }

    void zwp_text_input_v3::handle_commit(
        ::wl_client *client,
        struct wl_resource *resource)
    {
        Q_UNUSED(client);
        Resource *qtResource = Resource::fromResource(resource);
        if (Q_UNLIKELY(!qtResource->zwp_text_input_v3_object)) {
            return;
        }
        static_cast<zwp_text_input_v3 *>(qtResource->zwp_text_input_v3_object)->zwp_text_input_v3_commit(
            qtResource);
    }

    void zwp_text_input_v3::handle_set_available_actions(
        ::wl_client *client,
        struct wl_resource *resource,
        wl_array *available_actions)
    {
        Q_UNUSED(client);
        Resource *qtResource = Resource::fromResource(resource);
        if (Q_UNLIKELY(!qtResource->zwp_text_input_v3_object)) {
            return;
        }
        static_cast<zwp_text_input_v3 *>(qtResource->zwp_text_input_v3_object)->zwp_text_input_v3_set_available_actions(
            qtResource,
            available_actions);
    }

    void zwp_text_input_v3::handle_show_input_panel(
        ::wl_client *client,
        struct wl_resource *resource)
    {
        Q_UNUSED(client);
        Resource *qtResource = Resource::fromResource(resource);
        if (Q_UNLIKELY(!qtResource->zwp_text_input_v3_object)) {
            return;
        }
        static_cast<zwp_text_input_v3 *>(qtResource->zwp_text_input_v3_object)->zwp_text_input_v3_show_input_panel(
            qtResource);
    }

    void zwp_text_input_v3::handle_hide_input_panel(
        ::wl_client *client,
        struct wl_resource *resource)
    {
        Q_UNUSED(client);
        Resource *qtResource = Resource::fromResource(resource);
        if (Q_UNLIKELY(!qtResource->zwp_text_input_v3_object)) {
            return;
        }
        static_cast<zwp_text_input_v3 *>(qtResource->zwp_text_input_v3_object)->zwp_text_input_v3_hide_input_panel(
            qtResource);
    }

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

    void zwp_text_input_v3::send_enter(struct ::wl_resource *resource, struct ::wl_resource *surface)
    {
        zwp_text_input_v3_send_enter(
            resource,
            surface);
    }


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

    void zwp_text_input_v3::send_leave(struct ::wl_resource *resource, struct ::wl_resource *surface)
    {
        zwp_text_input_v3_send_leave(
            resource,
            surface);
    }


    void zwp_text_input_v3::send_preedit_string(const QString &text, int32_t cursor_begin, int32_t cursor_end)
    {
        Q_ASSERT_X(m_resource, "zwp_text_input_v3::preedit_string", "Uninitialised resource");
        if (Q_UNLIKELY(!m_resource)) {
            qWarning("could not call zwp_text_input_v3::preedit_string as it's not initialised");
            return;
        }
        send_preedit_string(
            m_resource->handle,
            text,
            cursor_begin,
            cursor_end);
    }

    void zwp_text_input_v3::send_preedit_string(struct ::wl_resource *resource, const QString &text, int32_t cursor_begin, int32_t cursor_end)
    {
        zwp_text_input_v3_send_preedit_string(
            resource,
            text.toUtf8().constData(),
            cursor_begin,
            cursor_end);
    }


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

    void zwp_text_input_v3::send_commit_string(struct ::wl_resource *resource, const QString &text)
    {
        zwp_text_input_v3_send_commit_string(
            resource,
            text.toUtf8().constData());
    }


    void zwp_text_input_v3::send_delete_surrounding_text(uint32_t before_length, uint32_t after_length)
    {
        Q_ASSERT_X(m_resource, "zwp_text_input_v3::delete_surrounding_text", "Uninitialised resource");
        if (Q_UNLIKELY(!m_resource)) {
            qWarning("could not call zwp_text_input_v3::delete_surrounding_text as it's not initialised");
            return;
        }
        send_delete_surrounding_text(
            m_resource->handle,
            before_length,
            after_length);
    }

    void zwp_text_input_v3::send_delete_surrounding_text(struct ::wl_resource *resource, uint32_t before_length, uint32_t after_length)
    {
        zwp_text_input_v3_send_delete_surrounding_text(
            resource,
            before_length,
            after_length);
    }


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

    void zwp_text_input_v3::send_done(struct ::wl_resource *resource, uint32_t serial)
    {
        zwp_text_input_v3_send_done(
            resource,
            serial);
    }


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

    void zwp_text_input_v3::send_action(struct ::wl_resource *resource, uint32_t action, uint32_t serial)
    {
        zwp_text_input_v3_send_action(
            resource,
            action,
            serial);
    }


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

    void zwp_text_input_v3::send_language(struct ::wl_resource *resource, const QString &language)
    {
        zwp_text_input_v3_send_language(
            resource,
            language.toUtf8().constData());
    }


    void zwp_text_input_v3::send_preedit_hint(uint32_t start, uint32_t end, uint32_t hint)
    {
        Q_ASSERT_X(m_resource, "zwp_text_input_v3::preedit_hint", "Uninitialised resource");
        if (Q_UNLIKELY(!m_resource)) {
            qWarning("could not call zwp_text_input_v3::preedit_hint as it's not initialised");
            return;
        }
        send_preedit_hint(
            m_resource->handle,
            start,
            end,
            hint);
    }

    void zwp_text_input_v3::send_preedit_hint(struct ::wl_resource *resource, uint32_t start, uint32_t end, uint32_t hint)
    {
        zwp_text_input_v3_send_preedit_hint(
            resource,
            start,
            end,
            hint);
    }



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

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

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

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

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

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

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

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

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

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

    zwp_text_input_manager_v3::Resource *zwp_text_input_manager_v3::add(struct ::wl_resource *resource)
    {
        return *m_resource_map.insert(wl_resource_get_client(resource), bind(resource));
    }

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

    const struct wl_interface *zwp_text_input_manager_v3::interface()
    {
        return &::zwp_text_input_manager_v3_interface;
    }

    zwp_text_input_manager_v3::Resource *zwp_text_input_manager_v3::zwp_text_input_manager_v3_allocate()
    {
        return new Resource;
    }

    void zwp_text_input_manager_v3::zwp_text_input_manager_v3_destroy_global()
    {
    }

    void zwp_text_input_manager_v3::zwp_text_input_manager_v3_bind_resource(Resource *)
    {
    }

    void zwp_text_input_manager_v3::zwp_text_input_manager_v3_destroy_resource(Resource *)
    {
    }

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

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

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

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


    void zwp_text_input_manager_v3::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, 300000);
    }

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

    zwp_text_input_manager_v3::Resource *zwp_text_input_manager_v3::bind(struct ::wl_resource *handle)
    {
        Resource *resource = zwp_text_input_manager_v3_allocate();
        resource->zwp_text_input_manager_v3_object = this;

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

    const struct ::zwp_text_input_manager_v3_interface zwp_text_input_manager_v3::m_zwp_text_input_manager_v3_interface = {
        zwp_text_input_manager_v3::handle_destroy,
        zwp_text_input_manager_v3::handle_get_text_input
    };

    void zwp_text_input_manager_v3::zwp_text_input_manager_v3_destroy(Resource *)
    {
    }

    void zwp_text_input_manager_v3::zwp_text_input_manager_v3_get_text_input(Resource *, uint32_t, struct ::wl_resource *)
    {
    }


    void zwp_text_input_manager_v3::handle_destroy(
        ::wl_client *client,
        struct wl_resource *resource)
    {
        Q_UNUSED(client);
        Resource *qtResource = Resource::fromResource(resource);
        if (Q_UNLIKELY(!qtResource->zwp_text_input_manager_v3_object)) {
            wl_resource_destroy(resource);
            return;
        }
        static_cast<zwp_text_input_manager_v3 *>(qtResource->zwp_text_input_manager_v3_object)->zwp_text_input_manager_v3_destroy(
            qtResource);
    }

    void zwp_text_input_manager_v3::handle_get_text_input(
        ::wl_client *client,
        struct wl_resource *resource,
        uint32_t id,
        struct ::wl_resource *seat)
    {
        Q_UNUSED(client);
        Resource *qtResource = Resource::fromResource(resource);
        if (Q_UNLIKELY(!qtResource->zwp_text_input_manager_v3_object)) {
            return;
        }
        static_cast<zwp_text_input_manager_v3 *>(qtResource->zwp_text_input_manager_v3_object)->zwp_text_input_manager_v3_get_text_input(
            qtResource,
            id,
            seat);
    }
}

QT_WARNING_POP
QT_END_NAMESPACE
