Treeland wallpaper manager
treeland_wallpaper_manager_v1 接口是一个全局对象,用于为指定的输出创建壁纸对象。
destroy()
销毁此 treeland_wallpaper_manager_v1 对象。
在由此 treeland_wallpaper_manager_v1 对象实例创建的壁纸仍然存在时,销毁已绑定的 treeland_wallpaper_manager_v1 对象是非法的,将导致协议错误。
get_treeland_wallpaper(id: new_id<treeland_wallpaper_v1>, output: object<wl_output>, surface: object<wl_surface>)
参数 | 类型 | 描述 |
|---|---|---|
| id | new_id<treeland_wallpaper_v1> | |
| output | object<wl_output> | |
| surface | object<wl_surface>允许为空 | The wl_surface associated with this wallpaper, or null to unset it |
创建一个绑定到指定 wl_output 的 treeland_wallpaper_v1 对象。
合成器可以强制规定对于给定的(输出、角色)组合只存在一个壁纸。
当关联了 surface 时,合成器将跟踪该 surface 所属的工作区。 每当工作区发生变化时,合成器可以通知客户端该工作区当前使用的壁纸文件路径。
注意:treeland_wallpaper_v1 对象必须在关联的 wl_surface 被销毁之前销毁。
treeland_wallpaper_v1 接口表示由合成器为特定输出和角色创建的壁纸实例。
客户端提供的壁纸源存储在合成器端并由其管理。 一旦设置了壁纸源,合成器可以独立于客户端对其进行缓存、重用或持久化。
destroy()
销毁 treeland_wallpaper_v1 对象并释放合成器端与之关联的所有资源。
调用此请求后,客户端不得再使用该壁纸对象。
set_image_source(file_source: string, role: uint)
参数 | 类型 | 描述 |
|---|---|---|
| file_source | string | Path to the image file to be used as the wallpaper |
| role | uint | wallpaper role |
将图片设置为壁纸源,应用于当前的 wl_output 和活动工作区。 除锁屏壁纸外,每个 wl_output 只能设置一个壁纸。 支持的格式:
- JPG / JPEG(联合图像专家组)
合成器将尝试加载并显示指定的图像文件。 如果文件无法访问、解码或格式不受支持,合成器将发出包含相应错误代码的 failed 事件。
访问控制:此协议接受客户端提供的 file_source, 如 /usr/share/wallpapers/xxx 或 /var/cache/wallpapers/xxxx。 合成器将执行文件验证。
set_video_source(file_source: string, role: uint)
参数 | 类型 | 描述 |
|---|---|---|
| file_source | string | Path to the video file to be used as the wallpaper |
| role | uint | wallpaper role |
将视频文件设置为壁纸源,应用于当前的 wl_output 和活动工作区。 除锁屏壁纸外,每个 wl_output 只能设置一个壁纸。 支持的格式:
- MP4
- AVI
- MOV
合成器负责解码和呈现视频。 播放行为(如循环、同步和性能特性)由合成器定义。
如果视频源无法打开或解码,将发出 failed 事件。
访问控制:此协议接受客户端提供的 file_source, 如 /usr/share/wallpapers/xxx 或 /var/cache/wallpapers/xxxx。 合成器将执行文件验证。
failed(file_source: string, error: uint<treeland_wallpaper_v1.error>)
参数 | 类型 | 描述 |
|---|---|---|
| file_source | string | Path to the file to be used as the wallpaper |
| error | uint<treeland_wallpaper_v1.error> | The error code indicating the failure reason |
当壁纸相关请求失败时发出此事件。
失败可能发生在源加载、验证或运行时设置期间。 错误代码提供有关失败原因的附加信息。
可能的错误值包括:
changed(role: uint<treeland_wallpaper_v1.wallpaper_role>, source_type: uint<treeland_wallpaper_v1.wallpaper_source_type>, file_source: string)
参数 | 类型 | 描述 |
|---|---|---|
| role | uint<treeland_wallpaper_v1.wallpaper_role> | |
| source_type | uint<treeland_wallpaper_v1.wallpaper_source_type> | The type of the current wallpaper source |
| file_source | string | The file path of the current wallpaper source |
合成器发出此事件通知客户端与此 treeland_wallpaper_v1 对象关联的壁纸源已更改。
此事件可能在初始对象设置期间发出,也可能在由于非此客户端发起的外部因素(如合成器策略决策、影响活动壁纸的工作区切换(锁屏壁纸除外)或其他系统组件)导致壁纸更改时发出。
因为桌面壁纸设计为支持不同的工作区,如果客户端是 surface,其显示工作区的更改也会发送事件(参考 set_reference_surface)。
此事件提供当前壁纸源类型和对应的源文件路径。
error { already_used, invalid_source, permission_denied }
参数 | 值 | 描述 |
|---|---|---|
| already_used | 0 | 壁纸文件已被使用并缓存在壁纸端 |
| invalid_source | 1 | 指定的壁纸源无效、不受支持或加载失败 |
| permission_denied | 2 | 打开指定壁纸源时权限被拒绝 |
wallpaper_role { desktop, lockscreen }
参数 | 值 | 描述 |
|---|---|---|
| desktop | 0x1 | 桌面环境壁纸 |
| lockscreen | 0x2 | 锁屏壁纸 |
合成器支持
Copyright
SPDX-FileCopyrightText: 2025 UnionTech Software Technology Co., Ltd. SPDX-License-Identifier: MIT