Fractional scale

请求分数级 surface 缩放的协议

此协议允许 compositor 建议 surface 以分数级缩放进行渲染。

客户端可以通过使用 wp_viewport 来提交缩放后的内容。这可以通过为 surface 创建一个 wp_viewport 对象,并在应用缩放因子之前将目标矩形设置为 surface 大小来实现。

缓冲区大小是通过将 surface 大小乘以预期的缩放来计算的。

wl_surface 缓冲区缩放应该保持设置为 1。

如果一个 surface 的本地大小为 100 px 乘 50 px,并希望以 1.5 的缩放提交缓冲区,那么应该使用一个 150px 乘 75 px 的缓冲区,并且 wp_viewport 目标矩形应该是 100 px 乘 50 px。

对于 toplevel surface,大小按远离零的半值舍入(rounded halfway away from zero)。对于 subsurface 位置和大小的舍入算法未定义。

分数级 surface 缩放信息

一个全局接口,用于请求 surface 使用分数级缩放。

destroy()
解除绑定分数级 surface 缩放接口

通知服务器客户端将不再使用此协议对象。这不会影响任何其他对象,包括 wp_fractional_scale_v1 对象。

get_fractional_scale(id: new_id<wp_fractional_scale_v1>, surface: object<wl_surface>)
参数
类型
描述
idnew_id<wp_fractional_scale_v1>
the new surface scale info interface id
surfaceobject<wl_surface>
the surface
扩展 surface 接口以获取缩放信息

为 wl_surface 创建一个附加对象,以让 compositor 请求分数级缩放。如果给定的 wl_surface 已经关联了一个 wp_fractional_scale_v1 对象,则会引发 fractional_scale_exists 协议错误。

参数
描述
fractional_scale_exists0
该 surface 已经关联了一个 fractional_scale 对象

wl_surface 的分数级缩放接口

wl_surface 对象的一个附加接口,允许 compositor 通知客户端首选的缩放。

destroy()
移除 surface 的 surface 缩放信息

销毁分数级缩放对象。当此对象被销毁时,将不再发送 preferred_scale 事件。

preferred_scale(scale: uint)
参数
类型
描述
scaleuint
the new preferred scale
通知新的首选缩放

通知 compositor 建议客户端应该使用的此 surface 的新首选缩放。

发送的缩放是分母为 120 的分数的分子。


合成器支持

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
wp_fractional_scale_manager_v1
x
1
x
1
1
1
1
1
1
x
1
1
1
1
1
1
1
x

Copyright © 2022 Kenny Levinsen

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 许可。