/* Generated by wayland-scanner 1.26.0 */

#ifndef TREELAND_KEYBOARD_STATE_NOTIFY_UNSTABLE_V1_SERVER_PROTOCOL_H
#define TREELAND_KEYBOARD_STATE_NOTIFY_UNSTABLE_V1_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_keyboard_state_notify_unstable_v1 The treeland_keyboard_state_notify_unstable_v1 protocol
 * global keyboard state notification
 *
 * @section page_desc_treeland_keyboard_state_notify_unstable_v1 Description
 *
 * This protocol allows privileged clients to subscribe to global keyboard
 * state changes (e.g. Caps Lock, Num Lock).
 *
 * Clients create watcher objects through the manager global, each bound
 * to a seat. The client then configures the watcher with set_modifiers to
 * choose which modifiers to monitor, and set_flags to choose which event
 * types (locked, unlocked, or both) to receive. Configuration changes are
 * double-buffered and take effect atomically when the client sends apply.
 * Both set_modifiers and set_flags can be called multiple times before
 * apply; only the values from the most recent calls are committed. This
 * allows changing the configuration at runtime without destroying and
 * recreating the watcher. After apply, the compositor sends a
 * current_state event for each watched modifier containing its
 * current lock state, so the client can synchronize its initial
 * state without waiting for the next physical key press. The
 * compositor then sends
 * state_changed events on the watcher whenever any of the watched
 * modifiers changes lock state globally, regardless of which surface
 * has keyboard focus.
 *
 * This protocol is observation-only. Keyboard state changes are never
 * consumed or intercepted by this protocol.
 *
 * 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_keyboard_state_notify_unstable_v1 Interfaces
 * - @subpage page_iface_treeland_keyboard_state_notify_manager_v1 - global keyboard state notification manager
 * - @subpage page_iface_treeland_keyboard_state_watcher_v1 - keyboard state watcher
 * @section page_copyright_treeland_keyboard_state_notify_unstable_v1 Copyright
 * <pre>
 *
 * SPDX-FileCopyrightText: 2026 UnionTech Software Technology Co., Ltd.
 * SPDX-License-Identifier: MIT
 * </pre>
 */
struct treeland_keyboard_state_notify_manager_v1;
struct treeland_keyboard_state_watcher_v1;
struct wl_seat;

#ifndef TREELAND_KEYBOARD_STATE_NOTIFY_MANAGER_V1_INTERFACE
#define TREELAND_KEYBOARD_STATE_NOTIFY_MANAGER_V1_INTERFACE
/**
 * @page page_iface_treeland_keyboard_state_notify_manager_v1 treeland_keyboard_state_notify_manager_v1
 * @section page_iface_treeland_keyboard_state_notify_manager_v1_desc Description
 *
 * The treeland_keyboard_state_notify_manager_v1 interface is a
 * singleton global object used to create watcher objects for monitoring
 * keyboard state changes on a given seat.
 *
 * A client may create multiple watcher objects for the same seat if
 * needed.
 * @section page_iface_treeland_keyboard_state_notify_manager_v1_api API
 * See @ref iface_treeland_keyboard_state_notify_manager_v1.
 */
/**
 * @defgroup iface_treeland_keyboard_state_notify_manager_v1 The treeland_keyboard_state_notify_manager_v1 interface
 *
 * The treeland_keyboard_state_notify_manager_v1 interface is a
 * singleton global object used to create watcher objects for monitoring
 * keyboard state changes on a given seat.
 *
 * A client may create multiple watcher objects for the same seat if
 * needed.
 */
extern const struct wl_interface treeland_keyboard_state_notify_manager_v1_interface;
#endif
#ifndef TREELAND_KEYBOARD_STATE_WATCHER_V1_INTERFACE
#define TREELAND_KEYBOARD_STATE_WATCHER_V1_INTERFACE
/**
 * @page page_iface_treeland_keyboard_state_watcher_v1 treeland_keyboard_state_watcher_v1
 * @section page_iface_treeland_keyboard_state_watcher_v1_desc Description
 *
 * The treeland_keyboard_state_watcher_v1 interface represents a
 * subscription to keyboard state changes on a specific
 * seat.
 *
 * This object is created via get_keyboard_state_watcher on the
 * treeland_keyboard_state_notify_manager_v1 global. The client
 * configures the watcher with set_modifiers to choose which modifiers
 * to monitor and set_flags to choose which state transitions to
 * receive. Both can be changed at runtime. Configuration changes are
 * double-buffered: set_modifiers and set_flags only update the pending
 * state, which is applied atomically when apply is called.
 *
 * The compositor sends a current_state event for each modifier in
 * the committed modifier set immediately after apply is called.
 * It then sends
 * state_changed events whenever any of the watched modifiers
 * changes lock state, according to the committed modifiers and
 * flags.
 * @section page_iface_treeland_keyboard_state_watcher_v1_api API
 * See @ref iface_treeland_keyboard_state_watcher_v1.
 */
/**
 * @defgroup iface_treeland_keyboard_state_watcher_v1 The treeland_keyboard_state_watcher_v1 interface
 *
 * The treeland_keyboard_state_watcher_v1 interface represents a
 * subscription to keyboard state changes on a specific
 * seat.
 *
 * This object is created via get_keyboard_state_watcher on the
 * treeland_keyboard_state_notify_manager_v1 global. The client
 * configures the watcher with set_modifiers to choose which modifiers
 * to monitor and set_flags to choose which state transitions to
 * receive. Both can be changed at runtime. Configuration changes are
 * double-buffered: set_modifiers and set_flags only update the pending
 * state, which is applied atomically when apply is called.
 *
 * The compositor sends a current_state event for each modifier in
 * the committed modifier set immediately after apply is called.
 * It then sends
 * state_changed events whenever any of the watched modifiers
 * changes lock state, according to the committed modifiers and
 * flags.
 */
extern const struct wl_interface treeland_keyboard_state_watcher_v1_interface;
#endif

/**
 * @ingroup iface_treeland_keyboard_state_notify_manager_v1
 * @struct treeland_keyboard_state_notify_manager_v1_interface
 */
struct treeland_keyboard_state_notify_manager_v1_interface {
	/**
	 * destroy the keyboard state notify manager
	 *
	 * Destroy this treeland_keyboard_state_notify_manager_v1 object.
	 *
	 * Existing watcher objects created through this interface are not
	 * destroyed automatically. Clients should destroy those objects
	 * before destroying the manager.
	 */
	void (*destroy)(struct wl_client *client,
			struct wl_resource *resource);
	/**
	 * create a keyboard state watcher object
	 *
	 * Create a treeland_keyboard_state_watcher_v1 object for
	 * monitoring keyboard state changes on the given seat, or on all
	 * seats if seat is null.
	 *
	 * The watcher is created with no modifiers and no flags set by
	 * default. The client should use set_modifiers and set_flags on
	 * the watcher to configure what to monitor.
	 *
	 * Note: 1. The treeland_keyboard_state_watcher_v1 object must be
	 * destroyed before the associated wl_seat is destroyed.
	 * @param seat seat to monitor keyboard state on, or null for all seats
	 */
	void (*get_keyboard_state_watcher)(struct wl_client *client,
					   struct wl_resource *resource,
					   uint32_t id,
					   struct wl_resource *seat);
};


/**
 * @ingroup iface_treeland_keyboard_state_notify_manager_v1
 */
#define TREELAND_KEYBOARD_STATE_NOTIFY_MANAGER_V1_DESTROY_SINCE_VERSION 1
/**
 * @ingroup iface_treeland_keyboard_state_notify_manager_v1
 */
#define TREELAND_KEYBOARD_STATE_NOTIFY_MANAGER_V1_GET_KEYBOARD_STATE_WATCHER_SINCE_VERSION 1

#ifndef TREELAND_KEYBOARD_STATE_WATCHER_V1_MODIFIER_ENUM
#define TREELAND_KEYBOARD_STATE_WATCHER_V1_MODIFIER_ENUM
/**
 * @ingroup iface_treeland_keyboard_state_watcher_v1
 * keyboard modifier type
 *
 * Bitfield of keyboard modifiers whose lock state can be
 * monitored. Multiple modifier values can be combined using
 * bitwise OR.
 *
 * caps_lock: the Caps Lock modifier.
 * num_lock: the Num Lock modifier.
 * scroll_lock: the Scroll Lock modifier.
 *
 * Examples:
 * caps_lock: monitor only Caps Lock.
 * caps_lock | num_lock: monitor both Caps Lock and Num Lock.
 */
enum treeland_keyboard_state_watcher_v1_modifier {
	/**
	 * Caps Lock modifier
	 */
	TREELAND_KEYBOARD_STATE_WATCHER_V1_MODIFIER_CAPS_LOCK = 1,
	/**
	 * Num Lock modifier
	 */
	TREELAND_KEYBOARD_STATE_WATCHER_V1_MODIFIER_NUM_LOCK = 2,
};
#endif /* TREELAND_KEYBOARD_STATE_WATCHER_V1_MODIFIER_ENUM */

#ifndef TREELAND_KEYBOARD_STATE_WATCHER_V1_MODIFIER_ENUM_IS_VALID
#define TREELAND_KEYBOARD_STATE_WATCHER_V1_MODIFIER_ENUM_IS_VALID
/**
 * @ingroup iface_treeland_keyboard_state_watcher_v1
 * Validate a treeland_keyboard_state_watcher_v1 modifier value.
 *
 * @return true on success, false on error.
 * @ref treeland_keyboard_state_watcher_v1_modifier
 */
static inline bool
treeland_keyboard_state_watcher_v1_modifier_is_valid(uint32_t value, uint32_t version) {
	uint32_t valid = 0;
	if (version >= 1)
		valid |= TREELAND_KEYBOARD_STATE_WATCHER_V1_MODIFIER_CAPS_LOCK;
	if (version >= 1)
		valid |= TREELAND_KEYBOARD_STATE_WATCHER_V1_MODIFIER_NUM_LOCK;
	return (value & ~valid) == 0;
}
#endif /* TREELAND_KEYBOARD_STATE_WATCHER_V1_MODIFIER_ENUM_IS_VALID */

#ifndef TREELAND_KEYBOARD_STATE_WATCHER_V1_WATCH_FLAG_ENUM
#define TREELAND_KEYBOARD_STATE_WATCHER_V1_WATCH_FLAG_ENUM
/**
 * @ingroup iface_treeland_keyboard_state_watcher_v1
 * modifier state transition flags
 *
 * Flags to specify which modifier lock state transitions the
 * client wants to be notified about.
 *
 * none: do not notify on any state transition.
 * locked: notify when a watched modifier becomes locked.
 * unlocked: notify when a watched modifier becomes unlocked.
 *
 * Examples:
 * locked: the client receives events only when a modifier is
 * locked.
 * unlocked: the client receives events only when a modifier is
 * unlocked.
 * locked | unlocked: the client receives events on both.
 */
enum treeland_keyboard_state_watcher_v1_watch_flag {
	/**
	 * notify when modifier is locked
	 */
	TREELAND_KEYBOARD_STATE_WATCHER_V1_WATCH_FLAG_LOCKED = 1,
	/**
	 * notify when modifier is unlocked
	 */
	TREELAND_KEYBOARD_STATE_WATCHER_V1_WATCH_FLAG_UNLOCKED = 2,
};
#endif /* TREELAND_KEYBOARD_STATE_WATCHER_V1_WATCH_FLAG_ENUM */

#ifndef TREELAND_KEYBOARD_STATE_WATCHER_V1_WATCH_FLAG_ENUM_IS_VALID
#define TREELAND_KEYBOARD_STATE_WATCHER_V1_WATCH_FLAG_ENUM_IS_VALID
/**
 * @ingroup iface_treeland_keyboard_state_watcher_v1
 * Validate a treeland_keyboard_state_watcher_v1 watch_flag value.
 *
 * @return true on success, false on error.
 * @ref treeland_keyboard_state_watcher_v1_watch_flag
 */
static inline bool
treeland_keyboard_state_watcher_v1_watch_flag_is_valid(uint32_t value, uint32_t version) {
	uint32_t valid = 0;
	if (version >= 1)
		valid |= TREELAND_KEYBOARD_STATE_WATCHER_V1_WATCH_FLAG_LOCKED;
	if (version >= 1)
		valid |= TREELAND_KEYBOARD_STATE_WATCHER_V1_WATCH_FLAG_UNLOCKED;
	return (value & ~valid) == 0;
}
#endif /* TREELAND_KEYBOARD_STATE_WATCHER_V1_WATCH_FLAG_ENUM_IS_VALID */

#ifndef TREELAND_KEYBOARD_STATE_WATCHER_V1_MODIFIER_STATE_ENUM
#define TREELAND_KEYBOARD_STATE_WATCHER_V1_MODIFIER_STATE_ENUM
/**
 * @ingroup iface_treeland_keyboard_state_watcher_v1
 * modifier lock state
 *
 * The current lock state of a keyboard modifier.
 */
enum treeland_keyboard_state_watcher_v1_modifier_state {
	/**
	 * modifier is now unlocked
	 */
	TREELAND_KEYBOARD_STATE_WATCHER_V1_MODIFIER_STATE_UNLOCKED = 0,
	/**
	 * modifier is now locked
	 */
	TREELAND_KEYBOARD_STATE_WATCHER_V1_MODIFIER_STATE_LOCKED = 1,
};
#endif /* TREELAND_KEYBOARD_STATE_WATCHER_V1_MODIFIER_STATE_ENUM */

#ifndef TREELAND_KEYBOARD_STATE_WATCHER_V1_MODIFIER_STATE_ENUM_IS_VALID
#define TREELAND_KEYBOARD_STATE_WATCHER_V1_MODIFIER_STATE_ENUM_IS_VALID
/**
 * @ingroup iface_treeland_keyboard_state_watcher_v1
 * Validate a treeland_keyboard_state_watcher_v1 modifier_state value.
 *
 * @return true on success, false on error.
 * @ref treeland_keyboard_state_watcher_v1_modifier_state
 */
static inline bool
treeland_keyboard_state_watcher_v1_modifier_state_is_valid(uint32_t value, uint32_t version) {
	switch (value) {
	case TREELAND_KEYBOARD_STATE_WATCHER_V1_MODIFIER_STATE_UNLOCKED:
		return version >= 1;
	case TREELAND_KEYBOARD_STATE_WATCHER_V1_MODIFIER_STATE_LOCKED:
		return version >= 1;
	default:
		return false;
	}
}
#endif /* TREELAND_KEYBOARD_STATE_WATCHER_V1_MODIFIER_STATE_ENUM_IS_VALID */

/**
 * @ingroup iface_treeland_keyboard_state_watcher_v1
 * @struct treeland_keyboard_state_watcher_v1_interface
 */
struct treeland_keyboard_state_watcher_v1_interface {
	/**
	 * destroy the keyboard state watcher
	 *
	 * Destroy this treeland_keyboard_state_watcher_v1 object and
	 * stop receiving keyboard state notifications.
	 */
	void (*destroy)(struct wl_client *client,
			struct wl_resource *resource);
	/**
	 * set the modifiers to watch
	 *
	 * Set the keyboard modifiers to watch on this watcher.
	 *
	 * The modifiers argument is a bitfield of values from the modifier
	 * enum (e.g. caps_lock = 1, num_lock = 2, scroll_lock = 4).
	 * Multiple modifiers can be combined using bitwise OR.
	 *
	 * Calling set_modifiers replaces any previously pending modifiers.
	 *
	 * This request only updates the pending configuration. The change
	 * takes effect when apply is called. If set_modifiers is called
	 * multiple times before apply, only the values from the most
	 * recent call are used.
	 * @param modifiers bitfield of modifier enum values to watch
	 */
	void (*set_modifiers)(struct wl_client *client,
			      struct wl_resource *resource,
			      uint32_t modifiers);
	/**
	 * change which state transitions to notify about
	 *
	 * Change the watch flags for this watcher, selecting which
	 * modifier state transitions (locked, unlocked, or both) the
	 * client wants to be notified about.
	 *
	 * This request only updates the pending configuration. The change
	 * takes effect when apply is called. If set_flags is called
	 * multiple times before apply, only the values from the most
	 * recent call are used.
	 * @param flags new watch flags
	 */
	void (*set_flags)(struct wl_client *client,
			  struct wl_resource *resource,
			  uint32_t flags);
	/**
	 * apply pending configuration changes
	 *
	 * Apply the pending configuration state for this watcher
	 * atomically.
	 *
	 * The compositor will use the modifiers and flags set by the most
	 * recent set_modifiers and set_flags calls as the new active
	 * configuration for this watcher. If set_modifiers or set_flags
	 * have not been called since the last apply (or since the watcher
	 * was created), the corresponding pending values remain unchanged.
	 *
	 * After this request, the pending configuration is considered
	 * consumed. Subsequent calls to set_modifiers or set_flags will
	 * begin a new pending configuration.
	 *
	 * The compositor will send a current_state event for each modifier
	 * in the newly committed modifier set immediately after processing
	 * this request.
	 */
	void (*apply)(struct wl_client *client,
		      struct wl_resource *resource);
};

#define TREELAND_KEYBOARD_STATE_WATCHER_V1_CURRENT_STATE 0
#define TREELAND_KEYBOARD_STATE_WATCHER_V1_STATE_CHANGED 1

/**
 * @ingroup iface_treeland_keyboard_state_watcher_v1
 */
#define TREELAND_KEYBOARD_STATE_WATCHER_V1_CURRENT_STATE_SINCE_VERSION 1
/**
 * @ingroup iface_treeland_keyboard_state_watcher_v1
 */
#define TREELAND_KEYBOARD_STATE_WATCHER_V1_STATE_CHANGED_SINCE_VERSION 1

/**
 * @ingroup iface_treeland_keyboard_state_watcher_v1
 */
#define TREELAND_KEYBOARD_STATE_WATCHER_V1_DESTROY_SINCE_VERSION 1
/**
 * @ingroup iface_treeland_keyboard_state_watcher_v1
 */
#define TREELAND_KEYBOARD_STATE_WATCHER_V1_SET_MODIFIERS_SINCE_VERSION 1
/**
 * @ingroup iface_treeland_keyboard_state_watcher_v1
 */
#define TREELAND_KEYBOARD_STATE_WATCHER_V1_SET_FLAGS_SINCE_VERSION 1
/**
 * @ingroup iface_treeland_keyboard_state_watcher_v1
 */
#define TREELAND_KEYBOARD_STATE_WATCHER_V1_APPLY_SINCE_VERSION 1

/**
 * @ingroup iface_treeland_keyboard_state_watcher_v1
 * Sends an current_state event to the client owning the resource.
 * @param resource_ The client's resource
 * @param modifier the modifier whose lock state is being reported
 * @param state the current lock state of the modifier
 */
static inline void
treeland_keyboard_state_watcher_v1_send_current_state(struct wl_resource *resource_, uint32_t modifier, uint32_t state)
{
	wl_resource_post_event(resource_, TREELAND_KEYBOARD_STATE_WATCHER_V1_CURRENT_STATE, modifier, state);
}

/**
 * @ingroup iface_treeland_keyboard_state_watcher_v1
 * Sends an state_changed event to the client owning the resource.
 * @param resource_ The client's resource
 * @param modifier the modifier that changed lock state
 * @param state the new lock state of the modifier
 */
static inline void
treeland_keyboard_state_watcher_v1_send_state_changed(struct wl_resource *resource_, uint32_t modifier, uint32_t state)
{
	wl_resource_post_event(resource_, TREELAND_KEYBOARD_STATE_WATCHER_V1_STATE_CHANGED, modifier, state);
}

#ifdef  __cplusplus
}
#endif

#endif
