wlr screencopy

在客户端缓冲区上捕获屏幕内容

此协议允许客户端请求合成器将部分屏幕内容复制到客户端缓冲区。

警告!此文件中描述的协议是实验性的,可能会进行不兼容的更改。向后兼容的更改可能会与相应的接口版本号一起添加。向后不兼容的更改通过在协议和接口名称中增加版本号并重置接口版本号来完成。一旦协议宣布稳定,协议和接口名称中的 'z' 前缀和版本号将被移除,接口版本号将被重置。

注意!此协议已弃用,不适用于生产环境。应改用 ext-image-copy-capture-v1 协议。

通知客户端并开始捕获的管理器

此对象是一个管理器,提供从源开始捕获的请求。

capture_output(frame: new_id<zwlr_screencopy_frame_v1>, overlay_cursor: int, output: object<wl_output>)
参数
类型
描述
framenew_id<zwlr_screencopy_frame_v1>
overlay_cursorint
composite cursor onto the frame
outputobject<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)
参数
类型
描述
framenew_id<zwlr_screencopy_frame_v1>
overlay_cursorint
composite cursor onto the frame
outputobject<wl_output>
xint
yint
widthint
heightint
捕获输出的区域

捕获输出区域的下一帧。

区域以输出逻辑坐标给出,参见 xdg_output.logical_size。区域将被裁剪到输出范围。

destroy()
销毁管理器

管理器创建的所有对象将仍然有效,直到调用它们相应的销毁请求。


准备复制的帧

此对象表示单个帧。

创建时,将发送一系列缓冲区事件,每个事件代表一种支持的缓冲区类型。随后发送 "buffer_done" 事件以指示所有支持的缓冲区类型已被枚举。客户端随后将能够发送 "copy" 请求。如果捕获成功,合成器将发送 "flags" 事件,然后是 "ready" 事件。

对于版本 2 或更低的对象,始终支持 wl_shm 缓冲区,即保证会发送 "buffer" 事件。

如果捕获失败,则发送 "failed" 事件。这可以在 "ready" 事件之前的任何时候发生。

一旦收到 "ready" 或 "failed" 事件,客户端应销毁该帧。

copy(buffer: object<wl_buffer>)
参数
类型
描述
bufferobject<wl_buffer>
复制帧

将帧复制到提供的缓冲区。缓冲区必须具有正确的大小,参见 zwlr_screencopy_frame_v1.buffer 和 zwlr_screencopy_frame_v1.linux_dmabuf。缓冲区需要具有支持的格式。

如果帧复制成功,将发送 "flags" 和 "ready" 事件。否则,将发送 "failed" 事件。

destroy()
删除此对象,无论是否使用

销毁帧。客户端可以随时发送此请求。

copy_with_damage(buffer: object<wl_buffer>)
参数
类型
描述
bufferobject<wl_buffer>
在帧损坏时复制

与 copy 相同,但等待有损坏时才复制。

buffer(format: uint<wl_shm.format>, width: uint, height: uint, stride: uint)
参数
类型
描述
formatuint<wl_shm.format>
buffer format
widthuint
buffer width
heightuint
buffer height
strideuint
buffer stride
wl_shm 缓冲区信息

提供此帧需要使用的 wl_shm 缓冲区参数信息。如果支持 wl_shm 缓冲区,则在帧创建后发送一次此事件。

参数
类型
描述
flagsuint<zwlr_screencopy_frame_v1.flags>
frame flags
帧标志

提供有关帧的标志。此事件在 "ready" 事件之前发送一次。

ready(tv_sec_hi: uint, tv_sec_lo: uint, tv_nsec: uint)
参数
类型
描述
tv_sec_hiuint
high 32 bits of the seconds part of the timestamp
tv_sec_louint
low 32 bits of the seconds part of the timestamp
tv_nsecuint
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] 范围内。秒部分在开始时可能有任意偏移。

收到此事件后,客户端应销毁对象。

failed()
帧复制失败

此事件指示尝试的帧复制失败。

收到此事件后,客户端应销毁对象。

damage(x: uint, y: uint, width: uint, height: uint)
参数
类型
描述
xuint
damaged x coordinates
yuint
damaged y coordinates
widthuint
current width
heightuint
current height
携带损坏区域的坐标

当请求 copy_with_damage 时,此事件在 ready 事件之前发送。对于每个 copy_with_damage 请求,可能会生成多次。

参数描述了自上次从当前 screencopy manager 实例派生的 copy 请求以来发生变化的区域周围的框。

在调用 copy_with_damage 和 ready 事件之间收到的所有区域的并集是自上次 ready 事件以来的总损坏。

linux_dmabuf(format: uint, width: uint, height: uint)
参数
类型
描述
formatuint
fourcc pixel format
widthuint
buffer width
heightuint
buffer height
linux-dmabuf 缓冲区信息

提供此帧需要使用的 linux-dmabuf 缓冲区参数信息。如果支持 linux-dmabuf 缓冲区,则在帧创建后发送一次此事件。

buffer_done()
所有缓冲区类型已报告

在所有缓冲区事件发送后发送一次此事件。

客户端应继续创建一种支持类型的缓冲区,并发送 "copy" 请求。

参数
描述
already_used0
该对象已被用于复制 wl_buffer
invalid_buffer1
缓冲区属性无效
flags { y_invert } 
参数
描述
y_invert1
内容是 Y 轴翻转的

合成器支持

Cage
Cage
0.2.0
COSMIC
COSMIC
1.0.0~beta.8
GameScope
GameScope
3.15.14
Hyprland
Hyprland
0.52.1
Jay
1.12.0
KWin
KWin
6.6
Labwc
Labwc
0.9.2
Louvre
Louvre
2.14.1
Mir
Mir
2.26
Muffin
Muffin
6.6.0
Mutter
Mutter
49.2
niri
niri
25.11
phoc
phoc
0.52
river
river
0.3.13
Sway
Sway
1.11
Treeland
Treeland
0.8.0
Wayfire
Wayfire
0.9.0
Weston
Weston
14.0.2
zwlr_screencopy_manager_v1
3
x
x
3
3
x
3
3
3
x
x
3
3
3
3
3
3
x

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.

Footer

© 2026 Wayland Explorer

本网站与 Wayland 官方项目无任何关联。网站所有内容均根据 Wayland 协议 XML 文件自动生成。

本网站使用的 Visual Studio Code - Codicons 遵循 CC BY 4.0 许可。