/* Generated by wayland-scanner 1.26.0 */

#ifndef TREELAND_WINE_WINDOW_STATE_V1_SERVER_PROTOCOL_H
#define TREELAND_WINE_WINDOW_STATE_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_wine_window_state_v1 The treeland_wine_window_state_v1 protocol
 * window state query and control for Wine
 *
 * @section page_desc_treeland_wine_window_state_v1 Description
 *
 * This protocol provides window state management capabilities required
 * by Wine (the Windows API compatibility layer) that are not available
 * through standard Wayland protocols.
 *
 * Standard xdg-shell lacks:
 * - any way to read whether a toplevel is minimized,
 * - any way to programmatically unminimize a toplevel,
 * - any way to request activation without a valid xdg-activation token
 * originating from a prior user interaction,
 * - any way to request a visual attention hint (taskbar flash) without
 * stealing focus.
 *
 * This protocol fills those gaps.  A client obtains a
 * treeland_wine_window_state_v1 object for each xdg_toplevel whose
 * state it needs to observe or control.  The compositor remains the
 * final authority: every request is advisory, and the compositor
 * reports the authoritative state through events.
 *
 * The key words "must", "must not", "should", "should not", and "may"
 * in this document are to be interpreted as described in IETF RFC 2119.
 *
 * 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_wine_window_state_v1 Interfaces
 * - @subpage page_iface_treeland_wine_window_state_manager_v1 - global entry point for Wine window state control
 * - @subpage page_iface_treeland_wine_window_state_v1 - per-toplevel state observation and control
 * @section page_copyright_treeland_wine_window_state_v1 Copyright
 * <pre>
 *
 * SPDX-FileCopyrightText: 2026 UnionTech Software Technology Co., Ltd.
 * SPDX-License-Identifier: MIT
 * </pre>
 */
struct treeland_wine_window_state_manager_v1;
struct treeland_wine_window_state_v1;
struct wl_seat;
struct xdg_toplevel;

#ifndef TREELAND_WINE_WINDOW_STATE_MANAGER_V1_INTERFACE
#define TREELAND_WINE_WINDOW_STATE_MANAGER_V1_INTERFACE
/**
 * @page page_iface_treeland_wine_window_state_manager_v1 treeland_wine_window_state_manager_v1
 * @section page_iface_treeland_wine_window_state_manager_v1_desc Description
 *
 * Lets a Wine client create per-toplevel state objects.  The
 * compositor should restrict binding to trusted clients identified
 * by app_id or an equivalent policy mechanism.
 *
 * The client must destroy all child
 * treeland_wine_window_state_v1 objects before destroying this
 * object.
 * @section page_iface_treeland_wine_window_state_manager_v1_api API
 * See @ref iface_treeland_wine_window_state_manager_v1.
 */
/**
 * @defgroup iface_treeland_wine_window_state_manager_v1 The treeland_wine_window_state_manager_v1 interface
 *
 * Lets a Wine client create per-toplevel state objects.  The
 * compositor should restrict binding to trusted clients identified
 * by app_id or an equivalent policy mechanism.
 *
 * The client must destroy all child
 * treeland_wine_window_state_v1 objects before destroying this
 * object.
 */
extern const struct wl_interface treeland_wine_window_state_manager_v1_interface;
#endif
#ifndef TREELAND_WINE_WINDOW_STATE_V1_INTERFACE
#define TREELAND_WINE_WINDOW_STATE_V1_INTERFACE
/**
 * @page page_iface_treeland_wine_window_state_v1 treeland_wine_window_state_v1
 * @section page_iface_treeland_wine_window_state_v1_desc Description
 *
 * Observes and controls the lifecycle state for one xdg_toplevel
 * surface.
 *
 * State flags are reported via the state_changed event.  Each
 * flag corresponds to a Windows window state that xdg-shell does
 * not expose to clients.
 *
 * If the associated xdg_toplevel is destroyed, this object
 * becomes inert.  All subsequent requests are ignored and no
 * further events are emitted.  The client should destroy the
 * inert object.
 * @section page_iface_treeland_wine_window_state_v1_api API
 * See @ref iface_treeland_wine_window_state_v1.
 */
/**
 * @defgroup iface_treeland_wine_window_state_v1 The treeland_wine_window_state_v1 interface
 *
 * Observes and controls the lifecycle state for one xdg_toplevel
 * surface.
 *
 * State flags are reported via the state_changed event.  Each
 * flag corresponds to a Windows window state that xdg-shell does
 * not expose to clients.
 *
 * If the associated xdg_toplevel is destroyed, this object
 * becomes inert.  All subsequent requests are ignored and no
 * further events are emitted.  The client should destroy the
 * inert object.
 */
extern const struct wl_interface treeland_wine_window_state_v1_interface;
#endif

#ifndef TREELAND_WINE_WINDOW_STATE_MANAGER_V1_ERROR_ENUM
#define TREELAND_WINE_WINDOW_STATE_MANAGER_V1_ERROR_ENUM
enum treeland_wine_window_state_manager_v1_error {
	/**
	 * a state object already exists for the given toplevel
	 */
	TREELAND_WINE_WINDOW_STATE_MANAGER_V1_ERROR_TOPLEVEL_ALREADY_BOUND = 0,
	/**
	 * the xdg_toplevel has no associated role or has been destroyed
	 */
	TREELAND_WINE_WINDOW_STATE_MANAGER_V1_ERROR_DEFUNCT_TOPLEVEL = 1,
};
#endif /* TREELAND_WINE_WINDOW_STATE_MANAGER_V1_ERROR_ENUM */

#ifndef TREELAND_WINE_WINDOW_STATE_MANAGER_V1_ERROR_ENUM_IS_VALID
#define TREELAND_WINE_WINDOW_STATE_MANAGER_V1_ERROR_ENUM_IS_VALID
/**
 * @ingroup iface_treeland_wine_window_state_manager_v1
 * Validate a treeland_wine_window_state_manager_v1 error value.
 *
 * @return true on success, false on error.
 * @ref treeland_wine_window_state_manager_v1_error
 */
static inline bool
treeland_wine_window_state_manager_v1_error_is_valid(uint32_t value, uint32_t version) {
	switch (value) {
	case TREELAND_WINE_WINDOW_STATE_MANAGER_V1_ERROR_TOPLEVEL_ALREADY_BOUND:
		return version >= 1;
	case TREELAND_WINE_WINDOW_STATE_MANAGER_V1_ERROR_DEFUNCT_TOPLEVEL:
		return version >= 1;
	default:
		return false;
	}
}
#endif /* TREELAND_WINE_WINDOW_STATE_MANAGER_V1_ERROR_ENUM_IS_VALID */

/**
 * @ingroup iface_treeland_wine_window_state_manager_v1
 * @struct treeland_wine_window_state_manager_v1_interface
 */
struct treeland_wine_window_state_manager_v1_interface {
	/**
	 * destroy the manager
	 *
	 * Destroys this manager object. The client must destroy every
	 * treeland_wine_window_state_v1 created through this manager
	 * before sending this request; otherwise the compositor must raise
	 * an implementation-defined protocol error.
	 */
	void (*destroy)(struct wl_client *client,
			struct wl_resource *resource);
	/**
	 * create a state object for an xdg_toplevel
	 *
	 * Creates a treeland_wine_window_state_v1 bound to the given
	 * xdg_toplevel. At most one state object may exist for each
	 * toplevel; requesting a second one is a toplevel_already_bound
	 * error. If the xdg_toplevel has been destroyed or has no
	 * configured role, the compositor must raise a defunct_toplevel
	 * error.
	 *
	 * Upon creation, the compositor immediately sends a state_changed
	 * event to report the current state of the toplevel.
	 */
	void (*get_window_state)(struct wl_client *client,
				 struct wl_resource *resource,
				 uint32_t id,
				 struct wl_resource *toplevel);
};


/**
 * @ingroup iface_treeland_wine_window_state_manager_v1
 */
#define TREELAND_WINE_WINDOW_STATE_MANAGER_V1_DESTROY_SINCE_VERSION 1
/**
 * @ingroup iface_treeland_wine_window_state_manager_v1
 */
#define TREELAND_WINE_WINDOW_STATE_MANAGER_V1_GET_WINDOW_STATE_SINCE_VERSION 1

#ifndef TREELAND_WINE_WINDOW_STATE_V1_STATE_ENUM
#define TREELAND_WINE_WINDOW_STATE_V1_STATE_ENUM
/**
 * @ingroup iface_treeland_wine_window_state_v1
 * window state flags
 *
 * Bitfield of window states that the compositor tracks for
 * this toplevel.  These supplement the states delivered by
 * xdg_toplevel.configure.  Keyboard focus (activated) is
 * excluded because it is already delivered by xdg_toplevel;
 * duplicating it here would create two conflicting sources of
 * truth.
 */
enum treeland_wine_window_state_v1_state {
	/**
	 * the toplevel is minimized (iconified)
	 */
	TREELAND_WINE_WINDOW_STATE_V1_STATE_MINIMIZED = 1,
	/**
	 * the toplevel is requesting user attention (taskbar flash active)
	 */
	TREELAND_WINE_WINDOW_STATE_V1_STATE_ATTENTION = 2,
};
#endif /* TREELAND_WINE_WINDOW_STATE_V1_STATE_ENUM */

#ifndef TREELAND_WINE_WINDOW_STATE_V1_STATE_ENUM_IS_VALID
#define TREELAND_WINE_WINDOW_STATE_V1_STATE_ENUM_IS_VALID
/**
 * @ingroup iface_treeland_wine_window_state_v1
 * Validate a treeland_wine_window_state_v1 state value.
 *
 * @return true on success, false on error.
 * @ref treeland_wine_window_state_v1_state
 */
static inline bool
treeland_wine_window_state_v1_state_is_valid(uint32_t value, uint32_t version) {
	uint32_t valid = 0;
	if (version >= 1)
		valid |= TREELAND_WINE_WINDOW_STATE_V1_STATE_MINIMIZED;
	if (version >= 1)
		valid |= TREELAND_WINE_WINDOW_STATE_V1_STATE_ATTENTION;
	return (value & ~valid) == 0;
}
#endif /* TREELAND_WINE_WINDOW_STATE_V1_STATE_ENUM_IS_VALID */

#ifndef TREELAND_WINE_WINDOW_STATE_V1_ACTIVATE_REASON_ENUM
#define TREELAND_WINE_WINDOW_STATE_V1_ACTIVATE_REASON_ENUM
/**
 * @ingroup iface_treeland_wine_window_state_v1
 * reason for an activation request
 *
 * Provides semantic context for an activate request so the
 * compositor can apply appropriate focus-stealing prevention
 * policy.
 */
enum treeland_wine_window_state_v1_activate_reason {
	/**
	 * the user explicitly asked to activate this window (e.g. taskbar click)
	 */
	TREELAND_WINE_WINDOW_STATE_V1_ACTIVATE_REASON_USER_REQUEST = 0,
	/**
	 * the application is activating itself (e.g. SetForegroundWindow without direct user gesture)
	 */
	TREELAND_WINE_WINDOW_STATE_V1_ACTIVATE_REASON_PROGRAMMATIC = 1,
	/**
	 * the window is being restored from a minimized or hidden state
	 */
	TREELAND_WINE_WINDOW_STATE_V1_ACTIVATE_REASON_RESTORE = 2,
};
#endif /* TREELAND_WINE_WINDOW_STATE_V1_ACTIVATE_REASON_ENUM */

#ifndef TREELAND_WINE_WINDOW_STATE_V1_ACTIVATE_REASON_ENUM_IS_VALID
#define TREELAND_WINE_WINDOW_STATE_V1_ACTIVATE_REASON_ENUM_IS_VALID
/**
 * @ingroup iface_treeland_wine_window_state_v1
 * Validate a treeland_wine_window_state_v1 activate_reason value.
 *
 * @return true on success, false on error.
 * @ref treeland_wine_window_state_v1_activate_reason
 */
static inline bool
treeland_wine_window_state_v1_activate_reason_is_valid(uint32_t value, uint32_t version) {
	switch (value) {
	case TREELAND_WINE_WINDOW_STATE_V1_ACTIVATE_REASON_USER_REQUEST:
		return version >= 1;
	case TREELAND_WINE_WINDOW_STATE_V1_ACTIVATE_REASON_PROGRAMMATIC:
		return version >= 1;
	case TREELAND_WINE_WINDOW_STATE_V1_ACTIVATE_REASON_RESTORE:
		return version >= 1;
	default:
		return false;
	}
}
#endif /* TREELAND_WINE_WINDOW_STATE_V1_ACTIVATE_REASON_ENUM_IS_VALID */

/**
 * @ingroup iface_treeland_wine_window_state_v1
 * @struct treeland_wine_window_state_v1_interface
 */
struct treeland_wine_window_state_v1_interface {
	/**
	 * destroy this state object
	 *
	 * Destroys the state object. This does not affect the associated
	 * xdg_toplevel.
	 */
	void (*destroy)(struct wl_client *client,
			struct wl_resource *resource);
	/**
	 * request that the toplevel be unminimized
	 *
	 * Requests that the compositor restore this toplevel from the
	 * minimized state.
	 *
	 * Standard xdg-shell provides xdg_toplevel.set_minimized but no
	 * way to reverse it. This request fills that gap.
	 *
	 * If the toplevel is not currently minimized, this request has no
	 * effect. If the compositor honors the request, it emits a
	 * state_changed event with the minimized flag cleared.
	 *
	 * This corresponds to the Wine/Windows ShowWindow(SW_RESTORE) call
	 * on a minimized window.
	 */
	void (*unminimize)(struct wl_client *client,
			   struct wl_resource *resource);
	/**
	 * request that the toplevel be activated
	 *
	 * Requests that the compositor give keyboard focus to this
	 * toplevel and raise it in the stacking order.
	 *
	 * serial is a client-assigned value that is echoed back in any
	 * activate_denied event for this request, allowing the client to
	 * correlate denials when multiple activations are in flight.
	 *
	 * The reason argument informs the compositor about the context of
	 * the activation. Compositors should generally honor user_request
	 * and restore activations, and may choose to deny or convert
	 * programmatic activations into attention requests based on
	 * focus-stealing prevention policy.
	 *
	 * If the compositor accepts the request, no activate_denied event
	 * is sent. Acceptance does not guarantee immediate keyboard focus:
	 * if another surface (e.g. a layer-shell surface with exclusive
	 * keyboard interactivity) currently holds focus, the compositor
	 * places this toplevel at the head of the focus fallback queue and
	 * activates it once the exclusive focus is released. The client
	 * will observe the eventual focus grant through the normal
	 * xdg_toplevel.configure activated state.
	 *
	 * If the compositor denies the request, it emits an
	 * activate_denied event carrying the same serial, and may set the
	 * attention flag via state_changed.
	 *
	 * Corresponds to the Wine/Windows SetForegroundWindow API. Under
	 * X11, Wine sends a _NET_ACTIVE_WINDOW client message with source
	 * indication; this request serves the same role under Wayland.
	 * @param serial client-assigned serial for correlating with activate_denied
	 * @param reason why the client is requesting activation
	 * @param seat the seat on which to activate
	 */
	void (*activate)(struct wl_client *client,
			 struct wl_resource *resource,
			 uint32_t serial,
			 uint32_t reason,
			 struct wl_resource *seat);
	/**
	 * request a user attention hint (taskbar flash)
	 *
	 * Asks the compositor to signal that this toplevel needs user
	 * attention in the taskbar or dock. This must not steal keyboard
	 * focus.
	 *
	 * The compositor forwards this hint to the taskbar via the foreign
	 * toplevel manager protocol. Whether the taskbar honors count and
	 * timeout_ms is implementation-defined and not guaranteed by the
	 * compositor; clients must not rely on exact flash behavior.
	 *
	 * count specifies how many times to flash. 0 means flash
	 * indefinitely until the window is activated, corresponding to
	 * FLASHW_TIMER in the Windows FlashWindowEx API.
	 *
	 * timeout_ms specifies the desired interval between flashes in
	 * milliseconds. 0 requests the compositor or taskbar default rate.
	 * This value is forwarded as a hint only.
	 *
	 * Sending this request replaces any currently active attention
	 * hint. To stop flashing, use clear_attention.
	 *
	 * This request covers the taskbar/tray component (FLASHW_TRAY) of
	 * the Windows FlashWindowEx API. Title-bar caption flashing
	 * (FLASHW_CAPTION) is handled by Wine's client-side decoration
	 * layer and is outside the scope of this protocol.
	 *
	 * Under X11, Wine sets _NET_WM_STATE_DEMANDS_ATTENTION; this
	 * request serves the same role under Wayland.
	 * @param count number of flashes; 0 for indefinite
	 * @param timeout_ms desired flash interval in milliseconds; 0 for default; forwarded as a hint only
	 */
	void (*set_attention)(struct wl_client *client,
			      struct wl_resource *resource,
			      uint32_t count,
			      uint32_t timeout_ms);
	/**
	 * cancel a user attention hint
	 *
	 * Cancels any active attention hint set via set_attention. If no
	 * hint is active, this request has no effect.
	 *
	 * The compositor emits a state_changed event with the attention
	 * flag cleared.
	 *
	 * Corresponds to FlashWindowEx with FLASHW_STOP.
	 */
	void (*clear_attention)(struct wl_client *client,
				struct wl_resource *resource);
};

#define TREELAND_WINE_WINDOW_STATE_V1_STATE_CHANGED 0
#define TREELAND_WINE_WINDOW_STATE_V1_ACTIVATE_DENIED 1

/**
 * @ingroup iface_treeland_wine_window_state_v1
 */
#define TREELAND_WINE_WINDOW_STATE_V1_STATE_CHANGED_SINCE_VERSION 1
/**
 * @ingroup iface_treeland_wine_window_state_v1
 */
#define TREELAND_WINE_WINDOW_STATE_V1_ACTIVATE_DENIED_SINCE_VERSION 1

/**
 * @ingroup iface_treeland_wine_window_state_v1
 */
#define TREELAND_WINE_WINDOW_STATE_V1_DESTROY_SINCE_VERSION 1
/**
 * @ingroup iface_treeland_wine_window_state_v1
 */
#define TREELAND_WINE_WINDOW_STATE_V1_UNMINIMIZE_SINCE_VERSION 1
/**
 * @ingroup iface_treeland_wine_window_state_v1
 */
#define TREELAND_WINE_WINDOW_STATE_V1_ACTIVATE_SINCE_VERSION 1
/**
 * @ingroup iface_treeland_wine_window_state_v1
 */
#define TREELAND_WINE_WINDOW_STATE_V1_SET_ATTENTION_SINCE_VERSION 1
/**
 * @ingroup iface_treeland_wine_window_state_v1
 */
#define TREELAND_WINE_WINDOW_STATE_V1_CLEAR_ATTENTION_SINCE_VERSION 1

/**
 * @ingroup iface_treeland_wine_window_state_v1
 * Sends an state_changed event to the client owning the resource.
 * @param resource_ The client's resource
 * @param state current state bitfield
 */
static inline void
treeland_wine_window_state_v1_send_state_changed(struct wl_resource *resource_, uint32_t state)
{
	wl_resource_post_event(resource_, TREELAND_WINE_WINDOW_STATE_V1_STATE_CHANGED, state);
}

/**
 * @ingroup iface_treeland_wine_window_state_v1
 * Sends an activate_denied event to the client owning the resource.
 * @param resource_ The client's resource
 * @param serial serial from the corresponding activate request
 */
static inline void
treeland_wine_window_state_v1_send_activate_denied(struct wl_resource *resource_, uint32_t serial)
{
	wl_resource_post_event(resource_, TREELAND_WINE_WINDOW_STATE_V1_ACTIVATE_DENIED, serial);
}

#ifdef  __cplusplus
}
#endif

#endif
