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

#ifndef QT_WAYLAND_SERVER_TREELAND_SHORTCUT_MANAGER_V2
#define QT_WAYLAND_SERVER_TREELAND_SHORTCUT_MANAGER_V2

#include "wayland-server-core.h"
#include "wayland-treeland-shortcut-manager-v2-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_shortcut_manager_v2
    {
    public:
        treeland_shortcut_manager_v2(struct ::wl_client *client, int id, int version);
        treeland_shortcut_manager_v2(struct ::wl_display *display, int version);
        treeland_shortcut_manager_v2(struct ::wl_resource *resource);
        treeland_shortcut_manager_v2();

        virtual ~treeland_shortcut_manager_v2();

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

            treeland_shortcut_manager_v2 *treeland_shortcut_manager_v2_object;
            treeland_shortcut_manager_v2 *object() { return treeland_shortcut_manager_v2_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 direction {
            direction_down = 1,
            direction_left = 2,
            direction_up = 3,
            direction_right = 4,
        };

        enum action {
            action_notify = 1,
            action_workspace_1 = 2,
            action_workspace_2 = 3,
            action_workspace_3 = 4,
            action_workspace_4 = 5,
            action_workspace_5 = 6,
            action_workspace_6 = 7,
            action_prev_workspace = 8,
            action_next_workspace = 9,
            action_show_desktop = 10,
            action_maximize = 11,
            action_cancel_maximize = 12,
            action_move_window = 13,
            action_close_window = 14,
            action_show_window_menu = 15,
            action_open_multitask_view = 16,
            action_close_multitask_view = 17,
            action_toggle_multitask_view = 18,
            action_toggle_fps_display = 19,
            action_lockscreen = 20,
            action_shutdown_menu = 21,
            action_quit = 22,
            action_taskswitch_enter = 23,
            action_taskswitch_next = 24,
            action_taskswitch_prev = 25,
            action_taskswitch_sameapp_next = 26,
            action_taskswitch_sameapp_prev = 27,
            action_tile_left = 28,
            action_tile_right = 29,
        };

        enum keybind_flag {
            keybind_flag_key_press = 0x1, // bind key press events
            keybind_flag_key_release = 0x2, // bind key release events
            keybind_flag_repeat = 0x4, // bind autorepeat events.
        };

        enum bind_error {
            bind_error_name_conflict = 1,
            bind_error_duplicate_binding = 2,
            bind_error_invalid_argument = 3,
            bind_error_internal_error = 4,
        };

        enum error {
            error_occupied = 1,
            error_not_acquired = 2,
            error_invalid_commit = 3,
            error_invalid_surface = 4,
        };

        void send_activated(const QString &name, uint32_t flags);
        void send_activated(struct ::wl_resource *resource, const QString &name, uint32_t flags);
        void send_commit_success();
        void send_commit_success(struct ::wl_resource *resource);
        void send_commit_failure(const QString &name, uint32_t error);
        void send_commit_failure(struct ::wl_resource *resource, const QString &name, uint32_t error);
    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 acquire(Resource *resource);
        virtual void bind_key(Resource *resource, const QString &name, const QString &key, uint32_t flags, uint32_t action);
        virtual void bind_swipe_gesture(Resource *resource, const QString &name, uint32_t finger, uint32_t direction, uint32_t action);
        virtual void bind_hold_gesture(Resource *resource, const QString &name, uint32_t finger, uint32_t action);
        virtual void commit(Resource *resource);
        virtual void unbind(Resource *resource, const QString &name);
        virtual void capture_next_shortcut(Resource *resource, struct ::wl_resource *surface, struct ::wl_resource *seat, uint32_t capture);

    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_shortcut_manager_v2_interface m_treeland_shortcut_manager_v2_interface;

        static void handle_destroy(
            ::wl_client *client,
            struct wl_resource *resource);
        static void handle_acquire(
            ::wl_client *client,
            struct wl_resource *resource);
        static void handle_bind_key(
            ::wl_client *client,
            struct wl_resource *resource,
            const char *name,
            const char *key,
            uint32_t flags,
            uint32_t action);
        static void handle_bind_swipe_gesture(
            ::wl_client *client,
            struct wl_resource *resource,
            const char *name,
            uint32_t finger,
            uint32_t direction,
            uint32_t action);
        static void handle_bind_hold_gesture(
            ::wl_client *client,
            struct wl_resource *resource,
            const char *name,
            uint32_t finger,
            uint32_t action);
        static void handle_commit(
            ::wl_client *client,
            struct wl_resource *resource);
        static void handle_unbind(
            ::wl_client *client,
            struct wl_resource *resource,
            const char *name);
        static void handle_capture_next_shortcut(
            ::wl_client *client,
            struct wl_resource *resource,
            struct ::wl_resource *surface,
            struct ::wl_resource *seat,
            uint32_t capture);

        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_shortcut_manager_v2 *parent;
        };
        DisplayDestroyedListener m_displayDestroyedListener;
    };

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

        virtual ~treeland_shortcut_capture_v1();

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

            treeland_shortcut_capture_v1 *treeland_shortcut_capture_v1_object;
            treeland_shortcut_capture_v1 *object() { return treeland_shortcut_capture_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 failed_reason {
            failed_reason_busy = 1, // another capture is in progress
            failed_reason_aborted = 2, // capture was aborted by compositor policy
            failed_reason_not_active = 3, // surface focus or active validation failed
            failed_reason_interrupted = 4, // capture was interrupted by a non-shortcut intercepted input
        };

        void send_captured(const QString &key);
        void send_captured(struct ::wl_resource *resource, const QString &key);
        void send_failed(uint32_t reason);
        void send_failed(struct ::wl_resource *resource, uint32_t reason);
    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);

    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_shortcut_capture_v1_interface m_treeland_shortcut_capture_v1_interface;

        static void handle_destroy(
            ::wl_client *client,
            struct wl_resource *resource);

        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_shortcut_capture_v1 *parent;
        };
        DisplayDestroyedListener m_displayDestroyedListener;
    };
}

QT_WARNING_POP
QT_END_NAMESPACE

#endif
