// This file was generated by qtwaylandscanner
// source file is plasma-shell.xml

#include "qwayland-server-plasma-shell.h"

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

namespace QtWaylandServer {

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

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

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

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

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

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

        if (m_resource)
            m_resource->org_kde_plasma_shell_object = nullptr;

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

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

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

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

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

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

    const struct wl_interface *org_kde_plasma_shell::interface()
    {
        return &::org_kde_plasma_shell_interface;
    }

    org_kde_plasma_shell::Resource *org_kde_plasma_shell::org_kde_plasma_shell_allocate()
    {
        return new Resource;
    }

    void org_kde_plasma_shell::org_kde_plasma_shell_destroy_global()
    {
    }

    void org_kde_plasma_shell::org_kde_plasma_shell_bind_resource(Resource *)
    {
    }

    void org_kde_plasma_shell::org_kde_plasma_shell_destroy_resource(Resource *)
    {
    }

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

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

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

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


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

    org_kde_plasma_shell::Resource *org_kde_plasma_shell::bind(struct ::wl_client *client, uint32_t id, int version)
    {
        Q_ASSERT_X(!wl_client_get_object(client, id), "QWaylandObject bind", QStringLiteral("binding to object %1 more than once").arg(id).toLocal8Bit().constData());
        struct ::wl_resource *handle = wl_resource_create(client, &::org_kde_plasma_shell_interface, version, id);
        return bind(handle);
    }

    org_kde_plasma_shell::Resource *org_kde_plasma_shell::bind(struct ::wl_resource *handle)
    {
        Resource *resource = org_kde_plasma_shell_allocate();
        resource->org_kde_plasma_shell_object = this;

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

    const struct ::org_kde_plasma_shell_interface org_kde_plasma_shell::m_org_kde_plasma_shell_interface = {
        org_kde_plasma_shell::handle_get_surface
    };

    void org_kde_plasma_shell::org_kde_plasma_shell_get_surface(Resource *, uint32_t, struct ::wl_resource *)
    {
    }


    void org_kde_plasma_shell::handle_get_surface(
        ::wl_client *client,
        struct wl_resource *resource,
        uint32_t id,
        struct ::wl_resource *surface)
    {
        Q_UNUSED(client);
        Resource *r = Resource::fromResource(resource);
        if (Q_UNLIKELY(!r->org_kde_plasma_shell_object)) {
            return;
        }
        static_cast<org_kde_plasma_shell *>(r->org_kde_plasma_shell_object)->org_kde_plasma_shell_get_surface(
            r,
            id,
            surface);
    }


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

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

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

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

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

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

        if (m_resource)
            m_resource->org_kde_plasma_surface_object = nullptr;

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

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

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

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

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

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

    const struct wl_interface *org_kde_plasma_surface::interface()
    {
        return &::org_kde_plasma_surface_interface;
    }

    org_kde_plasma_surface::Resource *org_kde_plasma_surface::org_kde_plasma_surface_allocate()
    {
        return new Resource;
    }

    void org_kde_plasma_surface::org_kde_plasma_surface_destroy_global()
    {
    }

    void org_kde_plasma_surface::org_kde_plasma_surface_bind_resource(Resource *)
    {
    }

    void org_kde_plasma_surface::org_kde_plasma_surface_destroy_resource(Resource *)
    {
    }

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

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

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

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


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

    org_kde_plasma_surface::Resource *org_kde_plasma_surface::bind(struct ::wl_client *client, uint32_t id, int version)
    {
        Q_ASSERT_X(!wl_client_get_object(client, id), "QWaylandObject bind", QStringLiteral("binding to object %1 more than once").arg(id).toLocal8Bit().constData());
        struct ::wl_resource *handle = wl_resource_create(client, &::org_kde_plasma_surface_interface, version, id);
        return bind(handle);
    }

    org_kde_plasma_surface::Resource *org_kde_plasma_surface::bind(struct ::wl_resource *handle)
    {
        Resource *resource = org_kde_plasma_surface_allocate();
        resource->org_kde_plasma_surface_object = this;

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

    const struct ::org_kde_plasma_surface_interface org_kde_plasma_surface::m_org_kde_plasma_surface_interface = {
        org_kde_plasma_surface::handle_destroy,
        org_kde_plasma_surface::handle_set_output,
        org_kde_plasma_surface::handle_set_position,
        org_kde_plasma_surface::handle_set_role,
        org_kde_plasma_surface::handle_set_panel_behavior,
        org_kde_plasma_surface::handle_set_skip_taskbar,
        org_kde_plasma_surface::handle_panel_auto_hide_hide,
        org_kde_plasma_surface::handle_panel_auto_hide_show,
        org_kde_plasma_surface::handle_set_panel_takes_focus,
        org_kde_plasma_surface::handle_set_skip_switcher,
        org_kde_plasma_surface::handle_open_under_cursor
    };

    void org_kde_plasma_surface::org_kde_plasma_surface_destroy(Resource *)
    {
    }

    void org_kde_plasma_surface::org_kde_plasma_surface_set_output(Resource *, struct ::wl_resource *)
    {
    }

    void org_kde_plasma_surface::org_kde_plasma_surface_set_position(Resource *, int32_t , int32_t )
    {
    }

    void org_kde_plasma_surface::org_kde_plasma_surface_set_role(Resource *, uint32_t )
    {
    }

    void org_kde_plasma_surface::org_kde_plasma_surface_set_panel_behavior(Resource *, uint32_t )
    {
    }

    void org_kde_plasma_surface::org_kde_plasma_surface_set_skip_taskbar(Resource *, uint32_t )
    {
    }

    void org_kde_plasma_surface::org_kde_plasma_surface_panel_auto_hide_hide(Resource *)
    {
    }

    void org_kde_plasma_surface::org_kde_plasma_surface_panel_auto_hide_show(Resource *)
    {
    }

    void org_kde_plasma_surface::org_kde_plasma_surface_set_panel_takes_focus(Resource *, uint32_t )
    {
    }

    void org_kde_plasma_surface::org_kde_plasma_surface_set_skip_switcher(Resource *, uint32_t )
    {
    }

    void org_kde_plasma_surface::org_kde_plasma_surface_open_under_cursor(Resource *)
    {
    }


    void org_kde_plasma_surface::handle_destroy(
        ::wl_client *client,
        struct wl_resource *resource)
    {
        Q_UNUSED(client);
        Resource *r = Resource::fromResource(resource);
        if (Q_UNLIKELY(!r->org_kde_plasma_surface_object)) {
            wl_resource_destroy(resource);
            return;
        }
        static_cast<org_kde_plasma_surface *>(r->org_kde_plasma_surface_object)->org_kde_plasma_surface_destroy(
            r);
    }

    void org_kde_plasma_surface::handle_set_output(
        ::wl_client *client,
        struct wl_resource *resource,
        struct ::wl_resource *output)
    {
        Q_UNUSED(client);
        Resource *r = Resource::fromResource(resource);
        if (Q_UNLIKELY(!r->org_kde_plasma_surface_object)) {
            return;
        }
        static_cast<org_kde_plasma_surface *>(r->org_kde_plasma_surface_object)->org_kde_plasma_surface_set_output(
            r,
            output);
    }

    void org_kde_plasma_surface::handle_set_position(
        ::wl_client *client,
        struct wl_resource *resource,
        int32_t x,
        int32_t y)
    {
        Q_UNUSED(client);
        Resource *r = Resource::fromResource(resource);
        if (Q_UNLIKELY(!r->org_kde_plasma_surface_object)) {
            return;
        }
        static_cast<org_kde_plasma_surface *>(r->org_kde_plasma_surface_object)->org_kde_plasma_surface_set_position(
            r,
            x,
            y);
    }

    void org_kde_plasma_surface::handle_set_role(
        ::wl_client *client,
        struct wl_resource *resource,
        uint32_t role)
    {
        Q_UNUSED(client);
        Resource *r = Resource::fromResource(resource);
        if (Q_UNLIKELY(!r->org_kde_plasma_surface_object)) {
            return;
        }
        static_cast<org_kde_plasma_surface *>(r->org_kde_plasma_surface_object)->org_kde_plasma_surface_set_role(
            r,
            role);
    }

    void org_kde_plasma_surface::handle_set_panel_behavior(
        ::wl_client *client,
        struct wl_resource *resource,
        uint32_t flag)
    {
        Q_UNUSED(client);
        Resource *r = Resource::fromResource(resource);
        if (Q_UNLIKELY(!r->org_kde_plasma_surface_object)) {
            return;
        }
        static_cast<org_kde_plasma_surface *>(r->org_kde_plasma_surface_object)->org_kde_plasma_surface_set_panel_behavior(
            r,
            flag);
    }

    void org_kde_plasma_surface::handle_set_skip_taskbar(
        ::wl_client *client,
        struct wl_resource *resource,
        uint32_t skip)
    {
        Q_UNUSED(client);
        Resource *r = Resource::fromResource(resource);
        if (Q_UNLIKELY(!r->org_kde_plasma_surface_object)) {
            return;
        }
        static_cast<org_kde_plasma_surface *>(r->org_kde_plasma_surface_object)->org_kde_plasma_surface_set_skip_taskbar(
            r,
            skip);
    }

    void org_kde_plasma_surface::handle_panel_auto_hide_hide(
        ::wl_client *client,
        struct wl_resource *resource)
    {
        Q_UNUSED(client);
        Resource *r = Resource::fromResource(resource);
        if (Q_UNLIKELY(!r->org_kde_plasma_surface_object)) {
            return;
        }
        static_cast<org_kde_plasma_surface *>(r->org_kde_plasma_surface_object)->org_kde_plasma_surface_panel_auto_hide_hide(
            r);
    }

    void org_kde_plasma_surface::handle_panel_auto_hide_show(
        ::wl_client *client,
        struct wl_resource *resource)
    {
        Q_UNUSED(client);
        Resource *r = Resource::fromResource(resource);
        if (Q_UNLIKELY(!r->org_kde_plasma_surface_object)) {
            return;
        }
        static_cast<org_kde_plasma_surface *>(r->org_kde_plasma_surface_object)->org_kde_plasma_surface_panel_auto_hide_show(
            r);
    }

    void org_kde_plasma_surface::handle_set_panel_takes_focus(
        ::wl_client *client,
        struct wl_resource *resource,
        uint32_t takes_focus)
    {
        Q_UNUSED(client);
        Resource *r = Resource::fromResource(resource);
        if (Q_UNLIKELY(!r->org_kde_plasma_surface_object)) {
            return;
        }
        static_cast<org_kde_plasma_surface *>(r->org_kde_plasma_surface_object)->org_kde_plasma_surface_set_panel_takes_focus(
            r,
            takes_focus);
    }

    void org_kde_plasma_surface::handle_set_skip_switcher(
        ::wl_client *client,
        struct wl_resource *resource,
        uint32_t skip)
    {
        Q_UNUSED(client);
        Resource *r = Resource::fromResource(resource);
        if (Q_UNLIKELY(!r->org_kde_plasma_surface_object)) {
            return;
        }
        static_cast<org_kde_plasma_surface *>(r->org_kde_plasma_surface_object)->org_kde_plasma_surface_set_skip_switcher(
            r,
            skip);
    }

    void org_kde_plasma_surface::handle_open_under_cursor(
        ::wl_client *client,
        struct wl_resource *resource)
    {
        Q_UNUSED(client);
        Resource *r = Resource::fromResource(resource);
        if (Q_UNLIKELY(!r->org_kde_plasma_surface_object)) {
            return;
        }
        static_cast<org_kde_plasma_surface *>(r->org_kde_plasma_surface_object)->org_kde_plasma_surface_open_under_cursor(
            r);
    }

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

    void org_kde_plasma_surface::send_auto_hidden_panel_hidden(struct ::wl_resource *resource)
    {
        org_kde_plasma_surface_send_auto_hidden_panel_hidden(
            resource);
    }


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

    void org_kde_plasma_surface::send_auto_hidden_panel_shown(struct ::wl_resource *resource)
    {
        org_kde_plasma_surface_send_auto_hidden_panel_shown(
            resource);
    }

}

QT_WARNING_POP
QT_END_NAMESPACE
