wlr screencopy
此协议允许客户端请求合成器将部分屏幕内容复制到客户端缓冲区。
警告!此文件中描述的协议是实验性的,可能会进行不兼容的更改。向后兼容的更改可能会与相应的接口版本号一起添加。向后不兼容的更改通过在协议和接口名称中增加版本号并重置接口版本号来完成。一旦协议宣布稳定,协议和接口名称中的 'z' 前缀和版本号将被移除,接口版本号将被重置。
注意!此协议已弃用,不适用于生产环境。应改用 ext-image-copy-capture-v1 协议。
此对象是一个管理器,提供从源开始捕获的请求。
capture_output(frame: new_id<zwlr_screencopy_frame_v1>, overlay_cursor: int, output: object<wl_output>)
参数 | 类型 | 描述 |
|---|---|---|
| frame | new_id<zwlr_screencopy_frame_v1> | |
| overlay_cursor | int | composite cursor onto the frame |
| output | object<wl_output> |
捕获整个输出的下一帧。
capture_output_region(frame: new_id<zwlr_screencopy_frame_v1>, overlay_cursor: int, output: object<wl_output>, x: int, y: int, width: int, height: int)
参数 | 类型 | 描述 |
|---|---|---|
| frame | new_id<zwlr_screencopy_frame_v1> | |
| overlay_cursor | int | composite cursor onto the frame |
| output | object<wl_output> | |
| x | int | |
| y | int | |
| width | int | |
| height | int |
捕获输出区域的下一帧。
区域以输出逻辑坐标给出,参见 xdg_output.logical_size。区域将被裁剪到输出范围。
此对象表示单个帧。
创建时,将发送一系列缓冲区事件,每个事件代表一种支持的缓冲区类型。随后发送 "buffer_done" 事件以指示所有支持的缓冲区类型已被枚举。客户端随后将能够发送 "copy" 请求。如果捕获成功,合成器将发送 "flags" 事件,然后是 "ready" 事件。
对于版本 2 或更低的对象,始终支持 wl_shm 缓冲区,即保证会发送 "buffer" 事件。
如果捕获失败,则发送 "failed" 事件。这可以在 "ready" 事件之前的任何时候发生。
一旦收到 "ready" 或 "failed" 事件,客户端应销毁该帧。
将帧复制到提供的缓冲区。缓冲区必须具有正确的大小,参见 zwlr_screencopy_frame_v1.buffer 和 zwlr_screencopy_frame_v1.linux_dmabuf。缓冲区需要具有支持的格式。
如果帧复制成功,将发送 "flags" 和 "ready" 事件。否则,将发送 "failed" 事件。
与 copy 相同,但等待有损坏时才复制。
buffer(format: uint<wl_shm.format>, width: uint, height: uint, stride: uint)
参数 | 类型 | 描述 |
|---|---|---|
| format | uint<wl_shm.format> | buffer format |
| width | uint | buffer width |
| height | uint | buffer height |
| stride | uint | buffer stride |
提供此帧需要使用的 wl_shm 缓冲区参数信息。如果支持 wl_shm 缓冲区,则在帧创建后发送一次此事件。
flags(flags: uint<zwlr_screencopy_frame_v1.flags>)
参数 | 类型 | 描述 |
|---|---|---|
| flags | uint<zwlr_screencopy_frame_v1.flags> | frame flags |
提供有关帧的标志。此事件在 "ready" 事件之前发送一次。
参数 | 类型 | 描述 |
|---|---|---|
| tv_sec_hi | uint | high 32 bits of the seconds part of the timestamp |
| tv_sec_lo | uint | low 32 bits of the seconds part of the timestamp |
| tv_nsec | uint | nanoseconds part of the timestamp |
在帧复制完成后调用,指示帧可供读取。此事件包括演示发生的时间。
时间戳表示为 tv_sec_hi、tv_sec_lo、tv_nsec 三元组,每个组件为无符号 32 位值。整秒在 tv_sec 中,它是 tv_sec_hi 和 tv_sec_lo 组合的 64 位值,附加的小数部分在 tv_nsec 中以纳秒为单位。因此,对于有效时间戳,tv_nsec 必须在 [0, 999999999] 范围内。秒部分在开始时可能有任意偏移。
收到此事件后,客户端应销毁对象。
参数 | 类型 | 描述 |
|---|---|---|
| x | uint | damaged x coordinates |
| y | uint | damaged y coordinates |
| width | uint | current width |
| height | uint | current height |
当请求 copy_with_damage 时,此事件在 ready 事件之前发送。对于每个 copy_with_damage 请求,可能会生成多次。
参数描述了自上次从当前 screencopy manager 实例派生的 copy 请求以来发生变化的区域周围的框。
在调用 copy_with_damage 和 ready 事件之间收到的所有区域的并集是自上次 ready 事件以来的总损坏。
提供此帧需要使用的 linux-dmabuf 缓冲区参数信息。如果支持 linux-dmabuf 缓冲区,则在帧创建后发送一次此事件。
buffer_done()
在所有缓冲区事件发送后发送一次此事件。
客户端应继续创建一种支持类型的缓冲区,并发送 "copy" 请求。
error { already_used, invalid_buffer }
参数 | 值 | 描述 |
|---|---|---|
| already_used | 0 | 该对象已被用于复制 wl_buffer |
| invalid_buffer | 1 | 缓冲区属性无效 |
合成器支持
Cage | COSMIC | GameScope | Hyprland | Jay | KWin | Labwc | Louvre | Mir | Muffin | Mutter | niri | phoc | river | Sway | Treeland | Wayfire | Weston | |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| zwlr_screencopy_manager_v1 | 3 | x | x | 3 | 3 | x | 3 | 3 | 3 | x | x | 3 | 3 | 3 | 3 | 3 | 3 | x |
Copyright
Copyright © 2018 Simon Ser Copyright © 2019 Andri Yngvason
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice (including the next paragraph) shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.