Fractional scale
此协议允许 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 使用分数级缩放。
destroy()
通知服务器客户端将不再使用此协议对象。这不会影响任何其他对象,包括 wp_fractional_scale_v1 对象。
get_fractional_scale(id: new_id<wp_fractional_scale_v1>, surface: object<wl_surface>)
参数 | 类型 | 描述 |
|---|---|---|
| id | new_id<wp_fractional_scale_v1> | the new surface scale info interface id |
| surface | object<wl_surface> | the surface |
为 wl_surface 创建一个附加对象,以让 compositor 请求分数级缩放。如果给定的 wl_surface 已经关联了一个 wp_fractional_scale_v1 对象,则会引发 fractional_scale_exists 协议错误。
error { fractional_scale_exists }
参数 | 值 | 描述 |
|---|---|---|
| fractional_scale_exists | 0 | 该 surface 已经关联了一个 fractional_scale 对象 |
wl_surface 对象的一个附加接口,允许 compositor 通知客户端首选的缩放。
destroy()
销毁分数级缩放对象。当此对象被销毁时,将不再发送 preferred_scale 事件。
合成器支持
Cage | COSMIC | GameScope | Hyprland | Jay | KWin | Labwc | Louvre | Mir | Muffin | Mutter | niri | phoc | river | Sway | Treeland | Wayfire | Weston | |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| wp_fractional_scale_manager_v1 | x | 1 | x | 1 | 1 | 1 | 1 | 1 | 1 | x | 1 | 1 | 1 | 1 | 1 | 1 | 1 | x |
Copyright
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.