/* Generated by wayland-scanner 1.26.0 */

#ifndef TREELAND_WALLPAPER_MANAGER_UNSTABLE_V1_SERVER_PROTOCOL_H
#define TREELAND_WALLPAPER_MANAGER_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_wallpaper_manager_unstable_v1 The treeland_wallpaper_manager_unstable_v1 protocol
 * wallpaper management
 *
 * @section page_desc_treeland_wallpaper_manager_unstable_v1 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_wallpaper_manager_unstable_v1 Interfaces
 * - @subpage page_iface_treeland_wallpaper_manager_v1 - Wallpaper manager interface
 * - @subpage page_iface_treeland_wallpaper_v1 - Wallpaper object interface for setting and managing wallpaper content
 * @section page_copyright_treeland_wallpaper_manager_unstable_v1 Copyright
 * <pre>
 *
 * SPDX-FileCopyrightText: 2025 UnionTech Software Technology Co., Ltd.
 * SPDX-License-Identifier: MIT
 * </pre>
 */
struct treeland_wallpaper_manager_v1;
struct treeland_wallpaper_v1;
struct wl_output;
struct wl_surface;

#ifndef TREELAND_WALLPAPER_MANAGER_V1_INTERFACE
#define TREELAND_WALLPAPER_MANAGER_V1_INTERFACE
/**
 * @page page_iface_treeland_wallpaper_manager_v1 treeland_wallpaper_manager_v1
 * @section page_iface_treeland_wallpaper_manager_v1_desc Description
 *
 * The treeland_wallpaper_manager_v1 interface is a global object used to
 * create wallpaper objects for specific outputs.
 * @section page_iface_treeland_wallpaper_manager_v1_api API
 * See @ref iface_treeland_wallpaper_manager_v1.
 */
/**
 * @defgroup iface_treeland_wallpaper_manager_v1 The treeland_wallpaper_manager_v1 interface
 *
 * The treeland_wallpaper_manager_v1 interface is a global object used to
 * create wallpaper objects for specific outputs.
 */
extern const struct wl_interface treeland_wallpaper_manager_v1_interface;
#endif
#ifndef TREELAND_WALLPAPER_V1_INTERFACE
#define TREELAND_WALLPAPER_V1_INTERFACE
/**
 * @page page_iface_treeland_wallpaper_v1 treeland_wallpaper_v1
 * @section page_iface_treeland_wallpaper_v1_desc Description
 *
 * The treeland_wallpaper_v1 interface represents a wallpaper instance
 * created by the compositor for a specific output, role.
 *
 * The wallpaper source provided by the client is stored and managed on
 * the compositor side. Once a wallpaper source has been set,
 * the compositor may cache, reuse, or persist the source independently
 * of the client.
 * @section page_iface_treeland_wallpaper_v1_api API
 * See @ref iface_treeland_wallpaper_v1.
 */
/**
 * @defgroup iface_treeland_wallpaper_v1 The treeland_wallpaper_v1 interface
 *
 * The treeland_wallpaper_v1 interface represents a wallpaper instance
 * created by the compositor for a specific output, role.
 *
 * The wallpaper source provided by the client is stored and managed on
 * the compositor side. Once a wallpaper source has been set,
 * the compositor may cache, reuse, or persist the source independently
 * of the client.
 */
extern const struct wl_interface treeland_wallpaper_v1_interface;
#endif

/**
 * @ingroup iface_treeland_wallpaper_manager_v1
 * @struct treeland_wallpaper_manager_v1_interface
 */
struct treeland_wallpaper_manager_v1_interface {
	/**
	 * destroy treeland_wallpaper_manager_v1
	 *
	 * Destroy this treeland_wallpaper_manager_v1 object.
	 *
	 * Destroying a bound treeland_wallpaper_manager_v1 object while
	 * there are wallpapers still alive created by this
	 * treeland_wallpaper_manager_v1 object instance is illegal and
	 * will result in a protocol error.
	 */
	void (*destroy)(struct wl_client *client,
			struct wl_resource *resource);
	/**
	 * Create a wallpaper object for an output.
	 *
	 * Creates a treeland_wallpaper_v1 object bound to the specified
	 * wl_output.
	 *
	 * The compositor may enforce that only one wallpaper exists for a
	 * given (output, role) combination.
	 *
	 * When a surface is associated, the compositor will track the
	 * workspace the surface belongs to. Whenever the workspace
	 * changes, the compositor may notify the client of the current
	 * wallpaper file path used by that workspace.
	 *
	 * Note: 1. The treeland_wallpaper_v1 object must be destroyed
	 * before the associated wl_output is destroyed. 1. The
	 * treeland_wallpaper_v1 object must be destroyed before the
	 * associated wl_surface is destroyed.
	 * @param surface The wl_surface associated with this wallpaper, or null to unset it
	 */
	void (*get_treeland_wallpaper)(struct wl_client *client,
				       struct wl_resource *resource,
				       uint32_t id,
				       struct wl_resource *output,
				       struct wl_resource *surface);
};


/**
 * @ingroup iface_treeland_wallpaper_manager_v1
 */
#define TREELAND_WALLPAPER_MANAGER_V1_DESTROY_SINCE_VERSION 1
/**
 * @ingroup iface_treeland_wallpaper_manager_v1
 */
#define TREELAND_WALLPAPER_MANAGER_V1_GET_TREELAND_WALLPAPER_SINCE_VERSION 1

#ifndef TREELAND_WALLPAPER_V1_ERROR_ENUM
#define TREELAND_WALLPAPER_V1_ERROR_ENUM
enum treeland_wallpaper_v1_error {
	/**
	 * wallpaper file has already been used and is cached on the wallpaper side
	 */
	TREELAND_WALLPAPER_V1_ERROR_ALREADY_USED = 0,
	/**
	 * The specified wallpaper source is invalid, unsupported, or failed to load.
	 */
	TREELAND_WALLPAPER_V1_ERROR_INVALID_SOURCE = 1,
	/**
	 * Permission denied when opening the specified wallpaper source
	 */
	TREELAND_WALLPAPER_V1_ERROR_PERMISSION_DENIED = 2,
};
#endif /* TREELAND_WALLPAPER_V1_ERROR_ENUM */

#ifndef TREELAND_WALLPAPER_V1_ERROR_ENUM_IS_VALID
#define TREELAND_WALLPAPER_V1_ERROR_ENUM_IS_VALID
/**
 * @ingroup iface_treeland_wallpaper_v1
 * Validate a treeland_wallpaper_v1 error value.
 *
 * @return true on success, false on error.
 * @ref treeland_wallpaper_v1_error
 */
static inline bool
treeland_wallpaper_v1_error_is_valid(uint32_t value, uint32_t version) {
	switch (value) {
	case TREELAND_WALLPAPER_V1_ERROR_ALREADY_USED:
		return version >= 1;
	case TREELAND_WALLPAPER_V1_ERROR_INVALID_SOURCE:
		return version >= 1;
	case TREELAND_WALLPAPER_V1_ERROR_PERMISSION_DENIED:
		return version >= 1;
	default:
		return false;
	}
}
#endif /* TREELAND_WALLPAPER_V1_ERROR_ENUM_IS_VALID */

#ifndef TREELAND_WALLPAPER_V1_WALLPAPER_SOURCE_TYPE_ENUM
#define TREELAND_WALLPAPER_V1_WALLPAPER_SOURCE_TYPE_ENUM
enum treeland_wallpaper_v1_wallpaper_source_type {
	/**
	 * The wallpaper source is an image
	 */
	TREELAND_WALLPAPER_V1_WALLPAPER_SOURCE_TYPE_IMAGE = 0,
	/**
	 * The wallpaper source is a video
	 */
	TREELAND_WALLPAPER_V1_WALLPAPER_SOURCE_TYPE_VIDEO = 1,
};
#endif /* TREELAND_WALLPAPER_V1_WALLPAPER_SOURCE_TYPE_ENUM */

#ifndef TREELAND_WALLPAPER_V1_WALLPAPER_SOURCE_TYPE_ENUM_IS_VALID
#define TREELAND_WALLPAPER_V1_WALLPAPER_SOURCE_TYPE_ENUM_IS_VALID
/**
 * @ingroup iface_treeland_wallpaper_v1
 * Validate a treeland_wallpaper_v1 wallpaper_source_type value.
 *
 * @return true on success, false on error.
 * @ref treeland_wallpaper_v1_wallpaper_source_type
 */
static inline bool
treeland_wallpaper_v1_wallpaper_source_type_is_valid(uint32_t value, uint32_t version) {
	switch (value) {
	case TREELAND_WALLPAPER_V1_WALLPAPER_SOURCE_TYPE_IMAGE:
		return version >= 1;
	case TREELAND_WALLPAPER_V1_WALLPAPER_SOURCE_TYPE_VIDEO:
		return version >= 1;
	default:
		return false;
	}
}
#endif /* TREELAND_WALLPAPER_V1_WALLPAPER_SOURCE_TYPE_ENUM_IS_VALID */

#ifndef TREELAND_WALLPAPER_V1_WALLPAPER_ROLE_ENUM
#define TREELAND_WALLPAPER_V1_WALLPAPER_ROLE_ENUM
enum treeland_wallpaper_v1_wallpaper_role {
	/**
	 * Wallpaper for the desktop environment
	 */
	TREELAND_WALLPAPER_V1_WALLPAPER_ROLE_DESKTOP = 0x1,
	/**
	 * Wallpaper for the lock screen
	 */
	TREELAND_WALLPAPER_V1_WALLPAPER_ROLE_LOCKSCREEN = 0x2,
};
#endif /* TREELAND_WALLPAPER_V1_WALLPAPER_ROLE_ENUM */

#ifndef TREELAND_WALLPAPER_V1_WALLPAPER_ROLE_ENUM_IS_VALID
#define TREELAND_WALLPAPER_V1_WALLPAPER_ROLE_ENUM_IS_VALID
/**
 * @ingroup iface_treeland_wallpaper_v1
 * Validate a treeland_wallpaper_v1 wallpaper_role value.
 *
 * @return true on success, false on error.
 * @ref treeland_wallpaper_v1_wallpaper_role
 */
static inline bool
treeland_wallpaper_v1_wallpaper_role_is_valid(uint32_t value, uint32_t version) {
	switch (value) {
	case TREELAND_WALLPAPER_V1_WALLPAPER_ROLE_DESKTOP:
		return version >= 1;
	case TREELAND_WALLPAPER_V1_WALLPAPER_ROLE_LOCKSCREEN:
		return version >= 1;
	default:
		return false;
	}
}
#endif /* TREELAND_WALLPAPER_V1_WALLPAPER_ROLE_ENUM_IS_VALID */

/**
 * @ingroup iface_treeland_wallpaper_v1
 * @struct treeland_wallpaper_v1_interface
 */
struct treeland_wallpaper_v1_interface {
	/**
	 * Destroy the wallpaper object
	 *
	 * Destroys the treeland_wallpaper_v1 object and releases all
	 * resources associated with it on the compositor side.
	 *
	 * After calling this request, the client must not use the
	 * wallpaper object anymore.
	 */
	void (*destroy)(struct wl_client *client,
			struct wl_resource *resource);
	/**
	 * Set an image wallpaper source
	 *
	 * Sets an image as the wallpaper source, apply to the current
	 * wl_output and the active workspace. except for lockscreen
	 * wallpapers, only one wallpaper can be set per wl_output.
	 * Supported formats:
	 *
	 * - JPG / JPEG (Joint Photographic Experts Group)
	 *
	 * The compositor will attempt to load and display the specified
	 * image file. If the file cannot be accessed, decoded, or is in an
	 * unsupported format, the compositor will emit a failed event with
	 * an appropriate error code.
	 *
	 * Access Control: This protocol accepts file_source such as
	 * /usr/share/wallpapers/xxx or /var/cache/wallpapers/xxxx provided
	 * by the client. the compositor will perform file verification.
	 * @param file_source Path to the image file to be used as the wallpaper
	 * @param role wallpaper role
	 */
	void (*set_image_source)(struct wl_client *client,
				 struct wl_resource *resource,
				 const char *file_source,
				 uint32_t role);
	/**
	 * Set a video wallpaper source
	 *
	 * Sets a video file as the wallpaper source, apply to the
	 * current wl_output and the active workspace. except for
	 * lockscreen wallpapers, only one wallpaper can be set per
	 * wl_output. Supported formats:
	 *
	 * - MP4 - AVI - MOV
	 *
	 * The compositor is responsible for decoding and presenting the
	 * video. Playback behavior such as looping, synchronization, and
	 * performance characteristics are compositor-defined.
	 *
	 * If the video source cannot be opened or decoded, a failed event
	 * will be emitted.
	 *
	 * Access Control: This protocol accepts file_source such as
	 * /usr/share/wallpapers/xxx or /var/cache/wallpapers/xxxx provided
	 * by the client. the compositor will perform file verification.
	 * @param file_source Path to the video file to be used as the wallpaper
	 * @param role wallpaper role
	 */
	void (*set_video_source)(struct wl_client *client,
				 struct wl_resource *resource,
				 const char *file_source,
				 uint32_t role);
};

#define TREELAND_WALLPAPER_V1_FAILED 0
#define TREELAND_WALLPAPER_V1_CHANGED 1

/**
 * @ingroup iface_treeland_wallpaper_v1
 */
#define TREELAND_WALLPAPER_V1_FAILED_SINCE_VERSION 1
/**
 * @ingroup iface_treeland_wallpaper_v1
 */
#define TREELAND_WALLPAPER_V1_CHANGED_SINCE_VERSION 1

/**
 * @ingroup iface_treeland_wallpaper_v1
 */
#define TREELAND_WALLPAPER_V1_DESTROY_SINCE_VERSION 1
/**
 * @ingroup iface_treeland_wallpaper_v1
 */
#define TREELAND_WALLPAPER_V1_SET_IMAGE_SOURCE_SINCE_VERSION 1
/**
 * @ingroup iface_treeland_wallpaper_v1
 */
#define TREELAND_WALLPAPER_V1_SET_VIDEO_SOURCE_SINCE_VERSION 1

/**
 * @ingroup iface_treeland_wallpaper_v1
 * Sends an failed event to the client owning the resource.
 * @param resource_ The client's resource
 * @param file_source Path to the file to be used as the wallpaper
 * @param error The error code indicating the failure reason
 */
static inline void
treeland_wallpaper_v1_send_failed(struct wl_resource *resource_, const char *file_source, uint32_t error)
{
	wl_resource_post_event(resource_, TREELAND_WALLPAPER_V1_FAILED, file_source, error);
}

/**
 * @ingroup iface_treeland_wallpaper_v1
 * Sends an changed event to the client owning the resource.
 * @param resource_ The client's resource
 * @param source_type The type of the current wallpaper source
 * @param file_source The file path of the current wallpaper source
 */
static inline void
treeland_wallpaper_v1_send_changed(struct wl_resource *resource_, uint32_t role, uint32_t source_type, const char *file_source)
{
	wl_resource_post_event(resource_, TREELAND_WALLPAPER_V1_CHANGED, role, source_type, file_source);
}

#ifdef  __cplusplus
}
#endif

#endif
