River window layout

允许客户端提议 view 位置和尺寸

此协议为客户端指定了一种方式,通过 river_layout_v3 对象向 compositor 的特定 output 提议一组 view 的任意位置和尺寸。

layout 是 view 的严格线性列表,其位置和尺寸由客户端提供。客户端在生成 layout 时可能使用的任何复杂的底层数据结构在传输过程中都会丢失。这是一个有意的限制。

此外,此协议允许 compositor 将与 layout 相关的任意用户提供的命令传递给客户端。客户端可以使用这些命令来实现运行时配置/控制,或者可以完全忽略它们。用户如何将这些命令提供给 compositor 并没有由此协议指定,而是留给了 compositor 策略。

警告!此文件中描述的协议目前处于测试阶段。在增加相应接口版本号的同时,可能会添加向后兼容的更改。只能通过创建扩展的新主版本来进行向后不兼容的更改。

管理 river layout 对象

用于 river_layout_v3 对象的全局工厂。

destroy()
销毁 river_layout_manager 对象

此请求表示客户端将不再使用 river_layout_manager 对象。通过此实例创建的对象不受影响。

get_layout(id: new_id<river_layout_v3>, output: object<wl_output>, namespace: string)
参数
类型
描述
idnew_id<river_layout_v3>
outputobject<wl_output>
namespacestring
namespace of the layout object
创建 river_layout_v3 对象

这会为给定的 wl_output 创建一个新的 river_layout_v3 对象。

所有与 layout 相关的通信均通过此接口完成。

compositor 使用 namespace 来决定哪个 river_layout_v3 对象将接收该 output 的 layout 需求(layout demands)。

要求每个 output 的 namespace 必须唯一。此外,两个不同的客户端不能在不同的 output 上共享同一个 namespace。如果不满足这些条件,将在创建 river_layout_v3 对象后立即发送 namespace_in_use 事件。


接收并响应 layout 需求

此接口允许客户端从 compositor 接收特定 output 的 layout 需求,并随后提议各个 view 的位置和尺寸。

destroy
类型: destructor
destroy()
销毁 river_layout_v3 对象

此请求表示客户端将不再使用 river_layout_v3 对象。

push_view_dimensions(x: int, y: int, width: uint, height: uint, serial: uint)
参数
类型
描述
xint
x coordinate of view
yint
y coordinate of view
widthuint
width of view
heightuint
height of view
serialuint
serial of layout demand
提议下一个 view 的尺寸

此请求为具有匹配 serial 的 layout 需求中的 view 提议尺寸和位置。

客户端必须为作为 layout 需求一部分的每个 view 发送此请求。layout 中的 view 数量由 layout_demand 事件的 view_count 参数给出。推送过多或过少的 view 尺寸都是协议错误。

x 和 y 坐标相对于 output 的可用区域,以 (0,0) 作为左上角。

commit(layout_name: string, serial: uint)
参数
类型
描述
layout_namestring
name of committed layout
serialuint
serial of layout demand
提交 layout

此请求表示客户端已完成尺寸的推送,compositor 可以应用该 layout。这完成了具有匹配 serial 的 layout 需求,任何与该 serial 一起发送的其他请求都是协议错误。

layout_name 参数是正在提交的 layout 的面向用户的名称或简短描述。例如,compositor 可能会将其显示在状态栏上,但具体如何处理由 compositor 自行决定。

compositor 可以自由选择如何使用这个提议的 layout,包括忽略它。

namespace_in_use()
请求的 namespace 已在使用中

发送此事件后,除了 destroy 事件之外的所有请求都将被服务器忽略。如果客户端希望使用不同的 namespace 重试,它们必须创建一个新的 river_layout_v3 对象。

layout_demand(view_count: uint, usable_width: uint, usable_height: uint, tags: uint, serial: uint)
参数
类型
描述
view_countuint
number of views in the layout
usable_widthuint
width of the usable area
usable_heightuint
height of the usable area
tagsuint
tags of the output, 32-bit bitfield
serialuint
serial of the layout demand
compositor 需要一个 layout

compositor 发送此事件以通知客户端它需要一组 view 的 layout。

可用宽度(usable width)和高度(height)指示了客户端可以安全放置 view 的空间,而不会干扰如面板(panels)之类的桌面小部件。

此事件的 serial 用于将后续请求标识为属于此 layout 需求。请注意,客户端可能需要同时处理多个 layout 需求。

服务器将忽略除最近的 layout 需求以外的所有响应。因此,只要求客户端响应最近收到的 layout_demand。如果在客户端完成对旧需求的响应之前收到了较新的 layout_demand,客户端应该中止对旧需求的工作,因为任何进一步的工作都将被浪费。

user_command(command: string)
参数
类型
描述
commandstring
用户发送的命令

此事件向客户端通知由用户发送给它的命令。

命令的语义含义由客户端决定。如果它愿意,它也可以完全忽略它。

如果 compositor 当前正在使用此 layout 对象来排列 output,则会在此事件之后发送一个 layout_demand。

如果绑定了 river_layout_v3 对象的版本 2 或更高版本,则保证在 user_command 事件之前直接发送 user_command_tags 事件。

user_command_tags(tags: uint)
参数
类型
描述
tagsuint
tags of the output, 32-bit bitfield
用户发送的命令标签

如果绑定了 river_layout_v3 对象的版本 2 或更高版本,则此事件将在每个 user_command 事件之前直接发送。这允许 layout 生成器在发送用户命令时了解 active tags(活动标签)。对于希望在每个 tag 基础上保留设置的生成器来说,这是必要的。

参数
描述
count_mismatch0
提议的尺寸数量与 layout 中的 view 数量不匹配
already_committed1
带有提供 serial 的 layout 需求已被提交

合成器支持

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
river_layout_manager_v3
x
x
x
x
x
x
x
x
x
x
x
x
x
2
x
x
x
x

Copyright 2020-2021 The River Developers

Permission to use, copy, modify, and/or distribute this software for any purpose with or without fee is hereby granted, provided that the above copyright notice and this permission notice appear in all copies.

THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.

Footer

© 2026 Wayland Explorer

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

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