/* Generated by wayland-scanner 1.26.0 */

#ifndef TREELAND_SHORTCUT_MANAGER_V2_SERVER_PROTOCOL_H
#define TREELAND_SHORTCUT_MANAGER_V2_SERVER_PROTOCOL_H

#include <stdint.h>
#include <stddef.h>
#include "wayland-server.h"

#ifdef  __cplusplus
extern "C" {
#endif

struct wl_client;
struct wl_resource;

/**
 * @page page_treeland_shortcut_manager_v2 The treeland_shortcut_manager_v2 protocol
 * keyboard shortcut management
 *
 * @section page_desc_treeland_shortcut_manager_v2 Description
 *
 * Warning! This protocol is EXPERIMENTAL and under active development.
 * It may change at any time, including in backward-incompatible ways,
 * without incrementing the interface major version and without prior
 * notice. No compatibility guarantees of any kind are provided. Clients
 * and compositors must track the upstream definition in treeland-protocols
 * and must not rely on the current interface names, requests, events, or
 * semantics remaining stable across releases.
 *
 * @section page_ifaces_treeland_shortcut_manager_v2 Interfaces
 * - @subpage page_iface_treeland_shortcut_manager_v2 - global shortcuts manager for treeland
 * - @subpage page_iface_treeland_shortcut_capture_v1 - one-shot shortcut capture object
 * @section page_copyright_treeland_shortcut_manager_v2 Copyright
 * <pre>
 *
 * SPDX-FileCopyrightText: 2024-2025 UnionTech Software Technology Co., Ltd.
 * SPDX-License-Identifier: MIT
 * </pre>
 */
struct treeland_shortcut_capture_v1;
struct treeland_shortcut_manager_v2;
struct wl_seat;
struct wl_surface;

#ifndef TREELAND_SHORTCUT_MANAGER_V2_INTERFACE
#define TREELAND_SHORTCUT_MANAGER_V2_INTERFACE
/**
 * @page page_iface_treeland_shortcut_manager_v2 treeland_shortcut_manager_v2
 * @section page_iface_treeland_shortcut_manager_v2_desc Description
 *
 * This interface allows privileged clients to register global shortcuts.
 *
 * In treeland, global shortcuts are managed in a per-user context.
 * Shortcuts for different users are isolated, and will not interfere with each other.
 * This allows multiple users to use their own set of global shortcuts
 * on the same system without conflicts.
 * This behavior is transparent to the clients of this interface (i.e.,
 * the user context used by this protocol is the same as that of the client.)
 * @section page_iface_treeland_shortcut_manager_v2_api API
 * See @ref iface_treeland_shortcut_manager_v2.
 */
/**
 * @defgroup iface_treeland_shortcut_manager_v2 The treeland_shortcut_manager_v2 interface
 *
 * This interface allows privileged clients to register global shortcuts.
 *
 * In treeland, global shortcuts are managed in a per-user context.
 * Shortcuts for different users are isolated, and will not interfere with each other.
 * This allows multiple users to use their own set of global shortcuts
 * on the same system without conflicts.
 * This behavior is transparent to the clients of this interface (i.e.,
 * the user context used by this protocol is the same as that of the client.)
 */
extern const struct wl_interface treeland_shortcut_manager_v2_interface;
#endif
#ifndef TREELAND_SHORTCUT_CAPTURE_V1_INTERFACE
#define TREELAND_SHORTCUT_CAPTURE_V1_INTERFACE
/**
 * @page page_iface_treeland_shortcut_capture_v1 treeland_shortcut_capture_v1
 * @section page_iface_treeland_shortcut_capture_v1_desc Description
 *
 * This object represents one request to capture the next shortcut input.
 *
 * After creation, the compositor captures input once and may send at most one
 * terminal event: either captured or failed.
 *
 * If the client destroys this object while capture is pending,
 * no terminal event is sent.
 *
 * After a terminal event is sent, this object becomes inert.
 * The client should destroy this object promptly after receiving
 * captured or failed.
 * @section page_iface_treeland_shortcut_capture_v1_api API
 * See @ref iface_treeland_shortcut_capture_v1.
 */
/**
 * @defgroup iface_treeland_shortcut_capture_v1 The treeland_shortcut_capture_v1 interface
 *
 * This object represents one request to capture the next shortcut input.
 *
 * After creation, the compositor captures input once and may send at most one
 * terminal event: either captured or failed.
 *
 * If the client destroys this object while capture is pending,
 * no terminal event is sent.
 *
 * After a terminal event is sent, this object becomes inert.
 * The client should destroy this object promptly after receiving
 * captured or failed.
 */
extern const struct wl_interface treeland_shortcut_capture_v1_interface;
#endif

#ifndef TREELAND_SHORTCUT_MANAGER_V2_DIRECTION_ENUM
#define TREELAND_SHORTCUT_MANAGER_V2_DIRECTION_ENUM
enum treeland_shortcut_manager_v2_direction {
	TREELAND_SHORTCUT_MANAGER_V2_DIRECTION_DOWN = 1,
	TREELAND_SHORTCUT_MANAGER_V2_DIRECTION_LEFT = 2,
	TREELAND_SHORTCUT_MANAGER_V2_DIRECTION_UP = 3,
	TREELAND_SHORTCUT_MANAGER_V2_DIRECTION_RIGHT = 4,
};
#endif /* TREELAND_SHORTCUT_MANAGER_V2_DIRECTION_ENUM */

#ifndef TREELAND_SHORTCUT_MANAGER_V2_DIRECTION_ENUM_IS_VALID
#define TREELAND_SHORTCUT_MANAGER_V2_DIRECTION_ENUM_IS_VALID
/**
 * @ingroup iface_treeland_shortcut_manager_v2
 * Validate a treeland_shortcut_manager_v2 direction value.
 *
 * @return true on success, false on error.
 * @ref treeland_shortcut_manager_v2_direction
 */
static inline bool
treeland_shortcut_manager_v2_direction_is_valid(uint32_t value, uint32_t version) {
	switch (value) {
	case TREELAND_SHORTCUT_MANAGER_V2_DIRECTION_DOWN:
		return version >= 1;
	case TREELAND_SHORTCUT_MANAGER_V2_DIRECTION_LEFT:
		return version >= 1;
	case TREELAND_SHORTCUT_MANAGER_V2_DIRECTION_UP:
		return version >= 1;
	case TREELAND_SHORTCUT_MANAGER_V2_DIRECTION_RIGHT:
		return version >= 1;
	default:
		return false;
	}
}
#endif /* TREELAND_SHORTCUT_MANAGER_V2_DIRECTION_ENUM_IS_VALID */

#ifndef TREELAND_SHORTCUT_MANAGER_V2_ACTION_ENUM
#define TREELAND_SHORTCUT_MANAGER_V2_ACTION_ENUM
/**
 * @ingroup iface_treeland_shortcut_manager_v2
 * compositor actions
 *
 * Compositor actions that can be assigned to a shortcut.
 */
enum treeland_shortcut_manager_v2_action {
	TREELAND_SHORTCUT_MANAGER_V2_ACTION_NOTIFY = 1,
	TREELAND_SHORTCUT_MANAGER_V2_ACTION_WORKSPACE_1 = 2,
	TREELAND_SHORTCUT_MANAGER_V2_ACTION_WORKSPACE_2 = 3,
	TREELAND_SHORTCUT_MANAGER_V2_ACTION_WORKSPACE_3 = 4,
	TREELAND_SHORTCUT_MANAGER_V2_ACTION_WORKSPACE_4 = 5,
	TREELAND_SHORTCUT_MANAGER_V2_ACTION_WORKSPACE_5 = 6,
	TREELAND_SHORTCUT_MANAGER_V2_ACTION_WORKSPACE_6 = 7,
	TREELAND_SHORTCUT_MANAGER_V2_ACTION_PREV_WORKSPACE = 8,
	TREELAND_SHORTCUT_MANAGER_V2_ACTION_NEXT_WORKSPACE = 9,
	TREELAND_SHORTCUT_MANAGER_V2_ACTION_SHOW_DESKTOP = 10,
	TREELAND_SHORTCUT_MANAGER_V2_ACTION_MAXIMIZE = 11,
	TREELAND_SHORTCUT_MANAGER_V2_ACTION_CANCEL_MAXIMIZE = 12,
	TREELAND_SHORTCUT_MANAGER_V2_ACTION_MOVE_WINDOW = 13,
	TREELAND_SHORTCUT_MANAGER_V2_ACTION_CLOSE_WINDOW = 14,
	TREELAND_SHORTCUT_MANAGER_V2_ACTION_SHOW_WINDOW_MENU = 15,
	TREELAND_SHORTCUT_MANAGER_V2_ACTION_OPEN_MULTITASK_VIEW = 16,
	TREELAND_SHORTCUT_MANAGER_V2_ACTION_CLOSE_MULTITASK_VIEW = 17,
	TREELAND_SHORTCUT_MANAGER_V2_ACTION_TOGGLE_MULTITASK_VIEW = 18,
	TREELAND_SHORTCUT_MANAGER_V2_ACTION_TOGGLE_FPS_DISPLAY = 19,
	TREELAND_SHORTCUT_MANAGER_V2_ACTION_LOCKSCREEN = 20,
	TREELAND_SHORTCUT_MANAGER_V2_ACTION_SHUTDOWN_MENU = 21,
	TREELAND_SHORTCUT_MANAGER_V2_ACTION_QUIT = 22,
	TREELAND_SHORTCUT_MANAGER_V2_ACTION_TASKSWITCH_ENTER = 23,
	TREELAND_SHORTCUT_MANAGER_V2_ACTION_TASKSWITCH_NEXT = 24,
	TREELAND_SHORTCUT_MANAGER_V2_ACTION_TASKSWITCH_PREV = 25,
	TREELAND_SHORTCUT_MANAGER_V2_ACTION_TASKSWITCH_SAMEAPP_NEXT = 26,
	TREELAND_SHORTCUT_MANAGER_V2_ACTION_TASKSWITCH_SAMEAPP_PREV = 27,
	/**
	 * @since 3
	 */
	TREELAND_SHORTCUT_MANAGER_V2_ACTION_TILE_LEFT = 28,
	/**
	 * @since 3
	 */
	TREELAND_SHORTCUT_MANAGER_V2_ACTION_TILE_RIGHT = 29,
};
/**
 * @ingroup iface_treeland_shortcut_manager_v2
 */
#define TREELAND_SHORTCUT_MANAGER_V2_ACTION_TILE_LEFT_SINCE_VERSION 3
/**
 * @ingroup iface_treeland_shortcut_manager_v2
 */
#define TREELAND_SHORTCUT_MANAGER_V2_ACTION_TILE_RIGHT_SINCE_VERSION 3
#endif /* TREELAND_SHORTCUT_MANAGER_V2_ACTION_ENUM */

#ifndef TREELAND_SHORTCUT_MANAGER_V2_ACTION_ENUM_IS_VALID
#define TREELAND_SHORTCUT_MANAGER_V2_ACTION_ENUM_IS_VALID
/**
 * @ingroup iface_treeland_shortcut_manager_v2
 * Validate a treeland_shortcut_manager_v2 action value.
 *
 * @return true on success, false on error.
 * @ref treeland_shortcut_manager_v2_action
 */
static inline bool
treeland_shortcut_manager_v2_action_is_valid(uint32_t value, uint32_t version) {
	switch (value) {
	case TREELAND_SHORTCUT_MANAGER_V2_ACTION_NOTIFY:
		return version >= 1;
	case TREELAND_SHORTCUT_MANAGER_V2_ACTION_WORKSPACE_1:
		return version >= 1;
	case TREELAND_SHORTCUT_MANAGER_V2_ACTION_WORKSPACE_2:
		return version >= 1;
	case TREELAND_SHORTCUT_MANAGER_V2_ACTION_WORKSPACE_3:
		return version >= 1;
	case TREELAND_SHORTCUT_MANAGER_V2_ACTION_WORKSPACE_4:
		return version >= 1;
	case TREELAND_SHORTCUT_MANAGER_V2_ACTION_WORKSPACE_5:
		return version >= 1;
	case TREELAND_SHORTCUT_MANAGER_V2_ACTION_WORKSPACE_6:
		return version >= 1;
	case TREELAND_SHORTCUT_MANAGER_V2_ACTION_PREV_WORKSPACE:
		return version >= 1;
	case TREELAND_SHORTCUT_MANAGER_V2_ACTION_NEXT_WORKSPACE:
		return version >= 1;
	case TREELAND_SHORTCUT_MANAGER_V2_ACTION_SHOW_DESKTOP:
		return version >= 1;
	case TREELAND_SHORTCUT_MANAGER_V2_ACTION_MAXIMIZE:
		return version >= 1;
	case TREELAND_SHORTCUT_MANAGER_V2_ACTION_CANCEL_MAXIMIZE:
		return version >= 1;
	case TREELAND_SHORTCUT_MANAGER_V2_ACTION_MOVE_WINDOW:
		return version >= 1;
	case TREELAND_SHORTCUT_MANAGER_V2_ACTION_CLOSE_WINDOW:
		return version >= 1;
	case TREELAND_SHORTCUT_MANAGER_V2_ACTION_SHOW_WINDOW_MENU:
		return version >= 1;
	case TREELAND_SHORTCUT_MANAGER_V2_ACTION_OPEN_MULTITASK_VIEW:
		return version >= 1;
	case TREELAND_SHORTCUT_MANAGER_V2_ACTION_CLOSE_MULTITASK_VIEW:
		return version >= 1;
	case TREELAND_SHORTCUT_MANAGER_V2_ACTION_TOGGLE_MULTITASK_VIEW:
		return version >= 1;
	case TREELAND_SHORTCUT_MANAGER_V2_ACTION_TOGGLE_FPS_DISPLAY:
		return version >= 1;
	case TREELAND_SHORTCUT_MANAGER_V2_ACTION_LOCKSCREEN:
		return version >= 1;
	case TREELAND_SHORTCUT_MANAGER_V2_ACTION_SHUTDOWN_MENU:
		return version >= 1;
	case TREELAND_SHORTCUT_MANAGER_V2_ACTION_QUIT:
		return version >= 1;
	case TREELAND_SHORTCUT_MANAGER_V2_ACTION_TASKSWITCH_ENTER:
		return version >= 1;
	case TREELAND_SHORTCUT_MANAGER_V2_ACTION_TASKSWITCH_NEXT:
		return version >= 1;
	case TREELAND_SHORTCUT_MANAGER_V2_ACTION_TASKSWITCH_PREV:
		return version >= 1;
	case TREELAND_SHORTCUT_MANAGER_V2_ACTION_TASKSWITCH_SAMEAPP_NEXT:
		return version >= 1;
	case TREELAND_SHORTCUT_MANAGER_V2_ACTION_TASKSWITCH_SAMEAPP_PREV:
		return version >= 1;
	case TREELAND_SHORTCUT_MANAGER_V2_ACTION_TILE_LEFT:
		return version >= 3;
	case TREELAND_SHORTCUT_MANAGER_V2_ACTION_TILE_RIGHT:
		return version >= 3;
	default:
		return false;
	}
}
#endif /* TREELAND_SHORTCUT_MANAGER_V2_ACTION_ENUM_IS_VALID */

#ifndef TREELAND_SHORTCUT_MANAGER_V2_KEYBIND_FLAG_ENUM
#define TREELAND_SHORTCUT_MANAGER_V2_KEYBIND_FLAG_ENUM
/**
 * @ingroup iface_treeland_shortcut_manager_v2
 * keybinding flags
 *
 * Flags to specify the keybinding mode.
 * With key_press, the action is triggered on key press.
 * With key_release, the action is triggered on key release.
 * With repeat, the action is repeatedly triggered if the key is held down.
 *
 * Examples:
 * key_press | repeat: the action is triggered on key press, and repeatedly
 * triggered if the key is held down.
 * key_press | key_release: the action is triggered on both key press and
 * key release, auto-repeated events are ignored.
 * key_press | key_release | repeat: note that treeland repeats both key
 * press and key release events.
 */
enum treeland_shortcut_manager_v2_keybind_flag {
	/**
	 * bind key press events
	 */
	TREELAND_SHORTCUT_MANAGER_V2_KEYBIND_FLAG_KEY_PRESS = 0x1,
	/**
	 * bind key release events
	 */
	TREELAND_SHORTCUT_MANAGER_V2_KEYBIND_FLAG_KEY_RELEASE = 0x2,
	/**
	 * bind autorepeat events.
	 */
	TREELAND_SHORTCUT_MANAGER_V2_KEYBIND_FLAG_REPEAT = 0x4,
};
#endif /* TREELAND_SHORTCUT_MANAGER_V2_KEYBIND_FLAG_ENUM */

#ifndef TREELAND_SHORTCUT_MANAGER_V2_KEYBIND_FLAG_ENUM_IS_VALID
#define TREELAND_SHORTCUT_MANAGER_V2_KEYBIND_FLAG_ENUM_IS_VALID
/**
 * @ingroup iface_treeland_shortcut_manager_v2
 * Validate a treeland_shortcut_manager_v2 keybind_flag value.
 *
 * @return true on success, false on error.
 * @ref treeland_shortcut_manager_v2_keybind_flag
 */
static inline bool
treeland_shortcut_manager_v2_keybind_flag_is_valid(uint32_t value, uint32_t version) {
	uint32_t valid = 0;
	if (version >= 1)
		valid |= TREELAND_SHORTCUT_MANAGER_V2_KEYBIND_FLAG_KEY_PRESS;
	if (version >= 1)
		valid |= TREELAND_SHORTCUT_MANAGER_V2_KEYBIND_FLAG_KEY_RELEASE;
	if (version >= 1)
		valid |= TREELAND_SHORTCUT_MANAGER_V2_KEYBIND_FLAG_REPEAT;
	return (value & ~valid) == 0;
}
#endif /* TREELAND_SHORTCUT_MANAGER_V2_KEYBIND_FLAG_ENUM_IS_VALID */

#ifndef TREELAND_SHORTCUT_MANAGER_V2_BIND_ERROR_ENUM
#define TREELAND_SHORTCUT_MANAGER_V2_BIND_ERROR_ENUM
/**
 * @ingroup iface_treeland_shortcut_manager_v2
 * binding error codes
 *
 * Error codes indicating the reason of a binding failure.
 */
enum treeland_shortcut_manager_v2_bind_error {
	TREELAND_SHORTCUT_MANAGER_V2_BIND_ERROR_NAME_CONFLICT = 1,
	TREELAND_SHORTCUT_MANAGER_V2_BIND_ERROR_DUPLICATE_BINDING = 2,
	TREELAND_SHORTCUT_MANAGER_V2_BIND_ERROR_INVALID_ARGUMENT = 3,
	TREELAND_SHORTCUT_MANAGER_V2_BIND_ERROR_INTERNAL_ERROR = 4,
};
#endif /* TREELAND_SHORTCUT_MANAGER_V2_BIND_ERROR_ENUM */

#ifndef TREELAND_SHORTCUT_MANAGER_V2_BIND_ERROR_ENUM_IS_VALID
#define TREELAND_SHORTCUT_MANAGER_V2_BIND_ERROR_ENUM_IS_VALID
/**
 * @ingroup iface_treeland_shortcut_manager_v2
 * Validate a treeland_shortcut_manager_v2 bind_error value.
 *
 * @return true on success, false on error.
 * @ref treeland_shortcut_manager_v2_bind_error
 */
static inline bool
treeland_shortcut_manager_v2_bind_error_is_valid(uint32_t value, uint32_t version) {
	switch (value) {
	case TREELAND_SHORTCUT_MANAGER_V2_BIND_ERROR_NAME_CONFLICT:
		return version >= 1;
	case TREELAND_SHORTCUT_MANAGER_V2_BIND_ERROR_DUPLICATE_BINDING:
		return version >= 1;
	case TREELAND_SHORTCUT_MANAGER_V2_BIND_ERROR_INVALID_ARGUMENT:
		return version >= 1;
	case TREELAND_SHORTCUT_MANAGER_V2_BIND_ERROR_INTERNAL_ERROR:
		return version >= 1;
	default:
		return false;
	}
}
#endif /* TREELAND_SHORTCUT_MANAGER_V2_BIND_ERROR_ENUM_IS_VALID */

#ifndef TREELAND_SHORTCUT_MANAGER_V2_ERROR_ENUM
#define TREELAND_SHORTCUT_MANAGER_V2_ERROR_ENUM
enum treeland_shortcut_manager_v2_error {
	TREELAND_SHORTCUT_MANAGER_V2_ERROR_OCCUPIED = 1,
	TREELAND_SHORTCUT_MANAGER_V2_ERROR_NOT_ACQUIRED = 2,
	TREELAND_SHORTCUT_MANAGER_V2_ERROR_INVALID_COMMIT = 3,
	/**
	 * @since 2
	 */
	TREELAND_SHORTCUT_MANAGER_V2_ERROR_INVALID_SURFACE = 4,
};
/**
 * @ingroup iface_treeland_shortcut_manager_v2
 */
#define TREELAND_SHORTCUT_MANAGER_V2_ERROR_INVALID_SURFACE_SINCE_VERSION 2
#endif /* TREELAND_SHORTCUT_MANAGER_V2_ERROR_ENUM */

#ifndef TREELAND_SHORTCUT_MANAGER_V2_ERROR_ENUM_IS_VALID
#define TREELAND_SHORTCUT_MANAGER_V2_ERROR_ENUM_IS_VALID
/**
 * @ingroup iface_treeland_shortcut_manager_v2
 * Validate a treeland_shortcut_manager_v2 error value.
 *
 * @return true on success, false on error.
 * @ref treeland_shortcut_manager_v2_error
 */
static inline bool
treeland_shortcut_manager_v2_error_is_valid(uint32_t value, uint32_t version) {
	switch (value) {
	case TREELAND_SHORTCUT_MANAGER_V2_ERROR_OCCUPIED:
		return version >= 1;
	case TREELAND_SHORTCUT_MANAGER_V2_ERROR_NOT_ACQUIRED:
		return version >= 1;
	case TREELAND_SHORTCUT_MANAGER_V2_ERROR_INVALID_COMMIT:
		return version >= 1;
	case TREELAND_SHORTCUT_MANAGER_V2_ERROR_INVALID_SURFACE:
		return version >= 2;
	default:
		return false;
	}
}
#endif /* TREELAND_SHORTCUT_MANAGER_V2_ERROR_ENUM_IS_VALID */

/**
 * @ingroup iface_treeland_shortcut_manager_v2
 * @struct treeland_shortcut_manager_v2_interface
 */
struct treeland_shortcut_manager_v2_interface {
	/**
	 * destroy the shortcut manager
	 *
	 * Destroy the shortcut manager. Existing shortcuts created
	 * through this interface remain valid.
	 */
	void (*destroy)(struct wl_client *client,
			struct wl_resource *resource);
	/**
	 * acquire the shortcut manager
	 *
	 * Acquire the shortcut manager for the current client.
	 *
	 * This request must be sent before any bind/unbind request can be
	 * performed.
	 *
	 * Only one client can hold exclusive control of the shortcut
	 * manager at a time, for a given session. If the shortcut manager
	 * is already acquired by another client, the compositor will raise
	 * the `occupied` protocol error.
	 */
	void (*acquire)(struct wl_client *client,
			struct wl_resource *resource);
	/**
	 * bind a key sequence to a compositor action
	 *
	 * Bind a key sequence to a compositor action.
	 *
	 * The key sequence is specified in the string format used by
	 * QKeySequence, see
	 * https://doc.qt.io/qt-6/qkeysequence.html#toString for details.
	 *
	 * Sending this request without first acquiring the shortcut
	 * manager will result in a `not_acquired` protocol error.
	 *
	 * The name argument must be unique among all existing bindings. If
	 * a binding with the same name already exists, the bind_key
	 * request will fail.
	 *
	 * The action argument specifies the compositor action to be
	 * executed when the key sequence is activated.
	 *
	 * Each keybind has a flags argument that specifies the exact
	 * triggering condition, see the documentation of the keybind_flag
	 * enum for details.
	 *
	 * If a binding with the same key sequence and action already
	 * exists, its flags will be updated to the new value.
	 *
	 * Note that the binding will not take effect until a commit
	 * request is sent.
	 * @param name unique name for the keybinding
	 * @param key key sequence for the keybinding
	 * @param flags flags for the keybinding
	 * @param action compositor action to be executed
	 */
	void (*bind_key)(struct wl_client *client,
			 struct wl_resource *resource,
			 const char *name,
			 const char *key,
			 uint32_t flags,
			 uint32_t action);
	/**
	 * bind a swipe gesture to a compositor action
	 *
	 * Bind a swipe gesture to a compositor action.
	 *
	 * Sending this request without first acquiring the shortcut
	 * manager will result in a `not_acquired` protocol error.
	 *
	 * The name argument must be unique among all existing bindings. If
	 * a binding with the same name already exists, the
	 * bind_swipe_gesture request will fail.
	 *
	 * The direction argument specifies the direction towards which the
	 * swipe gesture must be performed. If this argument is not one of
	 * the defined enum values, the bind_swipe_gesture request will
	 * fail.
	 *
	 * The action argument specifies the compositor action to be
	 * executed when the swipe gesture is activated. If a binding with
	 * the same gesture and action already exists, the
	 * bind_swipe_gesture request will fail.
	 *
	 * Note that the binding will not take effect until a commit
	 * request is sent.
	 * @param name unique name for the swipe gesture
	 * @param finger number of fingers required for the swipe gesture
	 * @param direction direction of the swipe gesture
	 * @param action compositor action to be executed
	 */
	void (*bind_swipe_gesture)(struct wl_client *client,
				   struct wl_resource *resource,
				   const char *name,
				   uint32_t finger,
				   uint32_t direction,
				   uint32_t action);
	/**
	 * bind a hold gesture to a compositor action
	 *
	 * Bind a hold gesture to a compositor action.
	 *
	 * Sending this request without first acquiring the shortcut
	 * manager will result in a `not_acquired` protocol error.
	 *
	 * The name argument must be unique among all existing bindings. If
	 * a binding with the same name already exists, the
	 * bind_hold_gesture request will fail.
	 *
	 * The action argument specifies the compositor action to be
	 * executed when the hold gesture is activated. If a binding with
	 * the same gesture and action already exists, the
	 * bind_hold_gesture request will fail.
	 *
	 * Note that the binding will not take effect until a commit
	 * request is sent.
	 * @param name unique name for the hold gesture
	 * @param finger number of fingers required for the hold gesture
	 * @param action compositor action to be executed
	 */
	void (*bind_hold_gesture)(struct wl_client *client,
				  struct wl_resource *resource,
				  const char *name,
				  uint32_t finger,
				  uint32_t action);
	/**
	 * commit the pending bindings
	 *
	 * Commit the pending bindings.
	 *
	 * This request applies all the bind_key, bind_swipe_gesture and
	 * bind_hold_gesture requests sent since the last commit.
	 *
	 * After processing this request, the compositor will emit a
	 * `commit_success` event if the commit was successful or
	 * `commit_failure` event if the commit failed.
	 *
	 * On a successful commit, all the pending bindings will take
	 * effect. On a failed commit, none of the pending bindings will
	 * take effect.
	 *
	 * Sending this request without first acquiring the shortcut
	 * manager will result in a `not_acquired` protocol error.
	 *
	 * Sending further commit requests before `commit_success` or
	 * `commit_failure` is sent is a protocol error.
	 */
	void (*commit)(struct wl_client *client,
		       struct wl_resource *resource);
	/**
	 * remove an existing binding
	 *
	 * Remove an existing binding.
	 *
	 * Sending this request without first acquiring the shortcut
	 * manager will result in a `not_acquired` protocol error.
	 *
	 * The binding to be removed is identified by its unique name. If
	 * no binding with the specified name exists, the unbind request
	 * has no effect.
	 * @param name unique name of the binding to be removed
	 */
	void (*unbind)(struct wl_client *client,
		       struct wl_resource *resource,
		       const char *name);
	/**
	 * capture the next shortcut once
	 *
	 * Request the compositor to capture the next shortcut input
	 * once, bound to the provided surface.
	 *
	 * The capture object is created by this request via new_id. The
	 * compositor performs validation after receiving the request, and
	 * may immediately emit a terminal event on the newly created
	 * object. Clients must be prepared to handle a capture object that
	 * is failed immediately after creation.
	 *
	 * The surface argument must be a wl_surface owned by the
	 * requesting client. Otherwise, the compositor will raise the
	 * `invalid_surface` protocol error.
	 *
	 * The compositor must verify that the provided surface currently
	 * has keyboard focus or is active before starting capture. If this
	 * check fails, the compositor must first decide that capture does
	 * not start, and then must emit `failed` with reason `not_active`
	 * on the created object.
	 *
	 * The compositor monitors both key_press and key_release events
	 * during capture. The shortcut candidate is established on
	 * key_press of a valid non-modifier key; the terminal event
	 * (captured or failed) is sent on key_release of that non-modifier
	 * key. Pure modifier-only key presses (e.g. Ctrl, Alt, Shift) are
	 * silently consumed while waiting for a non-modifier key.
	 * Auto-repeat events are consumed and ignored.
	 *
	 * If the next intercepted input is not a valid shortcut input (for
	 * example: unmodified alphanumeric keys such as a, b, c, d, 1, 2,
	 * 3, unmodified Escape, or pointer button and wheel events), the
	 * compositor must fail capture with reason `interrupted`. For
	 * either `interrupted` failure or successful `captured`, the
	 * triggering input event must be consumed by the compositor and
	 * must not be forwarded to the client.
	 *
	 * The compositor creates a treeland_shortcut_capture_v1 object and
	 * starts a one-shot capture flow for this request.
	 *
	 * This request does not modify existing shortcut bindings. This
	 * request does not require acquire.
	 * @param surface surface used for focus or active validation
	 * @param seat seat to capture from, or null to capture from any seat
	 * @param capture one-shot capture object
	 * @since 2
	 */
	void (*capture_next_shortcut)(struct wl_client *client,
				      struct wl_resource *resource,
				      struct wl_resource *surface,
				      struct wl_resource *seat,
				      uint32_t capture);
};

#define TREELAND_SHORTCUT_MANAGER_V2_ACTIVATED 0
#define TREELAND_SHORTCUT_MANAGER_V2_COMMIT_SUCCESS 1
#define TREELAND_SHORTCUT_MANAGER_V2_COMMIT_FAILURE 2

/**
 * @ingroup iface_treeland_shortcut_manager_v2
 */
#define TREELAND_SHORTCUT_MANAGER_V2_ACTIVATED_SINCE_VERSION 1
/**
 * @ingroup iface_treeland_shortcut_manager_v2
 */
#define TREELAND_SHORTCUT_MANAGER_V2_COMMIT_SUCCESS_SINCE_VERSION 1
/**
 * @ingroup iface_treeland_shortcut_manager_v2
 */
#define TREELAND_SHORTCUT_MANAGER_V2_COMMIT_FAILURE_SINCE_VERSION 1

/**
 * @ingroup iface_treeland_shortcut_manager_v2
 */
#define TREELAND_SHORTCUT_MANAGER_V2_DESTROY_SINCE_VERSION 1
/**
 * @ingroup iface_treeland_shortcut_manager_v2
 */
#define TREELAND_SHORTCUT_MANAGER_V2_ACQUIRE_SINCE_VERSION 1
/**
 * @ingroup iface_treeland_shortcut_manager_v2
 */
#define TREELAND_SHORTCUT_MANAGER_V2_BIND_KEY_SINCE_VERSION 1
/**
 * @ingroup iface_treeland_shortcut_manager_v2
 */
#define TREELAND_SHORTCUT_MANAGER_V2_BIND_SWIPE_GESTURE_SINCE_VERSION 1
/**
 * @ingroup iface_treeland_shortcut_manager_v2
 */
#define TREELAND_SHORTCUT_MANAGER_V2_BIND_HOLD_GESTURE_SINCE_VERSION 1
/**
 * @ingroup iface_treeland_shortcut_manager_v2
 */
#define TREELAND_SHORTCUT_MANAGER_V2_COMMIT_SINCE_VERSION 1
/**
 * @ingroup iface_treeland_shortcut_manager_v2
 */
#define TREELAND_SHORTCUT_MANAGER_V2_UNBIND_SINCE_VERSION 1
/**
 * @ingroup iface_treeland_shortcut_manager_v2
 */
#define TREELAND_SHORTCUT_MANAGER_V2_CAPTURE_NEXT_SHORTCUT_SINCE_VERSION 2

/**
 * @ingroup iface_treeland_shortcut_manager_v2
 * Sends an activated event to the client owning the resource.
 * @param resource_ The client's resource
 * @param name binding id of the activated shortcut
 * @param flags flags for the key event
 */
static inline void
treeland_shortcut_manager_v2_send_activated(struct wl_resource *resource_, const char *name, uint32_t flags)
{
	wl_resource_post_event(resource_, TREELAND_SHORTCUT_MANAGER_V2_ACTIVATED, name, flags);
}

/**
 * @ingroup iface_treeland_shortcut_manager_v2
 * Sends an commit_success event to the client owning the resource.
 * @param resource_ The client's resource
 */
static inline void
treeland_shortcut_manager_v2_send_commit_success(struct wl_resource *resource_)
{
	wl_resource_post_event(resource_, TREELAND_SHORTCUT_MANAGER_V2_COMMIT_SUCCESS);
}

/**
 * @ingroup iface_treeland_shortcut_manager_v2
 * Sends an commit_failure event to the client owning the resource.
 * @param resource_ The client's resource
 * @param name binding name that caused the failure
 * @param error error code indicating the reason of the failure
 */
static inline void
treeland_shortcut_manager_v2_send_commit_failure(struct wl_resource *resource_, const char *name, uint32_t error)
{
	wl_resource_post_event(resource_, TREELAND_SHORTCUT_MANAGER_V2_COMMIT_FAILURE, name, error);
}

#ifndef TREELAND_SHORTCUT_CAPTURE_V1_FAILED_REASON_ENUM
#define TREELAND_SHORTCUT_CAPTURE_V1_FAILED_REASON_ENUM
/**
 * @ingroup iface_treeland_shortcut_capture_v1
 * capture failure reason
 *
 * Reasons why a one-shot capture could not complete.
 */
enum treeland_shortcut_capture_v1_failed_reason {
	/**
	 * another capture is in progress
	 */
	TREELAND_SHORTCUT_CAPTURE_V1_FAILED_REASON_BUSY = 1,
	/**
	 * capture was aborted by compositor policy
	 */
	TREELAND_SHORTCUT_CAPTURE_V1_FAILED_REASON_ABORTED = 2,
	/**
	 * surface focus or active validation failed
	 */
	TREELAND_SHORTCUT_CAPTURE_V1_FAILED_REASON_NOT_ACTIVE = 3,
	/**
	 * capture was interrupted by a non-shortcut intercepted input
	 */
	TREELAND_SHORTCUT_CAPTURE_V1_FAILED_REASON_INTERRUPTED = 4,
};
#endif /* TREELAND_SHORTCUT_CAPTURE_V1_FAILED_REASON_ENUM */

#ifndef TREELAND_SHORTCUT_CAPTURE_V1_FAILED_REASON_ENUM_IS_VALID
#define TREELAND_SHORTCUT_CAPTURE_V1_FAILED_REASON_ENUM_IS_VALID
/**
 * @ingroup iface_treeland_shortcut_capture_v1
 * Validate a treeland_shortcut_capture_v1 failed_reason value.
 *
 * @return true on success, false on error.
 * @ref treeland_shortcut_capture_v1_failed_reason
 */
static inline bool
treeland_shortcut_capture_v1_failed_reason_is_valid(uint32_t value, uint32_t version) {
	switch (value) {
	case TREELAND_SHORTCUT_CAPTURE_V1_FAILED_REASON_BUSY:
		return version >= 1;
	case TREELAND_SHORTCUT_CAPTURE_V1_FAILED_REASON_ABORTED:
		return version >= 1;
	case TREELAND_SHORTCUT_CAPTURE_V1_FAILED_REASON_NOT_ACTIVE:
		return version >= 1;
	case TREELAND_SHORTCUT_CAPTURE_V1_FAILED_REASON_INTERRUPTED:
		return version >= 1;
	default:
		return false;
	}
}
#endif /* TREELAND_SHORTCUT_CAPTURE_V1_FAILED_REASON_ENUM_IS_VALID */

/**
 * @ingroup iface_treeland_shortcut_capture_v1
 * @struct treeland_shortcut_capture_v1_interface
 */
struct treeland_shortcut_capture_v1_interface {
	/**
	 * destroy the capture object
	 *
	 * Destroy this capture object.
	 *
	 * Destroying the object cancels capture if it is still pending.
	 */
	void (*destroy)(struct wl_client *client,
			struct wl_resource *resource);
};

#define TREELAND_SHORTCUT_CAPTURE_V1_CAPTURED 0
#define TREELAND_SHORTCUT_CAPTURE_V1_FAILED 1

/**
 * @ingroup iface_treeland_shortcut_capture_v1
 */
#define TREELAND_SHORTCUT_CAPTURE_V1_CAPTURED_SINCE_VERSION 1
/**
 * @ingroup iface_treeland_shortcut_capture_v1
 */
#define TREELAND_SHORTCUT_CAPTURE_V1_FAILED_SINCE_VERSION 1

/**
 * @ingroup iface_treeland_shortcut_capture_v1
 */
#define TREELAND_SHORTCUT_CAPTURE_V1_DESTROY_SINCE_VERSION 1

/**
 * @ingroup iface_treeland_shortcut_capture_v1
 * Sends an captured event to the client owning the resource.
 * @param resource_ The client's resource
 * @param key captured shortcut sequence
 */
static inline void
treeland_shortcut_capture_v1_send_captured(struct wl_resource *resource_, const char *key)
{
	wl_resource_post_event(resource_, TREELAND_SHORTCUT_CAPTURE_V1_CAPTURED, key);
}

/**
 * @ingroup iface_treeland_shortcut_capture_v1
 * Sends an failed event to the client owning the resource.
 * @param resource_ The client's resource
 * @param reason failure reason
 */
static inline void
treeland_shortcut_capture_v1_send_failed(struct wl_resource *resource_, uint32_t reason)
{
	wl_resource_post_event(resource_, TREELAND_SHORTCUT_CAPTURE_V1_FAILED, reason);
}

#ifdef  __cplusplus
}
#endif

#endif
