// This file was generated by qtwaylandscanner
// source file is /usr/share/treeland-protocols/treeland-wine-window-management-unstable-v1.xml

#ifndef QT_WAYLAND_SERVER_TREELAND_WINE_WINDOW_MANAGEMENT_V1
#define QT_WAYLAND_SERVER_TREELAND_WINE_WINDOW_MANAGEMENT_V1

#include "wayland-server-core.h"
#include "wayland-treeland-wine-window-management-v1-server-protocol.h"
#include <QByteArray>
#include <QMultiMap>
#include <QString>

#include <unistd.h>

#ifndef WAYLAND_VERSION_CHECK
#define WAYLAND_VERSION_CHECK(major, minor, micro) \
    ((WAYLAND_VERSION_MAJOR > (major)) || \
    (WAYLAND_VERSION_MAJOR == (major) && WAYLAND_VERSION_MINOR > (minor)) || \
    (WAYLAND_VERSION_MAJOR == (major) && WAYLAND_VERSION_MINOR == (minor) && WAYLAND_VERSION_MICRO >= (micro)))
#endif

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

namespace QtWaylandServer {
    class  treeland_wine_window_manager_v1
    {
    public:
        treeland_wine_window_manager_v1(struct ::wl_client *client, int id, int version);
        treeland_wine_window_manager_v1(struct ::wl_display *display, int version);
        treeland_wine_window_manager_v1(struct ::wl_resource *resource);
        treeland_wine_window_manager_v1();

        virtual ~treeland_wine_window_manager_v1();

        class Resource
        {
        public:
            Resource() : treeland_wine_window_manager_v1_object(nullptr), handle(nullptr) {}
            virtual ~Resource() {}

            treeland_wine_window_manager_v1 *treeland_wine_window_manager_v1_object;
            treeland_wine_window_manager_v1 *object() { return treeland_wine_window_manager_v1_object; } 
            struct ::wl_resource *handle;

            struct ::wl_client *client() const { return wl_resource_get_client(handle); }
            int version() const { return wl_resource_get_version(handle); }

            static Resource *fromResource(struct ::wl_resource *resource);
        };

        void init(struct ::wl_client *client, int id, int version);
        void init(struct ::wl_display *display, int version);
        void init(struct ::wl_resource *resource);

        Resource *add(struct ::wl_client *client, int version);
        Resource *add(struct ::wl_client *client, int id, int version);
        Resource *add(struct wl_list *resource_list, struct ::wl_client *client, int id, int version);

        Resource *resource() { return m_resource; }
        const Resource *resource() const { return m_resource; }

        const QMultiMap<struct ::wl_client*, Resource*> &resourceMap() const { return m_resource_map; }

        bool isGlobalRemoved() const { return m_globalRemovedEvent; }
        void globalRemove();

        bool isGlobal() const { return m_global != nullptr; }
        bool isResource() const { return m_resource != nullptr; }

        static const struct ::wl_interface *interface();
        static QByteArrayView interfaceName() { return interface()->name; }
        static int interfaceVersion() { return interface()->version; }


        enum error {
            error_toplevel_already_controlled = 0, // a control object already exists for the given toplevel
            error_defunct_toplevel = 1, // the xdg_toplevel has no associated role or has been destroyed
        };
    protected:
        struct ::wl_global *m_global;

    protected:
        virtual Resource *allocate();

        virtual void destroy_global();

        virtual void bind_resource(Resource *resource);
        virtual void destroy_resource(Resource *resource);

        virtual void destroy(Resource *resource);
        virtual void get_window_control(Resource *resource, uint32_t id, struct ::wl_resource *toplevel);

    private:
        static void bind_func(struct ::wl_client *client, void *data, uint32_t version, uint32_t id);
        static void destroy_func(struct ::wl_resource *client_resource);
        static void display_destroy_func(struct ::wl_listener *listener, void *data);
        static int deferred_destroy_global_func(void *data);

        Resource *bind(struct ::wl_client *client, uint32_t id, int version);
        Resource *bind(struct ::wl_resource *handle);

        static const struct ::treeland_wine_window_manager_v1_interface m_treeland_wine_window_manager_v1_interface;

        static void handle_destroy(
            ::wl_client *client,
            struct wl_resource *resource);
        static void handle_get_window_control(
            ::wl_client *client,
            struct wl_resource *resource,
            uint32_t id,
            struct ::wl_resource *toplevel);

        QMultiMap<struct ::wl_client*, Resource*> m_resource_map;
        Resource *m_resource;
        struct ::wl_display *m_display;
        struct wl_event_source *m_globalRemovedEvent;
        struct DisplayDestroyedListener : ::wl_listener {
            treeland_wine_window_manager_v1 *parent;
        };
        DisplayDestroyedListener m_displayDestroyedListener;
    };

    class  treeland_wine_window_control_v1
    {
    public:
        treeland_wine_window_control_v1(struct ::wl_client *client, int id, int version);
        treeland_wine_window_control_v1(struct ::wl_display *display, int version);
        treeland_wine_window_control_v1(struct ::wl_resource *resource);
        treeland_wine_window_control_v1();

        virtual ~treeland_wine_window_control_v1();

        class Resource
        {
        public:
            Resource() : treeland_wine_window_control_v1_object(nullptr), handle(nullptr) {}
            virtual ~Resource() {}

            treeland_wine_window_control_v1 *treeland_wine_window_control_v1_object;
            treeland_wine_window_control_v1 *object() { return treeland_wine_window_control_v1_object; } 
            struct ::wl_resource *handle;

            struct ::wl_client *client() const { return wl_resource_get_client(handle); }
            int version() const { return wl_resource_get_version(handle); }

            static Resource *fromResource(struct ::wl_resource *resource);
        };

        void init(struct ::wl_client *client, int id, int version);
        void init(struct ::wl_display *display, int version);
        void init(struct ::wl_resource *resource);

        Resource *add(struct ::wl_client *client, int version);
        Resource *add(struct ::wl_client *client, int id, int version);
        Resource *add(struct wl_list *resource_list, struct ::wl_client *client, int id, int version);

        Resource *resource() { return m_resource; }
        const Resource *resource() const { return m_resource; }

        const QMultiMap<struct ::wl_client*, Resource*> &resourceMap() const { return m_resource_map; }

        bool isGlobalRemoved() const { return m_globalRemovedEvent; }
        void globalRemove();

        bool isGlobal() const { return m_global != nullptr; }
        bool isResource() const { return m_resource != nullptr; }

        static const struct ::wl_interface *interface();
        static QByteArrayView interfaceName() { return interface()->name; }
        static int interfaceVersion() { return interface()->version; }


        enum error {
            error_invalid_sibling = 0, // sibling_id is non-zero for an op that does not accept a sibling
        };

        enum z_order_op {
            z_order_op_hwnd_top = 0, // raise to top of current tier; no tier change (HWND_TOP)
            z_order_op_hwnd_bottom = 1, // lower to absolute bottom of Z-order; clears topmost (HWND_BOTTOM)
            z_order_op_hwnd_topmost = 2, // enter topmost tier at its top; sets WS_EX_TOPMOST (HWND_TOPMOST)
            z_order_op_hwnd_notopmost = 3, // leave topmost tier; raise to top of normal tier (HWND_NOTOPMOST)
            z_order_op_hwnd_insert_after = 4, // place directly below the sibling identified by sibling_id
        };

        void send_window_id(uint32_t id);
        void send_window_id(struct ::wl_resource *resource, uint32_t id);
        void send_configure_position(int32_t x, int32_t y, uint32_t serial);
        void send_configure_position(struct ::wl_resource *resource, int32_t x, int32_t y, uint32_t serial);
        void send_configure_stacking(uint32_t topmost);
        void send_configure_stacking(struct ::wl_resource *resource, uint32_t topmost);
    protected:
        struct ::wl_global *m_global;

    protected:
        virtual Resource *allocate();

        virtual void destroy_global();

        virtual void bind_resource(Resource *resource);
        virtual void destroy_resource(Resource *resource);

        virtual void destroy(Resource *resource);
        virtual void set_position(Resource *resource, int32_t x, int32_t y, uint32_t serial);
        virtual void set_z_order(Resource *resource, uint32_t op, uint32_t sibling_id);

    private:
        static void bind_func(struct ::wl_client *client, void *data, uint32_t version, uint32_t id);
        static void destroy_func(struct ::wl_resource *client_resource);
        static void display_destroy_func(struct ::wl_listener *listener, void *data);
        static int deferred_destroy_global_func(void *data);

        Resource *bind(struct ::wl_client *client, uint32_t id, int version);
        Resource *bind(struct ::wl_resource *handle);

        static const struct ::treeland_wine_window_control_v1_interface m_treeland_wine_window_control_v1_interface;

        static void handle_destroy(
            ::wl_client *client,
            struct wl_resource *resource);
        static void handle_set_position(
            ::wl_client *client,
            struct wl_resource *resource,
            int32_t x,
            int32_t y,
            uint32_t serial);
        static void handle_set_z_order(
            ::wl_client *client,
            struct wl_resource *resource,
            uint32_t op,
            uint32_t sibling_id);

        QMultiMap<struct ::wl_client*, Resource*> m_resource_map;
        Resource *m_resource;
        struct ::wl_display *m_display;
        struct wl_event_source *m_globalRemovedEvent;
        struct DisplayDestroyedListener : ::wl_listener {
            treeland_wine_window_control_v1 *parent;
        };
        DisplayDestroyedListener m_displayDestroyedListener;
    };
}

QT_WARNING_POP
QT_END_NAMESPACE

#endif
